Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dac141e0
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看板
提交
dac141e0
编写于
4月 12, 2023
作者:
Z
zhangfuzhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增caPath属性
Signed-off-by:
N
zhangfuzhi
<
zhangfuzhi1@huawei.com
>
上级
352721dd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
42 deletion
+32
-42
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js
...test/netmanager_base/jshttp/src/main/js/test/Http2Test.js
+2
-1
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.js
...er_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.js
+30
-41
未找到文件。
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js
浏览文件 @
dac141e0
...
...
@@ -100,7 +100,8 @@ export default function Http2Test() {
header
:
"
content-type': 'application/json
"
,
readTimeout
:
6000
,
connectTimeout
:
6000
,
priority
:
100
priority
:
100
,
caPath
:
''
}
var
httpRequest
=
net_Http
.
createHttp
();
httpRequest
.
request
(
"
https://www.zhihu.com
"
,
httpRequestOptions
,
(
err
,
data
)
=>
{
...
...
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.js
浏览文件 @
dac141e0
...
...
@@ -56,48 +56,25 @@ export default function HttpRequest2JsunitTest() {
it
(
"
SUB_Telephony_NetStack_HttpRequest2_Async_0100
"
,
0
,
async
function
(
done
)
{
let
CaseName
=
"
SUB_Telephony_NetStack_HttpRequest2_Async_0100
"
;
let
Address_Img
=
"
https://img1.baidu.com/it/u=3010094603,1247181326&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500
"
;
let
H
ttpRequest
=
http
.
createHttp
();
let
h
ttpRequest
=
http
.
createHttp
();
try
{
HttpRequest
.
on
(
"
dataReceive
"
,
dataReceive_on_callback
);
HttpRequest
.
request2
(
Address_Img
,
httpRequestOptions
).
then
(
function
()
{
httpRequest
.
on
(
"
dataReceive
"
,
dataReceive_on_callback
);
httpRequest
.
on
(
"
dataProgress
"
,
dataProgress_on_callback
);
httpRequest
.
on
(
"
dataEnd
"
,
dataEnd_on_callback
);
httpRequest
.
request2
(
Address_Img
,
httpRequestOptions
,
(
err
,
data
)
=>
{
console
.
info
(
CaseName
+
"
responseCode data :
"
+
data
);
console
.
log
(
CaseName
+
"
NETSTACK request2 OK!
"
);
H
ttpRequest
.
off
(
"
dataReceive
"
);
h
ttpRequest
.
off
(
"
dataReceive
"
);
console
.
log
(
"
NETSTACK off dataReceive success!
"
);
}).
catch
(
function
(
err
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
err
));
});
}
catch
(
error
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
error
));
}
try
{
HttpRequest
.
on
(
"
dataProgress
"
,
dataProgress_on_callback
);
HttpRequest
.
request2
(
Address_Img
,
httpRequestOptions
).
then
(
function
()
{
console
.
log
(
CaseName
+
"
NETSTACK request2 OK!
"
);
HttpRequest
.
off
(
"
dataProgress
"
);
httpRequest
.
off
(
"
dataProgress
"
);
console
.
log
(
"
NETSTACK off dataProgress success!
"
);
}).
catch
(
function
(
err
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
err
));
});
}
catch
(
error
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
error
));
}
try
{
HttpRequest
.
on
(
"
dataEnd
"
,
dataEnd_on_callback
);
HttpRequest
.
request2
(
Address_Img
,
httpRequestOptions
).
then
(
function
()
{
console
.
log
(
CaseName
+
"
NETSTACK request2 OK!
"
);
HttpRequest
.
off
(
"
dataEnd
"
);
done
();
httpRequest
.
off
(
"
dataEnd
"
);
console
.
log
(
"
NETSTACK off dataEnd success!
"
);
}).
catch
(
function
(
err
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
err
));
expect
(
err
).
assertFalse
();
httpRequest
.
destroy
();
done
();
})
;
})
}
catch
(
error
)
{
console
.
log
(
"
NETSTACK request2 ERROR : error =
"
+
JSON
.
stringify
(
error
));
expect
(
error
).
assertFalse
();
done
();
console
.
log
(
"
NETSTACK request2 catch : error =
"
+
JSON
.
stringify
(
error
));
}
});
...
...
@@ -110,13 +87,14 @@ export default function HttpRequest2JsunitTest() {
it
(
"
SUB_Telephony_NetStack_HttpRequest2_Async_0200
"
,
0
,
async
function
(
done
)
{
let
CaseName
=
"
SUB_Telephony_NetStack_HttpRequest2_Async_0200
"
var
httpRequest
=
http
.
createHttp
();
httpRequest
.
request2
(
Address_Baidu
,
err
=>
{
httpRequest
.
request2
(
Address_Baidu
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
CaseName
+
"
request2 ERROR
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
}
console
.
log
(
CaseName
+
"
request2 Finish
"
);
httpRequest
.
destroy
();
console
.
log
(
CaseName
+
"
request2 Finish responseCode
"
+
data
);
done
();
});
});
...
...
@@ -129,8 +107,9 @@ export default function HttpRequest2JsunitTest() {
it
(
"
SUB_Telephony_NetStack_HttpRequest2_Promise_0100
"
,
0
,
async
function
(
done
)
{
let
CaseName
=
"
SUB_Telephony_NetStack_HttpRequest2_Promise_0100
"
;
var
httpRequest
=
http
.
createHttp
();
httpRequest
.
request2
(
Address_Baidu
,
httpRequestOptions
).
then
(
function
()
{
console
.
log
(
CaseName
+
"
request2 Finish
"
);
httpRequest
.
request2
(
Address_Baidu
,
httpRequestOptions
).
then
(
function
(
data
)
{
console
.
log
(
CaseName
+
"
request2 Finish responseCode
"
+
data
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -147,8 +126,9 @@ export default function HttpRequest2JsunitTest() {
it
(
"
SUB_Telephony_NetStack_HttpRequest2_Promise_0200
"
,
0
,
async
function
(
done
)
{
let
CaseName
=
"
SUB_Telephony_NetStack_HttpRequest2_Promise_0200
"
;
var
httpRequest
=
http
.
createHttp
();
httpRequest
.
request2
(
Address_Baidu
).
then
(
function
()
{
console
.
log
(
CaseName
+
"
request2 Finish
"
);
httpRequest
.
request2
(
Address_Baidu
).
then
(
function
(
data
)
{
console
.
log
(
CaseName
+
"
request2 Finish responseCode
"
+
data
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -172,6 +152,7 @@ export default function HttpRequest2JsunitTest() {
setTimeout
(()
=>
{
expect
(
dataReceive_status
).
assertEqual
(
true
);
console
.
log
(
CaseName
+
"
on dataReceive Finish
"
);
httpRequest
.
destroy
();
done
();
},
delayTime
);
}).
catch
(
function
(
err
)
{
...
...
@@ -203,6 +184,7 @@ export default function HttpRequest2JsunitTest() {
expect
(
dataReceive_status
).
assertEqual
(
false
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataReceive Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -232,6 +214,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest
.
off
(
"
dataReceive
"
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataReceive Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -260,6 +243,7 @@ export default function HttpRequest2JsunitTest() {
expect
(
dataProgress_status
).
assertEqual
(
true
);
},
delayTime
);
console
.
log
(
CaseName
+
"
on dataProgress Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -289,6 +273,7 @@ export default function HttpRequest2JsunitTest() {
expect
(
dataProgress_status
).
assertEqual
(
false
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataProgress Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -318,6 +303,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest
.
off
(
"
dataProgress
"
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataProgress Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -347,6 +333,7 @@ export default function HttpRequest2JsunitTest() {
expect
(
dataEnd_status
).
assertEqual
(
true
);
},
delayTime
);
console
.
log
(
CaseName
+
"
on dataEnd Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -377,6 +364,7 @@ export default function HttpRequest2JsunitTest() {
expect
(
dataEnd_status
).
assertEqual
(
false
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataEnd Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
@@ -406,6 +394,7 @@ export default function HttpRequest2JsunitTest() {
httpRequest
.
off
(
"
dataEnd
"
);
},
delayTime
);
console
.
log
(
CaseName
+
"
off dataEnd Finish
"
);
httpRequest
.
destroy
();
done
();
}).
catch
(
function
(
err
)
{
console
.
log
(
CaseName
+
"
: error =
"
+
JSON
.
stringify
(
err
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录