提交 41a37fde 编写于 作者: H huyunhui

Make xts testcases of esmodule fit the new test framework

Issue: https://gitee.com/openharmony/xts_acts/issues/I7UYCKSigned-off-by: Nhuyunhui <huyunhui1@huawei.com>
上级 df26a027
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"test-timeout": "1800000", "test-timeout": "1800000",
"bundle-name": "com.esmodule.acts", "bundle-name": "com.esmodule.acts",
"module-name": "entry", "module-name": "entry",
"shell-timeout": "180000" "shell-timeout": "180000",
"compile-mode": "esmodule"
}, },
"kits": [ "kits": [
{ {
......
...@@ -21,7 +21,7 @@ import window from '@ohos.window'; ...@@ -21,7 +21,7 @@ import window from '@ohos.window';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
export default class TestAbility extends UIAbility { export default class TestAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want: object, launchParam: object) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
......
...@@ -18,16 +18,6 @@ import {Sleep} from './Util' ...@@ -18,16 +18,6 @@ import {Sleep} from './Util'
export default function workerImport() { export default function workerImport() {
describe("WorkerImportTest", () => { describe("WorkerImportTest", () => {
it('importHar', 0, async () => {
let workerImportHar = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportHar')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = () => {
workerImportHar = 'success';
}
await Sleep(2000)
expect(workerImportHar).assertEqual('success')
})
it('importOhpm', 0, async () => { it('importOhpm', 0, async () => {
let workerImportOhpm = 'failed' let workerImportOhpm = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportOhpm') let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportOhpm')
......
/**
* 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 {ohpmRes} from 'har';
import worker from '@ohos.worker';
let workerPort = worker.workerPort;
workerPort.onmessage = () => {
if (ohpmRes) {
workerPort.postMessage('ModuleTest receive data from main thread');
}
};
\ No newline at end of file
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"test-timeout": "1800000", "test-timeout": "1800000",
"bundle-name": "com.esmodule.acts", "bundle-name": "com.esmodule.acts",
"module-name": "entry_test", "module-name": "entry_test",
"shell-timeout": "180000" "shell-timeout": "180000",
"compile-mode": "esmodule"
}, },
"kits": [ "kits": [
{ {
......
...@@ -21,7 +21,7 @@ import window from '@ohos.window'; ...@@ -21,7 +21,7 @@ import window from '@ohos.window';
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
export default class TestAbility extends UIAbility { export default class TestAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want: object, launchParam: object) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
"test-timeout": "1800000", "test-timeout": "1800000",
"bundle-name": "com.esmodule.acts", "bundle-name": "com.esmodule.acts",
"module-name": "entry_test", "module-name": "entry_test",
"shell-timeout": "180000" "shell-timeout": "180000",
"compile-mode": "esmodule"
}, },
"kits": [ "kits": [
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册