提交 4fefdaaf 编写于 作者: X xuchenghua09

merge master

Signed-off-by: Nxuchenghua09 <xuchenghua09@huawei.com>
上级 29fd6363
...@@ -13,19 +13,19 @@ ...@@ -13,19 +13,19 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsUsersApi7AppA") { ohos_hap_assist_suite("ActsAmsUsersApi7AppA") {
hap_name = "ActsAmsUsersApi7AppA" hap_name = "ActsAmsUsersApi7AppA"
js_build_mode = "debug" js_build_mode = "debug"
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true testonly = true
deps = [ deps = [
":actsamsusersapi7appa_resources", ":actsamsusersapi7appa_resources",
":actsamsusersapi7appa_ts_assets", ":actsamsusersapi7appa_ts_assets",
] ]
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_js_assets("actsamsusersapi7appa_ts_assets") { ohos_js_assets("actsamsusersapi7appa_ts_assets") {
......
...@@ -13,13 +13,11 @@ ...@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsUsersKillProcessAppA") { ohos_hap_assist_suite("ActsAmsUsersKillProcessAppA") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_name = "ActsAmsUsersKillProcessAppA" hap_name = "ActsAmsUsersKillProcessAppA"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true testonly = true
deps = [ deps = [
":actsamsuserskillprocessappa_js_assets", ":actsamsuserskillprocessappa_js_assets",
...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppA") { ...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppA") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_app_scope("actsamsuserskillprocessappa_app_profile") { ohos_app_scope("actsamsuserskillprocessappa_app_profile") {
......
...@@ -13,13 +13,11 @@ ...@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsUsersKillProcessAppB") { ohos_hap_assist_suite("ActsAmsUsersKillProcessAppB") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_name = "ActsAmsUsersKillProcessAppB" hap_name = "ActsAmsUsersKillProcessAppB"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true testonly = true
deps = [ deps = [
":actsamsuserskillprocessappb_js_assets", ":actsamsuserskillprocessappb_js_assets",
...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppB") { ...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppB") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_app_scope("actsamsuserskillprocessappb_app_profile") { ohos_app_scope("actsamsuserskillprocessappb_app_profile") {
......
...@@ -13,13 +13,11 @@ ...@@ -13,13 +13,11 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsUsersKillProcessAppC") { ohos_hap_assist_suite("ActsAmsUsersKillProcessAppC") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_name = "ActsAmsUsersKillProcessAppC" hap_name = "ActsAmsUsersKillProcessAppC"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true testonly = true
deps = [ deps = [
":actsamsuserskillprocessappc_js_assets", ":actsamsuserskillprocessappc_js_assets",
...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppC") { ...@@ -27,6 +25,8 @@ ohos_hap("ActsAmsUsersKillProcessAppC") {
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_app_scope("actsamsuserskillprocessappc_app_profile") { ohos_app_scope("actsamsuserskillprocessappc_app_profile") {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersSystemTest") { ohos_js_hap_suite("ActsAmsUsersSystemTest") {
hap_profile = "entry/src/main/module.json" hap_profile = "./entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
deps = [ deps = [
":actsamsuserssystemtest_js_assets", ":actsamsuserssystemtest_js_assets",
...@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsUsersSystemTest") { ...@@ -23,6 +23,8 @@ ohos_js_hap_suite("ActsAmsUsersSystemTest") {
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersSystemTest" hap_name = "ActsAmsUsersSystemTest"
subsystem_name = "ability"
part_name = "ability_runtime"
} }
ohos_app_scope("actsamsuserssystemtest_app_profile") { ohos_app_scope("actsamsuserssystemtest_app_profile") {
...@@ -31,11 +33,11 @@ ohos_app_scope("actsamsuserssystemtest_app_profile") { ...@@ -31,11 +33,11 @@ ohos_app_scope("actsamsuserssystemtest_app_profile") {
} }
ohos_js_assets("actsamsuserssystemtest_js_assets") { ohos_js_assets("actsamsuserssystemtest_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "./entry/src/main/ets"
} }
ohos_resources("actsamsuserssystemtest_resources") { ohos_resources("actsamsuserssystemtest_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "./entry/src/main/resources" ]
deps = [ ":actsamsuserssystemtest_app_profile" ] deps = [ ":actsamsuserssystemtest_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "./entry/src/main/module.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "300000", "test-timeout": "300000",
"package": "com.acts.actsinterfacemultiuserstest", "bundle-name": "com.acts.actsinterfacemultiuserstest",
"shell-timeout": "300000" "module-name":"phone",
"shell-timeout": "300000",
"testcase-timeout": 300000
}, },
"kits": [ "kits": [
{ {
......
...@@ -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() {
......
/*
* 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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
console.info("subscribeEvent run !!!!")
const configService = core.getDefaultService('config')
globalThis.abilityWant.parameters['timeout'] = 20000
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
configService.setConfig(globalThis.abilityWant.parameters)
testsuite(globalThis.abilityContext)
core.execute()
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('MainAbility')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
...@@ -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 commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
import appManager from '@ohos.application.appManager' import appManager from '@ohos.application.appManager'
import osaccount from '@ohos.account.osAccount' import osaccount from '@ohos.account.osAccount'
...@@ -26,7 +26,7 @@ var subscriberInfo_killprocess ={ ...@@ -26,7 +26,7 @@ var subscriberInfo_killprocess ={
var osAccountManager var osAccountManager
const START_ABILITY_TIMEOUT = 10000; const START_ABILITY_TIMEOUT = 10000;
console.debug("====>in Ability.test====>"); console.debug("====>in Ability.test====>");
export default function abilityTest(abilityContext) { export default function abilityTest() {
console.debug("====>in function abilityTest====>"); console.debug("====>in function abilityTest====>");
describe('ActsInterfaceMultiUsersTest', function () { describe('ActsInterfaceMultiUsersTest', function () {
// afterAll(function() { // afterAll(function() {
...@@ -64,7 +64,7 @@ export default function abilityTest(abilityContext) { ...@@ -64,7 +64,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -115,7 +115,7 @@ export default function abilityTest(abilityContext) { ...@@ -115,7 +115,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.error', bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2' abilityName: 'com.acts.error.MainAbility2'
...@@ -165,7 +165,7 @@ export default function abilityTest(abilityContext) { ...@@ -165,7 +165,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
abilityContext.startAbility( globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -217,7 +217,7 @@ export default function abilityTest(abilityContext) { ...@@ -217,7 +217,7 @@ export default function abilityTest(abilityContext) {
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
}) })
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.error', bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2' abilityName: 'com.acts.error.MainAbility2'
...@@ -266,7 +266,7 @@ export default function abilityTest(abilityContext) { ...@@ -266,7 +266,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -295,49 +295,6 @@ export default function abilityTest(abilityContext) { ...@@ -295,49 +295,6 @@ export default function abilityTest(abilityContext) {
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
}) })
/*
* @tc.number : ACTS_startAbility_0600
* @tc.name : start new ability
* @tc.desc : Starting mainability2 with startability failed.(promise)
*/
it('ACTS_StartAbility_0600', 0, async function (done) {
let Subscriber
function SubscribeCallBack (err, data) {
expect().assertFail();
console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => {
console.debug("====>Create Subscriber====>");
data.getSubscribeInfo().then(async (SubscribeInfo)=>{
console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo));
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
})
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribeCallback====>");
done();
}
function timeout() {
console.debug('ACTS_startAbility_0200 - timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/* /*
* @tc.number : ACTS_startAbility_0700 * @tc.number : ACTS_startAbility_0700
* @tc.name : start new ability * @tc.name : start new ability
...@@ -363,7 +320,7 @@ export default function abilityTest(abilityContext) { ...@@ -363,7 +320,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
abilityContext.startAbility( globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -392,51 +349,6 @@ export default function abilityTest(abilityContext) { ...@@ -392,51 +349,6 @@ export default function abilityTest(abilityContext) {
}) })
/*
* @tc.number : ACTS_startAbility_0800
* @tc.name : start new ability
* @tc.desc : Starting mainability2 with startability failed.(callback)
*/
it('ACTS_StartAbility_0800', 0, async function (done) {
let Subscriber
function SubscribeCallBack (err, data) {
expect().assertFail();
console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
data.getSubscribeInfo().then(async (SubscribeInfo)=>{
console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo));
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
},() => {
console.debug("====>startAbility end====>" );
})
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribeCallback====>");
done();
}
function timeout() {
console.debug('ACTS_startAbility_0800 - timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/* /*
* @tc.number : ACTS_startAbility_0900 * @tc.number : ACTS_startAbility_0900
* @tc.name : start new ability * @tc.name : start new ability
...@@ -461,7 +373,7 @@ export default function abilityTest(abilityContext) { ...@@ -461,7 +373,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.example.userservicesystemapi7', bundleName: 'com.example.userservicesystemapi7',
abilityName: 'com.example.userservicesystemapi7.ServiceAbility' abilityName: 'com.example.userservicesystemapi7.ServiceAbility'
...@@ -512,7 +424,7 @@ export default function abilityTest(abilityContext) { ...@@ -512,7 +424,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.example.userservicesystemapi7', bundleName: 'com.example.userservicesystemapi7',
abilityName: 'com.example.userservicesystemapi7.ServiceAbility' abilityName: 'com.example.userservicesystemapi7.ServiceAbility'
...@@ -556,7 +468,7 @@ export default function abilityTest(abilityContext) { ...@@ -556,7 +468,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -584,7 +496,7 @@ export default function abilityTest(abilityContext) { ...@@ -584,7 +496,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.error', bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3', abilityName: 'com.acts.error.MainAbility3',
...@@ -615,7 +527,7 @@ export default function abilityTest(abilityContext) { ...@@ -615,7 +527,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -642,7 +554,7 @@ export default function abilityTest(abilityContext) { ...@@ -642,7 +554,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.error', bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3', abilityName: 'com.acts.error.MainAbility3',
...@@ -673,7 +585,7 @@ export default function abilityTest(abilityContext) { ...@@ -673,7 +585,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -687,31 +599,6 @@ export default function abilityTest(abilityContext) { ...@@ -687,31 +599,6 @@ export default function abilityTest(abilityContext) {
}) })
}) })
/*
* @tc.number : ACTS_StartAbilityForResult_0600
* @tc.name : start new ability for result
* @tc.desc : Starting mainability3 with startAbilityForResult failed.(promise)
*/
it('ACTS_StartAbilityForResult_0600', 0, async function (done) {
function timeout() {
console.debug('ACTS_startAbilityForResult_0600 - timeout');
done();
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
}).then((data)=>{
console.debug("====>startAbilityForResult end====>");
expect().assertFail();
expect(data.resultCode).assertEqual(1)
expect(data.want.action).assertEqual('ACTION')
done();
})
})
/* /*
* @tc.number : ACTS_StartAbilityForResult_0700 * @tc.number : ACTS_StartAbilityForResult_0700
* @tc.name : start new ability for result * @tc.name : start new ability for result
...@@ -728,7 +615,7 @@ export default function abilityTest(abilityContext) { ...@@ -728,7 +615,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -741,31 +628,6 @@ export default function abilityTest(abilityContext) { ...@@ -741,31 +628,6 @@ export default function abilityTest(abilityContext) {
}) })
}) })
/*
* @tc.number : ACTS_StartAbilityForResult_0800
* @tc.name : start new ability for result
* @tc.desc : Starting mainability3 with startAbilityForResult failed.(callback)
*/
it('ACTS_StartAbilityForResult_0800', 0, async function (done) {
function timeout() {
console.debug('ACTS_startAbilityForResult_0800 - timeout');
done();
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
},(err,data)=>{
expect().assertFail();
console.debug("====>startAbilityForResult end====>");
expect(data.resultCode).assertEqual(1)
expect(data.want.action).assertEqual('ACTION')
done();
})
})
/* /*
* @tc.number : ACTS_TerminateSelf_0100 * @tc.number : ACTS_TerminateSelf_0100
* @tc.name : Use terminateself to terminate ability * @tc.name : Use terminateself to terminate ability
...@@ -792,7 +654,7 @@ export default function abilityTest(abilityContext) { ...@@ -792,7 +654,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -821,51 +683,6 @@ export default function abilityTest(abilityContext) { ...@@ -821,51 +683,6 @@ export default function abilityTest(abilityContext) {
}) })
/*
* @tc.number : ACTS_TerminateSelf_0200
* @tc.name : Use terminateself to terminate ability
* @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(promise)
*/
it('ACTS_TerminateSelf_0200', 0, async function (done) {
let Subscriber
function SubscribeCallBack (err, data) {
expect().assertFail();
console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
data.getSubscribeInfo().then(async(SubscribeInfo)=>{
console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo));
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
})
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribeCallback====>");
done();
}
function timeout() {
console.debug('ACTS_TerminateSelf_0200 - timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/* /*
* @tc.number : ACTS_TerminateSelf_0300 * @tc.number : ACTS_TerminateSelf_0300
* @tc.name : Use terminateself to terminate ability * @tc.name : Use terminateself to terminate ability
...@@ -892,7 +709,7 @@ export default function abilityTest(abilityContext) { ...@@ -892,7 +709,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
abilityContext.startAbility( globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2'
...@@ -921,50 +738,6 @@ export default function abilityTest(abilityContext) { ...@@ -921,50 +738,6 @@ export default function abilityTest(abilityContext) {
}) })
/*
* @tc.number : ACTS_TerminateSelf_0400
* @tc.name : Use terminateself to terminate ability
* @tc.desc : Starting mainability2 with startAbility then terminateself ability failed.(callback)
*/
it('ACTS_TerminateSelf_0400', 0, async function (done) {
let Subscriber
function SubscribeCallBack (err, data) {
expect().assertFail();
console.debug("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
}
commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => {
console.debug("====>Create Subscriber====>");
data.getSubscribeInfo().then(async(SubscribeInfo)=>{
console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo));
Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>");
await abilityContext.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
},() => {
console.debug("====>startAbility end====>" );
})
})
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribeCallback====>");
done();
}
function timeout() {
console.debug('ACTS_TerminateSelf_0400 - timeout');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
})
/* /*
* @tc.number : ACTS_TerminateSelfWithResult_0100 * @tc.number : ACTS_TerminateSelfWithResult_0100
* @tc.name : Use terminateselfwithresult to terminate ability and return result * @tc.name : Use terminateselfwithresult to terminate ability and return result
...@@ -982,7 +755,7 @@ export default function abilityTest(abilityContext) { ...@@ -982,7 +755,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -995,31 +768,7 @@ export default function abilityTest(abilityContext) { ...@@ -995,31 +768,7 @@ export default function abilityTest(abilityContext) {
done(); done();
}) })
}) })
/*
* @tc.number : ACTS_TerminateSelfWithResult_0200
* @tc.name : Use terminateselfwithresult to terminate ability and return result
* @tc.desc : Starting mainability3 with startAbilityforresult
* then terminateself ability and return result failed.(promise)
*/
it('ACTS_TerminateSelfWithResult_0200', 0, async function (done) {
function timeout() {
console.debug('ACTS_TerminateSelfWithResult_0200 - timeout');
done();
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
}).then((data)=>{
console.debug("====>startAbilityForResult end====>");
expect().assertFail();
expect(data.resultCode).assertEqual(1)
expect(data.want.action).assertEqual('ACTION')
done();
})
})
/* /*
* @tc.number : ACTS_TerminateSelfWithResult_0300 * @tc.number : ACTS_TerminateSelfWithResult_0300
* @tc.name : Use terminateselfwithresult to terminate ability and return result * @tc.name : Use terminateselfwithresult to terminate ability and return result
...@@ -1037,7 +786,7 @@ export default function abilityTest(abilityContext) { ...@@ -1037,7 +786,7 @@ export default function abilityTest(abilityContext) {
} }
setTimeout(timeout, START_ABILITY_TIMEOUT); setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>"); console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult( await globalThis.abilityContext.startAbilityForResult(
{ {
bundleName: 'com.acts.actsinterfacemultiuserstest', bundleName: 'com.acts.actsinterfacemultiuserstest',
abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3',
...@@ -1049,31 +798,6 @@ export default function abilityTest(abilityContext) { ...@@ -1049,31 +798,6 @@ export default function abilityTest(abilityContext) {
done(); done();
}) })
}) })
/*
* @tc.number : ACTS_TerminateSelfWithResult_0400
* @tc.name : Use terminateselfwithresult to terminate ability and return result
* @tc.desc : Starting mainability3 with startAbilityforresult
* then terminateself ability and return result failed.(callback)
*/
it('ACTS_TerminateSelfWithResult_0400', 0, async function (done) {
function timeout() {
console.debug('ACTS_TerminateSelfWithResult_0400 - timeout');
done();
}
setTimeout(timeout, START_ABILITY_TIMEOUT);
console.debug("====>start startAbilityForResult====>");
await abilityContext.startAbilityForResult(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility3',
},(err,data)=>{
expect().assertFail();
console.debug("====>startAbilityForResult end====>");
expect(data.resultCode).assertEqual(1)
expect(data.want.action).assertEqual('ACTION')
done();
})
})
/* /*
* @tc.number : ACTS_KillProcess_0100 * @tc.number : ACTS_KillProcess_0100
...@@ -1123,7 +847,7 @@ export default function abilityTest(abilityContext) { ...@@ -1123,7 +847,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.killprocesshap', bundleName: 'com.acts.killprocesshap',
abilityName: 'com.acts.killprocesshap.MainAbility' abilityName: 'com.acts.killprocesshap.MainAbility'
...@@ -1198,7 +922,7 @@ export default function abilityTest(abilityContext) { ...@@ -1198,7 +922,7 @@ export default function abilityTest(abilityContext) {
Subscriber = data; Subscriber = data;
commonEvent.subscribe(Subscriber, SubscribeCallBack); commonEvent.subscribe(Subscriber, SubscribeCallBack);
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.killprocesshap', bundleName: 'com.acts.killprocesshap',
abilityName: 'com.acts.killprocesshap.MainAbility' abilityName: 'com.acts.killprocesshap.MainAbility'
...@@ -1224,6 +948,7 @@ export default function abilityTest(abilityContext) { ...@@ -1224,6 +948,7 @@ export default function abilityTest(abilityContext) {
setTimeout(timeout, 19500); setTimeout(timeout, 19500);
}) })
/* /*
* @tc.number : ACTS_ThirdPartyKillProcess_0100 * @tc.number : ACTS_ThirdPartyKillProcess_0100
* @tc.name : Use terminateselfwithresult to terminate ability and return result * @tc.name : Use terminateselfwithresult to terminate ability and return result
...@@ -1232,7 +957,7 @@ export default function abilityTest(abilityContext) { ...@@ -1232,7 +957,7 @@ export default function abilityTest(abilityContext) {
*/ */
it('ACTS_ThirdPartyKillProcess_0100', 0, async function (done) { it('ACTS_ThirdPartyKillProcess_0100', 0, async function (done) {
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.killprocessthirdhap', bundleName: 'com.acts.killprocessthirdhap',
abilityName: 'com.acts.killprocessthirdhap.MainAbility' abilityName: 'com.acts.killprocessthirdhap.MainAbility'
...@@ -1270,6 +995,7 @@ export default function abilityTest(abilityContext) { ...@@ -1270,6 +995,7 @@ export default function abilityTest(abilityContext) {
}) })
},15000) },15000)
}) })
/* /*
* @tc.number : ACTS_ThirdPartyKillProcess_0200 * @tc.number : ACTS_ThirdPartyKillProcess_0200
* @tc.name : Use terminateselfwithresult to terminate ability and return result * @tc.name : Use terminateselfwithresult to terminate ability and return result
...@@ -1278,7 +1004,7 @@ export default function abilityTest(abilityContext) { ...@@ -1278,7 +1004,7 @@ export default function abilityTest(abilityContext) {
*/ */
it('ACTS_ThirdPartyKillProcess_0200', 0, async function (done) { it('ACTS_ThirdPartyKillProcess_0200', 0, async function (done) {
console.debug("====>start startAbility====>"); console.debug("====>start startAbility====>");
await abilityContext.startAbility( await globalThis.abilityContext.startAbility(
{ {
bundleName: 'com.acts.killprocessthirdhap2', bundleName: 'com.acts.killprocessthirdhap2',
abilityName: 'com.acts.killprocessthirdhap2.MainAbility' abilityName: 'com.acts.killprocessthirdhap2.MainAbility'
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import abilityTest from './Ability.test.ets' import abilityTest from './Ability.test.ets'
export default function testsuite(context) { export default function testsuite() {
console.debug("====>in list.test====>"); console.debug("====>in list.test====>");
abilityTest(context) abilityTest()
} }
\ No newline at end of file
{ {
"src": [ "src": [
"pages/index/index", "MainAbility/pages/index/index",
"pages/second/second" "MainAbility/pages/second/second"
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册