Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3ff02a42
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,发现更多精彩内容 >>
未验证
提交
3ff02a42
编写于
11月 28, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6729 【上传下载】订阅事件接口XTS优化
Merge pull request !6729 from 何海涛/request1128
上级
f306257c
de6363ce
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1160 addition
and
799 deletion
+1160
-799
request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
...st_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
+1
-1
request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
...tTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-1
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ge/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+6
-0
request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
...t/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
+2
-2
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+565
-72
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+88
-16
request/RequestTest_ets/Test.json
request/RequestTest_ets/Test.json
+0
-2
request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ts/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+9
-3
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+479
-628
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
...stTest_ets/entry/src/main/ets/test/requestUpload.test.ets
+9
-74
未找到文件。
request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
浏览文件 @
3ff02a42
import
hilog
from
'
@ohos.hilog
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
AbilityStage
from
"
@ohos.app
.ability
.AbilityStage
"
import
AbilityStage
from
"
@ohos.app
lication
.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
onCreate
()
{
...
...
request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
3ff02a42
...
@@ -2,7 +2,7 @@ import hilog from '@ohos.hilog';
...
@@ -2,7 +2,7 @@ import hilog from '@ohos.hilog';
import
Window
from
'
@ohos.window
'
;
import
Window
from
'
@ohos.window
'
;
import
{
Hypium
}
from
'
@ohos/hypium
'
;
import
{
Hypium
}
from
'
@ohos/hypium
'
;
import
testsuite
from
'
../test/List.test
'
;
import
testsuite
from
'
../test/List.test
'
;
import
Ability
from
'
@ohos.app
.ability.UI
Ability
'
;
import
Ability
from
'
@ohos.app
lication.
Ability
'
;
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
;
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
;
export
default
class
MainAbility
extends
Ability
{
export
default
class
MainAbility
extends
Ability
{
...
...
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
3ff02a42
...
@@ -59,6 +59,12 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -59,6 +59,12 @@ export default class OpenHarmonyTestRunner implements TestRunner {
}
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
abilityDelegator
.
executeShellCommand
(
"
echo
\"
123456
\"
> /data/app/el2/100/base/com.acts.requesttest.test/haps/entry_test/cache/test.txt
"
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
abilityDelegator
.
executeShellCommand
(
cmd
,
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
(
err
:
any
,
d
:
any
)
=>
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
...
...
request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
浏览文件 @
3ff02a42
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
import requestUploadJSUnit from './requestUpload.test';
import requestUploadJSUnit from './requestUpload.test';
import requestDownloadJSUnit from './requestDownload.test';
import requestDownloadJSUnit from './requestDownload.test';
export default function testsuite() {
export default function testsuite() {
requestUploadJSUnit()
requestDownloadJSUnit()
requestDownloadJSUnit()
requestUploadJSUnit()
}
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
3ff02a42
此差异已折叠。
点击以展开。
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
3ff02a42
...
@@ -114,7 +114,6 @@ export default function requestUploadJSUnit() {
...
@@ -114,7 +114,6 @@ export default function requestUploadJSUnit() {
});
});
} catch (err) {
} catch (err) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 error: " + err);
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
}
}
setTimeout(()=>{
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 end-----------------------");
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 end-----------------------");
...
@@ -157,7 +156,6 @@ export default function requestUploadJSUnit() {
...
@@ -157,7 +156,6 @@ export default function requestUploadJSUnit() {
});
});
} catch (e) {
} catch (e) {
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 error: " + JSON.stringify(e));
console.info("====>SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 error: " + JSON.stringify(e));
expect(e).assertFail();
}
}
setTimeout(()=>{
setTimeout(()=>{
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 end-----------------------");
console.info("====>------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 end-----------------------");
...
@@ -245,19 +243,28 @@ export default function requestUploadJSUnit() {
...
@@ -245,19 +243,28 @@ export default function requestUploadJSUnit() {
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {}));
uploadTask.off('complete', () => {
uploadTask.off('complete', () => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
try{
expect(true).assertEqual(true);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
}catch(err){
console.debug("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 complete err"+ JSON.stringify(err));
done();
}
});
});
uploadTask.off('fail', () => {
uploadTask.off('fail', () => {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
try{
expect(true).assertEqual(true);
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success");
expect(true).assertEqual(true);
}catch(err){
console.debug("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 fail err" + JSON.stringify(err));
done();
}
});
});
}catch(err){
}catch(err){
expect().assertFail();
expect().assertFail();
done();
done();
}
}
});
});
} catch (e) {
} catch (e) {
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e));
console.info("====>SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e));
...
@@ -281,16 +288,15 @@ export default function requestUploadJSUnit() {
...
@@ -281,16 +288,15 @@ export default function requestUploadJSUnit() {
try {
try {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data)=>{
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data)=>{
uploadTask = data;
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
console.info("
====>
SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
try{
try{
expect(true).assertEqual(uploadTask != undefined);
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 except error: " + e);
console.info("
====>
SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 except error: " + e);
}
}
});
});
} catch (err) {
} catch (err) {
console.error("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
console.error("====>SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
};
};
setTimeout(()=>{
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
...
@@ -310,18 +316,18 @@ export default function requestUploadJSUnit() {
...
@@ -310,18 +316,18 @@ export default function requestUploadJSUnit() {
try{
try{
request.uploadFile(globalThis.abilityContext, uploadConfig).then(data => {
request.uploadFile(globalThis.abilityContext, uploadConfig).then(data => {
uploadTask = data;
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
console.info("
====>
SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
try{
try{
expect(true).assertEqual(uploadTask != undefined);
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 except error: " + e);
console.info("
====>
SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 except error: " + e);
}
}
}).catch(err => {
}).catch(err => {
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 error: " + err);
console.error("
====>
SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
expect().assertFail();
})
})
}catch(err){
}catch(err){
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
console.error("
====>
SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
}
setTimeout(()=>{
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
...
@@ -329,5 +335,71 @@ export default function requestUploadJSUnit() {
...
@@ -329,5 +335,71 @@ export default function requestUploadJSUnit() {
}, 10000);
}, 10000);
});
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0001
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data) => {
try{
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete((err, data) => {
try{
if (err) {
console.error('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 Failed to delete the uploadTask task.');
expect().assertFail();
done();
}
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask task delete success.');
expect(typeof data == "boolean").assertTrue();
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 end-----------------------");
done();
}catch(err){
console.error('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 delete error' + err);
done();
}
});
} catch (error) {
console.error('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 delete catch error' + error);
done();
}
})
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0002
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
try{
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete().then(data => {
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 delete data:' + JSON.stringify(data));
expect(data).assertEqual(true);
done();
}).catch((err) => {
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 Failed to delete the uploadTask task.');
expect().assertFail();
done();
})
}catch(err){
console.error('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 delete catch err');
done();
}
})
});
})
})
}
}
request/RequestTest_ets/Test.json
浏览文件 @
3ff02a42
...
@@ -16,8 +16,6 @@
...
@@ -16,8 +16,6 @@
{
{
"type"
:
"ShellKit"
,
"type"
:
"ShellKit"
,
"run-command"
:
[
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/com.acts.requesttest/haps/entry/cache"
,
"echo
\"
123456
\"
> /data/app/el2/100/base/com.acts.requesttest/haps/entry/cache/test.txt"
]
]
}
}
]
]
...
...
request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
3ff02a42
...
@@ -54,15 +54,21 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -54,15 +54,21 @@ export default class OpenHarmonyTestRunner implements TestRunner {
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
let
lMonitor
=
{
abilityName
:
testAbilityName
,
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.MainAbility
'
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.MainAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
abilityDelegator
.
executeShellCommand
(
"
echo 123456 > /data/app/el2/100/base/com.acts.requesttest/haps/entry/cache/test.txt
"
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
(
err
:
any
,
d
:
any
)
=>
{
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
3ff02a42
此差异已折叠。
点击以展开。
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
3ff02a42
...
@@ -100,7 +100,7 @@ export default function requestUploadJSUnit() {
...
@@ -100,7 +100,7 @@ export default function requestUploadJSUnit() {
expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(1);
expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(1);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0001 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0001 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0001 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0001 end-----------------------");
done();
done();
...
@@ -127,7 +127,7 @@ export default function requestUploadJSUnit() {
...
@@ -127,7 +127,7 @@ export default function requestUploadJSUnit() {
expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(5);
expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(5);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0002 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0002 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0002 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0002 end-----------------------");
done();
done();
...
@@ -154,7 +154,7 @@ export default function requestUploadJSUnit() {
...
@@ -154,7 +154,7 @@ export default function requestUploadJSUnit() {
expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(0);
expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(0);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0003 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0003 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0003 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0003 end-----------------------");
done();
done();
...
@@ -181,7 +181,7 @@ export default function requestUploadJSUnit() {
...
@@ -181,7 +181,7 @@ export default function requestUploadJSUnit() {
expect(request.SESSION_FAILED).assertEqual(4);
expect(request.SESSION_FAILED).assertEqual(4);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0004 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0004 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0004 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0004 end-----------------------");
done();
done();
...
@@ -208,7 +208,7 @@ export default function requestUploadJSUnit() {
...
@@ -208,7 +208,7 @@ export default function requestUploadJSUnit() {
expect(request.SESSION_SUCCESSFUL).assertEqual(0);
expect(request.SESSION_SUCCESSFUL).assertEqual(0);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0005 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0005 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------");
done();
done();
...
@@ -245,7 +245,7 @@ export default function requestUploadJSUnit() {
...
@@ -245,7 +245,7 @@ export default function requestUploadJSUnit() {
expect(request.ERROR_UNSUPPORTED_NETWORK_TYPE).assertEqual(10);
expect(request.ERROR_UNSUPPORTED_NETWORK_TYPE).assertEqual(10);
} catch (err) {
} catch (err) {
expect(true).assertEqual(true);
expect(true).assertEqual(true);
console.error("SUB_REQUEST_UPLOAD_API_0006 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_0006 error: " + err);
}
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0006 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_0006 end-----------------------");
done();
done();
...
@@ -263,7 +263,7 @@ export default function requestUploadJSUnit() {
...
@@ -263,7 +263,7 @@ export default function requestUploadJSUnit() {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------");
try {
try {
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig));
request.upload(uploadConfig, (data) => {
request.upload(uploadConfig, (
err,
data) => {
uploadTask = data;
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
console.info("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask));
expect(uploadTask != undefined).assertEqual(true);
expect(uploadTask != undefined).assertEqual(true);
...
@@ -283,7 +283,7 @@ export default function requestUploadJSUnit() {
...
@@ -283,7 +283,7 @@ export default function requestUploadJSUnit() {
});
});
});
});
} catch (err) {
} catch (err) {
console.error("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 error: " + err);
console.error("
====>
SUB_REQUEST_UPLOAD_API_CALLBACK_0001 error: " + err);
expect().assertFail();
expect().assertFail();
}
}
sleep(Date.now(), 20000);
sleep(Date.now(), 20000);
...
@@ -324,77 +324,12 @@ export default function requestUploadJSUnit() {
...
@@ -324,77 +324,12 @@ export default function requestUploadJSUnit() {
});
});
});
});
} catch (e) {
} catch (e) {
console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
console.error("
====>
SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e));
expect(true).assertFail(true);
expect(true).assertFail(true);
}
}
sleep(Date.now(), 20000);
sleep(Date.now(), 20000);
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------");
done();
done();
});
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0001
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0001', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 is starting-----------------------");
try {
request.upload(uploadConfig, (data) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete((err, data) => {
if (err) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 Failed to delete the uploadTask task.');
expect().assertFail();
}
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0001 uploadTask task delete success.');
expect(typeof data == "boolean").assertTrue();
});
})
} catch (error) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0001 delete catch error' + error);
expect().assertFail();
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_UPLOAD_API_DELETE_0002
* @tc.desc Delete the upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_UPLOAD_API_DELETE_0002', 0, async function (done) {
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 is starting-----------------------");
try {
request.upload(uploadConfig, (data) => {
uploadTask = data;
console.info("====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask: " + uploadTask);
expect(uploadTask != undefined).assertEqual(true);
uploadTask.delete().then(data => {
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 uploadTask task delete success.');
expect(data == true).assertTrue();
}).catch((err) => {
console.info('====>SUB_REQUEST_UPLOAD_API_DELETE_0002 Failed to delete the uploadTask task.');
expect().assertFail();
})
})
} catch (error) {
console.error('SUB_REQUEST_UPLOAD_API_DELETE_0002 delete catch error');
expect().assertFail();
}
console.info("====>-----------------------SUB_REQUEST_UPLOAD_API_DELETE_0002 end-----------------------");
done();
});
})
})
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录