Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0d722800
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0d722800
编写于
7月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4615 【resourceschedule】【master分支】短时、延迟接口覆盖,新增用例
Merge pull request !4615 from qigongming/master_0726
上级
42dd3436
4b791cbc
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
2274 addition
and
0 deletion
+2274
-0
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js
...ndard/backgroundtaskmanager/src/main/js/test/List.test.js
+2
-0
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js
...groundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js
+327
-0
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js
...dule_standard/workscheduler/src/main/js/test/List.test.js
+2
-0
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
...workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
+1943
-0
未找到文件。
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/List.test.js
浏览文件 @
0d722800
...
...
@@ -14,7 +14,9 @@
*/
import
TransientTaskJsTest
from
'
./BackgroundTaskMagrJs.test.js
'
import
ContinuousTaskJsTest
from
'
./ContinuousTaskJsunit.test.js
'
import
ShortTaskMgrApiTest
from
'
./ShortTaskMgrJs.test.js
'
export
default
function
testsuite
()
{
TransientTaskJsTest
()
ContinuousTaskJsTest
()
ShortTaskMgrApiTest
()
}
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/test/ShortTaskMgrJs.test.js
0 → 100644
浏览文件 @
0d722800
/*
* 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
backgroundTaskManager
from
'
@ohos.backgroundTaskManager
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
ShortTaskMgrApiTest
()
{
describe
(
"
ShortTaskMgrApiTest
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_007
* @tc.name testRequestSuspendDelayFun001
* @tc.desc test request a suspend daly reason is NumberType.
*/
it
(
"
testRequestSuspendDelayFun001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testRequestSuspendDelayFun001---------------------------
'
);
function
callback
()
{}
let
reason
=
123
;
try
{
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
reason
,
callback
);
if
(
info
.
requestId
===
-
1
)
{
console
.
info
(
'
testRequestSuspendDelayFun001 backgroundTaskManager fail, because of reason is :
'
+
reason
);
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
}
else
{
console
.
info
(
'
testRequestSuspendDelayFun001 backgroundTaskManager success,requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
}
catch
(
error
){
console
.
info
(
'
testRequestSuspendDelayFun001 backgroundTaskManager fail, because of :
'
+
error
);
}
done
();
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_008
* @tc.name testRequestSuspendDelayFun002
* @tc.desc test request a suspend daly reason is BooleanType.
*/
it
(
"
testRequestSuspendDelayFun002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testRequestSuspendDelayFun002---------------------------
'
);
function
callback
()
{}
let
reason
=
true
;
try
{
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
reason
,
callback
);
if
(
info
.
requestId
===
-
1
)
{
console
.
info
(
'
testRequestSuspendDelayFun002 backgroundTaskManager fail, because of reason is :
'
+
reason
);
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
}
else
{
console
.
info
(
'
testRequestSuspendDelayFun002 backgroundTaskManager success,requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
}
catch
(
error
){
console
.
info
(
'
testRequestSuspendDelayFun002 backgroundTaskManager fail, because of :
'
+
error
);
}
done
();
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_009
* @tc.name testRequestSuspendDelayFun003
* @tc.desc test request a suspend daly reason is NullType.
*/
it
(
"
testRequestSuspendDelayFun003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testRequestSuspendDelayFun003---------------------------
'
);
function
callback
()
{}
let
reason
=
null
;
try
{
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
reason
,
callback
);
if
(
info
.
requestId
===
-
1
)
{
console
.
info
(
'
testRequestSuspendDelayFun003 backgroundTaskManager fail, because of reason is :
'
+
reason
);
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
}
else
{
console
.
info
(
'
testRequestSuspendDelayFun003 backgroundTaskManager success,requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
}
catch
(
error
){
console
.
info
(
'
testRequestSuspendDelayFun003 backgroundTaskManager fail, because of :
'
+
error
);
}
done
();
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_010
* @tc.name testRequestSuspendDelayFun004
* @tc.desc test request a suspend daly reason is EmptyString.
*/
it
(
"
testRequestSuspendDelayFun004
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testRequestSuspendDelayFun004---------------------------
'
);
function
callback
()
{}
let
reason
=
""
;
try
{
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
reason
,
callback
);
if
(
info
.
requestId
===
-
1
)
{
console
.
info
(
'
testRequestSuspendDelayFun004 backgroundTaskManager fail, because of reason is :
'
+
reason
);
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
}
else
{
console
.
info
(
'
testRequestSuspendDelayFun004 backgroundTaskManager success,requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
}
catch
(
error
){
console
.
info
(
'
testRequestSuspendDelayFun004 backgroundTaskManager fail, because of :
'
+
error
);
}
done
();
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_011
* @tc.name testRequestSuspendDelayFun005
* @tc.desc test request a suspend daly reason Undefined.
*/
it
(
"
testRequestSuspendDelayFun005
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testRequestSuspendDelayFun005---------------------------
'
);
function
callback
()
{}
let
reason
;
try
{
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
reason
,
callback
);
if
(
info
.
requestId
===
-
1
)
{
console
.
info
(
'
testRequestSuspendDelayFun005 backgroundTaskManager fail, because of reason is :
'
+
reason
);
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
}
else
{
console
.
info
(
'
testRequestSuspendDelayFun005 backgroundTaskManager success,requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
}
catch
(
error
){
console
.
info
(
'
testRequestSuspendDelayFun005 backgroundTaskManager fail, because of :
'
+
error
);
}
done
();
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_012
* @tc.name testGetRemainingDelayTimeFun001
* @tc.desc test getRemainingDelayTime Callback ,requestId non-existent.
*/
it
(
"
testGetRemainingDelayTimeFun001
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testGetRemainingDelayTimeFun001---------------------------
'
);
function
callback
()
{}
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
"
test
"
,
callback
);
if
(
info
.
requestId
!=
-
1
)
{
console
.
info
(
'
testGetRemainingDelayTimeFun001 backgroundTaskManager success, requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
else
{
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
done
();
}
backgroundTaskManager
.
getRemainingDelayTime
(
info
.
requestId
+
1
,
(
err
,
res
)
=>
{
if
(
err
)
{
console
.
info
(
'
testGetRemainingDelayTimeFun001 backgroundTaskManager error,cause:
'
+
err
.
code
);
expect
(
err
.
code
).
assertLarger
(
0
);
}
else
{
console
.
info
(
'
testGetRemainingDelayTimeFun001 backgroundTaskManager success, delaytime:
'
+
res
);
expect
(
res
).
assertLarger
(
0
);
}
backgroundTaskManager
.
cancelSuspendDelay
(
info
.
requestId
)
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_013
* @tc.name testGetRemainingDelayTimeFun002
* @tc.desc test getRemainingDelayTime Promise ,requestId non-existent.
*/
it
(
"
testGetRemainingDelayTimeFun002
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testGetRemainingDelayTimeFun002---------------------------
'
);
function
callback
()
{}
let
info
=
backgroundTaskManager
.
requestSuspendDelay
(
"
test
"
,
callback
);
if
(
info
.
requestId
!=
-
1
)
{
console
.
info
(
'
testGetRemainingDelayTimeFun002 backgroundTaskManager success, requestId:
'
+
info
.
requestId
);
expect
(
info
.
requestId
).
assertLarger
(
0
);
}
else
{
expect
(
info
.
requestId
).
assertEqual
(
-
1
);
done
();
}
backgroundTaskManager
.
getRemainingDelayTime
(
info
.
requestId
+
1
)
.
then
(
res
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun002 backgroundTaskManager success, delaytime:
'
+
res
);
expect
(
res
).
assertLarger
(
0
);
})
.
catch
(
err
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun002 backgroundTaskManager error,cause:
'
+
err
.
code
);
expect
(
err
.
code
).
assertLarger
(
0
);
});
backgroundTaskManager
.
cancelSuspendDelay
(
info
.
requestId
);
setTimeout
(()
=>
{
done
();
},
500
);
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_014
* @tc.name testGetRemainingDelayTimeFun003
* @tc.desc test getRemainingDelayTime Promise ,requestId is null.
*/
it
(
"
testGetRemainingDelayTimeFun003
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testGetRemainingDelayTimeFun003---------------------------
'
);
let
requestId
=
null
;
try
{
backgroundTaskManager
.
getRemainingDelayTime
(
requestId
)
.
then
(
res
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun003 backgroundTaskManager success, delaytime:
'
+
res
);
expect
(
res
).
assertLarger
(
0
);
})
.
catch
(
err
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun003 backgroundTaskManager error,cause:
'
+
err
.
code
);
expect
(
err
.
code
).
assertLarger
(
0
);
});
}
catch
(
error
){
console
.
info
(
'
testGetRemainingDelayTimeFun003 backgroundTaskManager error,
'
+
error
);
}
setTimeout
(()
=>
{
done
();
},
500
);
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_015
* @tc.name testGetRemainingDelayTimeFun004
* @tc.desc test getRemainingDelayTime Callback ,requestId = -1.
*/
it
(
"
testGetRemainingDelayTimeFun004
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testGetRemainingDelayTimeFun004---------------------------
'
);
let
requestId
=
-
1
;
backgroundTaskManager
.
getRemainingDelayTime
(
requestId
,
(
err
,
res
)
=>
{
if
(
err
)
{
console
.
info
(
'
testGetRemainingDelayTimeFun001 backgroundTaskManager error,cause:
'
+
err
.
code
);
expect
(
err
.
code
).
assertLarger
(
0
);
}
else
{
console
.
info
(
'
testGetRemainingDelayTimeFun001 backgroundTaskManager success, delaytime:
'
+
res
);
expect
(
res
).
assertLarger
(
0
);
}
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/*
* @tc.number SUB_RESOURCESCHEDULE_SHORT_TASK_MAG_API_016
* @tc.name testGetRemainingDelayTimeFun005
* @tc.desc test getRemainingDelayTime Promise ,requestId = 0.
*/
it
(
"
testGetRemainingDelayTimeFun005
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------testGetRemainingDelayTimeFun005---------------------------
'
);
let
requestId
=
0
;
try
{
backgroundTaskManager
.
getRemainingDelayTime
(
requestId
)
.
then
(
res
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun005 backgroundTaskManager success, delaytime:
'
+
res
);
expect
(
res
).
assertLarger
(
0
);
})
.
catch
(
err
=>
{
console
.
info
(
'
testGetRemainingDelayTimeFun005 backgroundTaskManager error,cause:
'
+
err
.
code
);
expect
(
err
.
code
).
assertLarger
(
0
);
});
}
catch
(
error
){
console
.
info
(
'
testGetRemainingDelayTimeFun005 backgroundTaskManager error,
'
+
error
);
}
setTimeout
(()
=>
{
done
();
},
500
);
})
})
}
\ No newline at end of file
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/List.test.js
浏览文件 @
0d722800
...
...
@@ -14,7 +14,9 @@
*/
import
WorkSchedulerJsTest
from
'
./WorkScheduler.test.js
'
import
WorkSchedulerPerformanceTest
from
'
./WorkSchedulerJs.performance.js
'
import
WorkSchedulerMgrApiTest
from
'
./WorkSchedulerMgrJs.test.js
'
export
default
function
testsuite
()
{
WorkSchedulerJsTest
()
WorkSchedulerPerformanceTest
()
WorkSchedulerMgrApiTest
()
}
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
0 → 100644
浏览文件 @
0d722800
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录