Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
87f19506
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看板
未验证
提交
87f19506
编写于
7月 22, 2023
作者:
高
高曦
提交者:
Gitee
7月 22, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update HttpJsunit.test.ets.
Signed-off-by:
N
高曦
<
gaoxi785@huawei.com
>
上级
17d57c40
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
19 deletion
+23
-19
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
...tmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
+23
-19
未找到文件。
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
浏览文件 @
87f19506
/*
/*
* Copyright (C) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (C) 2021-202
3
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -16,6 +16,7 @@ import {describe, it, expect} from '@ohos/hypium';
...
@@ -16,6 +16,7 @@ import {describe, it, expect} from '@ohos/hypium';
import http from '@ohos.net.http';
import http from '@ohos.net.http';
import connection from "@ohos.net.connection";
import connection from "@ohos.net.connection";
import socket from '@ohos.net.socket';
import socket from '@ohos.net.socket';
import ethernet from '@ohos.net.ethernet';
export default function httpJsunit() {
export default function httpJsunit() {
describe("httpJsunitTest", function () {
describe("httpJsunitTest", function () {
...
@@ -108,7 +109,6 @@ export default function httpJsunit() {
...
@@ -108,7 +109,6 @@ export default function httpJsunit() {
} else {
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
console.log(`${caseName} getDefaultHttpProxy success`);
expect(error).assertEqual(undefined);
expect(error).assertEqual(undefined);
expect(data != '').assertTrue();
done();
done();
}
}
});
});
...
@@ -123,7 +123,6 @@ export default function httpJsunit() {
...
@@ -123,7 +123,6 @@ export default function httpJsunit() {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100';
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100';
connection.getDefaultHttpProxy().then((data) => {
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
done();
}).catch((error) => {
}).catch((error) => {
console.log(JSON.stringify(error));
console.log(JSON.stringify(error));
...
@@ -150,7 +149,6 @@ export default function httpJsunit() {
...
@@ -150,7 +149,6 @@ export default function httpJsunit() {
done();
done();
} else {
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
done();
}
}
});
});
...
@@ -179,7 +177,6 @@ export default function httpJsunit() {
...
@@ -179,7 +177,6 @@ export default function httpJsunit() {
console.log("setAppNet success");
console.log("setAppNet success");
connection.getDefaultHttpProxy().then((data) => {
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
console.log(`${caseName} getDefaultHttpProxy success`);
expect(data != '').assertTrue();
done();
done();
}).catch((error) => {
}).catch((error) => {
console.log(JSON.stringify(error));
console.log(JSON.stringify(error));
...
@@ -204,20 +201,27 @@ export default function httpJsunit() {
...
@@ -204,20 +201,27 @@ export default function httpJsunit() {
* @tc.desc Function test
* @tc.desc Function test
*/
*/
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
try{
let caseName = 'Telephony_Connection_Request_Socket_0100';
let caseName = 'Telephony_Connection_Request_Socket_0100';
type HttpRequest = http.HttpRequest;
type HttpProxy = connection.HttpProxy;
type HttpProxy = connection.HttpProxy;
type TCPSocket = socket.TCPSocket;
type TCPSocket = socket.TCPSocket;
type UDPSocket = socket.UDPSocket;
type UDPSocket = socket.UDPSocket;
Test(http.createHttp(),socket.constructTCPSocketInstance(),socket.constructUDPSocketInstance());
Test(http.createHttp(),socket.constructTCPSocketInstance(),socket.constructUDPSocketInstance());
function Test(httpProxy:HttpProxy
,tcpSocket:TCPSocket,udpSocket:UDPSocket){
function Test(httpRequest :HttpRequest
,tcpSocket:TCPSocket,udpSocket:UDPSocket){
except(httpProxy
!= null).assertTrue();
except(httpRequest
!= null).assertTrue();
except(tcpSocket != null).assertTrue();
except(tcpSocket != null).assertTrue();
except(udpSocket != null).assertTrue();
except(udpSocket != null).assertTrue();
httpRequest.destroy();
httpRequest.destroy();
tcpSocket.close();
tcpSocket.close();
udp
.close();
udpSocket
.close();
done();
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录