Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
da87972b
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看板
未验证
提交
da87972b
编写于
6月 20, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3592 完善Worker模块的测试用例
Merge pull request !3592 from hyq5234/master
上级
a01fb748
99bed363
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
7 deletion
+44
-7
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0121.js
...r_lib_standard/src/main/js/default/workers/worker_0121.js
+4
-1
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0122.js
...r_lib_standard/src/main/js/default/workers/worker_0122.js
+1
-1
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_015.js
...er_lib_standard/src/main/js/default/workers/worker_015.js
+4
-1
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0151.js
...r_lib_standard/src/main/js/default/workers/worker_0151.js
+4
-1
compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js
...ntime/worker_lib_standard/src/main/js/test/Worker.test.js
+31
-3
未找到文件。
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0121.js
浏览文件 @
da87972b
...
...
@@ -25,7 +25,10 @@ parentPort.onmessage = function(e) {
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
Worker
(
"
workers/worker_0122.js
"
);
parentPort
.
postMessage
(
ss
!=
null
)
ss
.
terminate
();
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
ss
!=
null
);
}
break
;
default
:
break
;
...
...
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0122.js
浏览文件 @
da87972b
...
...
@@ -21,5 +21,5 @@ var backValue = undefined;
var
flag
=
false
;
parentPort
.
onmessage
=
function
(
e
)
{
console
.
log
(
"
worker:: thrid worker onmessage
"
)
console
.
info
(
"
worker:: thrid worker onmessage
"
)
}
\ No newline at end of file
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_015.js
浏览文件 @
da87972b
...
...
@@ -25,6 +25,9 @@ parentPort.onmessage = function(e) {
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
Worker
(
"
workers/worker_0151.js
"
);
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
backValue
);
// 16
}
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
// 16
flag
=
true
;
...
...
@@ -34,7 +37,7 @@ parentPort.onmessage = function(e) {
case
"
wait
"
:
ss
.
postMessage
({
type
:
"
wait
"
});
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
// 16
ss
.
terminate
();
}
break
;
default
:
...
...
compileruntime/worker_lib_standard/src/main/js/default/workers/worker_0151.js
浏览文件 @
da87972b
...
...
@@ -25,6 +25,9 @@ parentPort.onmessage = function(e) {
switch
(
data
.
type
)
{
case
"
new
"
:
ss
=
new
worker
.
Worker
(
"
workers/worker_0152.js
"
);
ss
.
onexit
=
function
()
{
parentPort
.
postMessage
(
backValue
);
// 16
}
ss
.
onmessage
=
function
(
ee
)
{
backValue
=
ee
.
data
;
flag
=
true
;
...
...
@@ -33,7 +36,7 @@ parentPort.onmessage = function(e) {
break
;
case
"
wait
"
:
if
(
flag
)
{
parentPort
.
postMessage
(
backValue
);
// 16
ss
.
terminate
();
}
break
;
default
:
...
...
compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js
浏览文件 @
da87972b
...
...
@@ -1015,6 +1015,10 @@ describe('workerTest', function () {
let
res
=
0
let
flag
=
false
ss
.
onexit
=
function
()
{
flag
=
true
}
ss
.
onmessageerror
=
function
(
e
)
{
flag
=
true
res
++
...
...
@@ -1025,6 +1029,12 @@ describe('workerTest', function () {
while
(
!
flag
)
{
await
promiseCase
()
}
flag
=
false
ss
.
postMessage
(
"
terminate
"
)
while
(
!
flag
)
{
await
promiseCase
()
}
expect
(
res
).
assertEqual
(
1
)
done
()
})
...
...
@@ -1264,12 +1274,15 @@ describe('workerTest', function () {
let
ss
=
new
worker
.
Worker
(
"
workers/worker_015.js
"
)
let
flag
=
false
let
res
=
undefined
let
isTerminate
=
false
ss
.
onmessage
=
function
(
e
)
{
ss
.
onexit
=
function
()
{
isTerminate
=
true
}
ss
.
onmessage
=
function
(
e
)
{
flag
=
true
res
=
e
.
data
}
ss
.
onerror
=
function
(
ee
)
{
console
.
log
(
"
worker::
"
+
ee
.
message
)
}
...
...
@@ -1279,6 +1292,11 @@ describe('workerTest', function () {
ss
.
postMessage
({
type
:
"
wait
"
})
await
promiseCase
()
}
ss
.
terminate
()
while
(
!
isTerminate
)
{
await
promiseCase
()
}
expect
(
res
).
assertEqual
(
16
)
done
()
...
...
@@ -1294,8 +1312,13 @@ describe('workerTest', function () {
let
ss
=
new
worker
.
Worker
(
"
workers/worker_011.js
"
)
let
flag
=
false
let
res
=
undefined
let
isTerminate
=
false
ss
.
onmessage
=
function
(
e
)
{
ss
.
onexit
=
function
()
{
isTerminate
=
true
}
ss
.
onmessage
=
function
(
e
)
{
flag
=
true
res
=
e
.
data
}
...
...
@@ -1317,6 +1340,11 @@ describe('workerTest', function () {
await
promiseCase
()
}
ss
.
terminate
()
while
(
!
isTerminate
)
{
await
promiseCase
()
}
expect
(
res
).
assertEqual
(
"
terminate
"
)
done
()
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录