提交 f8eb3a19 编写于 作者: X xuchenghua09

update

Signed-off-by: Nxuchenghua09 <xuchenghua09@huawei.com>
上级 d833c508
...@@ -18,22 +18,33 @@ group("aafwk_standard") { ...@@ -18,22 +18,33 @@ group("aafwk_standard") {
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
"abilitymanager:actsabilitymanagertest", "abilitymanager:actsabilitymanagertest",
"abilitymultiinstance:abilitymultiinstance",
"actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest",
"actsabilitydistributetest:ActsAbilityDistributeTest", "actsabilitydistributetest:ActsAbilityDistributeTest",
"actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest", "actsabilitylifecyclestatenew:ActsAbilityLifecycleStateNewTest",
"actsabilitymanageretstest:ActsAbilityManagerEtsTest", "actsabilitymanageretstest:ActsAbilityManagerEtsTest",
"actscalltest:actscalltest",
"actsdataabilityjs:ActsDataAbilityJsTest", "actsdataabilityjs:ActsDataAbilityJsTest",
"actsstartcomponenttest:actsstartcomponenttest",
"actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest", "actsstserviceabilityclientcase:ActsStServiceAbilityClientCaseTest",
"amsabilitymanager/amsMissionSnapshotTest:ActsAmsMissionSnapshotTest", "amsabilitymanager/amsMissionSnapshotTest:ActsAmsMissionSnapshotTest",
"amsabilitymanager/amsMissionSnapshotTestSingleton:ActsAmsMissionSnapshotTestSingleton", "amsabilitymanager/amsMissionSnapshotTestSingleton:ActsAmsMissionSnapshotTestSingleton",
"amsabilitymanager/amsMissionSnapshotTestSingletonS:ActsAmsMissionSnapshotTestSingletonS", "amsabilitymanager/amsMissionSnapshotTestSingletonS:ActsAmsMissionSnapshotTestSingletonS",
"amscontextualinforquery:amscontextualinforquery",
"amsdatauriutils:ActsAmsDataUriUtilsTest", "amsdatauriutils:ActsAmsDataUriUtilsTest",
"amsdisplayIdtest:amsdisplayIdtest",
"amsgetabilityprocessinfo:amsgetabilityprocessinfo", "amsgetabilityprocessinfo:amsgetabilityprocessinfo",
"context:context", "context:context",
"featureability:featureability", "featureability:featureability",
"formmanager:formmanager", "formmanager:formmanager",
"newwant:newwant",
"non_concurrent:non_concurrent",
"processmultiinstance:processmultiinstance",
"stage:stage", "stage:stage",
"want:want", "want:want",
"zidltest:zidltest",
"actsusers:actsusers",
"killprocesswithaccountstage:killprocesswithaccountstage"
] ]
} }
} }
...@@ -381,66 +381,6 @@ export default function abilityTest(abilityContext) { ...@@ -381,66 +381,6 @@ export default function abilityTest(abilityContext) {
}); });
}) })
/*
* @tc.number: ACTS_AbilityMultiInstance_Single_0500
* @tc.name: Connects a service ability, which is used to start a cloned page ability.
* @tc.desc: Check the event data of executor page ability publishes
*/
it('ACTS_AbilityMultiInstance_Single_0500', 0, async function (done) {
console.log('ACTS_AbilityMultiInstance_Single_0500====<begin');
var subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1",
"AppA:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
if (data.event == "MultiInstanceStartFinish") {
clearTimeout(id);
console.log('ACTS_AbilityMultiInstance_Single_0500 finish callBackSeq = ' + data.data);
expect(data.data).assertEqual(checkEventResults[checkIndex++]);
expect(checkIndex).assertEqual(2);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
console.log('ACTS_AbilityMultiInstance_Single_0500 finish');
} else if (data.event == "MultiInstanceStartNext") {
console.log('ACTS_AbilityMultiInstance_Single_0500 callBackSeq = ' + data.data);
expect(data.data).assertEqual(checkEventResults[checkIndex++]);
}
}
commonEvent.createSubscriber(subscriberInfoMultiInstance).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
setTimeout(function () {
done();
}, UNSUBSCRIBE_TIMEOUT)
}
function timeout() {
expect().assertFail();
console.log('ACTS_AbilityMultiInstance_Single_0500 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
console.log('Start AbilityMultiInstanceTester ACTS_AbilityMultiInstance_Single_0500 timer id : ' + id);
startAbilityProcess(abilityContext, {
startId: 0,
stepNum: 2,
nextStep: 0,
step: ["StartA1", "StartA1"]
});
})
/* /*
* @tc.number: ACTS_AbilityMultiInstance_Single_0600 * @tc.number: ACTS_AbilityMultiInstance_Single_0600
* @tc.name: Connects a service ability, which is used to start a cloned page ability. * @tc.name: Connects a service ability, which is used to start a cloned page ability.
......
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_hap("ActsAmsUsersApi7AppA") {
hap_name = "ActsAmsUsersApi7AppA"
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
deps = [
":actsamsusersapi7appa_resources",
":actsamsusersapi7appa_ts_assets",
]
certificate_profile = "signature/openharmony_sx.p7b"
}
ohos_js_assets("actsamsusersapi7appa_ts_assets") {
source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
}
ohos_resources("actsamsusersapi7appa_resources") {
sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests"
}
{
"app": {
"bundleName": "com.example.userservicesystemapi7",
"vendor": "test",
"version": {
"code": 1000110,
"name": "1.1.1"
},
"apiVersion": {
"compatible": 9,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.example.userservicesystemapi7",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"srcPath": "ServiceAbility",
"name": ".ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilitySatage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate");
}
}
\ 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("jws onCreate");
}
onDestroy() {
console.log("jws onDestroy");
}
onWindowStageCreate(windowStage) {
console.log("jws onWindowStageCreate");
}
onWindowStageDestroy() {
console.log("jws onWindowStageDestroy");
}
onForeground() {
console.log("jws onForeground");
}
onBackground() {
console.log("jws onBackground");
}
call(){
}
}
\ 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,12 +12,23 @@ ...@@ -12,12 +12,23 @@
* 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 {Core} from 'deccjsunit/index'
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
core.execute()
}
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('页面2') Text('Hello World')
.fontSize(50) .fontSize(50)
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
} }
......
/*
* 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
/*
* 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 commonEvent from "@ohos.commonevent"
import featureAbility from '@ohos.ability.featureAbility'
export default {
onStart() {
console.info('ServiceAbility onStart');
commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => {
console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback")
featureAbility.terminateSelf().then(() => {
console.log('terminateSelf promise');
commonEvent.publish("ACTS_TerminateSelf_CommonEvent", () => {
console.log(" Publish ACTS_TerminateSelf_CommonEvent callback")
})
});
})
},
onStop() {
console.info('ServiceAbility onStop');
},
onCommand(want, startId) {
console.info('ServiceAbility onCommand');
}
};
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "ServiceExtAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
},
{
"name": "description_dataability",
"value": "hap sample empty provider"
},
{
"name": "description_mainability2",
"value": "eTS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
},
{
"name": "description_testdataability",
"value": "hap sample empty provider"
},
{
"name": "permreason_dataability",
"value": "request dataability premission"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.acts.actsinterfacemultiusersextensiontest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon" : "$media:icon",
"label" : "$string:app_name",
"description" : "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 8,
"targetAPIVersion": 8,
"car": {
"apiCompatibleVersion": 8,
"singleUser": false
}
}
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersExtensionSystemTest") {
hap_profile = "entry/src/main/module.json"
deps = [
":actsamsusersextensionsystemtest_js_assets",
":actsamsusersextensionsystemtest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersExtensionSystemTest"
}
ohos_app_scope("actsamsusersextensionsystemtest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsamsusersextensionsystemtest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsamsusersextensionsystemtest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsamsusersextensionsystemtest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.acts.actsinterfacemultiusersextensiontest",
"shell-timeout": "300000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"acm create -n user101 -t normal",
"acm switch -i 101"
]
},
{
"test-file-name": [
"ActsAmsUsersExtensionSystemTest.hap",
"ActsAmsUsersApi7AppA.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ 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 AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground")
}
};
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
...@@ -13,45 +13,41 @@ ...@@ -13,45 +13,41 @@
* limitations under the License. * limitations under the License.
*/ */
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent' import commonEvent from "@ohos.commonevent"
function PublishCallBackOne1() {
console.debug("====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0100_CommonEvent====>");
globalThis.ability2Context.terminateSelf();
console.debug("====>close this context====>")
}
export default class MainAbility2 extends Ability { export default class MainAbility2 extends Ability {
onCreate(want, launchParam) { onCreate(want, launchParam) {
console.log("MainAbility2 onCreate") console.log("MainAbility2 onCreate");
globalThis.abilityContext = this.context
} }
onDestroy() { onDestroy() {
// Ability is destroying, release resources for this ability console.log("MainAbility2 onDestroy");
console.log("MainAbility2 onDestroy")
} }
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability console.log("MainAbility2 onWindowStageCreate");
console.log("MainAbility2 onWindowStageCreate") windowStage.setUIContent(this.context, "pages/index/second", null);
windowStage.setUIContent(this.context, "pages/index/index2", null) commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => {
globalThis.ability2Context = this.context; console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback")
commonEvent.publish("ACTS_ThirdPartyAbilityPermission_0100_Start_CommonEvent", PublishCallBackOne1); globalThis.abilityContext.terminateSelf().then(() => {
commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{
console.log('terminateSelf promise');
});
});
})
} }
onWindowStageDestroy() { onWindowStageDestroy() {
// Main window is destroyed, release UI related resources console.log("MainAbility2 onWindowStageDestroy");
console.log("MainAbility2 onWindowStageDestroy")
} }
onForeground() { onForeground() {
// Ability has brought to foreground console.log("MainAbility2 onForeground");
console.log("MainAbility2 onForeground")
} }
onBackground() { onBackground() {
// Ability has back to background console.log("MainAbility2 onBackground");
console.log("MainAbility2 onBackground")
} }
}; };
/*
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
class Stub extends rpc.RemoteObject {
constructor(des) {
super(des);
}
onRemoteRequest(code, data, reply, option) {
reply.writeNoException();
reply.writeString("success");
return true;
}
}
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want) {
console.log('ServiceAbility onCreate');
}
onDestory(){
console.log('ServiceAbility onDestory');
}
onRequest(want,startId) {
console.log('ServiceAbility onRequest');
}
onConnect(want) {
console.log('ServiceAbility onConnect');
console.log('globalThis.startnum is' + globalThis.startnum);
switch (globalThis.startnum) {
case 1:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.MainAbility2'
},{
windowMode:0
}
).then((data) => {
console.debug("====>startAbility end====>");
console.debug("====>data is====>" + JSON.stringify(data));
})
break;
case 2:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
},{
windowMode:0
}).then(()=>{
console.debug("====>startAbility end====>");
})
console.debug("====>case 2 end====>");
var myStub1 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub1;
break;
case 3:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.MainAbility2'
},{
windowMode:0
},(err,data) => {
console.debug("====>startAbility end====>" );
})
var myStub7 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub7;
break;
case 4:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.MainAbility2'
},{
windowMode:0
},() => {
console.debug("====>startAbility end====>" );
})
var myStub2 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub2;
break;
case 5:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2'
}).then((data)=>{
console.debug("====>startAbility end====>");
console.debug("====>data is====>" + JSON.stringify(data));
})
break;
case 6:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.ServiceAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
var myStub3 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub3;
break;
case 7:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2'
},() => {
console.debug("====>startAbility end====>" );
})
var myStub8 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub8;
break;
case 8:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.ServiceAbility2'
},() => {
console.debug("====>startAbility end====>" );
})
var myStub4 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub4;
break;
case 9:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
var myStub11 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub11;
break;
case 10:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.ServiceAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
var myStub5 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub5;
break;
case 11:
this.context.startAbility(
{
bundleName: 'com.acts.actsinterfacemultiusersextensiontest',
abilityName: 'com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2'
}).then(()=>{
console.debug("====>startAbility end====>");
})
var myStub12 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub12;
break;
case 12:
this.context.startAbility(
{
bundleName: 'com.acts.error',
abilityName: 'com.acts.error.ServiceAbility2'
},() => {
console.debug("====>startAbility end====>" );
})
var myStub6 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub6;
break;
case 13:
this.context.startAbility(
{
bundleName: 'com.example.userservicesystemapi7',
abilityName: 'com.example.userservicesystemapi7.ServiceAbility'
}).then(() => {
console.debug("====>startAbility end====>" );
})
var myStub9 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub9;
break;
case 14:
this.context.startAbility(
{
bundleName: 'com.example.userservicesystemapi7',
abilityName: 'com.example.userservicesystemapi7.ServiceAbility'
},() => {
console.debug("====>startAbility end====>" );
})
var myStub10 = new Stub("com.acts.actsinterfacemultiusersextensiontest.MainAbility");
console.log('ThirdAbility onConnect before return:')
return myStub10;
break;
default:
break;
}
}
onDisconnect(want) {
console.log('ServiceAbility onDisconnect');
}
onDestroy() {
console.log('ServiceAbility onDestroy');
}
}
\ No newline at end of file
/*
* 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import commonEvent from "@ohos.commonevent"
export default class ServiceAbility2 extends ServiceExtensionAbility {
onCreate(want) {
console.log('ServiceAbility2 onCreate');
}
onDestory(){
console.log('ServiceAbility2 onDestory');
}
onRequest(want,startId) {
console.log('ServiceAbility2 onRequest');
commonEvent.publish("ACTS_InterfaceMultiUsersExtension_CommonEvent", () => {
console.log("publish Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback")
this.context.terminateSelf().then(() => {
commonEvent.publish("ACTS_TerminateSelf_CommonEvent", ()=>{
console.log('terminateSelf promise');
});
});
})
}
onConnect(want) {
console.log('ServiceAbility2 onConnect');
}
onDisconnect(want) {
console.log('ServiceAbility2 onDisconnect, want:' + want.abilityName);
}
onDestroy() {
console.log('ServiceAbility2 onDestroy');
}
}
\ No newline at end of file
/*
* 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.ets"
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'] = 10000
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
/*
* 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 abilityTest from './Ability.test.ets'
export default function testsuite(context) {
console.debug("====>in list.test====>");
abilityTest(context)
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "com.acts.actsinterfacemultiusersextensiontest.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
},
{
"name": "com.acts.actsinterfacemultiusersextensiontest.MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait"
}
],
"extensionAbilities": [
{
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:phone_entry_main",
"type": "service",
"visible": true
},
{
"srcEntrance": "./ets/ServiceAbility2/ServiceAbility2.ts",
"name": "com.acts.actsinterfacemultiusersextensiontest.ServiceAbility2",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:phone_entry_main",
"type": "service",
"visible": true
}
],
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION"
}
],
"requestPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.CHANGE_ABILITY_ENABLED_STATE",
"reason": "need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name": "ohos.permission.REMOVE_CACHE_FILES",
"reason": "need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE",
"reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.GET_RUNNING_INFO",
"reason": "need use ohos.permission.GET_RUNNING_INFO"
},
{
"name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES",
"reason": "need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION",
"reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
}
]
}
}
{ {
"app": { "app": {
"bundleName": "com.example.actsabilitypermissionthirdtest", "bundleName": "com.acts.killprocesshap",
"vendor": "huawei", "vendor": "huawei",
"versionCode": 1000000, "versionCode": 1000000,
"versionName": "1.0.0", "versionName": "1.0.0",
......
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersKillProcessAppA") {
hap_profile = "entry/src/main/module.json"
deps = [
":actsamsuserskillprocessappa_js_assets",
":actsamsuserskillprocessappa_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersKillProcessAppA"
}
ohos_app_scope("actsamsuserskillprocessappa_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsamsuserskillprocessappa_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsamsuserskillprocessappa_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsamsuserskillprocessappa_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests"
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_KillProcess====>");
}
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
commonEvent.publish("ACTS_KillProcess", PublishCallBackOne);
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground")
}
};
/*
* 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 file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('hello')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({
top: 20
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
{ {
"module": { "module": {
"name": "com.example.actsabilitypermissionthirdtest", "name": "phone",
"type": "entry", "type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts", "srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc", "description": "$string:phone_entry_dsc",
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"pages": "$profile:main_pages", "pages": "$profile:main_pages",
"abilities": [ "abilities": [
{ {
"name": "com.example.actsabilitypermissionthirdtest.MainAbility", "name": "com.acts.killprocesshap.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts", "srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main", "description": "$string:phone_entry_main",
"icon": "$media:icon", "icon": "$media:icon",
...@@ -31,37 +31,8 @@ ...@@ -31,37 +31,8 @@
] ]
} }
] ]
},
{
"name": "com.example.actsabilitypermissionthirdtest.MainAbility2",
"srcEntrance": "./ets/MainAbility2/MainAbility2.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts",
"name": "com.example.actsabilitypermissionthirdtest.ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:phone_entry_main",
"type": "service",
"visible": true
} }
] ]
} }
} }
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.acts.killprocessthirdhap",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon" : "$media:icon",
"label" : "$string:app_name",
"description" : "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 8,
"targetAPIVersion": 8,
"car": {
"apiCompatibleVersion": 8,
"singleUser": false
}
}
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersKillProcessAppB") {
hap_profile = "entry/src/main/module.json"
deps = [
":actsamsuserskillprocessappb_js_assets",
":actsamsuserskillprocessappb_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersKillProcessAppB"
}
ohos_app_scope("actsamsuserskillprocessappb_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsamsuserskillprocessappb_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsamsuserskillprocessappb_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsamsuserskillprocessappb_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import appManager from '@ohos.application.appManager'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground")
console.log("in killhap onForeground")
setTimeout(()=>{
appManager.killProcessesByBundleName('com.example.killprocessthirdhap').then((data)=>{
console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data))
})
},2000)
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground")
}
};
/*
* 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 file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('hello')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({
top: 20
})
}
.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
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "com.acts.killprocessthirdhap.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.acts.killprocessthirdhap2",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon" : "$media:icon",
"label" : "$string:app_name",
"description" : "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 8,
"targetAPIVersion": 8,
"car": {
"apiCompatibleVersion": 8,
"singleUser": false
}
}
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAmsUsersKillProcessAppC") {
hap_profile = "entry/src/main/module.json"
deps = [
":actsamsuserskillprocessappc_js_assets",
":actsamsuserskillprocessappc_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAmsUsersKillProcessAppC"
}
ohos_app_scope("actsamsuserskillprocessappc_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsamsuserskillprocessappc_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsamsuserskillprocessappc_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsamsuserskillprocessappc_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests"
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import appManager from '@ohos.application.appManager'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground")
console.log("in killhap onForeground")
setTimeout(()=>{
appManager.killProcessesByBundleName('com.example.killprocessthirdhap2',(err,data)=>{
console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data))
})
},2000)
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground")
}
};
/*
* 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 file from '@system.file';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info("start run testcase!!!!")
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('hello')
.fontSize(50)
.fontWeight(FontWeight.Bold)
.margin({
top: 20
})
}
.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
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "com.acts.killprocessthirdhap2.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
]
}
\ No newline at end of file
{
"app":{
"bundleName":"com.acts.actsinterfacemultiuserstest",
"vendor":"huawei",
"versionCode":1000000,
"versionName":"1.0.0",
"debug":false,
"icon":"$media:icon",
"label":"$string:app_name",
"description":"$string:description_application",
"distributedNotificationEnabled":true,
"keepAlive":true,
"singleUser":true,
"minAPIVersion":8,
"targetAPIVersion":8,
"car":{
"apiCompatibleVersion":8,
"singleUser":false
}
}
}
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
...@@ -13,28 +13,28 @@ ...@@ -13,28 +13,28 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsThirdAppATest") { ohos_js_hap_suite("ActsAmsUsersSystemTest") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
deps = [ deps = [
":acts_thirdappa_test_js_assets", ":actsamsuserssystemtest_js_assets",
":acts_thirdappa_test_resources", ":actsamsuserssystemtest_resources",
] ]
ets2abc = true ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsThirdAppATest" hap_name = "ActsAmsUsersSystemTest"
} }
ohos_app_scope("acts_thirdappa_test_app_profile") { ohos_app_scope("actsamsuserssystemtest_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_js_assets("acts_thirdappa_test_js_assets") { ohos_js_assets("actsamsuserssystemtest_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_resources("acts_thirdappa_test_resources") { ohos_resources("actsamsuserssystemtest_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
deps = [ ":acts_thirdappa_test_app_profile" ] deps = [ ":actsamsuserssystemtest_app_profile" ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "com.acts.actsinterfacemultiuserstest",
"shell-timeout": "300000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"acm create -n user101 -t normal",
"acm switch -i 101"
],
"teardown-command": [
"acm switch -i 100",
"acm delete -i 101"
]
},
{
"test-file-name": [
"ActsAmsUsersSystemTest.hap",
"ActsAmsUsersKillProcessAppA.hap",
"ActsAmsUsersKillProcessAppB.hap",
"ActsAmsUsersKillProcessAppC.hap",
"ActsAmsUsersApi7AppA.hap"
],
"type": "AppInstallKit",
"cleanup-apps": false
}
]
}
\ 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 AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("MainAbility onBackground")
}
};
\ No newline at end of file
/*
* 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'
import commonEvent from '@ohos.commonevent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>");
globalThis.abilityContext.terminateSelf().then(()=>{
commonEvent.publish("ACTS_TerminateSelf_CommonEvent", PublishCallBackTwo);
console.debug("====>publish ACTS_TerminateSelf_CommonEvent finish====>")
});
console.debug("====>terminateSelf succese====>")
}
function PublishCallBackTwo(){
console.debug("====>Publish CallBack ACTS_TerminateSelf_CommonEvent====>");
}
export default class MainAbility2 extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("MainAbility2 onCreate")
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility2 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility2 onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/second", null)
commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", PublishCallBackOne);
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("MainAbility2 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility2 onForeground")
}
onBackground() {
// Ability has back to background
console.log("MainAbility2 onBackground")
}
};
\ 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 Ability from '@ohos.application.Ability'
export default class MainAbility3 extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("MainAbility3 onCreate")
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility3 onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility3 onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/second", null)
globalThis.abilityContext.terminateSelfWithResult(
{
resultCode:1,
want:{
action:'ACTION'
}
},()=>{
console.debug("====>terminateSelfWithResult succese====>")
});
console.debug("====>terminateSelf end====>")
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("MainAbility3 onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility3 onForeground")
}
onBackground() {
// Ability has back to background
console.log("MainAbility3 onBackground")
}
};
\ No newline at end of file
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
...@@ -12,47 +12,33 @@ ...@@ -12,47 +12,33 @@
* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility'
import commonEvent from '@ohos.commonevent' import ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility'
import rpc from '@ohos.rpc'; import commonEvent from "@ohos.commonevent"
class Stub extends rpc.RemoteObject {
constructor(des) { export default class ServiceAbility extends ServiceExtensionAbility {
super(des);
}
// process client's request
onRemoteRequest(code, data, reply, option) {
reply.writeNoException();
reply.writeString("success");
return true;
}
}
function PublishCallBackOne8() {
console.debug("====>Publish CallBack ACTS_ThirdPartyAbilityPermission_0400====>");
console.debug("====>close this context====>0400====>")
}
export default class ServiceAbility extends ServiceExtension {
onCreate(want) { onCreate(want) {
console.log('ServiceAbility onCreate, want: ' + want.abilityName); console.log('ServiceAbility onCreate');
} }
onDestory(){
onRequest(want, startId) { console.log('ServiceAbility onDestory');
console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); }
onRequest(want,startId) {
console.log('ServiceAbility onRequest');
commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => {
console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback")
this.context.terminateSelf().then(()=>{
console.log(" terminateSelf callback")
})
})
} }
onConnect(want) { onConnect(want) {
console.log('ServiceAbility onConnect, want:' + want.abilityName); console.log('ServiceAbility onConnect');
console.log('ServiceAbility onConnect, action:' + want.action);
if (want.action == 'StartAbilityPromise') {
commonEvent.publish("ACTS_ThirdPartyAbilityPermission_0400_Start_CommonEvent", PublishCallBackOne8);
var myStub = new Stub("com.example.actsabilitypermissionthirdtest.ServiceAbility");
console.log('ThirdAbility onConnect before returnU100:')
return myStub;
console.log('after return')
}
} }
onDisconnect(want) { onDisconnect(want) {
console.log('ServiceAbility onDisconnect, want:' + want.abilityName); console.log('ServiceAbility onDisconnect');
} }
onDestroy() { onDestroy() {
......
/*
* 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.ets"
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
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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 abilityPermissionText from './AbilityPermission.test.ets' import abilityTest from './Ability.test.ets'
export default function testsuite(context) { export default function testsuite(context) {
abilityPermissionText(context) console.debug("====>in list.test====>");
abilityTest(context)
} }
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
{
"src": [
"pages/index/index",
"pages/second/second"
]
}
\ No newline at end of file
# 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("//build/ohos_var.gni")
group("actsusers") {
testonly = true
if (is_standard_system) {
deps = [
"actsconnectabilitysystemabilitytest:ActsConnectAbilitySystemAbilityTest",
"actsextensionconnectabilitytest:ActsExtensionConnectAbilityTest",
"actsserviceabilityrelytest:actsServiceAbilityRelyHap",
"ActsAmsUsersSystemTest:ActsAmsUsersSystemTest",
"ActsAmsUsersExtensionSystemTest:ActsAmsUsersExtensionSystemTest",
"ActsAmsUsersKillProcessAppA:ActsAmsUsersKillProcessAppA",
"ActsAmsUsersKillProcessAppB:ActsAmsUsersKillProcessAppB",
"ActsAmsUsersKillProcessAppC:ActsAmsUsersKillProcessAppC",
"ActsAmsUsersApi7AppA:ActsAmsUsersApi7AppA"
]
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册