提交 51df5338 编写于 作者: Q qigongming

延迟任务调度回调接口API用例覆盖

Signed-off-by: Nqigongming <qigongming@huawei.com>
Change-Id: I6f48435a1c3b238787129f339df6ead0db56f1a0
上级 21ba14a1
......@@ -13,13 +13,44 @@
* limitations under the License.
*/
import workScheduler from '@ohos.workScheduler'
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function WorkSchedulerJsTest() {
describe("WorkSchedulerJsTest", function () {
let workInfo = {
workId: 0,
bundleName: "ohos.acts.resourceschedule.workscheduler.js.function",
abilityName: "com.mytest.abilityName"
}
function workStart(workInfo, callback) {
let result = null
try{
WorkSchedulerExtensionAbility.onWorkStart(workInfo)
result = true
} catch(err) {
result = err
}
callback(result)
}
function workStop(workInfo, callback) {
let result = null
try{
WorkSchedulerExtensionAbility.onWorkStop(workInfo)
result = true
} catch(err) {
result = err
}
callback(result)
}
beforeAll(function() {
workStart(workInfo,function(data) {
console.info("onWorkStart finish,result: " + data)
})
/*
* @tc.setup: setup invoked before all testcases
*/
......@@ -28,6 +59,9 @@ describe("WorkSchedulerJsTest", function () {
afterAll(function() {
workStop(workInfo, function(data) {
console.info("onWorkStop finish,result: " + data)
})
/*
* @tc.teardown: teardown invoked after all testcases
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册