未验证 提交 87f19506 编写于 作者: 高曦 提交者: Gitee

update HttpJsunit.test.ets.

Signed-off-by: N高曦 <gaoxi785@huawei.com>
上级 17d57c40
/*
* Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -16,6 +16,7 @@ import {describe, it, expect} from '@ohos/hypium';
import http from '@ohos.net.http';
import connection from "@ohos.net.connection";
import socket from '@ohos.net.socket';
import ethernet from '@ohos.net.ethernet';
export default function httpJsunit() {
describe("httpJsunitTest", function () {
......@@ -108,7 +109,6 @@ export default function httpJsunit() {
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
expect(error).assertEqual(undefined);
expect(data != '').assertTrue();
done();
}
});
......@@ -123,7 +123,6 @@ export default function httpJsunit() {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100';
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
}).catch((error) => {
console.log(JSON.stringify(error));
......@@ -150,7 +149,6 @@ export default function httpJsunit() {
done();
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
}
});
......@@ -179,7 +177,6 @@ export default function httpJsunit() {
console.log("setAppNet success");
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
}).catch((error) => {
console.log(JSON.stringify(error));
......@@ -204,20 +201,27 @@ export default function httpJsunit() {
* @tc.desc Function test
*/
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
try{
let caseName = 'Telephony_Connection_Request_Socket_0100';
type HttpRequest = http.HttpRequest;
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();
function Test(httpRequest :HttpRequest,tcpSocket:TCPSocket,udpSocket:UDPSocket){
except(httpRequest != null).assertTrue();
except(tcpSocket != null).assertTrue();
except(udpSocket != null).assertTrue();
httpRequest.destroy();
tcpSocket.close();
udp.close();
udpSocket.close();
done();
}
} catch (error) {
console.info("Telephony_Connection_Request_Socket_0100 catch " + error);
done();
}
});
});
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册