提交 5a0a20c2 编写于 作者: Y yqhan

Modify the worker test case module

issue: https://gitee.com/openharmony/xts_acts/issues/I68FR8Signed-off-by: Nyqhan <hanyuqing2@huawei.com>
上级 9851c0c6
{
"app": {
"bundleName": "com.example.workertest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"debug": false,
"description": "$string:app_name",
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
{
"string":[
{
"name":"app_name",
"value":"WorkerTest"
}
]
}
\ No newline at end of file
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Copyright (c) 2022 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
......@@ -14,23 +14,30 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("worker_js_hap") {
hap_profile = "./src/main/config.json"
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":worker_js_assets",
":worker_resources",
":workertest_js_assets",
":workertest_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsWorkerJSTest"
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsWorkerJsTest"
subsystem_name = "commonlibrary"
part_name = "ets_utils"
}
ohos_js_assets("worker_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
ohos_app_scope("workertest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_resources("worker_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
ohos_js_assets("workertest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("workertest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":workertest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for startup worker js api Tests",
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "800000",
"bundle-name": "com.example.workerxts",
"package-name": "com.example.workerxts",
"bundle-name": "com.example.workertest",
"module-name": "entry",
"shell-timeout": "800000"
},
"kits": [
{
"test-file-name": [
"ActsWorkerJSTest.hap"
"ActsWorkerJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -12,12 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate')
import AbilityStage from "@ohos.app.ability.AbilityStage"
},
onDestroy() {
console.info("TestApplication onDestroy");
var printLog0 = 'Worker:AbilityStage:'
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.info(printLog0 + "onCreate")
}
};
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
......@@ -12,39 +12,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility';
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
var printLog = 'Worker:MainAbility:'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.info(printLog + 'onCreate')
}
onDestroy() {
console.info(printLog + 'onDestroy')
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.info(printLog + 'onWindowStageCreate')
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
windowStage.loadContent("MainAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
}
onWindowStageDestroy() {
console.info(printLog + 'onWindowStageDestroy')
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
onForeground() {
console.info(printLog + 'onForeground')
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
onBackground() {
console.info(printLog + 'onBackground')
}
}
\ No newline at end of file
};
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
......@@ -12,37 +12,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import router from '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
import testsuite from '../../test/List.test'
@Entry
@Component
struct Index {
@State message: string = 'MainAbility Worker'
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
aboutToAppear() {
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
touchMove(e) {
if (e.direction === 'right') {
this.appExit();
}
},
appExit() {
app.terminate()
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
......@@ -12,12 +12,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.app.ability.UIAbility'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
}
export default {
onCreate() {
console.info("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.loadContent("TestAbility/pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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 router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
......@@ -12,48 +12,67 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.workertest.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
......@@ -13,14 +13,10 @@
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
import WorkerTest from './WorkerTest.test.js'
import threadWorkerTest from './ThreadWorker.test.js'
export default function List() {
WorkerTest()
threadWorkerTest()
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ describe('threadWorkerTest', function () {
function promiseCase() {
let p = new Promise(function (resolve, reject) {
setTimeout(function () {
resolve()
resolve(0)
}, 100)
}).then(undefined, (error) => {
})
......@@ -39,7 +39,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
ss.onexit = function () {
......@@ -60,7 +60,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js", {name:"new worker", shared:"False"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js", {name:"1st worker", shared: false})
let isTerminate = false
ss.onexit = function () {
......@@ -81,7 +81,8 @@ describe('threadWorkerTest', function () {
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js", {type:"classic", name:"new worker", shared:"false"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js",
{type:"classic", name:"2st worker", shared: false})
let isTerminate = false
ss.onexit = function () {
......@@ -102,7 +103,8 @@ describe('threadWorkerTest', function () {
* @tc.desc: worker constructor to Creates a worker instance.
*/
it('threadWorker_constructor_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js", {type:"classic", name:"new worker", shared:"true"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js",
{type:"classic", name:"3st worker", shared: true})
let isTerminate = false
ss.onexit = function () {
......@@ -127,7 +129,7 @@ describe('threadWorkerTest', function () {
try {
let a = 0
while (a <= 8) {
ss[a] = new worker.ThreadWorker("workers/newworker.js")
ss[a] = new worker.ThreadWorker("entry/ets/workers/newworker.js")
a += 1
}
} catch (error) {
......@@ -156,7 +158,7 @@ describe('threadWorkerTest', function () {
*/
it('threadWorker_constructor_test_006', 0, async function (done) {
try {
let ss = new worker.ThreadWorker("workers/newworker.js", {type:"other", name:"new worker", shared:"true"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js", {type:"other", name:"worker"})
} catch (error) {
expect(error.name == "BusinessError").assertTrue()
expect(error.message == "the type must be classic, unsupport others now.").assertTrue()
......@@ -170,7 +172,8 @@ describe('threadWorkerTest', function () {
*/
it('threadWorker_constructor_test_007', 0, async function (done) {
try {
let ss = new worker.ThreadWorker("workers/newworker.js", {type:1, name:"new worker", shared:"true"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js",
{type:1, name:"new worker", shared: true})
} catch (error) {
expect(error.name == "BusinessError").assertTrue()
expect(error.message == "the type of type must be string.").assertTrue()
......@@ -184,7 +187,7 @@ describe('threadWorkerTest', function () {
*/
it('threadWorker_constructor_test_008', 0, async function (done) {
try {
let ss = new worker.ThreadWorker("workers/newworker.js", {type:"classic1", name:1, shared:"true"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js", {type:"classic", name:1, shared: true})
} catch (error) {
expect(error.name == "BusinessError").assertTrue()
expect(error.message == "the type of name in worker must be string.").assertTrue()
......@@ -213,7 +216,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_002.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_002.js")
let res = undefined
let flag = false
......@@ -248,7 +251,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_003.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_003.js")
let res = undefined
let flag = false
......@@ -283,7 +286,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_004.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_004.js")
let res = undefined
let flag = false
......@@ -317,7 +320,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_005.js", {name: "zhangsan"})
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_005.js", {name: "zhangsan"})
let res = undefined
let flag = false
......@@ -353,7 +356,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_006.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_006.js")
let isTerminate = false
ss.onexit = function () {
......@@ -393,7 +396,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Sends a message to the worker thread.
*/
it('threadWorker_postMessage_test_006', 0, async function (done) {
const ss = new worker.ThreadWorker("workers/newworker_007.js")
const ss = new worker.ThreadWorker("entry/ets/workers/newworker_007.js")
let res = undefined
let flag = false
......@@ -427,7 +430,7 @@ describe('threadWorkerTest', function () {
*/
it('threadWorker_postMessage_test_007', 0, async function (done) {
try {
const ss = new worker.ThreadWorker("workers/newworker_007.js")
const ss = new worker.ThreadWorker("entry/ets/workers/newworker_007.js")
ss.postMessage()
} catch (error) {
expect(error.name).assertEqual("BusinessError")
......@@ -442,7 +445,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Terminates the worker thread to stop the worker from receiving messages.
*/
it('threadWorker_terminate_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let res = 0
let flag = false
......@@ -466,7 +469,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Terminates the worker thread to stop the worker from receiving messages.
*/
it('threadWorker_terminate_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let res = 0
let flag = false
......@@ -493,7 +496,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Terminates the worker thread to stop the worker from receiving messages.
*/
it('threadWorker_terminate_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let res = 0
let flag = false
......@@ -528,7 +531,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker.
*/
it('threadWorker_on_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -540,7 +543,7 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -557,7 +560,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker.
*/
it('threadWorker_on_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -572,8 +575,8 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -590,7 +593,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker.
*/
it('threadWorker_on_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -604,7 +607,7 @@ describe('threadWorkerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -623,7 +626,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker when throw error.
*/
it('threadWorker_on_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
try {
......@@ -648,7 +651,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker when throw error.
*/
it('threadWorker_on_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
try {
......@@ -673,7 +676,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Adds an event listener to the worker when throw error.
*/
it('threadWorker_on_test_006', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
try {
......@@ -698,15 +701,16 @@ describe('threadWorkerTest', function () {
after it is invoked once when throw error.
*/
it('threadWorker_on_test_007', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
let times = 0
try {
ss.on("zhangsan", ()=>{
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.onexit = function () {
isTerminate = true
}
......@@ -732,7 +736,7 @@ describe('threadWorkerTest', function () {
after it is invoked once.
*/
it('threadWorker_once_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -743,7 +747,7 @@ describe('threadWorkerTest', function () {
ss.once("zhangsan", ()=>{
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -761,7 +765,7 @@ describe('threadWorkerTest', function () {
after it is invoked once.
*/
it('threadWorker_once_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -775,7 +779,7 @@ describe('threadWorkerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -793,7 +797,7 @@ describe('threadWorkerTest', function () {
after it is invoked once.
*/
it('threadWorker_once_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -809,8 +813,8 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -827,7 +831,7 @@ describe('threadWorkerTest', function () {
after it is invoked once when throw error.
*/
it('threadWorker_once_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -856,7 +860,7 @@ describe('threadWorkerTest', function () {
after it is invoked once when throw error.
*/
it('threadWorker_once_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
......@@ -882,7 +886,7 @@ describe('threadWorkerTest', function () {
after it is invoked once when throw error.
*/
it('threadWorker_once_test_006', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
......@@ -908,15 +912,16 @@ describe('threadWorkerTest', function () {
after it is invoked once when throw error.
*/
it('threadWorker_once_test_007', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let isTerminate = false
let times = 0
try {
ss.once("zhangsan", ()=>{
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.onexit = function () {
isTerminate = true
}
......@@ -941,7 +946,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker.
*/
it('threadWorker_addEventListener_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -953,8 +958,8 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -971,7 +976,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker.
*/
it('threadWorker_addEventListener_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -986,8 +991,8 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1004,7 +1009,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker.
*/
it('threadWorker_addEventListener_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1018,7 +1023,7 @@ describe('threadWorkerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -1036,7 +1041,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker when throw error.
*/
it('threadWorker_addEventListener_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1065,7 +1070,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker when throw error.
*/
it('threadWorker_addEventListener_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1092,7 +1097,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker when throw error.
*/
it('threadWorker_addEventListener_test_006', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1119,7 +1124,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker when throw error.
*/
it('threadWorker_addEventListener_test_007', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1129,7 +1134,7 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.onexit = function () {
isTerminate = true
......@@ -1156,7 +1161,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Add an event listener to the Worker when throw error.
*/
it('threadWorker_addEventListener_test_008', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let times = 0
let isTerminate = false
......@@ -1166,7 +1171,7 @@ describe('threadWorkerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.onexit = function () {
isTerminate = true
......@@ -1175,7 +1180,7 @@ describe('threadWorkerTest', function () {
while (!isTerminate) {
await promiseCase()
}
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
} catch (error) {
expect(error.name).assertEqual("BusinessError")
expect(error.message).assertEqual("Worker instance is not running, maybe worker has been terminated")
......@@ -1189,7 +1194,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event listener to the worker.
*/
it('threadWorker_off_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1201,13 +1206,13 @@ describe('threadWorkerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(1)
ss.off("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1224,7 +1229,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event listener to the worker.
*/
it('threadWorker_off_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1236,8 +1241,8 @@ describe('threadWorkerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
for (let i=0;i<3;i++)
......@@ -1245,7 +1250,7 @@ describe('threadWorkerTest', function () {
ss.off("zhangsan")
}
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1262,7 +1267,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event listener to the worker when throw error.
*/
it('threadWorker_off_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1293,7 +1298,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event listener to the worker when throw error.
*/
it('threadWorker_off_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1323,7 +1328,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event listener to the worker when throw error.
*/
it('threadWorker_off_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1353,7 +1358,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker.
*/
it('threadWorker_removeListener_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1365,13 +1370,13 @@ describe('threadWorkerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(1)
ss.removeEventListener("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1388,7 +1393,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker.
*/
it('threadWorker_removeListener_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1400,8 +1405,8 @@ describe('threadWorkerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
for (let i=0;i<3;i++)
......@@ -1409,7 +1414,7 @@ describe('threadWorkerTest', function () {
ss.removeEventListener("zhangsan")
}
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1426,7 +1431,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker.
*/
it('threadWorker_removeListener_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1443,21 +1448,21 @@ describe('threadWorkerTest', function () {
liSiTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
expect(liSiTimes).assertEqual(2)
ss.removeAllListener()
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -1474,7 +1479,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker when throw error.
*/
it('threadWorker_removeListener_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1504,7 +1509,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker when throw error.
*/
it('threadWorker_removeListener_test_004', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1534,7 +1539,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker when throw error.
*/
it('threadWorker_removeListener_test_005', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1564,7 +1569,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Removes an event defined for the worker when throw error.
*/
it('threadWorker_removeListener_test_006', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -1594,7 +1599,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Close the worker thread to stop the worker from receiving messages.
*/
it('threadWorker_parentPortClose_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_008.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_008.js")
let res = 0
let flag = false
......@@ -1618,7 +1623,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Close the worker thread to stop the worker from receiving messages.
*/
it('threadWorker_parentPortClose_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_008.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_008.js")
let res = 0
let flag = false
......@@ -1654,7 +1659,7 @@ describe('threadWorkerTest', function () {
a message that cannot be serialized. The event handler is executed in the host thread
*/
it('threadWorker_onmessageerror_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_008.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_008.js")
let res = 0
let flag = false
......@@ -1681,7 +1686,7 @@ describe('threadWorkerTest', function () {
a message that cannot be serialized. The event handler is executed in the host thread
*/
it('threadWorker_onmessageerror_test_002', 0, async function (done) {
var ss = new worker.ThreadWorker("workers/newworker_008.js")
var ss = new worker.ThreadWorker("entry/ets/workers/newworker_008.js")
var res = 0
var flag = false
......@@ -1709,7 +1714,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Create a second worker.
*/
it('threadWorker_new_second_worker_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_009.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_009.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1752,7 +1757,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Create a third worker.
*/
it('threadWorker_new_second_worker_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_012.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_012.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1796,7 +1801,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Check if the postMessage function of the second worker is ok.
*/
it('threadWorker_second_worker_postMessage_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_010.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_010.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1840,7 +1845,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Check if the postMessage function of the second worker is ok.
*/
it('threadWorker_second_worker_postMessage_test_002', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_013.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_013.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1884,7 +1889,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Check if the postMessage function of the second worker is ok.
*/
it('threadWorker_second_worker_postMessage_test_003', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_014.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_014.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1929,7 +1934,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Check if the postMessage function of the third worker is ok.
*/
it('threadWorker_third_worker_postMessage_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_015.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_015.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1966,7 +1971,7 @@ describe('threadWorkerTest', function () {
* @tc.desc: Check if the terminate function of the second worker is ok.
*/
it('threadWorker_second_worker_terminate_test_001', 0, async function (done) {
let ss = new worker.ThreadWorker("workers/newworker_011.js")
let ss = new worker.ThreadWorker("entry/ets/workers/newworker_011.js")
let flag = false
let res = undefined
let isTerminate = false
......
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Copyright (c) 2022 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,
* 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 app from '@system.app'
import worker from "@ohos.worker"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function workerTest() {
describe('workerTest', function () {
import worker from '@ohos.worker'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
export default function WorkerTest() {
describe('WorkerTest', function () {
afterAll(function () {
console.info('total case over')
......@@ -26,21 +25,20 @@ describe('workerTest', function () {
function promiseCase() {
let p = new Promise(function (resolve, reject) {
setTimeout(function () {
resolve()
resolve(0)
}, 100)
}).then(undefined, (error) => {
})
return p
}
// check worker constructor is ok
/**
* @tc.name: worker_constructor_test_001
* @tc.desc: worker constructor to Creates a worker instance.
* @tc.author: hanyuqing
*/
it('worker_constructor_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let isTerminate = false
ss.onexit = function () {
......@@ -62,7 +60,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_constructor_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js", {name:"second worker", shared:"False"})
let ss = new worker.Worker("entry/ets/workers/worker.js", {name:"1st worker", shared: false})
let isTerminate = false
ss.onexit = function () {
......@@ -84,7 +82,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_constructor_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js", {type:"classic", name:"second worker", shared:"false"})
let ss = new worker.Worker("entry/ets/workers/worker.js", {type:"classic", name:"2st worker", shared: false})
let isTerminate = false
ss.onexit = function () {
......@@ -106,7 +104,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_constructor_test_004', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js", {type:"classic", name:"third worker", shared:"true"})
let ss = new worker.Worker("entry/ets/workers/worker.js", {type:"classic", name:"3st worker", shared: true})
let isTerminate = false
ss.onexit = function () {
......@@ -130,7 +128,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_002.js")
let ss = new worker.Worker("entry/ets/workers/worker_002.js")
let res = undefined
let flag = false
......@@ -166,7 +164,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker_003.js")
let ss = new worker.Worker("entry/ets/workers/worker_003.js")
let res = undefined
let flag = false
......@@ -202,7 +200,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker_004.js")
let ss = new worker.Worker("entry/ets/workers/worker_004.js")
let res = undefined
let flag = false
......@@ -237,7 +235,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_004', 0, async function (done) {
let ss = new worker.Worker("workers/worker_005.js", {name: "zhangsan"})
let ss = new worker.Worker("entry/ets/workers/worker_005.js", {name: "zhangsan"})
let res = undefined
let flag = false
......@@ -274,7 +272,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_005', 0, async function (done) {
let ss = new worker.Worker("workers/worker_006.js")
let ss = new worker.Worker("entry/ets/workers/worker_006.js")
let isTerminate = false
ss.onexit = function () {
......@@ -315,7 +313,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_postMessage_test_006', 0, async function (done) {
let ss = new worker.Worker("workers/worker_007.js")
let ss = new worker.Worker("entry/ets/workers/worker_007.js")
let res = undefined
let flag = false
......@@ -354,7 +352,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_terminate_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let res = 0
let flag = false
......@@ -379,7 +377,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_terminate_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let res = 0
let flag = false
......@@ -407,7 +405,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_terminate_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let res = 0
let flag = false
......@@ -438,7 +436,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_on_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -450,7 +448,7 @@ describe('workerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -468,7 +466,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_on_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -483,8 +481,8 @@ describe('workerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -502,7 +500,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_on_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -516,7 +514,7 @@ describe('workerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -537,7 +535,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_once_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -548,7 +546,7 @@ describe('workerTest', function () {
ss.once("zhangsan", ()=>{
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -567,7 +565,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_once_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -581,7 +579,7 @@ describe('workerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -600,7 +598,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_once_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -616,8 +614,8 @@ describe('workerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -635,7 +633,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_addEventListener_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -647,8 +645,8 @@ describe('workerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -666,7 +664,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_addEventListener_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -681,8 +679,8 @@ describe('workerTest', function () {
times++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -700,7 +698,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_addEventListener_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let times = 0
let isTerminate = false
......@@ -714,7 +712,7 @@ describe('workerTest', function () {
for (let i=0;i<10;i++)
{
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
}
ss.terminate()
......@@ -733,7 +731,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_off_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -745,13 +743,13 @@ describe('workerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(1)
ss.off("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -769,7 +767,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_off_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -781,8 +779,8 @@ describe('workerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
for (let i=0;i<3;i++)
......@@ -790,7 +788,7 @@ describe('workerTest', function () {
ss.off("zhangsan")
}
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -808,7 +806,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_removeListener_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -820,13 +818,13 @@ describe('workerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(1)
ss.removeEventListener("zhangsan")
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -844,7 +842,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_removeListener_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -856,8 +854,8 @@ describe('workerTest', function () {
zhangSanTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
for (let i=0;i<3;i++)
......@@ -865,7 +863,7 @@ describe('workerTest', function () {
ss.removeEventListener("zhangsan")
}
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -883,7 +881,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_removeListener_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker.js")
let ss = new worker.Worker("entry/ets/workers/worker.js")
let zhangSanTimes = 0
let isTerminate = false
......@@ -900,21 +898,21 @@ describe('workerTest', function () {
liSiTimes++
})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
expect(liSiTimes).assertEqual(2)
ss.removeAllListener()
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
ss.dispatchEvent({type: "zhangsan", timeStamp: 0})
expect(zhangSanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.dispatchEvent({type: "lisi", timeStamp: 0})
ss.terminate()
while (!isTerminate) {
......@@ -932,7 +930,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_parentPortClose_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_008.js")
let ss = new worker.Worker("entry/ets/workers/worker_008.js")
let res = 0
let flag = false
......@@ -957,7 +955,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_parentPortClose_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker_008.js")
let ss = new worker.Worker("entry/ets/workers/worker_008.js")
let res = 0
let flag = false
......@@ -988,7 +986,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_onmessageerror_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_008.js")
let ss = new worker.Worker("entry/ets/workers/worker_008.js")
let res = 0
let flag = false
......@@ -1016,7 +1014,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_onmessageerror_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker_008.js")
let ss = new worker.Worker("entry/ets/workers/worker_008.js")
let res = 0
let flag = false
......@@ -1046,7 +1044,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_new_second_worker_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_009.js")
let ss = new worker.Worker("entry/ets/workers/worker_009.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1090,7 +1088,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_new_second_worker_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker_012.js")
let ss = new worker.Worker("entry/ets/workers/worker_012.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1135,7 +1133,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_second_worker_postMessage_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_010.js")
let ss = new worker.Worker("entry/ets/workers/worker_010.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1180,7 +1178,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_second_worker_postMessage_test_002', 0, async function (done) {
let ss = new worker.Worker("workers/worker_013.js")
let ss = new worker.Worker("entry/ets/workers/worker_013.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1225,7 +1223,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_second_worker_postMessage_test_003', 0, async function (done) {
let ss = new worker.Worker("workers/worker_014.js")
let ss = new worker.Worker("entry/ets/workers/worker_014.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1271,7 +1269,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_third_worker_postMessage_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_015.js")
let ss = new worker.Worker("entry/ets/workers/worker_015.js")
let flag = false
let res = undefined
let isTerminate = false
......@@ -1309,7 +1307,7 @@ describe('workerTest', function () {
* @tc.author: hanyuqing
*/
it('worker_second_worker_terminate_test_001', 0, async function (done) {
let ss = new worker.Worker("workers/worker_011.js")
let ss = new worker.Worker("entry/ets/workers/worker_011.js")
let flag = false
let res = undefined
let isTerminate = false
......
......@@ -23,7 +23,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0091.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0091.js");
console.log("worker:: workerxx ");
ss.onexit = function() {
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0101.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0101.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0111.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0111.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0121.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0121.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0122.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0122.js");
ss.terminate();
ss.onexit = function() {
parentPort.postMessage(ss != null);
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
var data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0131.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0131.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0141.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0141.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
var data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0151.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0151.js");
ss.onexit = function() {
parentPort.postMessage(backValue); // 16
}
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.ThreadWorker("workers/newworker_0152.js");
ss = new worker.ThreadWorker("entry/ets/workers/newworker_0152.js");
ss.onexit = function() {
parentPort.postMessage(backValue); // 16
}
......
......@@ -23,8 +23,8 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0091.js");
console.log("worker:: workerxx ");
ss = new worker.Worker("entry/ets/workers/worker_0091.js");
console.log("worker:: workerxx");
ss.onexit = function() {
flag = true;
}
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0101.js");
ss = new worker.Worker("entry/ets/workers/worker_0101.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0111.js");
ss = new worker.Worker("entry/ets/workers/worker_0111.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0121.js");
ss = new worker.Worker("entry/ets/workers/worker_0121.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0122.js");
ss = new worker.Worker("entry/ets/workers/worker_0122.js");
ss.terminate();
ss.onexit = function() {
parentPort.postMessage(ss != null);
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
var data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0131.js");
ss = new worker.Worker("entry/ets/workers/worker_0131.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0141.js");
ss = new worker.Worker("entry/ets/workers/worker_0141.js");
ss.onmessage = function(ee) {
backValue = ee.data;
flag = true;
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
var data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0151.js");
ss = new worker.Worker("entry/ets/workers/worker_0151.js");
ss.onexit = function() {
parentPort.postMessage(backValue); // 16
}
......
......@@ -24,7 +24,7 @@ parentPort.onmessage = function(e) {
let data = e.data;
switch(data.type) {
case "new":
ss = new worker.Worker("workers/worker_0152.js");
ss = new worker.Worker("entry/ets/workers/worker_0152.js");
ss.onexit = function() {
parentPort.postMessage(backValue); // 16
}
......
{
"module": {
"name": "entry",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:entry_desc",
"mainElement": "MainAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.example.workertest.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:white",
"visible": true,
"orientation": "portrait",
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "white",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_desc",
"value": "description"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "form_FormAbility_desc",
"value": "form_description"
},
{
"name": "form_FormAbility_label",
"value": "form_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.workerxts",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "com.example.workerxts",
"name": ".entry",
"mainAbility": ".MainAbility",
"srcPath":"",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
\ No newline at end of file
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!--
Copyright (C) 2022 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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
<!--
Copyright (c) 2021 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.
-->
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
/*
* Copyright (C) 2022 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 workerTest from './Worker.test.js'
import threadWorkerTest from './ThreadWorker.test.js'
export default function testsuite() {
workerTest()
threadWorkerTest()
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册