From 14ea885de24feec2870abb3e122c4b4974f9cc94 Mon Sep 17 00:00:00 2001 From: zhangyushuai Date: Mon, 29 Aug 2022 09:30:03 +0000 Subject: [PATCH] fixed 320159d from https://gitee.com/yu-shuai-zhang/xts_acts/pulls/5290 optimization reuqest Signed-off-by: zhangyushuai --- request/BUILD.gn | 5 +- request/RequestTest_Stage/AppScope/app.json | 21 +++ .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes request/RequestTest_Stage/BUILD.gn | 43 +++++ request/RequestTest_Stage/Test.json | 18 ++ .../src/main/ets/Application/AbilityStage.ts | 23 +++ .../src/main/ets/MainAbility/MainAbility.ts | 51 ++++++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 ++++++++ .../entry/src/main/ets/pages/index/index.ets | 51 ++++++ .../src/main/ets/pages/second/second.ets | 43 +++++ .../entry/src/main/ets/test/List.test.ets | 21 +++ .../main/ets/test/requestDownload.test.ets | 117 ++++++++++++ .../src/main/ets/test/requestUpload.test.ets | 168 ++++++++++++++++++ .../entry/src/main/module.json | 44 +++++ .../main/resources/base/element/string.json | 36 ++++ .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 6 + .../signature/actsRequestStageTest.p7b} | Bin 3443 -> 3502 bytes request/RequestTest_ets/BUILD.gn | 2 +- request/RequestTest_ets/Test.json | 2 +- .../entry/src/main/config.json | 12 ++ .../entry/src/main/ets/MainAbility/app.ets | 0 .../src/main/ets/MainAbility/pages/index.ets | 0 .../entry/src/main/ets/TestAbility/app.ets | 0 .../src/main/ets/TestAbility/pages/index.ets | 0 .../ets/TestRunner/OpenHarmonyTestRunner.ts | 0 .../entry/src/main/ets/test/List.test.ets | 0 .../main/ets/test/requestDownload.test.ets | 62 +------ .../src/main/ets/test/requestUpload.test.ets | 88 +-------- .../main/resources/base/element/string.json | 0 .../src/main/resources/base/media/icon.png | Bin .../signature/ActsRequestETSApiTest.p7b | Bin 0 -> 3535 bytes .../wallpaper_ets/entry/src/main/config.json | 18 +- 34 files changed, 772 insertions(+), 145 deletions(-) mode change 100755 => 100644 request/BUILD.gn create mode 100644 request/RequestTest_Stage/AppScope/app.json create mode 100644 request/RequestTest_Stage/AppScope/resources/base/element/string.json create mode 100644 request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png create mode 100644 request/RequestTest_Stage/BUILD.gn create mode 100644 request/RequestTest_Stage/Test.json create mode 100644 request/RequestTest_Stage/entry/src/main/ets/Application/AbilityStage.ts create mode 100644 request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts create mode 100644 request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets create mode 100644 request/RequestTest_Stage/entry/src/main/ets/pages/second/second.ets create mode 100644 request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets create mode 100644 request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets create mode 100644 request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets create mode 100644 request/RequestTest_Stage/entry/src/main/module.json create mode 100644 request/RequestTest_Stage/entry/src/main/resources/base/element/string.json create mode 100644 request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png create mode 100644 request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json rename request/{RequestTest_ets/signature/openharmony_sx.p7b => RequestTest_Stage/signature/actsRequestStageTest.p7b} (51%) mode change 100755 => 100644 mode change 100755 => 100644 request/RequestTest_ets/BUILD.gn mode change 100755 => 100644 request/RequestTest_ets/Test.json mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/config.json mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/ets/test/List.test.ets mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/resources/base/element/string.json mode change 100755 => 100644 request/RequestTest_ets/entry/src/main/resources/base/media/icon.png create mode 100644 request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b diff --git a/request/BUILD.gn b/request/BUILD.gn old mode 100755 new mode 100644 index d366567d0..444566b1d --- a/request/BUILD.gn +++ b/request/BUILD.gn @@ -14,5 +14,8 @@ import("//build/ohos_var.gni") group("request") { testonly = true - deps = [ "RequestTest_ets:ActsRequestETSApiTest" ] + deps = [ + "RequestTest_Stage:ActsRequestStageTest", + "RequestTest_ets:ActsRequestETSApiTest", + ] } diff --git a/request/RequestTest_Stage/AppScope/app.json b/request/RequestTest_Stage/AppScope/app.json new file mode 100644 index 000000000..4817f2f10 --- /dev/null +++ b/request/RequestTest_Stage/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"com.acts.request.test", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:app_name", + "description":"$string:description_application", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":9, + "targetAPIVersion":9, + "car":{ + "apiCompatibleVersion":9, + "singleUser":false + } + } +} diff --git a/request/RequestTest_Stage/AppScope/resources/base/element/string.json b/request/RequestTest_Stage/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..ee69f9a86 --- /dev/null +++ b/request/RequestTest_Stage/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png b/request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000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R$+*_00RmPx+0mW+vVG4mxd(n$(eQf3-w>JPl2UJpafrPaL5@2j}%{VE-) zBI%6Qpj*dsdH<;g!S!avA~bv^0E+ zfyJbSjPb+j;J52U)<|cIcntQBI2T#>2;tOxu{%D?kML476AErF(qN9hPva5Nkc@BF zC-tLF@3ZFb%Kpj)M<{)x*l|*Ia@ECeXo2E4h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets b/request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 000000000..e1942ec72 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,51 @@ +/* + * 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 diff --git a/request/RequestTest_Stage/entry/src/main/ets/pages/second/second.ets b/request/RequestTest_Stage/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 000000000..f9009a3e8 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..9dafbd92a --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,21 @@ +/* + * 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 requestUploadJSUnit from './requestUpload.test' +import requestDownloadJSUnit from './requestDownload.test'; + +export default function testsuite() { + requestUploadJSUnit() + requestDownloadJSUnit() +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets new file mode 100644 index 000000000..efe308363 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets @@ -0,0 +1,117 @@ +// @ts-nocheck +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import request from "@ohos.request"; + +export default function requestDownloadJSUnit() { + describe('requestDownloadTest', function () { + console.info('################################request download Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + 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(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + let downloadTask; + let downloadConfig = { + url: 'http://download.ci.openharmony.cn/version/Daily_Version/', + header: { + headers: 'http' + }, + enableMetered: false, + enableRoaming: false, + description: 'XTS download test!', + networkType: request.NETWORK_WIFI, + filePath: 'internal://cache/test.txt', + title: 'XTS download test!', + background: true + } + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------"); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let context = abilityDelegator.getAppContext(); + try { + request.download(context, downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + }); + } catch (err) { + console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 is starting-----------------------"); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let context = abilityDelegator.getAppContext(); + request.download(context, downloadConfig).then(data => { + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + }).catch(err => { + console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 error: " + err); + expect().assertFail(); + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------"); + done(); + }); + + }) +} diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets new file mode 100644 index 000000000..0ace537e4 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets @@ -0,0 +1,168 @@ +// @ts-nocheck +/* + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import request from "@ohos.request"; + +export default function requestUploadJSUnit() { + describe('requestUploadTest', function () { + console.info('################################request upload Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + 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(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + /** + * sleep function. + */ + function sleep(date, time){ + while(Date.now() - date <= time); + } + + let uploadTask; + let RequestData = { + name: 'name', + value: '123' + } + + let File = { + filename: 'test', + name: 'test', + uri: 'internal://cache/test.txt', + type: 'txt' + } + + let uploadConfig = { + url: 'http://127.0.0.1', + header: { + headers: 'http' + }, + method: 'POST', + files: [File], + data: [RequestData] + }; + + /** + * @tc.number SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig)); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let appContext = abilityDelegator.getAppContext(); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 context = " + appContext); + request.upload(appContext, uploadConfig, (data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask)); + expect(true).assertEqual(uploadTask != undefined); + + uploadTask.on('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data2 =" + data2); + }); + + uploadTask.off('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data2 =" + data2); + }); + + uploadTask.remove((err, data) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 remove =" + data); + }); + }); + } catch (err) { + console.error("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /* + * @tc.number : SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig)); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let appContext = abilityDelegator.getAppContext(); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 context = " + appContext); + request.upload(appContext, uploadConfig).then((data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 uploadTask = " + uploadTask); + expect(true).assertEqual(uploadTask != undefined); + + uploadTask.on('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.off('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.remove().then((result)=>{ + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 remove result = " + result); + expect(result).assertEqual(true); + }); + }); + } catch (e) { + console.error("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 error: " + JSON.stringify(e)); + expect(e).assertFail(); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 end-----------------------"); + done(); + }); + }) +} diff --git a/request/RequestTest_Stage/entry/src/main/module.json b/request/RequestTest_Stage/entry/src/main/module.json new file mode 100644 index 000000000..c86569a67 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/module.json @@ -0,0 +1,44 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.request.test.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.INTERNET", + "reason":"need use ohos.permission.INTERNET." + } + ] + } +} diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json b/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..ea8ffb9ce --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsImeAbilityTest" + }, + { + "name": "ime_description", + "value": "input method extension ability." + }, + { + "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" + } + ] +} diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png b/request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4Zzg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fL+eST}!rU zSL=(_x`$DZ@%kAp^|v9J5@LY~00QxoO3cDlEKJ@zV=$mRF)brjSlMP6kcWoRg$Bz( zL1lmsBxnrr1h7C#*MXCZ0|Bu#1NcBaqzyJ`>r7pkcp%#lAR5G)0Pzxy1cq&1+R@hr z8q1@6D{g?ibE!9Qd6F%XiITsBlomj{8s`?Ia=T6Ya%$QHl<2B7Vg;tV zo3aO<(#I*CjkgnAs}Xmr4Yg-b4yd(~9TGKDnq>DO<243B3peR-_I9`LSLj5^%ki$e zIldN&EhuWwUFqtbzV7zMUqv>~E2`xZ>sJZIvK*{y%O~+3L0taqkI4GzGk_e0HiH!= zn`32GAAhhw4^y!;8K)9dyhg4*UgP-)MMM@iUOqdd=C6Od{?4`clXv#-zV!OT&yBSk zUnV25Xzq(2OXQikCxQ>+cr$V;90^PaFH+~MTLyRk`@N6e{`lS@`R9xC-cxVR{BmyZ yhi~4x{9*Ff@P(NN==kURkL(AcdE?>rn=@yh|LvzwqQ`|hg@ae`wr;=SEd2$11Ad7B delta 1076 zcmZ9LPi)&%9LJk1ZRwyZe*}l_QX;r8Xr9xACTK-^&wjC;=EZShCvgbUY{#*iKeiJm zwVNJ-B2MSy!$#%3^EIls!6$whn)c+}wN5_TM?bAvLLVlixP|_5E z7Dcy`Y&O~omro>jL3IOiV>O`StpaLb#_=*mzD60Vh>6V#rrY?o5!njC4yN7R!k&mR$t$#+nIr!bL8R1Myb3xY~oB) zXGSTsBn# zeU_$sY>6b&vuOs2kWnG@Ya$=O>_7ztG43W9ei(DTx}7799L<?M6p zD0CPFC4_-I5|r%h8{HZ7v7HUFBi6HG)9aD=ir^YHr}n#!y|=Eq?)1mV<@{)R^(hb!huZq`MLYWt;UV7-@J424V--R$KelaN5=Q>ynnm< z+10sce){#vUuMYl>Zi$X!bi8HzaC!w{ - downloadTask = data; - console.info("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 downloadTask: " + downloadTask); - expect(downloadTask != undefined).assertEqual(true); - }); - } catch (err) { - console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 error: " + err); - expect().assertFail(); - } - console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 end-----------------------"); - done(); - }); - /** * @tc.number SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 * @tc.desc Starts a download session. @@ -134,29 +109,6 @@ export default function requestDownloadJSUnit() { done(); }); - /** - * @tc.number SUB_REQUEST_DOWNLOAD_API_PROMISE_0002 - * @tc.desc Starts a download session. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_REQUEST_DOWNLOAD_API_PROMISE_0002', 0, async function (done) { - console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0002 is starting-----------------------"); - let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); - let context = abilityDelegator.getAppContext(); - request.download(context, downloadConfig).then(data => { - downloadTask = data; - console.info("SUB_REQUEST_DOWNLOAD_API_PROMISE_0002 downloadTask: " + downloadTask); - expect(downloadTask != undefined).assertEqual(true); - }).catch(err => { - console.error("SUB_REQUEST_DOWNLOAD_API_PROMISE_0002 error: " + err); - expect().assertFail(); - }) - console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0002 end-----------------------"); - done(); - }); - /** * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 * @tc.desc alled when the current download session is in process. @@ -169,12 +121,12 @@ export default function requestDownloadJSUnit() { request.download( downloadConfig, (data)=>{ downloadTask = data; console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 downloadTask: " + downloadTask); - expect(downloadTask != undefined).assertEqual(true); + expect(true).assertEqual(downloadTask != undefined); downloadTask.on('progress', (data1, data2) => { console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data1 =" + data1); console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data2 =" + data2); - expect(data1 != undefined).assertEqual(true); - expect(data2 != undefined).assertEqual(true); + expect(true).assertEqual(data1 != undefined); + expect(true).assertEqual(data2 != undefined); }); }); @@ -194,7 +146,7 @@ export default function requestDownloadJSUnit() { request.download( downloadConfig, (data)=>{ downloadTask = data; console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 downloadTask: " + downloadTask); - expect(downloadTask != undefined).assertEqual(true); + expect(true).assertEqual(downloadTask != undefined); try{ downloadTask.on('complete', () => { console.info('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 task completed.') @@ -220,7 +172,7 @@ export default function requestDownloadJSUnit() { request.download( downloadConfig, (data)=>{ downloadTask = data; console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 downloadTask: " + downloadTask); - expect(downloadTask != undefined).assertEqual(true); + expect(true).assertEqual(downloadTask != undefined); try{ downloadTask.on('pause', () => { console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 task pause.') diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets index 0db63d062..30d02c27d 100644 --- a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets @@ -255,49 +255,6 @@ export default function requestUploadJSUnit() { done(); }); - /** - * @tc.number SUB_REQUEST_UPLOAD_API_CALLBACK_0002 - * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME - * @tc.desc Test requestUploadTest API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_REQUEST_UPLOAD_API_CALLBACK_0002', 0, async function (done) { - console.info("-----------------------Request_test_0006 is starting-----------------------"); - try { - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 uploadConfig = " + JSON.stringify(uploadConfig)); - let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); - let appContext = abilityDelegator.getAppContext(); - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 context = " + appContext); - request.upload(appContext, uploadConfig, (data) => { - uploadTask = data; - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 progress uploadTask =" + JSON.stringify(uploadTask)); - expect(uploadTask != undefined).assertEqual(true); - - uploadTask.on('progress', function (data1, data2) { - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 on data1 =" + data1); - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 on data2 =" + data2); - }); - - uploadTask.off('progress', function (data1, data2) { - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 off data1 =" + data1); - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 off data2 =" + data2); - }); - - uploadTask.remove((err, data) => { - console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 remove =" + data); - }); - }); - } catch (err) { - console.error("SUB_REQUEST_UPLOAD_API_CALLBACK_0002 error: " + err); - expect().assertFail(); - } - sleep(Date.now(), 20000); - console.info("-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0002 end-----------------------"); - done(); - }); - /* * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001 * @tc.name : Use getEntries get the value by mixing the string key @@ -307,6 +264,7 @@ export default function requestUploadJSUnit() { * @tc.level : Level 1 */ it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------"); try { console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig)); request.upload(uploadConfig).then((data) => { @@ -331,52 +289,12 @@ export default function requestUploadJSUnit() { }); } catch (e) { console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e)); - expect(e).assertFail(); + expect(true).assertFail(true); } sleep(Date.now(), 20000); + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------"); done(); }); - /* - * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0002 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_REQUEST_UPLOAD_API_PROMISE_0002', 0, async function (done) { - try { - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 UploadConfig = " + JSON.stringify(uploadConfig)); - let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); - let appContext = abilityDelegator.getAppContext(); - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 context = " + appContext); - request.upload(appContext, uploadConfig).then((data) => { - uploadTask = data; - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 uploadTask = " + uploadTask); - expect(data != undefined).assertEqual(true); - - uploadTask.on('headerReceive', (header) => { - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 header = " + header); - expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); - }); - - uploadTask.off('headerReceive', (header) => { - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 header = " + header); - expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); - }); - - uploadTask.remove().then((result)=>{ - console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 remove result = " + result); - expect(result).assertEqual(true); - }); - }); - } catch (e) { - console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0002 error: " + JSON.stringify(e)); - expect(e).assertFail(); - } - sleep(Date.now(), 20000); - done(); - }); }) } diff --git a/request/RequestTest_ets/entry/src/main/resources/base/element/string.json b/request/RequestTest_ets/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/resources/base/media/icon.png b/request/RequestTest_ets/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b b/request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b new file mode 100644 index 0000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