Reactos

Revert "[WININET_APITEST] Add Download testcase (#1832)" (#1839)

This reverts commit 7464241adabfbdfec5a058697632a8d3938479fb.

authored by

Katayama Hirofumi MZ and committed by
GitHub
86b8aeb3 2c5b3e32

+2 -87
+2 -2
modules/rostests/apitests/wininet/CMakeLists.txt
··· 1 1 2 - add_executable(wininet_apitest Download.c InternetOpen.c testlist.c) 2 + add_executable(wininet_apitest InternetOpen.c testlist.c) 3 3 target_link_libraries(wininet_apitest wine) 4 4 set_module_type(wininet_apitest win32cui) 5 5 #add_delay_importlibs(wininet_apitest wininet) 6 - add_importlibs(wininet_apitest wininet msvcrt kernel32 ntdll) 6 + add_importlibs(wininet_apitest msvcrt kernel32 ntdll) 7 7 add_rostests_file(TARGET wininet_apitest)
-83
modules/rostests/apitests/wininet/Download.c
··· 1 - /* 2 - * PROJECT: ReactOS API Tests 3 - * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+) 4 - * PURPOSE: wininet Download testcase 5 - * COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) 6 - */ 7 - #include <apitest.h> 8 - #include <stdio.h> 9 - 10 - #define WIN32_NO_STATUS 11 - #define _INC_WINDOWS 12 - #define COM_NO_WINDOWS_H 13 - #include <windef.h> 14 - #include <wininet.h> 15 - 16 - #define FILENAME "download-testdata.txt" 17 - #define TESTDATA "This is a test data.\r\n" 18 - 19 - static void DoDownload1(const char *url, const char *filename) 20 - { 21 - HANDLE hFile; 22 - HINTERNET hInternet, hConnect; 23 - static const char s_header[] = "Accept: */" "*\r\n\r\n"; 24 - BYTE buffer[256]; 25 - DWORD cbRead; 26 - BOOL ret; 27 - 28 - hFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, 29 - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 30 - ok(hFile != INVALID_HANDLE_VALUE, "hFile was INVALID_HANDLE_VALUE.\n"); 31 - 32 - hInternet = InternetOpenA(NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); 33 - ok(hInternet != NULL, "hInternet was NULL.\n"); 34 - 35 - hConnect = InternetOpenUrlA(hInternet, url, s_header, lstrlenA(s_header), 36 - INTERNET_FLAG_DONT_CACHE, 0); 37 - ok(hConnect != NULL, "hConnect was NULL.\n"); 38 - 39 - for (;;) 40 - { 41 - Sleep(100); 42 - 43 - ret = InternetReadFile(hConnect, buffer, ARRAYSIZE(buffer), &cbRead); 44 - if (!ret || !cbRead) 45 - break; 46 - 47 - if (!WriteFile(hFile, buffer, cbRead, &cbRead, NULL)) 48 - { 49 - ok(0, "WriteFile returns FALSE.\n"); 50 - break; 51 - } 52 - } 53 - 54 - ok_int(InternetCloseHandle(hConnect), TRUE); 55 - ok_int(InternetCloseHandle(hInternet), TRUE); 56 - CloseHandle(hFile); 57 - } 58 - 59 - static void DoDownload2(const char *url, const char *filename) 60 - { 61 - FILE *fp; 62 - char buf[256]; 63 - DoDownload1(url, filename); 64 - ok_int(GetFileAttributesA(FILENAME) != INVALID_FILE_ATTRIBUTES, TRUE); 65 - fp = fopen(FILENAME, "rb"); 66 - ok(fp != NULL, "fp was NULL.\n"); 67 - ok(fgets(buf, ARRAYSIZE(buf), fp) != NULL, "fgets failed.\n"); 68 - ok_str(buf, TESTDATA); 69 - fclose(fp); 70 - DeleteFileA(FILENAME); 71 - } 72 - 73 - START_TEST(Download) 74 - { 75 - // https://tinyurl.com/y4cpy2fu 76 - // --> 77 - // https://raw.githubusercontent.com/katahiromz/downloads/master/download-testdata.txt 78 - DoDownload2("https://tinyurl.com/y4cpy2fu", FILENAME); 79 - 80 - DoDownload2( 81 - "https://raw.githubusercontent.com/katahiromz/downloads/master/download-testdata.txt", 82 - FILENAME); 83 - }
-2
modules/rostests/apitests/wininet/testlist.c
··· 3 3 #define STANDALONE 4 4 #include <apitest.h> 5 5 6 - extern void func_Download(void); 7 6 extern void func_InternetOpen(void); 8 7 9 8 const struct test winetest_testlist[] = 10 9 { 11 - { "Download", func_Download }, 12 10 { "InternetOpen", func_InternetOpen }, 13 11 14 12 { 0, 0 }