提交 736c6d9a 编写于 作者: C chengxingzhen
上级 de95f65a
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"bundle-name": "com.example.abilitystagemonitortest", "bundle-name": "com.example.abilitystagemonitortest",
"module-name": "entry_test", "module-name": "entry_test",
"shell-timeout": "600000", "shell-timeout": "600000",
"testcase-timeout": "7000" "testcase-timeout": "15000"
}, },
"kits": [ "kits": [
{ {
......
...@@ -21,6 +21,8 @@ let moduleName1: any ...@@ -21,6 +21,8 @@ let moduleName1: any
let monitor: any let monitor: any
let want: any let want: any
let timeout = 3000; let timeout = 3000;
let addMonitor = false;
let removeMonitor = false;
function sleep(delay) { function sleep(delay) {
let start = (new Date()).getTime(); let start = (new Date()).getTime();
...@@ -329,6 +331,8 @@ export default function abilityStageMonitorTest() { ...@@ -329,6 +331,8 @@ export default function abilityStageMonitorTest() {
it('SUB_AA_AbilityStageMonitor_0700', 0, async function (done) { it('SUB_AA_AbilityStageMonitor_0700', 0, async function (done) {
console.info("SUB_AA_AbilityStageMonitor_0700 begin") console.info("SUB_AA_AbilityStageMonitor_0700 begin")
addMonitor = false;
removeMonitor = false;
monitor = { monitor = {
moduleName: "feature_assisth", moduleName: "feature_assisth",
srcEntrance: "./ets/Application/MyAbilityStage.ts", srcEntrance: "./ets/Application/MyAbilityStage.ts",
...@@ -338,6 +342,7 @@ export default function abilityStageMonitorTest() { ...@@ -338,6 +342,7 @@ export default function abilityStageMonitorTest() {
await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => { await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => {
console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); console.info("stageMonitor addAbilityStageMonitor promise, data = " + data);
addMonitor = true;
}).catch((err) => { }).catch((err) => {
console.info("SUB_AA_AbilityStageMonitor_0700 addAbilityStageMonitor err: " + JSON.stringify(err)); console.info("SUB_AA_AbilityStageMonitor_0700 addAbilityStageMonitor err: " + JSON.stringify(err));
expect().assertFail() expect().assertFail()
...@@ -349,18 +354,21 @@ export default function abilityStageMonitorTest() { ...@@ -349,18 +354,21 @@ export default function abilityStageMonitorTest() {
}).catch((err) => { }).catch((err) => {
console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err));
expect(err.code).assertEqual(-1) expect(err.code).assertEqual(-1)
done()
}) })
console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor"); console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor");
await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => { await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => {
console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); console.info("stageMonitor addAbilityStageMonitor promise, data = " + data);
removeMonitor = true;
}).catch((err) => { }).catch((err) => {
console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor err: " + JSON.stringify(err)); console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor err: " + JSON.stringify(err));
expect().assertFail() expect().assertFail()
done() done()
}); });
expect(addMonitor).assertTrue();
expect(removeMonitor).assertTrue();
done()
}) })
/** /**
...@@ -374,6 +382,8 @@ export default function abilityStageMonitorTest() { ...@@ -374,6 +382,8 @@ export default function abilityStageMonitorTest() {
it('SUB_AA_AbilityStageMonitor_0800', 0, async function (done) { it('SUB_AA_AbilityStageMonitor_0800', 0, async function (done) {
console.info("SUB_AA_AbilityStageMonitor_0800 begin") console.info("SUB_AA_AbilityStageMonitor_0800 begin")
addMonitor = false;
removeMonitor = false;
monitor = { monitor = {
moduleName: "feature_assisti", moduleName: "feature_assisti",
srcEntrance: "./ets/Application/AbilityStage.ts", srcEntrance: "./ets/Application/AbilityStage.ts",
...@@ -385,6 +395,7 @@ export default function abilityStageMonitorTest() { ...@@ -385,6 +395,7 @@ export default function abilityStageMonitorTest() {
abilityDelegator.addAbilityStageMonitor(monitor, (err, data) => { abilityDelegator.addAbilityStageMonitor(monitor, (err, data) => {
console.info("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback, data = " + data + console.info("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback, data = " + data +
"err: " + err); "err: " + err);
addMonitor = true;
}) })
} catch (error) { } catch (error) {
console.log("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback err: " + error); console.log("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback err: " + error);
...@@ -397,7 +408,6 @@ export default function abilityStageMonitorTest() { ...@@ -397,7 +408,6 @@ export default function abilityStageMonitorTest() {
}).catch((err) => { }).catch((err) => {
console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err));
expect(err.code).assertEqual(-1) expect(err.code).assertEqual(-1)
done()
}) })
try { try {
...@@ -405,12 +415,20 @@ export default function abilityStageMonitorTest() { ...@@ -405,12 +415,20 @@ export default function abilityStageMonitorTest() {
abilityDelegator.removeAbilityStageMonitor(monitor, (err, data) => { abilityDelegator.removeAbilityStageMonitor(monitor, (err, data) => {
console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback, data = " + console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback, data = " +
data + "err: " + err); data + "err: " + err);
removeMonitor = true;
}) })
} catch (error) { } catch (error) {
console.log("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback err: " + error); console.log("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback err: " + error);
expect().assertFail() expect().assertFail()
done() done()
} }
setTimeout(() => {
expect(addMonitor).assertTrue()
expect(removeMonitor).assertTrue()
done()
}, 3000);
}) })
/** /**
...@@ -474,8 +492,8 @@ export default function abilityStageMonitorTest() { ...@@ -474,8 +492,8 @@ export default function abilityStageMonitorTest() {
it('SUB_AA_AbilityStageMonitor_1000', 0, async function (done) { it('SUB_AA_AbilityStageMonitor_1000', 0, async function (done) {
console.info("SUB_AA_AbilityStageMonitor_1000 begin") console.info("SUB_AA_AbilityStageMonitor_1000 begin")
let addMonitor = false; addMonitor = false;
let removeMonitor = true; removeMonitor = false;
monitor = { monitor = {
moduleName: "feature_assa", moduleName: "feature_assa",
srcEntrance: "./ets/Application/MyAbilityStage.ts", srcEntrance: "./ets/Application/MyAbilityStage.ts",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册