Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8d2cf244
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看板
未验证
提交
8d2cf244
编写于
11月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6746 【monthly_20221018】【上传下载】XTS_queryMimeType时序优化
Merge pull request !6746 from 何海涛/cherry-pick-1669730678
上级
de79c74f
b30c21b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
18 deletion
+20
-18
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+2
-2
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+18
-16
未找到文件。
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
8d2cf244
...
...
@@ -75,7 +75,7 @@ export default function requestDownloadJSUnit() {
title: 'XTS download test!',
background: false
}
request.download
File
(globalThis.abilityContext, downloadConfig, async (err, data)=>{
request.download(globalThis.abilityContext, downloadConfig, async (err, data)=>{
downloadTask = data;
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
try {
...
...
@@ -113,7 +113,7 @@ export default function requestDownloadJSUnit() {
title: 'XTS download test!',
background: false
}
request.download
File
(globalThis.abilityContext, downloadConfig).then(async (data) => {
request.download(globalThis.abilityContext, downloadConfig).then(async (data) => {
downloadTask = data;
console.info("====>SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
8d2cf244
...
...
@@ -758,13 +758,13 @@ export default function requestDownloadJSUnit() {
console
.
info
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 downloadTask: "
+
downloadTask
);
try
{
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'progress'
,
(
data1
,
data2
)
=>
{
downloadTask
.
on
(
'progress'
,
async
(
data1
,
data2
)
=>
{
try
{
if
(
data1
>
0
){
if
(
data1
>
0
&&
downloadTask
!=
null
){
downloadTask
.
queryMimeType
((
err
,
data
)
=>
{
try
{
if
(
err
)
{
console
.
error
(
'====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 err:'
+
JSON
.
stringify
(
err
));
console
.
error
(
'====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001
return_
err:'
+
JSON
.
stringify
(
err
));
expect
()
.
assertFail
();
done
();
}
...
...
@@ -772,22 +772,23 @@ export default function requestDownloadJSUnit() {
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 data:'
+
JSON
.
stringify
(
data
));
expect
(
typeof
data
==
"string"
)
.
assertTrue
();
}
else
{
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 error: "
+
JSON
.
stringify
(
err
));
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001
data_
error: "
+
JSON
.
stringify
(
err
));
expect
()
.
assertFail
();
}
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 throw_error: "
+
JSON
.
stringify
(
err
));
}
setTimeout
(
async
()
=>
{
await
downloadTask
.
remove
()
done
();
},
1000
)
}
});
}
if
(
data1
==
data2
){
downloadTask
=
null
await
downloadTask
.
remove
()
done
();
}
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 error: "
+
JSON
.
stringify
(
err
));
done
();
}
}
})
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 error: "
+
JSON
.
stringify
(
err
));
...
...
@@ -813,14 +814,15 @@ export default function requestDownloadJSUnit() {
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'progress'
,
async
(
data1
,
data2
)
=>
{
try
{
if
(
data1
>
0
){
if
(
data1
>
0
&&
downloadTask
!=
null
){
let
data
=
await
downloadTask
.
queryMimeType
()
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Download task queryMimeType.'
);
expect
(
typeof
data
==
"string"
)
.
assertTrue
();
setTimeout
(
async
()
=>
{
await
downloadTask
.
remove
()
done
();
},
1000
)
expect
(
typeof
data
==
"string"
)
.
assertTrue
();
}
if
(
data1
==
data2
){
downloadTask
=
null
await
downloadTask
.
remove
()
done
();
}
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 throw_error: "
+
JSON
.
stringify
(
err
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录