未验证 提交 1ae3d501 编写于 作者: O openharmony_ci 提交者: Gitee

!1850 Solve the problem that the compileruntime test suite does not compile

Merge pull request !1850 from 小马奔腾/OpenHarmony-3.0-LTS
......@@ -2,7 +2,7 @@
"description": "Configuration for startup process js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"test-timeout": "300000",
"package": "com.example.childprocess",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for startup url js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"test-timeout": "300000",
"package": "com.example.url",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for startup util js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"test-timeout": "300000",
"package": "com.example.childprocess",
"shell-timeout": "60000"
},
......
......@@ -17,7 +17,6 @@
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import worker from '@ohos.worker'
var worker = globalThis.requireNapi('worker');
describe('workerTest', function () {
......@@ -388,33 +387,33 @@ describe('workerTest', function () {
it('worker_off_test_001', 0, function () {
var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0;
var zhangsanTimes = 0;
ss.on("zhangsan", ()=>{
zhangsan_times++;
zhangsanTimes++;
})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1)
expect(zhangsanTimes).assertEqual(1)
ss.off("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1)
expect(zhangsanTimes).assertEqual(1)
})
// check worker off function is ok
it('worker_off_test_002', 0, function () {
var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0;
var zhangsanTimes = 0;
ss.on("zhangsan", ()=>{
zhangsan_times++;
zhangsanTimes++;
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
for (var i=0;i<3;i++)
{
......@@ -422,40 +421,40 @@ describe('workerTest', function () {
}
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
})
// check worker removeEventListener function is ok
it('worker_removeListener_test_001', 0, function () {
var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0;
var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{
zhangsan_times++;
zhangsanTimes++;
})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1)
expect(zhangsanTimes).assertEqual(1)
ss.removeEventListener("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1)
expect(zhangsanTimes).assertEqual(1)
})
// check worker removeEventListener function is ok
it('worker_removeListener_test_002', 0, function () {
var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0;
var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{
zhangsan_times++;
zhangsanTimes++;
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
for (var i=0;i<3;i++)
{
......@@ -463,39 +462,39 @@ describe('workerTest', function () {
}
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
})
// check worker removeAllListener function is ok
it('worker_removeListener_test_003', 0, function () {
var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0;
var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{
zhangsan_times++;
zhangsanTimes++;
})
var lisi_times = 0;
var lisiTimes = 0;
ss.addEventListener("lisi", ()=>{
lisi_times++;
lisiTimes++;
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
expect(lisi_times).assertEqual(2)
expect(lisiTimes).assertEqual(2)
ss.removeAllListener()
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2)
expect(zhangsanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
expect(lisi_times).assertEqual(2)
expect(lisiTimes).assertEqual(2)
})
// check parentPort.close is ok
......
......@@ -25,6 +25,7 @@ _all_test_packages = [
"${ACTS_ROOT}/account:account",
"${ACTS_ROOT}/communication:communication",
"${ACTS_ROOT}/compileruntime:compileruntime",
"${ACTS_ROOT}/notification:notification",
"${ACTS_ROOT}/aafwk:aafwk",
"${ACTS_ROOT}/location:location",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册