提交 0f4d013b 编写于 作者: O openharmony_ci 提交者: Gitee

!1316 Update xts test code 1208

Merge pull request !1316 from blackleon/master_xts_1208
# 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")
group("getactiveprocessinfos") {
testonly = true
if (is_standard_system) {
deps = [
"getactiveprocessinfo:getactiveprocessinfo",
"setshowonlocka:setshowonlocka",
]
}
}
# 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("getactiveprocessinfo") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "getactiveprocessinfo"
}
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": "30000",
"package": "com.example.getactiveprocessinfo",
"shell-timeout": "30000"
},
"kits": [
{
"test-file-name": [
"getactiveprocessinfo.hap",
"setshowonlock.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.getactiveprocessinfo",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getactiveprocessinfo",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.getactiveprocessinfo.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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.
*/
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;
}
<div class="container">
<text class="title">
测试zlib-1515-test
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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, ReportExtend} from 'deccjsunit/index'
const injecttRef = Object.getPrototypeOf(global) || global
injecttRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "amsZipfileUnzipfileST"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "serviceability_description",
"value": "hap sample empty service"
},
{
"name": "serviceability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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 appmgr from '@ohos.app.abilityManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('Getacitve', function () {
/*
* @tc.number: FWK_ProcessInfo_0100
* @tc.name: getActiveProcessInfos
* @tc.desc: A process retrieves information
*/
it('FWK_ProcessInfo_0100', 0, async function (done) {
console.log('FWK_ProcessInfo_0100 start');
try{
appmgr.getActiveProcessInfos(
(error, data) => {
expect(data[0].uid > 0).assertTrue();
expect(data[0].pid > 0).assertTrue();
expect(data[0].processName != null).assertTrue();
expect(data[0].bundleNames != null).assertTrue();
done();
});
}catch(err){
console.log('FWK_ProcessInfo_0100 err' + err);
done();
}
})
/*
* @tc.number: FWK_ProcessInfo_0200
* @tc.name: getActiveProcessInfos
* @tc.desc: Two processes get the information
*/
it('FWK_ProcessInfo_0200', 0, async function (done) {
console.log('FWK_ProcessInfo_0200 start');
try{
appmgr.getActiveProcessInfos(
(error, data) => {
var len = data.length;
for(var i =1; i<len; ++i){
expect(data[i].uid > 0).assertTrue();
expect(data[i].pid > 0).assertTrue();
expect(data[i].processName != null).assertTrue();
expect(data[i].bundleNames != null).assertTrue();
}
done();
})
}catch(err){
console.log('FWK_ProcessInfo_0200 err' + err);
done();
}
})
/*
* @tc.number: FWK_ProcessInfo_0300
* @tc.name: getActiveProcessInfos
* @tc.desc: A process retrieves information
*/
it('FWK_ProcessInfo_0300', 0, async function (done) {
console.log('FWK_ProcessInfo_0300 Begin');
try{
appmgr.getActiveProcessInfos().then((data) => {
expect(data[0].uid > 0).assertTrue();
expect(data[0].pid > 0).assertTrue();
expect(data[0].processName != null).assertTrue();
expect(data[0].bundleNames != null).assertTrue();
done();
}).catch((error) => {
console.log('FWK_ProcessInfo_0300 error code is ' + error.code);
done();
});
}catch(err){
console.log('FWK_ProcessInfo_0300 err' + err);
done();
}
})
/*
* @tc.number: FWK_ProcessInfo_0400
* @tc.name: getActiveProcessInfos
* @tc.desc: Two processes get the information
*/
it('FWK_ProcessInfo_0400', 0, async function (done) {
console.log('FWK_ProcessInfo_0400 Begin');
try{
appmgr.getActiveProcessInfos().then((data) => {
var len = data.length;
for(var i =1; i<len; ++i){
expect(data[i].uid > 0).assertTrue();
expect(data[i].pid > 0).assertTrue();
expect(data[i].processName != null).assertTrue();
expect(data[i].bundleNames != null).assertTrue();
}
done();
}).catch((error) => {
console.log('FWK_ProcessInfo_0400 error code is ' + error.code);
done();
});
}catch(err){
console.log('FWK_ProcessInfo_0400 err' + err);
done();
}
})
/*
* @tc.number: FWK_MemoryInfo_0100
* @tc.name: getSystemMemoryAttr
* @tc.desc: Anapplication memory information
*/
it('FWK_MemoryInfo_0100', 0, async function (done) {
console.log('FWK_MemoryInfo_0100 start');
try{
appmgr.getSystemMemoryAttr(
(error, data) => {
expect(data.availSysMem > 0).assertTrue();
expect(data.totalSysMem > 0).assertTrue();
expect(data.threshold > 0).assertTrue();
expect(data.isSysInlowMem == (data.availSysMem < data.threshold)).assertTrue();
done();
});
}catch(err){
console.log('FWK_ProcessInfo_0400 err' + err);
}
console.log('ZLM-----onClick1 End');
})
/*
* @tc.number: FWK_MemoryInfo_0200
* @tc.name: getSystemMemoryAttr
* @tc.desc: Anapplication memory information
*/
it('FWK_MemoryInfo_0200', 0, async function (done) {
console.log('FWK_MemoryInfo_0200 Begin');
try{
appmgr.getSystemMemoryAttr().then((data) => {
expect(data.availSysMem > 0).assertTrue();
expect(data.totalSysMem > 0).assertTrue();
expect(data.threshold > 0).assertTrue();
expect(data.isSysInlowMem == (data.availSysMem < data.threshold)).assertTrue();
done();
}).catch((error) => {
console.log('FWK_MemoryInfo_0200 error code is ' + error.code);
done();
});
}catch(err){
console.log('FWK_ProcessInfo_0400 err' + err);
}
console.log('FWK_MemoryInfo_0200 End');
})
})
/*
* 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.
*/
require('./Getactive.test.js')
# 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("setshowonlock") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "setshowonlock"
}
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"
}
{
"app": {
"bundleName": "com.example.setshowonlock",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.setshowonlock",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.setshowonlock.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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.
*/
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;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
export default{
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "setShowOnLock"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("setshowonlocka") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "setshowonlocka"
}
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"
}
{
"app": {
"bundleName": "com.example.setshowonlock",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.setshowonlock",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.setshowonlock.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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.
*/
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;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
export default{
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "setShowOnLock"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsBmsGetInfosTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBmsGetInfosTest"
}
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": "180000",
"package": "com.example.actsbmsgetinfostest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"bmsSystemBundleTest1.hap",
"bmsVendorBundleTest1.hap",
"ActsBmsGetInfosTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /data/test"
]
},
{
"type": "PushKit",
"push": [
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap",
"bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap",
"bmsThirdBundleTest3.hap->/data/test/bmsThirdBundleTest3.hap",
"bmsThirdBundleTest4.hap->/data/test/bmsThirdBundleTest4.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /data/test/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.actsbmsgetinfostest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsbmsgetinfostest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home",
"flag.home.intent.from.system"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsbmsgetinfostest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ 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.
*/
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;
}
/*
* 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 {Core, ExpectExtend} from 'deccjsunit'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: 'Test actsbmsgetinfostest'
},
onInit() {
this.title = 'Test actsbmsgetinfostest';
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
onBackPress(){
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "actsbmsgetinfostest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ 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 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 NUM_TWO = 2;
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;
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third5',
abilityName: 'com.example.third5.AMainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[0].name).assertEqual("com.example.third5.AMainAbility");
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping);
expect(dataInfos[1].name).assertEqual("com.example.third5.BMainAbility");
expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer + voip);
}
installer.uninstall('com.example.third5', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third6',
abilityName: '',
},
}
}, 0, 0)
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('com.example.third6', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third2',
abilityName: 'com.example.third2.MainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(1);
if (dataInfos.length == 1) {
expect(dataInfos[0].name).assertEqual("com.example.third2.MainAbility")
expect(dataInfos[0].backgroundModes).assertEqual(audioPlayback + audioRecording + location
+ bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
installer.uninstall('com.example.third2', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third4',
abilityName: 'com.example.third4.MainAbility',
},
}
}, 0, 0)
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('com.example.third4', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.AMainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(NUM_TWO);
if (dataInfos.length == NUM_TWO) {
expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbility")
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes)
installer.uninstall('com.example.third1', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
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, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.MainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(1);
if (dataInfos.length == 1) {
expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbility")
expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording +
location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping)
}
installer.install(bundlePath2, {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, async (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
var dataInfos = await bundle.queryAbilityByWant({
want: {
action: 'action.system.home',
entities: ['entity.system.home'],
elementName: {
deviceId: '0',
bundleName: 'com.example.third1',
abilityName: 'com.example.third1.AMainAbility',
},
}
}, 0, 0)
expect(dataInfos.length).assertEqual(1);
if (dataInfos.length == 1) {
expect(dataInfos[0].name).assertEqual("com.example.third1.AMainAbility");
expect(dataInfos[0].backgroundModes).assertEqual(audioRecording + location + bluetoothInteraction +
multiDeviceConnection + wifiInteraction + voip + taskKeeping);
}
console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes)
installer.uninstall('com.example.third1', {
param: {
userId: 0,
installFlag: 1,
isKeepData: false
}
}, (err, data) => {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
expect(data.statusMessage).assertEqual('SUCCESS');
done();
});
})
})
})
})
\ 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.
*/
require('./ActsBmsGetBackGroundModes.test.js')
require('./ActsBmsFormsInfoTest.test.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册