提交 e08ef2a0 编写于 作者: Q qigongming

release分支新增信息查询测试套

Signed-off-by: Nqigongming <qigongming@huawei.com>
Change-Id: I4a970c5cff4d46c5eb0970b96d157d6e068dbf55
上级 a66199d6
......@@ -18,6 +18,7 @@ group("resourceschedule_standard") {
if (is_standard_system) {
deps = [
"backgroundtaskmanager:resourceschedule_backgroundtaskmanager_js_test",
"deviceusagestatisticsjsunit:resourceschedule_deviceusagestatisticsjsunit_js_test",
"reminderagent:resourceschedule_reminderagent_js_test",
"workscheduler:resourceschedule_workscheduler_js_test",
]
......
......@@ -180,4 +180,27 @@ describe("TransientTaskJsTest", function () {
}
done();
})
/*
* @tc.name: TransientTaskJsTest006
* @tc.desc: test DelaySuspendInfo actualDealyTime
* @tc.type: FUNC
* @tc.require:
*/
it("TransientTaskJsTest006", 0, async function (done) {
function callback() {}
var info = backgroundTaskManager.requestSuspendDelay("test", callback);
if (info.requestId != -1) {
console.info('TransientTaskJsTest006 DelaySuspendInfo actualDealyTime:' +
info.actualDealyTime);
expect(info).assertTrue();
} else {
expect(false).assertTrue();
done();
}
setTimeout(() => {
done();
},500);
})
})
# 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("resourceschedule_deviceusagestatisticsjsunit_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":resourceschedule_js_assets",
":resourceschedule_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsResourcescheduleDeviceUsageStatisticsJsunitTest"
}
ohos_js_assets("resourceschedule_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("resourceschedule_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for resourceschedule js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsResourcescheduleDeviceUsageStatisticsJsunitTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.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() {
},
}
/*
* 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('./DeviceUsageStatisticsJsunit.test.js')
{
"string": [
{
"name": "app_name",
"value": "ResourcescheduleJSApiTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
* limitations under the License.
*/
import workScheduler from '@ohos.workScheduler'
import workSchedulerCallback from '@ohos.workSchedulerExtensionAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
......@@ -887,4 +888,143 @@ describe("WorkSchedulerJsTest", function () {
expect(res).assertEqual(false)
done();
})
/*
* @tc.name: WorkSchedulerJsTest046
* @tc.desc: test workScheduler workInfo networkType
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest046", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest046---------------------------');
let workInfo = {
workId: 7,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
networkType: NETWORK_TYPE_ANY
}
let res = workScheduler.startWork(workInfo);
expect(res).assertEqual(true);
console.info("workSchedulerLog workInfo networkType :" + workInfo.networkType)
done();
})
/*
* @tc.name: WorkSchedulerJsTest047
* @tc.desc: test workScheduler workInfo ChargingType
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest047", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest047---------------------------');
let workInfo = {
workId: 5,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
chargerType: workScheduler.ChargingType.CHARGING_PLUGGED_AC
}
let res = workScheduler.startWork(workInfo);
expect(res).assertEqual(true);
console.info("workSchedulerLog workInfo ChargingType :" + workScheduler.ChargingType.CHARGING_PLUGGED_AC)
done();
})
/*
* @tc.name: WorkSchedulerJsTest048
* @tc.desc: test workScheduler workInfo BatteryStatus
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest048", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest048---------------------------');
let workInfo = {
workId: 5,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
batteryStatus: workScheduler.BatteryStatus.BATTERY_STATUS_LOW
}
let res = workScheduler.startWork(workInfo);
expect(res).assertEqual(true);
console.info("workSchedulerLog workInfo BatteryStatus :" + workScheduler.BatteryStatus.BATTERY_STATUS_LOW)
done();
})
/*
* @tc.name: WorkSchedulerJsTest049
* @tc.desc: test WorkSchedulerExtensoinAbility onWorkStart
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest049", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest049---------------------------');
let workInfo = {
workId: 2,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
}
let res = workScheduler.onWorkStart(workInfo);
expect(res).assertEqual(true);
done();
})
/*
* @tc.name: WorkSchedulerJsTest050
* @tc.desc: test WorkSchedulerExtensoinAbility onWorkStop
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest050", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest050---------------------------');
let workInfo = {
workId: 2,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
}
let res = workSchedulerCallback.onWorkStop(workInfo);
if(res === true) {
let stopRes = WorkSchedulerCallback.onWorkStop(workInfo,false);
expect(stopRes).assertEqual(true);
} else {
expect(false).assertEqual(true);
}
done();
})
/*
* @tc.name: WorkSchedulerJsTest051
* @tc.desc: test workScheduler bundleName
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest051", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest051---------------------------');
let workInfo = {
workId: 4,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
}
var res = workScheduler.startWork(workInfo);
expect(res).assertEqual(true);
console.log("workScheduler workInfo bundleName :" + info.bundleName)
done();
})
/*
* @tc.name: WorkSchedulerJsTest052
* @tc.desc: test workScheduler workInfo abilityName
* @tc.type: FUNC
* @tc.require:
*/
it("WorkSchedulerJsTest052", 0, async function (done) {
console.info('----------------------WorkSchedulerJsTest052---------------------------');
let workInfo = {
workId: 4,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName",
}
var res = workScheduler.startWork(workInfo);
expect(res).assertEqual(true);
console.log("workScheduler workInfo abilityName :" + info.abilityName)
done();
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册