提交 218a2e20 编写于 作者: X xialiangwei

增加UIExtension中XTS测试用例

Signed-off-by: Nxialiangwei <xialiangwei1@huawei.com>
Change-Id: Ifb40663431a9fba85dd0f3fac294db1c186b00f9
上级 71e11258
......@@ -17,9 +17,9 @@ group("actsuiextensiontest") {
testonly = true
if (is_standard_system) {
deps = [
"actsabilityusertest:StartAbilityByUIContentSession",
"uiextensionprovider:UIExtensionProvider",
"uiextensiontest:UIExtensionTest",
"actsabilityusertest:StartAbilityByUIContentSession",
]
}
}
......@@ -15,28 +15,29 @@
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log('MainAbility onCreate')
console.log('MainAbility onCreate');
}
onDestroy() {
console.log('MainAbility onDestroy')
console.log('MainAbility onDestroy');
}
onWindowStageCreate(windowStage) {
console.log('MainAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null)
console.log('MainAbility onWindowStageCreate');
windowStage.setUIContent(this.context, 'MainAbility/pages/index', null);
}
onWindowStageDestroy() {
console.log('MainAbility onWindowStageDestroy')
console.log('MainAbility onWindowStageDestroy');
}
onForeground() {
console.log('MainAbility onForeground')
console.log('MainAbility onForeground');
}
onBackground() {
console.log('MainAbility onBackground')
console.log('MainAbility onBackground');
}
};
\ No newline at end of file
......@@ -12,13 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
import commonEventManager from '@ohos.commonEventManager'
import Ability from '@ohos.app.ability.UIAbility';
import commonEventManager from '@ohos.commonEventManager';
function PublishCallBackOne() {
console.log("====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>");
const sleepTimeOne = 1000;
function publishCallBack() {
console.log('====>Publish CallBack ACTS_StartAbility_0100_CommonEvent====>');
globalThis.ability2Context.terminateSelf().then(()=>{
console.log("====>terminateSelf success====>");
console.log('====>terminateSelf success====>');
});
}
......@@ -29,43 +31,43 @@ function timeout() {
abilityName: 'TestAbility',
}
).then(()=>{
console.log("====>start com.example.uiextensiontest.TestAbility finish====>")
console.log('====>start com.example.uiextensiontest.TestAbility finish====>');
});
}
}
export default class MainAbility2 extends Ability {
onCreate(want, launchParam) {
console.log("MainAbility2 onCreate");
console.log('MainAbility2 onCreate');
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility2 onDestroy");
console.log('MainAbility2 onDestroy');
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility2 onWindowStageCreate");
windowStage.setUIContent(this.context, "pages/index2", null);
console.log('MainAbility2 onWindowStageCreate');
windowStage.setUIContent(this.context, 'pages/index2', null);
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility2 onWindowStageDestroy");
console.log('MainAbility2 onWindowStageDestroy');
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility2 onForeground");
console.log('MainAbility2 onForeground');
globalThis.ability2Context = this.context;
setTimeout(timeout, 1000);
setTimeout(timeout, sleepTimeOne);
}
onBackground() {
// Ability has back to background
console.log("MainAbility2 onBackground");
console.log('MainAbility2 onBackground');
let onResultEvent = 'ACTS_UIExtension_StartAbility_OnResult';
commonEventManager.publish(onResultEvent, PublishCallBackOne);
commonEventManager.publish(onResultEvent, publishCallBack);
}
};
......@@ -12,60 +12,61 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
import Ability from '@ohos.app.ability.UIAbility';
const sleepTimeOne = 1000;
function timeout() {
globalThis.ability3Context.startAbility(
{
bundleName: 'com.example.uiextensiontest',
abilityName: 'TestAbility',
abilityName: 'TestAbility'
}
).then(()=>{
console.log("====>start com.example.uiextensiontest.TestAbility finish====>")
console.log('====>start com.example.uiextensiontest.TestAbility finish====>');
});
}
}
export default class MainAbility3 extends Ability {
onCreate(want, launchParam) {
console.log("MainAbility3 onCreate");
console.log('MainAbility3 onCreate');
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("MainAbility3 onDestroy");
console.log('MainAbility3 onDestroy');
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("MainAbility3 onWindowStageCreate");
windowStage.setUIContent(this.context, "pages/index3", null);
console.log('MainAbility3 onWindowStageCreate');
windowStage.setUIContent(this.context, 'pages/index3', null);
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
console.log("MainAbility3 onWindowStageDestroy");
console.log('MainAbility3 onWindowStageDestroy');
}
onForeground() {
// Ability has brought to foreground
console.log("MainAbility3 onForeground");
console.log('MainAbility3 onForeground');
globalThis.ability3Context = this.context;
setTimeout(timeout, 1000);
setTimeout(timeout, sleepTimeOne);
}
onBackground() {
// Ability has back to background
console.log("MainAbility3 onBackground");
console.log('MainAbility3 onBackground');
globalThis.ability3Context.terminateSelfWithResult(
{
resultCode:1,
want:{
action:'ACTION'
}
},()=>{
console.debug("====>terminateSelfWithResult success====>")
}, ()=>{
console.debug('====>terminateSelfWithResult success====>');
});
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册