提交 ec2e7486 编写于 作者: X xinking129

code check

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 459db85a
...@@ -21,43 +21,43 @@ let abilityDelegator = undefined; ...@@ -21,43 +21,43 @@ let abilityDelegator = undefined;
let abilityDelegatorArguments = undefined; let abilityDelegatorArguments = undefined;
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
} }
async function addAbilityMonitorCallback(err: any) { async function addAbilityMonitorCallback(err: any) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
} }
export default class OpenHarmonyTestRunner implements TestRunner { export default class OpenHarmonyTestRunner implements TestRunner {
constructor() { constructor() {
} }
onPrepare() { onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
} }
async onRun() { async onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility';
let lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
let debug = abilityDelegatorArguments.parameters['-D']; let debug = abilityDelegatorArguments.parameters['-D'];
if (debug == 'true') { if (debug == 'true') {
cmd += ' -D' cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
} }
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册