mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
This reverts commit 7464241ada
.
This commit is contained in:
parent
2c5b3e3265
commit
86b8aeb3f2
3 changed files with 2 additions and 87 deletions
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
add_executable(wininet_apitest Download.c InternetOpen.c testlist.c)
|
add_executable(wininet_apitest InternetOpen.c testlist.c)
|
||||||
target_link_libraries(wininet_apitest wine)
|
target_link_libraries(wininet_apitest wine)
|
||||||
set_module_type(wininet_apitest win32cui)
|
set_module_type(wininet_apitest win32cui)
|
||||||
#add_delay_importlibs(wininet_apitest wininet)
|
#add_delay_importlibs(wininet_apitest wininet)
|
||||||
add_importlibs(wininet_apitest wininet msvcrt kernel32 ntdll)
|
add_importlibs(wininet_apitest msvcrt kernel32 ntdll)
|
||||||
add_rostests_file(TARGET wininet_apitest)
|
add_rostests_file(TARGET wininet_apitest)
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* PROJECT: ReactOS API Tests
|
|
||||||
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
|
|
||||||
* PURPOSE: wininet Download testcase
|
|
||||||
* COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
|
||||||
*/
|
|
||||||
#include <apitest.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
|
||||||
#define _INC_WINDOWS
|
|
||||||
#define COM_NO_WINDOWS_H
|
|
||||||
#include <windef.h>
|
|
||||||
#include <wininet.h>
|
|
||||||
|
|
||||||
#define FILENAME "download-testdata.txt"
|
|
||||||
#define TESTDATA "This is a test data.\r\n"
|
|
||||||
|
|
||||||
static void DoDownload1(const char *url, const char *filename)
|
|
||||||
{
|
|
||||||
HANDLE hFile;
|
|
||||||
HINTERNET hInternet, hConnect;
|
|
||||||
static const char s_header[] = "Accept: */" "*\r\n\r\n";
|
|
||||||
BYTE buffer[256];
|
|
||||||
DWORD cbRead;
|
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
hFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL,
|
|
||||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
ok(hFile != INVALID_HANDLE_VALUE, "hFile was INVALID_HANDLE_VALUE.\n");
|
|
||||||
|
|
||||||
hInternet = InternetOpenA(NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
|
|
||||||
ok(hInternet != NULL, "hInternet was NULL.\n");
|
|
||||||
|
|
||||||
hConnect = InternetOpenUrlA(hInternet, url, s_header, lstrlenA(s_header),
|
|
||||||
INTERNET_FLAG_DONT_CACHE, 0);
|
|
||||||
ok(hConnect != NULL, "hConnect was NULL.\n");
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
Sleep(100);
|
|
||||||
|
|
||||||
ret = InternetReadFile(hConnect, buffer, ARRAYSIZE(buffer), &cbRead);
|
|
||||||
if (!ret || !cbRead)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!WriteFile(hFile, buffer, cbRead, &cbRead, NULL))
|
|
||||||
{
|
|
||||||
ok(0, "WriteFile returns FALSE.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ok_int(InternetCloseHandle(hConnect), TRUE);
|
|
||||||
ok_int(InternetCloseHandle(hInternet), TRUE);
|
|
||||||
CloseHandle(hFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DoDownload2(const char *url, const char *filename)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char buf[256];
|
|
||||||
DoDownload1(url, filename);
|
|
||||||
ok_int(GetFileAttributesA(FILENAME) != INVALID_FILE_ATTRIBUTES, TRUE);
|
|
||||||
fp = fopen(FILENAME, "rb");
|
|
||||||
ok(fp != NULL, "fp was NULL.\n");
|
|
||||||
ok(fgets(buf, ARRAYSIZE(buf), fp) != NULL, "fgets failed.\n");
|
|
||||||
ok_str(buf, TESTDATA);
|
|
||||||
fclose(fp);
|
|
||||||
DeleteFileA(FILENAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
START_TEST(Download)
|
|
||||||
{
|
|
||||||
// https://tinyurl.com/y4cpy2fu
|
|
||||||
// -->
|
|
||||||
// https://raw.githubusercontent.com/katahiromz/downloads/master/download-testdata.txt
|
|
||||||
DoDownload2("https://tinyurl.com/y4cpy2fu", FILENAME);
|
|
||||||
|
|
||||||
DoDownload2(
|
|
||||||
"https://raw.githubusercontent.com/katahiromz/downloads/master/download-testdata.txt",
|
|
||||||
FILENAME);
|
|
||||||
}
|
|
|
@ -3,12 +3,10 @@
|
||||||
#define STANDALONE
|
#define STANDALONE
|
||||||
#include <apitest.h>
|
#include <apitest.h>
|
||||||
|
|
||||||
extern void func_Download(void);
|
|
||||||
extern void func_InternetOpen(void);
|
extern void func_InternetOpen(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
{ "Download", func_Download },
|
|
||||||
{ "InternetOpen", func_InternetOpen },
|
{ "InternetOpen", func_InternetOpen },
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
|
|
Loading…
Reference in a new issue