Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4dacb3c6
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看板
未验证
提交
4dacb3c6
编写于
10月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5997 【resourceschedule】【master】workschedule:adapter api error code modify.
Merge pull request !5997 from 南先森/rms1021
上级
0e3e88de
58a52533
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
1005 addition
and
659 deletion
+1005
-659
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js
...dard/workscheduler/src/main/js/test/WorkScheduler.test.js
+343
-182
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerJs.performance.js
...scheduler/src/main/js/test/WorkSchedulerJs.performance.js
+130
-57
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
...workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
+532
-420
未找到文件。
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js
浏览文件 @
4dacb3c6
此差异已折叠。
点击以展开。
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerJs.performance.js
浏览文件 @
4dacb3c6
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
workscheduler
from
'
@ohos.workScheduler
'
import
workscheduler
from
'
@ohos.
resourceschedule.
workScheduler
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
...
...
@@ -33,6 +33,7 @@ describe("WorkSchedulerPerformanceTest", function () {
function
performanceStartWork
()
{
it
(
'
WorkSchedulerPerformance_001
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
totalTime
=
0
let
workInfo
=
{
workId
:
201
,
...
...
@@ -41,16 +42,20 @@ function performanceStartWork() {
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
let
startTime
=
new
Date
().
getTime
()
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
}
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_001: startWork WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
done
()
})
}
function
performanceStopWork
()
{
it
(
'
WorkSchedulerPerformance_002
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
totalTime
=
0
let
workingInfo
=
{
workId
:
202
,
...
...
@@ -58,7 +63,11 @@ function performanceStopWork() {
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workingInfo
)
try
{
workscheduler
.
startWork
(
workingInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
}
let
workInfo
=
{
workId
:
202
,
batteryStatus
:
workscheduler
.
BatteryStatus
.
BATTERY_STATUS_LOW
,
...
...
@@ -66,150 +75,214 @@ function performanceStopWork() {
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
let
startTime
=
new
Date
().
getTime
()
try
{
workscheduler
.
stopWork
(
workInfo
,
false
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
}
workscheduler
.
stopWork
(
workInfo
,
false
)
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_002: stopWork WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
done
()
})
}
function
performanceGetWorkStatusCallback
()
{
it
(
'
WorkSchedulerPerformance_003
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
203
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
getWorkStatus
(
203
,
(
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_003: getWorkStatus callback WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
try
{
await
workscheduler
.
getWorkStatus
(
203
,
(
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_003: getWorkStatus callback WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
}
catch
(
error
)
{
done
()
}
)
}
})
}
function
performanceGetWorkStatusPromise
()
{
it
(
'
WorkSchedulerPerformance_004
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
204
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
getWorkStatus
(
204
)
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_004: getWorkStatus promise WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
done
()
})
.
catch
((
err
)
=>
{
done
()
})
try
{
await
workscheduler
.
getWorkStatus
(
204
)
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_004: getWorkStatus promise WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
.
catch
((
err
)
=>
{
done
()
})
}
catch
(
error
)
{
done
()
}
})
}
function
performanceObtainAllWorksCallback
()
{
it
(
'
WorkSchedulerPerformance_005
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
205
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
obtainAllWorks
((
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_005: obtainAllWorks callback WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
try
{
await
workscheduler
.
obtainAllWorks
((
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_005: obtainAllWorks callback WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
}
catch
(
error
)
{
done
()
}
)
}
})
}
function
performanceObtainAllWorksPromise
()
{
it
(
'
WorkSchedulerPerformance_006
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
206
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
obtainAllWorks
()
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_006: obtainAllWorks promise WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
done
()
})
.
catch
((
err
)
=>
{
done
()
})
try
{
await
workscheduler
.
obtainAllWorks
()
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_006: obtainAllWorks promise WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
.
catch
((
err
)
=>
{
done
()
})
}
catch
(
error
)
{
done
()
}
})
}
function
performanceIsLastWorkTimeOutCallback
()
{
it
(
'
WorkSchedulerPerformance_007
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
207
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
isLastWorkTimeOut
(
207
,
(
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_007: isLastWorkTimeOut callback WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
try
{
await
workscheduler
.
isLastWorkTimeOut
(
207
,
(
err
,
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_007: isLastWorkTimeOut callback WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
}
catch
(
error
)
{
done
()
}
)
}
})
}
function
performanceIsLastWorkTimeOutPromise
()
{
it
(
'
WorkSchedulerPerformance_008
'
,
0
,
async
function
(
done
)
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
208
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
await
workscheduler
.
isLastWorkTimeOut
(
208
)
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_008: isLastWorkTimeOut promise WaitTime:
'
+
totalTime
+
'
ms
'
)
workscheduler
.
stopAndClearWorks
()
done
()
})
.
catch
((
err
)
=>
{
done
()
})
try
{
await
workscheduler
.
isLastWorkTimeOut
(
208
)
.
then
((
res
)
=>
{
let
totalTime
=
new
Date
().
getTime
()
-
startTime
console
.
info
(
'
WorkSchedulerPerformance_008: isLastWorkTimeOut promise WaitTime:
'
+
totalTime
+
'
ms
'
)
done
()
})
.
catch
((
err
)
=>
{
done
()
})
}
catch
(
error
)
{
done
()
}
})
}
function
performanceStopAndClearWorks
()
{
it
(
'
WorkSchedulerPerformance_009
'
,
0
,
function
()
{
workscheduler
.
stopAndClearWorks
()
let
workInfo
=
{
workId
:
209
,
storageRequest
:
workscheduler
.
StorageRequest
.
STORAGE_LEVEL_LOW_OR_OKAY
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
ohos.acts.resourceschedule.workscheduler.js.function.WorkSchedulerAppService
"
}
workscheduler
.
startWork
(
workInfo
)
try
{
workscheduler
.
startWork
(
workInfo
)
}
catch
(
error
)
{
expect
(
true
).
assertEqual
(
false
)
done
()
}
let
startTime
=
new
Date
().
getTime
()
workscheduler
.
stopAndClearWorks
()
let
totalTime
=
new
Date
().
getTime
()
-
startTime
...
...
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkSchedulerMgrJs.test.js
浏览文件 @
4dacb3c6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录