提交 1019d6cb 编写于 作者: G gaoxi785

sendshortmessage

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 9a339e86
......@@ -15,8 +15,7 @@
import {describe, it, expect} from '@ohos/hypium';
import http from '@ohos.net.http';
import connection from "@ohos.net.connection";
import ethernet from '@ohos.net.ethernet';
type httpProxy = connection.HttpProxy;
import socket from '@ohos.net.socket';
export default function httpJsunit() {
describe("httpJsunitTest", function () {
......@@ -157,7 +156,13 @@ export default function httpJsunit() {
});
}).catch(error => {
console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
});
......@@ -183,8 +188,36 @@ export default function httpJsunit() {
});
}).catch(error => {
console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Connection_Request_Socket_0100
* @tc.name Test type
* @tc.desc Function test
*/
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
let caseName = 'Telephony_Connection_Request_Socket_0100';
type HttpProxy = connection.HttpProxy;
type TCPSocket = socket.TCPSocket;
type UDPSocket = socket.UDPSocket;
Test(http.createHttp(),socket.constructTCPSocketInstance(),socket.constructUDPSocketInstance());
function Test(httpProxy:HttpProxy,tcpSocket:TCPSocket,udpSocket:UDPSocket){
except(httpProxy != null).assertTrue();
except(tcpSocket != null).assertTrue();
except(udpSocket != null).assertTrue();
httpRequest.destroy();
tcpSocket.close();
udp.close();
done();
}
});
}
\ No newline at end of file
......@@ -182,7 +182,7 @@ describe('SmsMmsErrorTest', function () {
sendCallback,
deliveryCallback
};
sms.sendMessage(options).then((data)=>{
sms.sendShortMessage(options).then((data)=>{
console.info('Telephony_SmsMms_sendShortMessage_Promise_0100 ' + JSON.stringify(data));
expect().assertFail();
done();
......@@ -224,9 +224,9 @@ describe('SmsMmsErrorTest', function () {
sendCallback,
deliveryCallback
};
sms.sendMessage(options,(err,data)=>{
sms.sendShortMessage(options,(err, data)=>{
if(err){
expect(error.code == 201).assertTrue();
expect(err.code == 201).assertTrue();
done();
} else {
console.info('Telephony_SmsMms_sendShortMessage_Async_0100 ' + JSON.stringify(data));
......@@ -234,7 +234,7 @@ describe('SmsMmsErrorTest', function () {
done();
}
});
} catch (err) {
} catch (error) {
expect(true).assertFalse();
done();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册