提交 98392fea 编写于 作者: J jiangyuan0000

fixed 004feaf4 from https://gitee.com/jiangyuan0000/xts_acts_1/pulls/5944

hidebug getServiceDump xts测试用例同步修改
Signed-off-by: Njiangyuan0000 <jiangyuan29@huawei.com>
上级 be09a18b
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import hidebug from '@ohos.hidebug' import hidebug from '@ohos.hidebug'
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, it, expect} from '@ohos/hypium' import {describe, it, expect} from '@ohos/hypium'
export default function HidebugJsTest() { export default function HidebugJsTest() {
...@@ -337,47 +338,74 @@ describe('HidebugJsTest', function () { ...@@ -337,47 +338,74 @@ describe('HidebugJsTest', function () {
*/ */
it('DFX_DFR_Hiprofiler_Interface_1100', 0, function() { it('DFX_DFR_Hiprofiler_Interface_1100', 0, function() {
console.log('************* DFX_DFR_Hiprofiler_Interface_1100 Test start*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_1100 Test start*************');
try { let context = featureAbility.getContext();
let temp = hidebug.getServiceDump(10); context.getFilesDir().then((data) => {
console.info("ServiceDump is " + temp); var path = data + "/serviceInfo1.txt"
expect(temp.indexOf('Success')!=-1).assertTrue(); let fd = fileio.openSync(path, 0o102, 0o666)
} catch (error) { var serviceId = 10
expect().assertFail(); var args = new Array("allInfo")
} try {
hidebug.getServiceDump(serviceId, fd, args)
expect(true).assertTrue();
} catch (error) {
expect().assertFail();
console.info(error.code)
console.info(error.message)
}
fileio.closeSync(fd);
})
console.log('************* DFX_DFR_Hiprofiler_Interface_1100 Test end*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_1100 Test end*************');
}); });
/* /*
* @tc.number : DFX_DFR_Hiprofiler_Interface_0900 * @tc.number : DFX_DFR_Hiprofiler_Interface_0900
* @tc.name : getServiceDump with abnormal parameter * @tc.name : getServiceDump with parameter error
* @tc.desc : getServiceDump * @tc.desc : getServiceDump
*/ */
it('DFX_DFR_Hiprofiler_Interface_0900', 0, function() { it('DFX_DFR_Hiprofiler_Interface_0900', 0, function() {
console.log('************* DFX_DFR_Hiprofiler_Interface_0900 Test start*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_0900 Test start*************');
try { let context = featureAbility.getContext();
let temp = hidebug.getServiceDump(-1); context.getFilesDir().then((data) => {
console.info("ServiceDump is " + temp); var path = data + "/serviceInfo2.txt"
expect(temp=="Error: no such system ability service.").assertTrue(); let fd = fileio.openSync(path, 0o102, 0o666)
} catch (error) { var serviceId = 10
expect().assertFail(); var args = new Array("allInfo")
} try {
hidebug.getServiceDump(serviceId)
expect().assertFail();
} catch (error) {
console.info(error.code)
console.info(error.message)
expect(error.code == 401).assertTrue();
}
fileio.closeSync(fd);
})
console.log('************* DFX_DFR_Hiprofiler_Interface_0900 Test end*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_0900 Test end*************');
}); });
/* /*
* @tc.number : DFX_DFR_Hiprofiler_Interface_1000 * @tc.number : DFX_DFR_Hiprofiler_Interface_1000
* @tc.name : getServiceDump with overlog parameter * @tc.name : getServiceDump with check system ability failed
* @tc.desc : getServiceDump * @tc.desc : getServiceDump
*/ */
it('DFX_DFR_Hiprofiler_Interface_1000', 0, function() { it('DFX_DFR_Hiprofiler_Interface_1000', 0, function() {
console.log('************* DFX_DFR_Hiprofiler_Interface_1000 Test start*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_1000 Test start*************');
try { let context = featureAbility.getContext();
let temp = hidebug.getServiceDump(9007199254740993); context.getFilesDir().then((data) => {
console.info("ServiceDump is " + temp); var path = data + "/serviceInfo3.txt"
expect(temp=="Error: invalid param").assertTrue(); let fd = fileio.openSync(path, 0o102, 0o666)
} catch (error) { var serviceId = -10
expect().assertFail(); var args = new Array("allInfo")
} try {
hidebug.getServiceDump(serviceId, fd, args)
expect().assertFail();
} catch (error) {
console.info(error.code)
console.info(error.message)
expect(error.code == 11400101).assertTrue();
}
fileio.closeSync(fd);
})
console.log('************* DFX_DFR_Hiprofiler_Interface_1000 Test end*************'); console.log('************* DFX_DFR_Hiprofiler_Interface_1000 Test end*************');
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册