diff --git a/entry/src/main/config.json b/entry/src/main/config.json index c186ef2..2e0e442 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -128,8 +128,7 @@ "pages/testResourceManagerPage", "pages/testMultiThreadWorkerPage2", "pages/testGlideOptionChangedPage", - "pages/CropImagePage", - "pages/networkTestCasePage" + "pages/CropImagePage" ], "name": ".MainAbility", "window": { diff --git a/entry/src/main/ets/MainAbility/pages/index.ets b/entry/src/main/ets/MainAbility/pages/index.ets index 02caf33..5a090ca 100644 --- a/entry/src/main/ets/MainAbility/pages/index.ets +++ b/entry/src/main/ets/MainAbility/pages/index.ets @@ -158,11 +158,7 @@ struct Index { console.log("pages/CropImagePage 页面跳转") router.push({ uri: "pages/CropImagePage" }); }).margin({ top: 15 }) - Button("测试网络") - .onClick(() => { - console.log("pages/networkTestCasePage 页面跳转") - router.push({ uri: "pages/networkTestCasePage" }); - }).margin({ top: 15 }) + } } .width('100%') diff --git a/entry/src/main/ets/MainAbility/pages/networkTestCasePage.ets b/entry/src/main/ets/MainAbility/pages/networkTestCasePage.ets deleted file mode 100644 index 0d8853c..0000000 --- a/entry/src/main/ets/MainAbility/pages/networkTestCasePage.ets +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 1521 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'; - -import request from '@ohos.requestability'; - -@Entry -@Component -struct NetworkTestCasePage { - @State hint1: string = '基础request' - - build() { - Scroll() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Button('网络上传下载1').fontSize(15) - .margin({ top: 30 }) - .onClick(() => { - console.log("网络上传下载1") - - let DownloadConfig = { - url: 'https://mirror.bjtu.edu.cn/kernel/linux/libs/libc5/libc5.cvs.tar.gz', // Resource address. - header: {}, // Adds an HTTP or HTTPS header to be included with the upload request. - enableMetered: true, - enableRoaming: true, // Allows download in a roaming network. - description: 'a', // Sets the description of a download session. - networkType: 1, // Sets the network type allowed for download. - filePath: '/data/abc1.txt', // Sets the path for downloads. - title: 'a', // Sets a download session title. - } - - let downloadTask; - - // 使用callback形式回调返回DownloadTask实例。 - console.log("------------------start Download_Test_0100-------------------"); - try { - console.log("Show me the log"); - request.download(DownloadConfig, (err, data) => { - console.log("Download_Test_0100: register download issue successful, result = " + data); - }); - } catch (error) { - console.log("logMessage Download_Test_0100: error = " + error); - } - console.log("------------------end Download_Test_0100-------------------"); - }) - - Button('网络上传下载2').fontSize(15) - .margin({ top: 30 }) - .onClick(() => { - console.log("网络上传下载2") - let downloadConfig = { - url: 'https://img-blog.csdn.net/20140514114029140', - header: {}, - enableMetered: true, - enableRoaming: true, - description: 'download libc from mirror site', - networkType: 1, - filePath: '/data/bmpSample.bmp', - title: 'download libc', - } - let downloadTask; - // 使用callback形式回调返回DownloadTask实例。 - console.log("------------------start Download_Test_0102-------------------"); - try { - console.log("Show me the log"); - request.download(downloadConfig, (err, data) => { - console.log("Download_Test_0102: register download issue successful, result = " + data); - data.on('complete',(err1,data1) =>{ - console.log("Download_Test_0700: , on complete result = "+data1); - }) - data.on('eventType',(err1,data1,data2) =>{ - console.log("Download_Test_0200: , on progress result data1 = "+data1); - console.log("Download_Test_0200: , on progress result data2 = "+data2); - }) - }); - } catch (error) { - console.log("logMessage Download_Test_0102: error = " + error); - } - console.log("------------------end Download_Test_0102-------------------"); - }) - - - - } - } - .width('100%') - .height('100%') - } - - aboutToAppear() { - } - - onBackPress() { - let cache = Glide.getMemoryCache(); - cache.print() - } -} - -var Glide; -var defaultTemp = globalThis.exports.default -if (defaultTemp != undefined) { - Glide = defaultTemp.data.glide; -} \ No newline at end of file