未验证 提交 2dc5fa91 编写于 作者: O openharmony_ci 提交者: Gitee

!5583 【resourceschedule】【master分支】延迟任务调度回调接口API用例覆盖

Merge pull request !5583 from qigongming/master_0921
...@@ -13,13 +13,44 @@ ...@@ -13,13 +13,44 @@
* limitations under the License. * limitations under the License.
*/ */
import workScheduler from '@ohos.workScheduler' import workScheduler from '@ohos.workScheduler'
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function WorkSchedulerJsTest() { export default function WorkSchedulerJsTest() {
describe("WorkSchedulerJsTest", function () { 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() { beforeAll(function() {
workStart(workInfo,function(data) {
console.info("onWorkStart finish,result: " + data)
})
/* /*
* @tc.setup: setup invoked before all testcases * @tc.setup: setup invoked before all testcases
*/ */
...@@ -28,6 +59,9 @@ describe("WorkSchedulerJsTest", function () { ...@@ -28,6 +59,9 @@ describe("WorkSchedulerJsTest", function () {
afterAll(function() { afterAll(function() {
workStop(workInfo, function(data) {
console.info("onWorkStop finish,result: " + data)
})
/* /*
* @tc.teardown: teardown invoked after all testcases * @tc.teardown: teardown invoked after all testcases
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册