未验证 提交 6e1faa9d 编写于 作者: O openharmony_ci 提交者: Gitee

!3691 更新master分支上Worker模块的XTS用例

Merge pull request !3691 from hyq5234/OpenHarmony-3.1-Release
......@@ -17,6 +17,7 @@ import worker from "@ohos.worker"
const parentPort = worker.parentPort;
var ss = undefined;
var flag = false;
parentPort.onmessage = function(e) {
let data = e.data;
......@@ -24,8 +25,20 @@ parentPort.onmessage = function(e) {
case "new":
ss = new worker.Worker("workers/worker_0091.js");
console.log("worker:: workerxx ");
ss.onexit = function() {
flag = true;
}
parentPort.postMessage(ss != null);
break;
case "wait":
if (flag) {
parentPort.postMessage("terminate");
}
break;
case "terminate":
flag = false;
ss.terminate();
break;
default:
break;
}
......
......@@ -29,6 +29,10 @@ parentPort.onmessage = function(e) {
backValue = ee.data;
flag = true;
}
ss.onexit = function() {
backValue = "terminate";
flag = true;
}
ss.postMessage(data.value);
break;
case "wait":
......@@ -36,6 +40,10 @@ parentPort.onmessage = function(e) {
parentPort.postMessage(backValue);
}
break;
case "terminate":
flag = false;
ss.terminate();
break;
default:
break;
}
......
......@@ -29,6 +29,10 @@ parentPort.onmessage = function(e) {
backValue = ee.data;
flag = true;
}
ss.onexit = function() {
backValue = "terminate";
flag = true;
}
ss.postMessage({type: "new"});
break;
case "wait":
......@@ -36,6 +40,10 @@ parentPort.onmessage = function(e) {
parentPort.postMessage(backValue);
}
break;
case "terminate":
flag = false;
ss.terminate();
break;
default:
break;
}
......
......@@ -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;
......
......@@ -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
......@@ -29,6 +29,10 @@ parentPort.onmessage = function(e) {
backValue = ee.data;
flag = true;
}
ss.onexit = function() {
backValue = "terminate";
flag = true;
}
ss.postMessage(data.value);
break;
case "wait":
......@@ -36,6 +40,10 @@ parentPort.onmessage = function(e) {
parentPort.postMessage(backValue);
}
break;
case "terminate":
flag = false;
ss.terminate();
break;
default:
break;
}
......
......@@ -29,6 +29,10 @@ parentPort.onmessage = function(e) {
backValue = ee.data;
flag = true;
}
ss.onexit = function() {
backValue = "terminate";
flag = true;
}
ss.postMessage(data.value);
break;
case "wait":
......@@ -36,6 +40,10 @@ parentPort.onmessage = function(e) {
parentPort.postMessage(backValue);
}
break;
case "terminate":
flag = false;
ss.terminate();
break;
default:
break;
}
......
......@@ -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:
......
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册