Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
48668477
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看板
未验证
提交
48668477
编写于
6月 07, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8863 woker&&threadworker参数传递增加测试用例
Merge pull request !8863 from coollixin/master
上级
3f295ea8
d704c662
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
232 addition
and
0 deletion
+232
-0
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/test/ThreadWorker.test.js
...lib_standard/entry/src/main/ets/test/ThreadWorker.test.js
+71
-0
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/workers/newworker_026.js
..._lib_standard/entry/src/main/ets/workers/newworker_026.js
+23
-0
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/workers/newworker_027.js
..._lib_standard/entry/src/main/ets/workers/newworker_027.js
+22
-0
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/test/WorkerTest.test.js
...r_lib_standard/entry/src/main/ets/test/WorkerTest.test.js
+71
-0
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/workers/worker_022.js
...ker_lib_standard/entry/src/main/ets/workers/worker_022.js
+23
-0
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/workers/worker_023.js
...ker_lib_standard/entry/src/main/ets/workers/worker_023.js
+22
-0
未找到文件。
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/test/ThreadWorker.test.js
浏览文件 @
48668477
...
@@ -2342,6 +2342,77 @@ describe('threadWorkerTest', function () {
...
@@ -2342,6 +2342,77 @@ describe('threadWorkerTest', function () {
done
();
done
();
})
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_008
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it
(
'
threadWorker_support_types_test_008
'
,
0
,
async
function
(
done
)
{
let
ss
=
new
worker
.
ThreadWorker
(
"
entry/ets/workers/newworker_026.js
"
);
let
flag
=
false
;
let
result
;
let
isTerminate
=
false
;
class
MyModel
{
name
=
"
module
"
;
Init
()
{
this
.
name
=
"
Init
"
;
}
}
let
model
=
new
MyModel
()
ss
.
onmessage
=
function
(
d
)
{
result
=
d
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
isTerminate
=
true
;
}
ss
.
postMessage
(
model
);
while
(
!
flag
)
{
await
promiseCase
();
}
ss
.
terminate
();
while
(
!
isTerminate
)
{
await
promiseCase
();
}
expect
(
result
).
assertEqual
(
"
module
"
);
done
();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: threadWorker_support_types_test_009
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it
(
'
threadWorker_support_types_test_009
'
,
0
,
async
function
(
done
)
{
let
ss
=
new
worker
.
ThreadWorker
(
"
entry/ets/workers/newworker_027.js
"
);
let
result
=
""
;
let
isTerminate
=
false
;
class
MyModel
{
name
=
"
module
"
;
Init
()
{
this
.
name
=
"
Init
"
;
}
}
let
model
=
new
MyModel
()
ss
.
onerror
=
function
(
e
){
result
=
"
unInit
"
;
}
ss
.
onexit
=
function
()
{
isTerminate
=
true
;
}
ss
.
postMessage
(
model
);
while
(
!
isTerminate
)
{
await
promiseCase
();
}
expect
(
result
).
assertEqual
(
"
unInit
"
);
done
();
})
// Check the postmessage of worker is ok.
// Check the postmessage of worker is ok.
/**
/**
* @tc.name: threadWorker_worker_postmessage_test_001
* @tc.name: threadWorker_worker_postmessage_test_001
...
...
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/workers/newworker_026.js
0 → 100644
浏览文件 @
48668477
/*
* Copyright (C) 2023 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
worker
from
'
@ohos.worker
'
;
const
workerPort
=
worker
.
workerPort
;
workerPort
.
onmessage
=
function
(
e
)
{
let
model
=
e
.
data
;
let
str
=
model
.
name
;
workerPort
.
postMessage
(
str
);
}
\ No newline at end of file
commonlibrary/ets_utils/threadWorker_lib_standard/entry/src/main/ets/workers/newworker_027.js
0 → 100644
浏览文件 @
48668477
/*
* Copyright (C) 2023 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
worker
from
'
@ohos.worker
'
;
const
workerPort
=
worker
.
workerPort
;
workerPort
.
onmessage
=
function
(
e
)
{
let
model
=
e
.
data
;
let
str
=
model
.
Init
();
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/test/WorkerTest.test.js
浏览文件 @
48668477
...
@@ -1640,5 +1640,76 @@ describe('WorkerTest', function () {
...
@@ -1640,5 +1640,76 @@ describe('WorkerTest', function () {
expect
(
flag
).
assertTrue
();
expect
(
flag
).
assertTrue
();
done
();
done
();
})
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_008
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it
(
'
worker_support_types_test_008
'
,
0
,
async
function
(
done
)
{
let
ss
=
new
worker
.
Worker
(
"
entry/ets/workers/worker_022.js
"
);
let
flag
=
false
;
let
result
;
let
isTerminate
=
false
;
class
MyModel
{
name
=
"
module
"
;
Init
()
{
this
.
name
=
"
Init
"
;
}
}
let
model
=
new
MyModel
()
ss
.
onmessage
=
function
(
d
)
{
result
=
d
.
data
;
flag
=
true
;
}
ss
.
onexit
=
function
()
{
isTerminate
=
true
;
}
ss
.
postMessage
(
model
);
while
(
!
flag
)
{
await
promiseCase
();
}
ss
.
terminate
();
while
(
!
isTerminate
)
{
await
promiseCase
();
}
expect
(
result
).
assertEqual
(
"
module
"
);
done
();
})
// Check the transmission types supported by Worker is ok.
/**
* @tc.name: worker_support_types_test_009
* @tc.desc: Check the transmission types supported by Worker is ok.
*/
it
(
'
worker_support_types_test_009
'
,
0
,
async
function
(
done
)
{
let
ss
=
new
worker
.
Worker
(
"
entry/ets/workers/worker_023.js
"
);
let
result
=
""
;
let
isTerminate
=
false
;
class
MyModel
{
name
=
"
module
"
;
Init
()
{
this
.
name
=
"
Init
"
;
}
}
let
model
=
new
MyModel
()
ss
.
onerror
=
function
(
e
){
result
=
"
unInit
"
;
}
ss
.
onexit
=
function
()
{
isTerminate
=
true
;
}
ss
.
postMessage
(
model
);
while
(
!
isTerminate
)
{
await
promiseCase
();
}
expect
(
result
).
assertEqual
(
"
unInit
"
);
done
();
})
})
})
}
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/workers/worker_022.js
0 → 100644
浏览文件 @
48668477
/*
* Copyright (C) 2023 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
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
parentPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
model
=
e
.
data
;
let
str
=
model
.
name
;
parentPort
.
postMessage
(
str
);
}
\ No newline at end of file
commonlibrary/ets_utils/worker_lib_standard/entry/src/main/ets/workers/worker_023.js
0 → 100644
浏览文件 @
48668477
/*
* Copyright (C) 2023 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
worker
from
'
@ohos.worker
'
;
const
parentPort
=
worker
.
parentPort
;
parentPort
.
onmessage
=
function
(
e
)
{
let
model
=
e
.
data
;
let
str
=
model
.
Init
();
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录