Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3c54b95c
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看板
提交
3c54b95c
编写于
6月 13, 2023
作者:
J
jianghuanhuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
observer用例优化
Signed-off-by:
N
jianghuanhuan
<
jianghuanhuan@huawei.com
>
上级
c617ad84
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
164 deletion
+42
-164
telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets
.../observer/entry/src/main/ets/test/ObserverJsunit.test.ets
+42
-164
未找到文件。
telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets
浏览文件 @
3c54b95c
...
...
@@ -44,26 +44,6 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_observer_DataConnectState_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_networkStateChange_0100
* @tc.name : on_networkStateChange
* @tc.desc : call the on method of networkStateChange
*/
it('Telephony_observer_observer_on_networkStateChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test start *************");
try {
observer.on('networkStateChange', NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_networkStateChange_0200
* @tc.name : on_networkStateChange
...
...
@@ -72,17 +52,20 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_networkStateChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test start *************");
try {
observer.on('networkStateChange', {
slotId: 0
}, NetworkState => {
let callback = NetworkState => {
console.log("on networkStateChange, NetworkState:" + JSON.stringify(NetworkState));
expect(typeof NetworkState === undefined).assertFalse();
});
}
observer.on('networkStateChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('networkStateChange');
console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test end *************");
})
...
...
@@ -110,25 +93,7 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_signalInfoChange_0100
* @tc.name : on_signalInfoChange
* @tc.desc : call the on method of signalInfoChange
*/
it('Telephony_observer_observer_on_signalInfoChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test start *************");
try {
observer.on('signalInfoChange', SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_signalInfoChange_0200
...
...
@@ -138,17 +103,19 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_signalInfoChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test start *************");
try {
observer.on('signalInfoChange', {
slotId: 0
}, SignalInformation => {
let callback = SignalInformation => {
console.log("on signalInfoChange, SignalInformation:" + JSON.stringify(SignalInformation));
expect(typeof SignalInformation === undefined).assertFalse();
});
}
observer.on('signalInfoChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('signalInfoChange');
console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test end *************");
})
...
...
@@ -177,26 +144,7 @@ export default function ObserverJsunit() {
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0100
* @tc.name : on_cellularDataConnectionStateChange
* @tc.desc : call the on method of cellularDataConnectionStateChange
*/
it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test start *************");
try {
observer.on('cellularDataConnectionStateChange', value => {
console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network);
expect(typeof value.state === undefined).assertFalse();
expect(typeof value.network === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0200
...
...
@@ -206,18 +154,20 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test start *************");
try {
observer.on('cellularDataConnectionStateChange', {
slotId: 0
}, value => {
let callback = value => {
console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network);
expect(typeof value.state === undefined).assertFalse();
expect(typeof value.network === undefined).assertFalse();
});
}
observer.on('cellularDataConnectionStateChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('cellularDataConnectionStateChange');
console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test end *************");
})
...
...
@@ -244,26 +194,6 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0100
* @tc.name : on_cellularDataFlowChange
* @tc.desc : call the on method of cellularDataFlowChange
*/
it('Telephony_observer_observer_on_cellularDataFlowChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test start *************");
try {
observer.on('cellularDataFlowChange', DataFlowType => {
console.log("on networkStateChange, DataFlowType:" + JSON.stringify(DataFlowType));
expect(typeof DataFlowType === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0200
* @tc.name : on_cellularDataFlowChange
...
...
@@ -272,17 +202,19 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_cellularDataFlowChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test start *************");
try {
observer.on('cellularDataFlowChange', {
slotId: 0
}, DataFlowType => {
let callback = DataFlowType => {
console.log("on networkStateChange, DataFlowType:" + JSON.stringify(DataFlowType));
expect(typeof DataFlowType === undefined).assertFalse();
});
}
observer.on('cellularDataFlowChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('cellularDataFlowChange');
console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test end *************")
})
...
...
@@ -309,26 +241,6 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test end *************")
})
/*
* @tc.number : Telephony_observer_observer_on_callStateChange_0100
* @tc.name : on_callStateChange
* @tc.desc : call the on method of callStateChange
*/
it('Telephony_observer_observer_on_callStateChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test start *************");
try {
observer.on('callStateChange', value => {
console.log("on callStateChange, state:" + value.state + ", number:" + value.number);
expect(typeof value.state === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_callStateChange_0200
* @tc.name : on_callStateChange
...
...
@@ -337,17 +249,19 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_callStateChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test start *************");
try {
observer.on('callStateChange', {
slotId: 0
}, value => {
let callback = value => {
console.log("on callStateChange, state:" + value.state + ", number:" + value.number);
expect(typeof value.state === undefined).assertFalse();
});
}
observer.on('callStateChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('callStateChange');
console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test end *************");
})
...
...
@@ -374,25 +288,6 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_simStateChange_0100
* @tc.name : on_simStateChange
* @tc.desc : call the on method of simStateChange
*/
it('Telephony_observer_observer_on_simStateChange_0100', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test start *************");
try {
observer.on('simStateChange', SimStateData => {
console.log("on simStateChange, SimStateData:" + JSON.stringify(SimStateData));
expect(typeof SimStateData === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test end *************");
})
/*
* @tc.number : Telephony_observer_observer_on_simStateChange_0200
...
...
@@ -402,17 +297,19 @@ export default function ObserverJsunit() {
it('Telephony_observer_observer_on_simStateChange_0200', 0, async function (done) {
console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test start *************");
try {
observer.on('simStateChange', {
slotId: 0
}, SimStateData => {
let callback = SimStateData => {
console.log("on simStateChange, SimStateData:" + JSON.stringify(SimStateData));
expect(typeof SimStateData === undefined).assertFalse();
});
}
observer.on('simStateChange', {
slotId: 0
}, callback);
done();
} catch (error) {
expect(false).assertTrue();
done();
}
observer.off('simStateChange');
console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test end *************")
})
...
...
@@ -426,6 +323,9 @@ export default function ObserverJsunit() {
try {
let callback = data => {
console.log("on simStateChange, data:" + JSON.stringify(data));
expect(typeof SimStateData.reason === undefined).assertFalse();
expect(typeof SimStateData.state === undefined).assertFalse();
expect(typeof SimStateData.type === undefined).assertFalse();
}
observer.on('simStateChange', callback);
// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。
...
...
@@ -594,28 +494,6 @@ export default function ObserverJsunit() {
console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test end *************");
})
/*
* @tc.number : Telephony_Observer_SimStateData_Reason
* @tc.name : on_simStateChange
* @tc.desc : call the on method of simStateChange
*/
it('Telephony_Observer_SimStateData_Reason', 0, async function (done) {
console.log("************* Telephony_Observer_SimStateData_Reason Test start *************");
try {
observer.on('simStateChange', SimStateData => {
console.log("on simStateChange, SimStateData:" + JSON.stringify(SimStateData));
expect(typeof SimStateData.reason === undefined).assertFalse();
expect(typeof SimStateData.state === undefined).assertFalse();
expect(typeof SimStateData.type === undefined).assertFalse();
});
done();
} catch (error) {
expect(false).assertTrue();
done();
}
console.log("************* Telephony_Observer_SimStateData_Reason Test end *************");
})
console.log("************* Observer Test end *************");
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录