Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
774f7362
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看板
未验证
提交
774f7362
编写于
9月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5770 【杂散】【上传下载】优化request测试用例
Merge pull request !5770 from 张育帅/master
上级
7482ce33
46f8b755
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
380 addition
and
476 deletion
+380
-476
request/BUILD.gn
request/BUILD.gn
+1
-1
request/RequestTest_Stage/AppScope/app.json
request/RequestTest_Stage/AppScope/app.json
+15
-21
request/RequestTest_Stage/AppScope/resources/base/element/string.json
...estTest_Stage/AppScope/resources/base/element/string.json
+8
-8
request/RequestTest_Stage/BUILD.gn
request/RequestTest_Stage/BUILD.gn
+5
-5
request/RequestTest_Stage/Test.json
request/RequestTest_Stage/Test.json
+3
-3
request/RequestTest_Stage/entry/src/main/ets/Application/AbilityStage.ts
...Test_Stage/entry/src/main/ets/Application/AbilityStage.ts
+0
-23
request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
...st_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
+9
-0
request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
...tTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
+66
-51
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ge/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+19
-26
request/RequestTest_Stage/entry/src/main/ets/pages/index.ets
request/RequestTest_Stage/entry/src/main/ets/pages/index.ets
+37
-42
request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets
...equestTest_Stage/entry/src/main/ets/pages/index/index.ets
+0
-51
request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
...t/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
+2
-1
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+115
-117
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+13
-14
request/RequestTest_Stage/entry/src/main/module.json
request/RequestTest_Stage/entry/src/main/module.json
+43
-44
request/RequestTest_Stage/entry/src/main/resources/base/element/color.json
...st_Stage/entry/src/main/resources/base/element/color.json
+8
-0
request/RequestTest_Stage/entry/src/main/resources/base/element/string.json
...t_Stage/entry/src/main/resources/base/element/string.json
+16
-36
request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json
...age/entry/src/main/resources/base/profile/main_pages.json
+4
-5
request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
...stTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
+1
-1
request/RequestTest_ets/entry/src/main/ets/test/List.test.ets
...est/RequestTest_ets/entry/src/main/ets/test/List.test.ets
+1
-1
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
...Test_ets/entry/src/main/ets/test/requestDownload.test.ets
+2
-3
request/RequestTest_ets/entry/src/main/ets/test/requestSystem.test.ets
...stTest_ets/entry/src/main/ets/test/requestSystem.test.ets
+10
-20
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
...stTest_ets/entry/src/main/ets/test/requestUpload.test.ets
+2
-3
未找到文件。
request/BUILD.gn
浏览文件 @
774f7362
# Copyright (C) 202
1
Huawei Device Co., Ltd.
# Copyright (C) 202
2
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
...
...
request/RequestTest_Stage/AppScope/app.json
浏览文件 @
774f7362
{
{
"app"
:{
"app"
:
{
"bundleName"
:
"com.acts.request.test"
,
"bundleName"
:
"com.acts.request.test"
,
"vendor"
:
"huawei"
,
"vendor"
:
"huawei"
,
"versionCode"
:
1000000
,
"versionCode"
:
1000000
,
"versionName"
:
"1.0.0"
,
"versionName"
:
"1.0.0"
,
"debug"
:
false
,
"icon"
:
"$media:app_icon"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:app_name"
,
"label"
:
"$string:app_name"
,
"distributedNotificationEnabled"
:
true
,
"description"
:
"$string:description_application"
,
"keepAlive"
:
true
,
"distributedNotificationEnabled"
:
true
,
"singleUser"
:
true
,
"keepAlive"
:
true
,
"minAPIVersion"
:
9
,
"singleUser"
:
true
,
"targetAPIVersion"
:
9
"minAPIVersion"
:
9
,
}
"targetAPIVersion"
:
9
,
}
"car"
:{
"apiCompatibleVersion"
:
9
,
"singleUser"
:
false
}
}
}
request/RequestTest_Stage/AppScope/resources/base/element/string.json
浏览文件 @
774f7362
{
{
"string"
:[
"string"
:
[
{
{
"name"
:
"app_name"
,
"name"
:
"app_name"
,
"value"
:
"ohosProject"
"value"
:
"ActsTimeAPITest"
}
}
]
]
}
}
\ No newline at end of file
request/RequestTest_Stage/BUILD.gn
浏览文件 @
774f7362
...
@@ -14,17 +14,17 @@
...
@@ -14,17 +14,17 @@
import("//test/xts/tools/build/suite.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsRequestStageTest") {
ohos_js_hap_suite("ActsRequestStageTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
deps = [
":requestStage_ets_assets",
":requestStage_ets_assets",
":requestStage_resources",
":requestStage_resources",
]
]
ets2abc = true
ets2abc = true
certificate_profile = "signature/actsRequestStageTest.p7b"
js_build_mode = "debug"
hap_name = "ActsRequestStageTest"
subsystem_name = "request"
part_name = "request"
part_name = "request"
subsystem_name = "request"
hap_name = "ActsRequestStageTest"
hap_profile = "entry/src/main/module.json"
certificate_profile = "signature/actsRequestStageTest.p7b"
}
}
ohos_app_scope("requestStage_app_profile") {
ohos_app_scope("requestStage_app_profile") {
...
...
request/RequestTest_Stage/Test.json
浏览文件 @
774f7362
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
"type"
:
"OHJSUnitTest"
,
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"180000"
,
"test-timeout"
:
"180000"
,
"bundle-name"
:
"com.acts.request.test"
,
"bundle-name"
:
"com.acts.request.test"
,
"module-name"
:
"
phone
"
,
"module-name"
:
"
entry_test
"
,
"shell-timeout"
:
"
60
0000"
,
"shell-timeout"
:
"
18
0000"
,
"testcase-timeout"
:
7
0000
"testcase-timeout"
:
60
0000
},
},
"kits"
:
[{
"kits"
:
[{
"test-file-name"
:
[
"test-file-name"
:
[
...
...
request/RequestTest_Stage/entry/src/main/ets/Application/AbilityStage.ts
已删除
100644 → 0
浏览文件 @
7482ce33
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
AbilityStage
from
"
@ohos.application.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage onCreate
"
);
globalThis
.
stageOnCreateRun
=
1
;
globalThis
.
stageContext
=
this
.
context
;
}
}
request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts
0 → 100644
浏览文件 @
774f7362
import
hilog
from
'
@ohos.hilog
'
;
import
AbilityStage
from
"
@ohos.application.AbilityStage
"
export
default
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
AbilityStage onCreate
'
);
}
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
774f7362
/*
import
hilog
from
'
@ohos.hilog
'
;
* Copyright (c) 2022 Huawei Device Co., Ltd.
import
Window
from
'
@ohos.window
'
;
* Licensed under the Apache License, Version 2.0 (the "License");
import
{
Hypium
}
from
'
@ohos/hypium
'
;
* you may not use this file except in compliance with the License.
import
testsuite
from
'
../test/List.test
'
;
* You may obtain a copy of the License at
import
Ability
from
'
@ohos.application.Ability
'
;
*
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
;
* http://www.apache.org/licenses/LICENSE-2.0
*
export
default
class
MainAbility
extends
Ability
{
* Unless required by applicable law or agreed to in writing, software
onCreate
(
want
,
launchParam
)
{
* distributed under the License is distributed on an "AS IS" BASIS,
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onCreate
'
);
* See the License for the specific language governing permissions and
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
want param:
'
+
JSON
.
stringify
(
want
)
??
''
);
* limitations under the License.
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
launchParam:
'
+
JSON
.
stringify
(
launchParam
)
??
''
);
*/
import
Ability
from
'
@ohos.application.Ability
'
var
abilityDelegator
:
any
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
export
default
class
MainAbility
extends
Ability
{
var
abilityDelegatorArguments
:
any
;
onCreate
(
want
,
launchParam
){
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
();
// Ability is creating, initialize resources for this ability
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
console
.
info
(
"
requestStageTestAbility onCreate
"
)
if
(
abilityDelegator
!=
undefined
&&
abilityDelegatorArguments
!=
undefined
)
{
globalThis
.
abilityWant
=
want
;
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
start run testcase!!!
'
);
}
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
);
}
else
{
onDestroy
()
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
abilityDelegator or abilityDelegatorArguments is undefined!!!
'
);
// Ability is destroying, release resources for this ability
}
console
.
info
(
"
requestStageTestAbility onDestroy
"
)
}
}
onDestroy
()
{
onWindowStageCreate
(
windowStage
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
// Main window is created, set main page for this ability
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onDestroy
'
);
console
.
info
(
"
requestStageTestAbility onWindowStageCreate
"
)
}
globalThis
.
abilityContext
=
this
.
context
windowStage
.
setUIContent
(
this
.
context
,
"
pages/index/index
"
,
null
)
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
console
.
info
(
"
requestStageTestAbility onWindowStageCreate finish
"
)
// Main window is created, set main page for this ability
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageCreate
'
);
onWindowStageDestroy
()
{
// Main window is destroyed, release UI related resources
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
console
.
info
(
"
requestStageTestAbility onWindowStageDestroy
"
)
if
(
err
.
code
)
{
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
onForeground
()
{
return
;
// Ability has brought to foreground
}
console
.
info
(
"
requestStageTestAbility onForeground
"
)
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
}
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
});
onBackground
()
{
}
// Ability has back to background
console
.
info
(
"
requestStageTestAbility onBackground
"
)
onWindowStageDestroy
()
{
}
// Main window is destroyed, release UI related resources
};
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
\ No newline at end of file
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onWindowStageDestroy
'
);
}
onForeground
()
{
// Ability has brought to foreground
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onForeground
'
);
}
onBackground
()
{
// Ability has back to background
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
Ability onBackground
'
);
}
}
request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
浏览文件 @
774f7362
/*
import
hilog
from
'
@ohos.hilog
'
;
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
...
@@ -34,11 +21,13 @@ function translateParamsToString(parameters) {
...
@@ -34,11 +21,13 @@ function translateParamsToString(parameters) {
}
}
async
function
onAbilityCreateCallback
()
{
async
function
onAbilityCreateCallback
()
{
console
.
log
(
"
onAbilityCreateCallback
"
);
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
onAbilityCreateCallback
'
);
}
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
"
addAbilityMonitorCallback :
"
+
JSON
.
stringify
(
err
))
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
addAbilityMonitorCallback : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
}
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
...
@@ -46,11 +35,13 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -46,11 +35,13 @@ export default class OpenHarmonyTestRunner implements TestRunner {
}
}
onPrepare
()
{
onPrepare
()
{
console
.
info
(
"
OpenHarmonyTestRunner OnPrepare
"
)
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner OnPrepare
'
);
}
}
async
onRun
()
{
async
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun run
'
);
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.MainAbility
'
...
@@ -59,20 +50,22 @@ export default class OpenHarmonyTestRunner implements TestRunner {
...
@@ -59,20 +50,22 @@ export default class OpenHarmonyTestRunner implements TestRunner {
onAbilityCreate
:
onAbilityCreateCallback
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
com.acts.request.test.MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
var
cmd
=
'
aa start -d 0 -a
MainAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
var
debug
=
abilityDelegatorArguments
.
parameters
[
'
-D
'
]
if
(
debug
==
'
true
'
)
if
(
debug
==
'
true
'
)
{
{
cmd
+=
'
-D
'
cmd
+=
'
-D
'
}
}
console
.
info
(
'
cmd :
'
+
cmd
)
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
cmd : %{public}s
'
,
cmd
);
abilityDelegator
.
executeShellCommand
(
cmd
,
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : err : %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
stdResult
??
''
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
executeShellCommand : data : %{public}s
'
,
d
.
exitCode
??
''
);
})
})
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
%{public}s
'
,
'
OpenHarmonyTestRunner onRun end
'
);
}
}
};
}
\ No newline at end of file
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/pages/
second/second
.ets
→
request/RequestTest_Stage/entry/src/main/ets/pages/
index
.ets
浏览文件 @
774f7362
/*
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import router from '@system.router';
import hilog from '@ohos.hilog';
@Entry
@Component
@Entry
struct Second {
@Component
private content: string = "Second Page"
struct Index {
aboutToAppear() {
build() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
Text(`${this.content}`)
}
.fontSize(50)
.fontWeight(FontWeight.Bold)
@State message: string = 'REQUEST TEST'
Button() {
build() {
Text('back to index')
Row() {
.fontSize(20)
Column() {
.fontWeight(FontWeight.Bold)
Text(this.message)
}.type(ButtonType.Capsule)
.fontSize(50)
.margin({
.fontWeight(FontWeight.Bold)
top: 20
}
})
.width('100%')
.backgroundColor('#0D9FFB')
}
.onClick(() => {
.height('100%')
router.back()
}
})
}
.width('100%')
.height('100%')
}
}
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets
已删除
100644 → 0
浏览文件 @
7482ce33
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../test/List.test'
@Entry
@Component
struct Index {
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {})
}
.width('100%')
.height('100%')
}
aboutToAppear(){
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets
浏览文件 @
774f7362
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
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() {
...
...
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
774f7362
// @ts-nocheck
/*
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import request from "@ohos.request";
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import request from "@ohos.request";
export default function requestDownloadJSUnit() {
export default function requestDownloadJSUnit() {
describe('requestDownloadJSUnit', function () {
describe('requestDownloadTest', function () {
console.info('################################request download Test start');
console.info('################################request download Test start');
/**
/**
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/
*/
beforeAll(function () {
beforeAll(function () {
console.info('beforeAll: Prerequisites are executed.');
console.info('beforeAll: Prerequisites are executed.');
});
});
/**
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
*/
beforeEach(function () {
beforeEach(function () {
console.info('beforeEach: Prerequisites is executed.');
console.info('beforeEach: Prerequisites is executed.');
});
});
/**
/**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/
*/
afterEach(function () {
afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.');
console.info('afterEach: Test case-level clearance conditions is executed.');
});
});
/**
/**
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/
*/
afterAll(function () {
afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition is executed');
console.info('afterAll: Test suite-level cleanup condition is executed');
});
});
let downloadTask;
let downloadTask;
let downloadConfig = {
let downloadConfig = {
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
header: {
header: {
headers: 'http'
headers: 'http'
},
},
enableMetered: false,
enableMetered: false,
enableRoaming: false,
enableRoaming: false,
description: 'XTS download test!',
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
networkType: request.NETWORK_WIFI,
filePath: 'internal://cache/test.txt',
filePath: 'internal://cache/test.txt',
title: 'XTS download test!',
title: 'XTS download test!',
background: true
background: true
}
}
/**
/**
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001
* @tc.desc Starts a download session.
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level 2
* @tc.level : Level 2
*/
*/
it('SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) {
it('SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------");
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------");
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let context = abilityDelegator.getAppContext();
let context = abilityDelegator.getAppContext();
try {
try {
request.download(context, downloadConfig, (data)=>{
request.download(context, downloadConfig, (data)=>{
downloadTask = data;
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
expect(true).assertEqual(downloadTask != undefined);
});
});
} catch (err) {
} catch (err) {
console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 error: " + err);
console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
expect().assertFail();
}
}
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 end-----------------------");
done();
done();
});
});
/**
/**
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001
* @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001
* @tc.desc Starts a download session.
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level 2
* @tc.level : Level 2
*/
*/
it('SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001', 0, async function (done) {
it('SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 is starting-----------------------");
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 is starting-----------------------");
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let context = abilityDelegator.getAppContext();
let context = abilityDelegator.getAppContext();
request.download(context, downloadConfig).then(data => {
request.download(context, downloadConfig).then(data => {
downloadTask = data;
downloadTask = data;
console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
expect(true).assertEqual(downloadTask != undefined);
expect(true).assertEqual(downloadTask != undefined);
}).catch(err => {
}).catch(err => {
console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 error: " + err);
console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
expect().assertFail();
})
})
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------");
console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------");
done();
done();
});
});
});
}
})
\ No newline at end of file
}
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
774f7362
// @ts-nocheck
/*
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -14,45 +13,45 @@
...
@@ -14,45 +13,45 @@
* limitations under the License.
* limitations under the License.
*/
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import request from "@ohos.request";
import request from "@ohos.request";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function requestUploadJSUnit() {
export default function requestUploadJSUnit() {
describe('requestUpload
Tes
t', function () {
describe('requestUpload
JSUni
t', function () {
console.info('################################request upload Test start');
console.info('################################request upload Test start');
/**
/**
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
* beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.
*/
*/
beforeAll(function () {
beforeAll(function () {
console.info('beforeAll: Prerequisites are executed.');
console.info('beforeAll: Prerequisites are executed.');
});
});
/**
/**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/
*/
beforeEach(function () {
beforeEach(function () {
console.info('beforeEach: Prerequisites is executed.');
console.info('beforeEach: Prerequisites is executed.');
});
});
/**
/**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/
*/
afterEach(function () {
afterEach(function () {
console.info('afterEach: Test case-level clearance conditions is executed.');
console.info('afterEach: Test case-level clearance conditions is executed.');
});
});
/**
/**
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
* afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed.
*/
*/
afterAll(function () {
afterAll(function () {
console.info('afterAll: Test suite-level cleanup condition is executed');
console.info('afterAll: Test suite-level cleanup condition is executed');
});
});
/**
/**
* sleep function.
* sleep function.
*/
*/
function sleep(date, time){
function sleep(date, time){
while(Date.now() - date <= time);
while(Date.now() - date <= time);
}
}
...
...
request/RequestTest_Stage/entry/src/main/module.json
浏览文件 @
774f7362
{
{
"module"
:
{
"module"
:
{
"name"
:
"phone"
,
"name"
:
"entry_test"
,
"type"
:
"entry"
,
"type"
:
"entry"
,
"srcEntrance"
:
"./ets/Application/AbilityStage.ts"
,
"srcEntrance"
:
"./ets/Application/MyAbilityStage.ts"
,
"description"
:
"$string:phone_entry_dsc"
,
"description"
:
"$string:entry_desc"
,
"mainElement"
:
"MainAbility"
,
"mainElement"
:
"MainAbility"
,
"deviceTypes"
:
[
"deviceTypes"
:
[
"phone"
"phone"
],
],
"deliveryWithInstall"
:
true
,
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"installationFree"
:
false
,
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"pages"
:
"$profile:main_pages"
,
"abilities"
:
[
"abilities"
:
[
{
{
"name"
:
"MainAbility"
,
"name"
:
"com.acts.request.test.MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
"description"
:
"$string:MainAbility_desc"
,
"description"
:
"$string:phone_entry_main"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"label"
:
"$string:MainAbility_label"
,
"label"
:
"$string:entry_label"
,
"startWindowIcon"
:
"$media:icon"
,
"visible"
:
true
,
"startWindowBackground"
:
"$color:white"
,
"orientation"
:
"portrait"
,
"visible"
:
true
,
"launchType"
:
"singleton"
,
"skills"
:
[
"skills"
:
[
{
{
"entities"
:
[
"actions"
:
[
"entity.system.home"
"action.system.home"
],
],
"actions"
:
[
"entities"
:[
"action.system.home"
"entity.system.home"
]
]
}
}
]
]
}
}
],
],
"requestPermissions"
:
[
"requestPermissions"
:
[
{
{
"name"
:
"ohos.permission.INTERNET"
,
"name"
:
"ohos.permission.INTERNET"
,
"reason"
:
"need use ohos.permission.INTERNET."
"reason"
:
"need use ohos.permission.INTERNET."
}
}
]
]
}
}
}
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
774f7362
{
"color"
:
[
{
"name"
:
"white"
,
"value"
:
"#FFFFFF"
}
]
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/resources/base/element/string.json
浏览文件 @
774f7362
{
{
"string"
:
[
"string"
:
[
{
{
"name"
:
"phone_entry_dsc"
,
"name"
:
"entry_desc"
,
"value"
:
"i am an entry for phone"
"value"
:
"description"
},
},
{
{
"name"
:
"phone_entry_main"
,
"name"
:
"MainAbility_desc"
,
"value"
:
"the phone entry ability"
"value"
:
"description"
},
},
{
{
"name"
:
"entry_label"
,
"name"
:
"MainAbility_label"
,
"value"
:
"ActsImeAbilityTest"
"value"
:
"ActsTimeAPITest"
},
}
{
]
"name"
:
"ime_description"
,
}
"value"
:
"input method extension ability."
\ No newline at end of file
},
{
"name"
:
"ime_label"
,
"value"
:
"inputMethod extension ability services."
},
{
"name"
:
"ime_label_1"
,
"value"
:
"inputMethod extension ability services_1."
},
{
"name"
:
"description_application"
,
"value"
:
"demo for test"
},
{
"name"
:
"app_name"
,
"value"
:
"Demo"
}
]
}
request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
774f7362
{
{
"src"
:
[
"src"
:
[
"pages/index/index"
,
"pages/index"
"pages/second/second"
]
]
}
}
\ No newline at end of file
request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
774f7362
...
@@ -26,7 +26,7 @@ struct MyComponent {
...
@@ -26,7 +26,7 @@ struct MyComponent {
alignItems: ItemAlign.Center,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
justifyContent: FlexAlign.Center
}) {
}) {
Text('REQUEST
ETS
TEST')
Text('REQUEST TEST')
.fontSize(50)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}
}
...
...
request/RequestTest_ets/entry/src/main/ets/test/List.test.ets
浏览文件 @
774f7362
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import requestUploadJSUnit from './requestUpload.test';
import requestUploadJSUnit from './requestUpload.test';
import requestDownloadJSUnit from './requestDownload.test';
import requestDownloadJSUnit from './requestDownload.test';
import requestSystemJSUnit from './requestSystem
JSUni
t';
import requestSystemJSUnit from './requestSystem
.tes
t';
export default function testsuite() {
export default function testsuite() {
requestUploadJSUnit()
requestUploadJSUnit()
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
774f7362
// @ts-nocheck
/*
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -14,9 +13,9 @@
...
@@ -14,9 +13,9 @@
* limitations under the License.
* limitations under the License.
*/
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import request from "@ohos.request";
import request from "@ohos.request";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
export default function requestDownloadJSUnit() {
export default function requestDownloadJSUnit() {
describe('requestDownloadTest', function () {
describe('requestDownloadTest', function () {
...
...
request/RequestTest_ets/entry/src/main/ets/test/requestSystem
JSUni
t.ets
→
request/RequestTest_ets/entry/src/main/ets/test/requestSystem
.tes
t.ets
浏览文件 @
774f7362
// @ts-nocheck
/**
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -13,20 +12,14 @@
...
@@ -13,20 +12,14 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {describe, it, expect} from 'hypium/index';
import request from '@system.request';
import request from '@system.request';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
export default function requestSystemJSUnit() {
export default function requestSystemJSUnit() {
describe('requestSystemJSUnit', function () {
describe('requestSystemJSUnit', function () {
console.info('****************start requestSystemTest*****************')
console.info('****************start requestSystemTest*****************')
/**
* sleep function.
*/
function sleep(date, time){
while(Date.now() - date <= time);
}
/**
/**
* @tc.name: ohos.SUB_REQUESTSYSTEM_UPLOAD_API_0001
* @tc.name: ohos.SUB_REQUESTSYSTEM_UPLOAD_API_0001
* @tc.desc: Upload files.
* @tc.desc: Upload files.
...
@@ -70,14 +63,13 @@ export default function requestSystemJSUnit() {
...
@@ -70,14 +63,13 @@ export default function requestSystemJSUnit() {
}
}
try{
try{
let result = request.upload(UploadRequestOptions);
let result = request.upload(UploadRequestOptions);
sleep(500)
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + result);
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + result);
expect(true).assertEqual(true)
expect(true).assertEqual(true)
;
}catch(err){
}catch(err){
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + err);
console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + err);
}
}
console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 end-----------------------");
console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 end-----------------------");
done()
done()
;
});
});
/**
/**
...
@@ -109,15 +101,14 @@ export default function requestSystemJSUnit() {
...
@@ -109,15 +101,14 @@ export default function requestSystemJSUnit() {
}
}
}
}
try{
try{
let result = request.download(DownloadRequestOptions)
let result = request.download(DownloadRequestOptions);
sleep(500)
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 upload err:' + result);
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 upload err:' + result);
expect(result == null).assertEqual(true)
expect(result == null).assertEqual(true)
;
}catch(err){
}catch(err){
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete' + err);
console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete' + err);
}
}
done()
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 end-----------------------");
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 end-----------------------");
done();
});
});
/**
/**
...
@@ -145,12 +136,11 @@ export default function requestSystemJSUnit() {
...
@@ -145,12 +136,11 @@ export default function requestSystemJSUnit() {
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download complete');
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download complete');
}
}
}
}
let result = request.onDownloadComplete(OnDownloadCompleteOptions)
let result = request.onDownloadComplete(OnDownloadCompleteOptions);
sleep(500)
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 upload err:' + result);
console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 upload err:' + result);
expect(result == null).assertEqual(true)
expect(result == null).assertEqual(true);
done()
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 end-----------------------");
console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 end-----------------------");
done();
});
});
})
})
}
}
request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
774f7362
// @ts-nocheck
/*
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -14,9 +13,9 @@
...
@@ -14,9 +13,9 @@
* limitations under the License.
* limitations under the License.
*/
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import request from "@ohos.request";
import request from "@ohos.request";
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
export default function requestUploadJSUnit() {
export default function requestUploadJSUnit() {
describe('requestUploadTest', function () {
describe('requestUploadTest', function () {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录