Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e6e361c6
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看板
未验证
提交
e6e361c6
编写于
10月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6064 【元能力】新增errorManager接口XTS
Merge pull request !6064 from donglin/master
上级
f952cd9b
0bb97a3c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
84 addition
and
0 deletion
+84
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets
...ver/apicoverhaptest/entry/src/main/ets/test/List.test.ets
+2
-0
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
...ptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
+82
-0
未找到文件。
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets
浏览文件 @
e6e361c6
...
...
@@ -14,6 +14,7 @@
*/
import apiCoverAbility from './ApiCoverAbility.test'
import newApiCoverAbility from './NewApiCoverAbility.test'
import verificationTest from './VerificationTest'
import wantAgentCover from './WantAgentCover.test'
import contextEnvironmentTest from './ContextEnvironmentTest.test';
...
...
@@ -21,6 +22,7 @@ import contextEnvironmentTest from './ContextEnvironmentTest.test';
export default function List() {
apiCoverAbility()
newApiCoverAbility()
verificationTest()
wantAgentCover()
contextEnvironmentTest(globalThis.applicationContext)
...
...
ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/NewApiCoverAbility.test.ets
0 → 100644
浏览文件 @
e6e361c6
/*
* 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import errorManager from '@ohos.app.ability.errorManager';
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
export default function ApiCoverTest() {
describe('NewApiCoverTestTest', function () {
afterEach(async (done) => {
setTimeout(function () {
done();
}, 2500);
})
/*
* @tc.number SUB_AA_ReisterErrorObserver_New_0100
* @tc.name Test ReisterErrorObserver.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ReisterErrorObserver_New_0100', 0, async function (done) {
let errorObserver:errorManager.ErrorObserver;
errorObserver = {
onUnhandledException:(errMessage) => {
console.info("SUB_AA_ReisterErrorObserver_0100" + JSON.stringify(errMessage));
}
}
try {
let errCodeId = errorManager.on("error", errorObserver)
expect(errCodeId).assertEqual(0)
errorManager.off("error", errCodeId).then((data)=>{
expect(data).assertEqual(undefined)
done();
}).catch((err)=>{
expect().assertFail()
done();
})
} catch (error) {
expect().assertFail()
done();
}
});
/*
* @tc.number SUB_AA_ReisterErrorObserver_0200
* @tc.name Test unregisterErrorObserver with error number.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ReisterErrorObserver_New_0200', 0, async function (done) {
try {
errorManager.off("error", -1).then((data)=>{
expect().assertFail()
done();
}).catch((err)=>{
expect(err.code).assertEqual(401)
done();
})
} catch (error) {
expect().assertFail()
done();
}
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录