Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
333449b4
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
333449b4
编写于
5月 27, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8711 【杂散】【上传下载】off用例修改,错误码修改
Merge pull request !8711 from 张育帅/master
上级
28ba34e4
fe0dc649
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
68 deletion
+25
-68
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+23
-66
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
...stTest_ets/entry/src/main/ets/test/requestUpload.test.ets
+2
-2
未找到文件。
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
333449b4
...
...
@@ -304,7 +304,7 @@ export default function requestDownloadJSUnit() {
await
request
.
download
(
downloadConfig
);
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0006 second throw_error: "
+
err
);
expect
(
err
.
code
)
.
assertEqual
(
13400002
);
expect
(
err
.
code
)
.
assertEqual
(
undefined
);
downloadTask
.
off
(
'complete'
);
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
...
...
@@ -337,24 +337,12 @@ export default function requestDownloadJSUnit() {
console
.
info
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 downloadTask: "
+
downloadTask
);
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'progress'
,
async
(
data1
,
data2
)
=>
{
downloadTask
.
off
(
'progress'
,
async
(
data1
,
data2
)
=>
{
if
(
flag
==
false
){
flag
=
true
;
try
{
console
.
info
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 off data1 ="
+
data1
);
console
.
info
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 off data2 ="
+
data2
);
expect
(
data1
)
.
assertEqual
(
0
);
expect
(
data2
)
.
assertEqual
(
0
);
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 off_err: "
+
err
);
}
downloadTask
.
off
(
'progress'
);
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
}
});
downloadTask
.
off
(
'progress'
,
async
(
data1
,
data2
)
=>
{});
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
});
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 error: "
+
err
);
await
downloadTask
.
remove
();
...
...
@@ -380,18 +368,10 @@ export default function requestDownloadJSUnit() {
try
{
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'complete'
,
()
=>
{});
downloadTask
.
off
(
'complete'
,
async
()
=>
{
try
{
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 task complete.'
)
expect
(
true
)
.
assertTrue
();
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 off_err: "
+
err
);
}
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
});
downloadTask
.
off
(
'complete'
,
async
()
=>
{});
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 error: "
+
err
);
await
downloadTask
.
remove
();
...
...
@@ -417,18 +397,10 @@ export default function requestDownloadJSUnit() {
try
{
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'pause'
,
()
=>
{});
downloadTask
.
off
(
'pause'
,
async
()
=>
{
try
{
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 task pause.'
)
expect
(
true
)
.
assertTrue
();
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 off_err: "
+
err
);
}
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
});
downloadTask
.
off
(
'pause'
,
async
()
=>
{});
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 error: "
+
err
);
await
downloadTask
.
remove
();
...
...
@@ -454,17 +426,10 @@ export default function requestDownloadJSUnit() {
try
{
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'remove'
,
()
=>
{});
downloadTask
.
off
(
'remove'
,
async
()
=>
{
try
{
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 remove success'
)
expect
(
true
)
.
assertTrue
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 off_err: "
+
err
);
}
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
});
downloadTask
.
off
(
'remove'
,
async
()
=>
{});
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 error: "
+
err
);
await
downloadTask
.
remove
();
...
...
@@ -490,18 +455,10 @@ export default function requestDownloadJSUnit() {
try
{
expect
(
downloadTask
!=
undefined
)
.
assertEqual
(
true
);
downloadTask
.
on
(
'fail'
,
(
data
)
=>
{});
downloadTask
.
off
(
'fail'
,
async
(
err
)
=>
{
try
{
console
.
info
(
'====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 fail_data:'
+
JSON
.
stringify
(
err
))
expect
(
err
)
.
assertEqual
(
0
)
console
.
info
(
"====>-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 end-----------------------"
);
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 fail_error: "
+
err
);
}
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
});
downloadTask
.
off
(
'fail'
,
async
(
err
)
=>
{});
await
downloadTask
.
remove
();
fileio
.
unlinkSync
(
filePath
);
done
();
}
catch
(
err
){
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 error: "
+
err
);
await
downloadTask
.
remove
();
...
...
@@ -854,7 +811,7 @@ export default function requestDownloadJSUnit() {
fileio
.
unlinkSync
(
filePath
);
done
();
}
else
{
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 data_error: "
+
JSON
.
stringify
(
err
)
);
console
.
error
(
"====>SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 data_error: "
);
expect
()
.
assertFail
();
}
}
catch
(
err
)
{
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
333449b4
...
...
@@ -261,12 +261,12 @@ export default function requestUploadJSUnit() {
request.upload(uploadConfig, (err, uploadTask) => {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true);
uploadTask.on('progress',
function (data1, data2)
{
uploadTask.on('progress',
(data1, data2) =>
{
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2);
});
uploadTask.off('progress',
function (data1, data2)
{
uploadTask.off('progress',
(data1, data2) =>
{
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1);
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录