提交 e062a614 编写于 作者: K kirl.liu

Supplementary meta-ability test cases.

Signed-off-by: Nkirl.liu <kirl.liu@huawei.com>
上级 29949fd5
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAbilityDelegatorCaseTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAbilityDelegatorCaseTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.amsst.actsabilitydelegatorcasetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAbilityDelegatorCaseTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.amsst.actsabilitydelegatorcasetest",
"vendor": "amsst",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.actsabilitydelegatorcasetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.amsst.actsabilitydelegatorcasetest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"reqPermissions": [
{
"name": "ohos.permission.INSTALL_BUNDLE",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"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.MANAGE_LOCAL_ACCOUNTS",
"reason":"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
ActsAbilityDelegatorCaseTest
</text>
</div>
/*
* 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'
import app from '@system.app'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('====onShow finish====<')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "StSeAbClient"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import featureAbility from '@ohos.ability.featureAbility'
import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import bundle from '@ohos.bundle'
describe('ActsStServiceAbilityTest', function () {
let gSetTimeout = 1000
beforeAll(async (done) => {
console.debug('= ACTS_AbeforeAll 1812 ====<begin');
console.debug('= ACTS_AbeforeAll ====<end');
done();
})
beforeEach(async (done) => {
setTimeout(function () {
done();
}, gSetTimeout);
})
afterEach(async (done) => {
setTimeout(function () {
done();
}, gSetTimeout);
})
afterAll((done) => {
console.debug('= ACTS_AAAfterAll ====<begin');
setTimeout(function () {
console.debug('= ACTS_AAAfterAll ====<end');
featureAbility.terminateSelf();
done();
}, gSetTimeout);
})
/**
* @tc.number: ACTS_AExecuteShellCommand_0100
* @tc.name: Execute a shell command without arguments (AsyncCallback).
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_AExecuteShellCommand_Callback_0100', 0, async function (done) {
console.log("ACTS_AExecuteShellCommand_Callback_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AExecuteShellCommand_Callback_0100====<end mySetTimeout')
done();
}
var cmd = 'pwd'
var escresult = '/system/app'
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
AbilityDelegator.executeShellCommand(cmd, (err, data) => {
clearTimeout(currentAlertTimeout);
console.log('ACTS_AExecuteShellCommand_Callback_0100 - executeShellCommand: start ')
console.log('ACTS_AExecuteShellCommand_Callback_0100 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf('/system/app');
console.log('ACTS_AExecuteShellCommand_Callback_0100 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_AExecuteShellCommand_Callback_0100 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
console.log('ACTS_AExecuteShellCommand_Callback_0100 - executeShellCommand: end')
done()
})
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AExecuteShellCommand_Callback_0100 : error = " + error);
console.debug('ACTS_AExecuteShellCommand_Callback_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AExecuteShellCommand_0200
* @tc.name: Execute a shell command with arguments (AsyncCallback).
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_AExecuteShellCommand_Callback_0200', 0, async function (done) {
console.log("ACTS_AExecuteShellCommand_Callback_0200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AExecuteShellCommand_Callback_0200====<end mySetTimeout')
done();
}
var cmd = 'aa start -d 0 -a com.example.actskillProcessWithAccountclosetest.MainAbility'
+ ' -b com.example.actskillProcessWithAccountclosetest'
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
AbilityDelegator.executeShellCommand(cmd, 1000, (err, data) => {
clearTimeout(currentAlertTimeout);
console.log('ACTS_AExecuteShellCommand_Callback_0200 - executeShellCommand: start ')
console.log('ACTS_AExecuteShellCommand_Callback_0200 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf('start ability successfully.');
console.log('ACTS_AExecuteShellCommand_Callback_0200 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_AExecuteShellCommand_Callback_0200 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
done()
})
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AExecuteShellCommand_Callback_0200 : error = " + error);
console.debug('ACTS_AExecuteShellCommand_Callback_0200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AExecuteShellCommand_Promise_0100
* @tc.name: Execute a shell command without arguments (Promise).
* @tc.desc: Verify that the interface executes the Shell command successfully.
*/
it('ACTS_AExecuteShellCommand_Promise_0100', 0, async function (done) {
console.log("ACTS_AExecuteShellCommand_Promise_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AExecuteShellCommand_Callback_0200====<end mySetTimeout')
done();
}
var cmd = 'pwd'
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
AbilityDelegator.executeShellCommand(cmd, 1).then((data) => {
clearTimeout(currentAlertTimeout);
console.log('ACTS_AExecuteShellCommand_Promise_0100 - executeShellCommand: start ')
console.log('ACTS_AExecuteShellCommand_Promise_0100 stdResult = ' + data.stdResult)
var i = data.stdResult.indexOf('/system/app');
console.log('ACTS_AExecuteShellCommand_Callback_0100 query string i = ' + i);
expect(i == -1).assertEqual(false);
console.log('ACTS_AExecuteShellCommand_Promise_0100 exitCode = ' + data.exitCode)
expect(data.exitCode).assertEqual(0);
done();
})
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AExecuteShellCommand_Callback_0200 : error = " + error);
console.debug('ACTS_AExecuteShellCommand_Callback_0200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AAACommand_0100
* @tc.name: Hide this for inner system use.
* @tc.desc: VHide this for inner system use successfully.
*/
it('ACTS_AAACommand_0100', 0, async function (done) {
console.log("ACTS_AAACommand_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AAACommand_0100====<end mySetTimeout')
done();
}
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
AbilityDelegator.finishTest(msg, 1, () => {
console.log("ACTS_AAACommand_0100 finishTest test end ========> callback ")
done()
})
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AAACommand_0100 : error = " + error);
console.debug('ACTS_AAACommand_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AAACommand_1200
* @tc.name: Hide this for inner system use.
* @tc.desc: VHide this for inner system use successfully.
*/
it('ACTS_AAACommand_1200', 0, async function (done) {
console.log("ACTS_AAACommand_1200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AAACommand_1200====<end mySetTimeout')
done();
}
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
var msg = '测试日志!@#$%^&*()_+QWE{}|?><Fafq3146'
AbilityDelegator.finishTest(msg, Number.MAX_VALUE).then(() => {
console.log("ACTS_AAACommand_1200 finishTest test end ========> callback ")
done()
})
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AAACommand_1200 : error = " + error);
console.debug('ACTS_AAACommand_1200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AGetDisplayOrientation_0100
* @tc.name: GetDisplayOrientation
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_AGetDisplayOrientation_0100', 0, async function (done) {
console.log("ACTS_AGetDisplayOrientation_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AGetDisplayOrientation_0100====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.getDisplayOrientation(
(err, DisplayOrientation) => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_AGetDisplayOrientation_0100====DisplayOrientation>"
+ JSON.stringify(DisplayOrientation) + " , err= " + err);
expect(DisplayOrientation == bundle.DisplayOrientation.UNSPECIFIED
|| (DisplayOrientation != bundle.DisplayOrientation.LANDSCAPE
|| DisplayOrientation != bundle.DisplayOrientation.PORTRAIT
|| DisplayOrientation != bundle.DisplayOrientation.FOLLOW_RECENT
)).assertTrue();
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AGetDisplayOrientation_0100 : error = " + error);
console.debug('ACTS_AGetDisplayOrientation_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_AGetDisplayOrientation_0200
* @tc.name: GetDisplayOrientation
* @tc.desc: Check the return type of the interface (by promise)
*/
it('ACTS_AGetDisplayOrientation_0200', 0, async function (done) {
console.log("ACTS_AGetDisplayOrientation_0200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_AGetDisplayOrientation_0200====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.getDisplayOrientation().then((data) => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_AGetDisplayOrientation_0200====DisplayOrientation>"
+ JSON.stringify(DisplayOrientation) + " , err= " + err);
expect(DisplayOrientation == bundle.DisplayOrientation.UNSPECIFIED
|| (DisplayOrientation != bundle.DisplayOrientation.LANDSCAPE
|| DisplayOrientation != bundle.DisplayOrientation.PORTRAIT
|| DisplayOrientation != bundle.DisplayOrientation.FOLLOW_RECENT
)).assertTrue();
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_AGetDisplayOrientation_0200 : error = " + error);
console.debug('ACTS_AGetDisplayOrientation_0200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetDisplayOrientation_0100
* @tc.name: SetDisplayOrientation
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_ASetDisplayOrientation_0100', 0, async function (done) {
console.log("ACTS_ASetDisplayOrientation_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetDisplayOrientation_0100====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setDisplayOrientation(bundle.DisplayOrientation.UNSPECIFIED,
(err) => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_ASetDisplayOrientation_0100====err>"
+ JSON.stringify(err) + " , err= " + err);
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetDisplayOrientation_0100 : error = " + error);
console.debug('ACTS_ASetDisplayOrientation_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetDisplayOrientation_0200
* @tc.name: SetDisplayOrientation
* @tc.desc: Check the return type of the interface (by promise)
*/
it('ACTS_ASetDisplayOrientation_0200', 0, async function (done) {
console.log("ACTS_ASetDisplayOrientation_0200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetDisplayOrientation_0200====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setDisplayOrientation(bundle.DisplayOrientation.UNSPECIFIED).then(() => {
clearTimeout(currentAlertTimeout);
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetDisplayOrientation_0200 : error = " + error);
console.debug('ACTS_ASetDisplayOrientation_0200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetShowOnLockScreen_0100
* @tc.name: SetShowOnLockScreen
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_ASetShowOnLockScreen_0100', 0, async function (done) {
console.log("ACTS_ASetShowOnLockScreen_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetShowOnLockScreen_0100====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setShowOnLockScreen(true,
(err) => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_ASetShowOnLockScreen_0100====err>"
+ JSON.stringify(err) + " , err= " + err);
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetShowOnLockScreen_0100 : error = " + error);
console.debug('ACTS_ASetShowOnLockScreen_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetShowOnLockScreen_0200
* @tc.name: SetShowOnLockScreen
* @tc.desc: Check the return type of the interface (by promise)
*/
it('ACTS_ASetShowOnLockScreen_0200', 0, async function (done) {
console.log("ACTS_ASetShowOnLockScreen_0200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetShowOnLockScreen_0200====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setShowOnLockScreen(true).then(() => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_ASetShowOnLockScreen_0200====then>");
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetShowOnLockScreen_0200 : error = " + error);
console.debug('ACTS_ASetShowOnLockScreen_0200====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetWakeUpScreen_0100
* @tc.name: SetWakeUpScreen
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_ASetWakeUpScreen_0100', 0, async function (done) {
console.log("ACTS_ASetWakeUpScreen_0100 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetWakeUpScreen_0100====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setWakeUpScreen(true,
(err) => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_ASetWakeUpScreen_0100====err>"
+ JSON.stringify(err) + " , err= " + err);
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetWakeUpScreen_0100 : error = " + error);
console.debug('ACTS_ASetWakeUpScreen_0100====<end catch (error)');
done();
}
})
/**
* @tc.number: ACTS_ASetWakeUpScreen_0200
* @tc.name: SetWakeUpScreen
* @tc.desc: Check the return type of the interface (by promise)
*/
it('ACTS_ASetWakeUpScreen_0200', 0, async function (done) {
console.log("ACTS_ASetWakeUpScreen_0200 --- start")
var currentAlertTimeout = 0;
try {
currentAlertTimeout = setTimeout(mySetTimeout, gSetTimeout);
function mySetTimeout() {
console.log('ACTS_ASetWakeUpScreen_0200====<end mySetTimeout')
done();
}
var context = featureAbility.getContext()
var result = context.setWakeUpScreen(true).then(() => {
clearTimeout(currentAlertTimeout);
console.debug("ACTS_ASetWakeUpScreen_0200====then>");
done()
}
);
} catch (error) {
clearTimeout(currentAlertTimeout);
console.log("ACTS_ASetWakeUpScreen_0200 : error = " + error);
console.debug('ACTS_ASetWakeUpScreen_0200====<end catch (error)');
done();
}
})
/*
* @tc.number : ACTS_ATestRunner_0200
* @tc.name : start new ability
* @tc.desc : Starting mainability2 with startability succeeded.(callback)
*/
it('ACTS_ATestRunner_0200', 0, async function (done) {
console.debug('ACTS_ATestRunner_0200====<begin');
try {
var AbilityDelegatorArgs = abilityDelegatorRegistry.getArguments()
console.debug("ACTS_ATestRunner_0200====>getArguments is====>" + JSON.stringify(AbilityDelegatorArgs));
console.debug("ACTS_ATestRunner_0200====bundleName>" + JSON.stringify(AbilityDelegatorArgs.bundleName));
expect(AbilityDelegatorArgs.bundleName).assertEqual(undefined)
console.debug("ACTS_ATestRunner_0200====parameters>" + JSON.stringify(AbilityDelegatorArgs.parameters));
expect(AbilityDelegatorArgs.parameters).assertEqual(undefined)
console.debug("ACTS_ATestRunner_0200====testCaseNames>"
+ JSON.stringify(AbilityDelegatorArgs.testCaseNames));
expect(AbilityDelegatorArgs.testCaseNames).assertEqual(undefined)
console.debug("ACTS_ATestRunner_0200====testRunnerClassName>"
+ JSON.stringify(AbilityDelegatorArgs.testRunnerClassName));
expect(AbilityDelegatorArgs.testRunnerClassName).assertEqual(undefined)
console.debug('ACTS_ATestRunner_0200====<end');
done();
} catch (error) {
console.log("ACTS_ATestRunner_0200 : error = " + error);
console.debug('ACTS_ATestRunner_0200====<end catch (error)');
done();
}
})
})
\ 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.
*/
require('./ActsAbilityDelegatorCaseTest.test.js')
\ No newline at end of file
......@@ -17,6 +17,7 @@ group("aafwk_standard") {
testonly = true
if (is_standard_system) {
deps = [
"ActsAbilityDelegatorCaseTest:ActsAbilityDelegatorCaseTest",
"ActsAbilityLifecycleStateNewTest:ActsAbilityLifecycleStateNewTest",
"ActsDataAbilityJsTest:ActsDataAbilityJsTest",
"ActsKillProcessWithAccountApi7:ActsKillProcessWithAccountApi7",
......
/*
* 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 bundle from '@ohos.bundle'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit'
const BUNDLE_PATH1 = '/data/test/bmsThirdBundleTest1.hap';
const BUNDLE_PATH2 = '/data/test/bmsThirdBundleTest2.hap';
const BUNDLE_PATH3 = '/data/test/bmsThirdBundleTest3.hap';
const BUNDLE_PATH4 = '/data/test/bmsThirdBundleTest4.hap';
const BUNDLE_PATH5 = '/data/test/bmsThirdBundleTest5.hap';
const BUNDLE_PATH6 = '/data/test/bmsThirdBundleTest6.hap';
const BUNDLE_PATHUPDATE = '/data/test/bmsThirdBundleTestA1.hap';
const SYSTEM_PATH = '/data/test/bmsSystemBundleTest2.hap';
const BUNDLE_NAME1 = 'com.example.third1';
const BUNDLE_NAME2 = 'com.example.third2';
const BUNDLE_NAME4 = 'com.example.third4';
const BUNDLE_NAME5 = 'com.example.third5';
const BUNDLE_NAME6 = 'com.example.third6';
const SYSTEM_NAME = 'com.example.system2';
const NUM_TWO = 2;
const NUM_THREE = 3;
const NUM_FOUR = 4;
const NUM_NINE = 9;
let dataTransfer = 1;
let audioPlayback = 2;
let audioRecording = 4;
let location = 8;
let bluetoothInteraction = 16;
let multiDeviceConnection = 32;
let wifiInteraction = 64;
let voip = 128;
let taskKeeping = 256;
const USERID = 100;
var installParam = {
userId: USERID,
installFlag: 1,
isKeepData: false
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
}
describe('ActsBmsGetBackGroundModes', function () {
/*
* @tc.number: bms_backGroundModes_0100
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Get the information of the background modes from multi-ability application
*/
it('bms_backGroundModes_0100', 0, async function (done) {
console.info('=====================bms_backGroundModes_0100==================');
var bundlePath = [BUNDLE_PATH5]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME5,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_FOUR);
if (dataInfos.length == NUM_FOUR) {
expect(dataInfos[NUM_TWO].name).assertEqual("com.example.third5.MainAbilityA");
expect(dataInfos[NUM_TWO].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping);
expect(dataInfos[NUM_THREE].name).assertEqual("com.example.third5.MainAbilityB");
expect(dataInfos[NUM_THREE].backgroundModes).assertEqual(dataTransfer | voip);
}
var bundleInfos = await bundle.getAllBundleInfo(1, USERID)
for (let i = 0; i < bundleInfos.length; i++) {
console.info("========>bundleInfos[i].name======" + bundleInfos[i].name)
console.info("========>bundleInfos[i]======" + JSON.stringify(bundleInfos[i]));
if (bundleInfos[i].name == BUNDLE_NAME5) {
console.info("========>bundleInfos[i].abilityinfos======" + JSON.stringify(bundleInfos[i].abilityInfos))
for (let j = 0; j < bundleInfos[i].abilityInfos.length; j++) {
console.info("========>bundleInfos[i].abilityinfos[j].name======"
+ bundleInfos[i].abilityInfos[j].name)
if (bundleInfos[i].abilityInfos[j].name == 'com.example.third5.MainAbilityA') {
expect(bundleInfos[i].abilityInfos[j].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping);
} else if (bundleInfos[i].abilityInfos[j].name == 'com.example.third5.MainAbilityB') {
expect(bundleInfos[i].abilityInfos[j].backgroundModes).assertEqual(dataTransfer | voip);
}
}
}
}
var data3 = await bundle.getBundleInfo(BUNDLE_NAME5, 1)
console.info("========>data3======" + data3.abilityInfos.length)
for (let q = 0; q < data3.abilityInfos.length; q++) {
console.info("========>data3.abilityInfos======" + JSON.stringify(data3.abilityInfos[2].backgroundModes))
console.info("========>data3.abilityInfos======" + JSON.stringify(data3.abilityInfos[3].backgroundModes))
}
expect(data3.abilityInfos[2].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping);
expect(data3.abilityInfos[3].backgroundModes).assertEqual(dataTransfer | voip);
var data5 = await bundle.getBundleArchiveInfo(BUNDLE_PATH5, 1)
console.info("========>data5======" + data5.abilityInfos.length)
for (let i = 0; i < data5.abilityInfos.length; i++) {
console.info("========>data5.abilityInfos======" + JSON.stringify(data5.abilityInfos[2].backgroundModes))
console.info("========>data5.abilityInfos======" + JSON.stringify(data5.abilityInfos[3].backgroundModes))
}
expect(data5.abilityInfos[2].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping);
expect(data5.abilityInfos[3].backgroundModes).assertEqual(dataTransfer | voip);
installer.uninstall(BUNDLE_NAME5, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
/*
* @tc.number: bms_backGroundModes_0200
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Get all background modes information, and each ability of the application
* contains one of the background mode
*/
it('bms_backGroundModes_0200', 0, async function (done) {
console.info('=====================bms_backGroundModes_0200==================');
var bundlePath = [BUNDLE_PATH6]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME6,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_NINE);
for (let i = 0, len = dataInfos.length; i < len; i++) {
expect(dataInfos[i].backgroundModes).assertEqual(1 << i);
console.info("==========dataInfos[i].backgroundModes=========" + dataInfos[i].backgroundModes);
console.info("==========dataInfos[1].name=========" + dataInfos[i].name);
}
installer.uninstall(BUNDLE_NAME6, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
/*
* @tc.number: bms_backGroundModes_0300
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes
*/
it('bms_backGroundModes_0300', 0, async function (done) {
console.info('=====================bms_backGroundModes_0300==================');
var bundlePath = [BUNDLE_PATH2]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME2,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third2.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(audioPlayback | audioRecording | location
| bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
}
bundle.getAllBundleInfo(1, USERID, (err, bundleInfos) => {
for (let i = 0; i < bundleInfos.length; i++) {
console.info("========>bundleInfos[i].name======" + bundleInfos[i].name)
console.info("========>bundleInfos[i]======" + JSON.stringify(bundleInfos[i]));
if (bundleInfos[i].name == BUNDLE_NAME2) {
console.info("========>bundleInfos[i].abilityinfos======" + JSON.stringify(bundleInfos[i].abilityInfos))
for (let j = 0; j < bundleInfos[i].abilityInfos.length; j++) {
console.info("========>bundleInfos[i].abilityinfos[j].name======"
+ bundleInfos[i].abilityInfos[j].name)
if (bundleInfos[i].abilityInfos[j].name == 'com.example.third2.MainAbilityA') {
expect(bundleInfos[i].abilityInfos[j].backgroundModes).assertEqual(audioPlayback | audioRecording | location
| bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping);
}
}
}
}
})
bundle.getBundleInfo(BUNDLE_NAME2, 1, (err, data3) => {
expect(data3.abilityInfos[1].backgroundModes).assertEqual(audioPlayback | audioRecording | location
| bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
})
bundle.getBundleArchiveInfo(BUNDLE_PATH2, 1, (err, data5) => {
expect(data5.abilityInfos[1].backgroundModes).assertEqual(audioPlayback | audioRecording | location
| bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
})
installer.uninstall(BUNDLE_NAME2, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
/*
* @tc.number: bms_backGroundModes_0400
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes
*/
it('bms_backGroundModes_0400', 0, async function (done) {
console.info('=====================bms_backGroundModes_0400==================');
var bundlePath1 = [BUNDLE_PATH4]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME4,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(1);
if (dataInfos.length == 1) {
expect(dataInfos[0].name).assertEqual("com.example.third4.MainAbility")
expect(dataInfos[0].backgroundModes).assertEqual(0)
}
installer.uninstall(BUNDLE_NAME4, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
/*
* @tc.number: bms_backGroundModes_0500
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Get the backgroundModes information of the multi-hap package of the application
*/
it('bms_backGroundModes_0500', 0, async function (done) {
console.info('=====================bms_backGroundModes_0500==================');
var bundlePath = [BUNDLE_PATH1, BUNDLE_PATH3];
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_FOUR);
if (dataInfos.length == NUM_FOUR) {
expect(dataInfos[1].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
expect(dataInfos[3].name).assertEqual("com.example.third3.MainAbilityA")
expect(dataInfos[3].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
}
console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes)
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
/*
* @tc.number: bms_backGroundModes_0600
* @tc.name: Get the backgroundModes information of the application through queryAbilityByWant
* @tc.desc: Get the backgroundModes information of the upgraded application's ability
*/
it('bms_backGroundModes_0600', 0, async function (done) {
console.info('=====================bms_backGroundModes_0600==================');
var bundlePath1 = [BUNDLE_PATH1]
var bundlePath2 = [BUNDLE_PATHUPDATE]
var installer = await bundle.getBundleInstaller();
installer.install(bundlePath1, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third1.MainAbilityA")
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer | audioPlayback | audioRecording |
location | bluetoothInteraction | multiDeviceConnection | wifiInteraction | voip | taskKeeping)
}
installer.install(bundlePath2, installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: BUNDLE_NAME1,
abilityName: '',
},
}, 0, USERID)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[1].name).assertEqual("com.example.third1.AMainAbilityA");
expect(dataInfos[1].backgroundModes).assertEqual(audioRecording | location | bluetoothInteraction |
multiDeviceConnection | wifiInteraction | voip | taskKeeping);
}
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
})
})
})
/*
* @tc.number: bms_queryAbilityByEntities_0100
* @tc.name: Use the implicit query method in queryAbilityByWant to get abilityInfos
* @tc.desc: The entities in the parameter want pass in the new field, and use the implicit query to get abilitInfos
*/
it('bms_queryAbilityByEntities_0100', 0, async function (done) {
console.info('===========begin bms_queryAbilityByEntities_0100===========');
let installer = await bundle.getBundleInstaller()
installer.install([SYSTEM_PATH], installParam, async (err, data) => {
checkInstallOrUninstall(err, data);
var dataInfos = await bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, 0, USERID)
console.log('=========ability info is=========' + JSON.stringify(dataInfos));
expect(dataInfos.length).assertEqual(1);
expect(dataInfos[0].name).assertEqual('com.example.system2.MainAbility');
installer.uninstall(SYSTEM_NAME, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
});
});
})
})
\ No newline at end of file
......@@ -14,4 +14,5 @@
*/
require('./ActsBmsFormsInfoTest.test.js')
require('./ActsBmsQueryAbilityByWant.test.js')
require('./ActsBmsCleanCacheTest.test.js')
\ No newline at end of file
require('./ActsBmsCleanCacheTest.test.js')
require('./ActsBmsGetBackGroundModes.test.js')
\ No newline at end of file
......@@ -33,7 +33,7 @@
"entity.system.home"
],
"actions": [
"action.system.third5A"
"action.system.home"
]
}
],
......@@ -114,7 +114,7 @@
"entity.system.home"
],
"actions": [
"action.system.third5B"
"action.system.home"
]
}
],
......
......@@ -2,7 +2,6 @@
"app": {
"bundleName": "com.example.third1",
"vendor": "example",
"singleUser":true,
"version": {
"code": 1,
"name": "1.0"
......@@ -14,13 +13,12 @@
}
},
"deviceConfig": {
"default":{
"keepAlive":true
}
"default":{}
},
"module": {
"package": "com.example.third1.entry",
"name": "com.example.third1.BmsThirdBundle1",
"colorMode": "light",
"deviceType": [
"phone"
],
......@@ -87,20 +85,6 @@
"launchType": "standard",
"visible": true,
"metaData": {
"parameters": [
{
"name": "Data1",
"type": "float",
"description": "$string:mainability_description"
}
],
"results": [
{
"name": "Data1",
"type": "float",
"description": "$string:mainability_description"
}
],
"customizeData": [
{
"name": "Data1",
......
......@@ -2,7 +2,6 @@
"app": {
"bundleName": "com.example.third1",
"vendor": "example",
"singleUser":false,
"version": {
"code": 2,
"name": "2.0"
......@@ -14,14 +13,13 @@
}
},
"deviceConfig": {
"default":{
"keepAlive":false
}
"default":{}
},
"module": {
"package": "com.example.third1.entry",
"name": "com.example.third1.BmsThirdBundle1",
"mainAbility": "com.example.third1.AMainAbility",
"colorMode": "dark",
"deviceType": [
"phone"
],
......
......@@ -2,7 +2,6 @@
"app": {
"bundleName": "com.example.system2",
"vendor": "example",
"singleUser":true,
"version": {
"code": 1,
"name": "1.0"
......@@ -14,9 +13,7 @@
}
},
"deviceConfig": {
"default":{
"keepAlive":false
}
"default":{}
},
"module": {
"package": "com.example.system2",
......@@ -35,7 +32,15 @@
"skills": [
{
"entities": [
"entity.system.home"
"entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"
],
"actions": [
"action.system.home"
......
......@@ -2,7 +2,6 @@
"app": {
"bundleName": "com.example.third1",
"vendor": "example",
"singleUser":true,
"version": {
"code": 1,
"name": "1.0"
......@@ -14,13 +13,12 @@
}
},
"deviceConfig": {
"default":{
"keepAlive":true
}
"default":{}
},
"module": {
"package": "com.example.third3",
"name": ".BmsThirdBundle3",
"colorMode": "auto",
"deviceType": [
"phone"
],
......@@ -87,20 +85,6 @@
],
"launchType": "standard",
"metaData": {
"parameters": [
{
"name": "Data3",
"type": "float",
"description": "$string:mainability_description"
}
],
"results": [
{
"name": "Data3",
"type": "float",
"description": "$string:mainability_description"
}
],
"customizeData": [
{
"name": "Data3",
......@@ -132,7 +116,7 @@
"voip",
"taskKeeping"
],
"name": "com.example.third1.MainAbilityA",
"name": "com.example.third3.MainAbilityA",
"icon": "$media:icon",
"form": {
"formEntity": [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册