static const char *status_string[MAX_INTERNET_STATUS];
static HANDLE hCompleteEvent, conn_close_event;
+static DWORD req_error;
#define TESTF_REDIRECT 0x01
#define TESTF_COMPRESSED 0x02
-#define TESTF_ALLOW_COOKIE 0x04
-#define TESTF_CHUNKED 0x08
+#define TESTF_CHUNKED 0x04
typedef struct {
const char *url;
"www.codeweavers.com",
"",
"Accept-Encoding: gzip, deflate",
- TESTF_COMPRESSED|TESTF_ALLOW_COOKIE
+ TESTF_COMPRESSED
},
{
"http://test.winehq.org/tests/post.php",
return proxy_enable != 0;
}
+#define test_status_code(a,b) _test_status_code(__LINE__,a,b)
+static void _test_status_code(unsigned line, HINTERNET req, DWORD excode)
+{
+ DWORD code, size, index;
+ char exbuf[10], bufa[10];
+ BOOL res;
+
+ code = 0xdeadbeef;
+ size = sizeof(code);
+ res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, NULL);
+ ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode);
+
+ code = 0xdeadbeef;
+ index = 0;
+ size = sizeof(code);
+ res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index);
+ ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode);
+ ok_(__FILE__,line)(!index, "index = %d, expected 0\n", code);
+
+ sprintf(exbuf, "%u", excode);
+
+ size = sizeof(bufa);
+ res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE, bufa, &size, NULL);
+ ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
+ ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s", bufa, exbuf);
+
+ code = 0xdeadbeef;
+ index = 1;
+ size = sizeof(code);
+ res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE||HTTP_QUERY_FLAG_NUMBER, &code, &size, &index);
+ ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
+ "HttpQueryInfo failed: %x(%d)\n", res, GetLastError());
+
+ code = 0xdeadbeef;
+ size = sizeof(code);
+ res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE||HTTP_QUERY_FLAG_REQUEST_HEADERS, &code, &size, NULL);
+ ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
+ "HttpQueryInfo failed: %x(%d)\n", res, GetLastError());
+}
+
static int close_handle_cnt;
static VOID WINAPI callback(
ok(dwStatusInformationLength == sizeof(INTERNET_ASYNC_RESULT),
"info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %d\n",
dwStatusInformationLength);
+ ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %ld\n", iar->dwResult);
trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_COMPLETE {%ld,%d} %d\n",
GetCurrentThreadId(), hInternet, dwContext,
iar->dwResult,iar->dwError,dwStatusInformationLength);
+ req_error = iar->dwError;
SetEvent(hCompleteEvent);
break;
}
CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
- if(test->flags & TESTF_ALLOW_COOKIE) {
- SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
- SET_OPTIONAL(INTERNET_STATUS_COOKIE_RECEIVED);
- }
+ SET_OPTIONAL2(INTERNET_STATUS_COOKIE_SENT,2);
+ SET_OPTIONAL2(INTERNET_STATUS_COOKIE_RECEIVED,2);
if (first_connection_to_test_url)
{
SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
goto abort;
}
+ test_status_code(hor, 0);
+
trace("HttpSendRequestA -->\n");
if(test->post_data) {
post_len = strlen(test->post_data);
"Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
trace("HttpSendRequestA <--\n");
- if (flags & INTERNET_FLAG_ASYNC)
+ if (flags & INTERNET_FLAG_ASYNC) {
WaitForSingleObject(hCompleteEvent, INFINITE);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+ }
HeapFree(GetProcessHeap(), 0, post_data);
- if(test->flags & TESTF_ALLOW_COOKIE) {
- CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
- CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_RECEIVED);
- }
+ CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
+ CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_RECEIVED);
if (first_connection_to_test_url)
{
if (! proxy_active())
ok(!length, "InternetQueryDataAvailable returned ERROR_IO_PENDING and %u length\n", length);
WaitForSingleObject(hCompleteEvent, INFINITE);
CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
+ ok(req_error, "req_error = 0\n");
continue;
}else {
ok(0, "InternetQueryDataAvailable failed: %u\n", GetLastError());
SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
SET_EXPECT(INTERNET_STATUS_NAME_RESOLVED);
}
+ SET_OPTIONAL2(INTERNET_STATUS_COOKIE_SENT, 2);
SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER);
SET_EXPECT2(INTERNET_STATUS_SENDING_REQUEST, 2);
"Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
trace("HttpSendRequestA <--\n");
- if (!rc && (GetLastError() == ERROR_IO_PENDING))
+ if (!rc && (GetLastError() == ERROR_IO_PENDING)) {
WaitForSingleObject(hCompleteEvent, INFINITE);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+ }
if (first_connection_to_test_url)
{
CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
else
todo_wine CHECK_NOT_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
+ CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
/* Sent on WinXP only if first_connection_to_test_url is TRUE, on Win98 always sent */
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
rc = InternetReadFileEx(hor, &inetbuffers, 0, 0xdeadcafe);
ok(rc, "InternetReadFileEx failed with error %u\n", GetLastError());
- trace("read %i bytes\n", inetbuffers.dwBufferLength);
+ trace("read %i bytes\n", inetbuffers.dwBufferLength);
todo_wine
{
CHECK_NOT_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
WaitForSingleObject(hCompleteEvent, INFINITE);
CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
}
else
{
static void test_proxy_indirect(int port)
{
HINTERNET hi, hc, hr;
- DWORD r, sz, val;
+ DWORD r, sz;
char buffer[0x40];
hi = InternetOpen(NULL, 0, NULL, NULL, 0);
}
ok(!strcmp(buffer, "Basic realm=\"placebo\""), "proxy auth info wrong\n");
- sz = sizeof buffer;
- r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
- ok(r, "HttpQueryInfo failed\n");
- ok(!strcmp(buffer, "407"), "proxy code wrong\n");
-
- sz = sizeof val;
- r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &val, &sz, NULL);
- ok(r, "HttpQueryInfo failed\n");
- ok(val == 407, "proxy code wrong\n");
+ test_status_code(hr, 407);
sz = sizeof buffer;
r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &sz, NULL);
r = HttpSendRequest(hr, NULL, 0, NULL, 0);
ok(r, "HttpSendRequest failed\n");
- sz = sizeof buffer;
- r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
- ok(r, "HttpQueryInfo failed\n");
- ok(!strcmp(buffer, "407"), "proxy code wrong\n");
-
+ test_status_code(hr, 407);
/* set the user + password then try again */
todo_wine {
ret = HttpSendRequest(request, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(request, 200);
InternetCloseHandle(request);
static void test_connection_header(int port)
{
HINTERNET ses, con, req;
- DWORD size, status;
BOOL ret;
ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL);
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(req, 200);
InternetCloseHandle(req);
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL);
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(req, 200);
InternetCloseHandle(req);
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL);
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(req, 200);
InternetCloseHandle(req);
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed\n");
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL);
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(req, 200);
InternetCloseHandle(req);
InternetCloseHandle(con);
ok(!res && (GetLastError() == ERROR_IO_PENDING),
"Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
WaitForSingleObject(hCompleteEvent, INFINITE);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
ok(!res && (GetLastError() == ERROR_IO_PENDING),
"Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
WaitForSingleObject(hCompleteEvent, INFINITE);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
SetEvent(conn_close_event);
WaitForSingleObject(hCompleteEvent, INFINITE);
+ ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
static void test_cookie_header(int port)
{
HINTERNET ses, con, req;
- DWORD size, status, error;
+ DWORD size, error;
BOOL ret;
char buffer[64];
ret = HttpSendRequest(req, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL);
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(req, 200);
buffer[0] = 0;
size = sizeof(buffer);
static void test_basic_authentication(int port)
{
HINTERNET session, connect, request;
- DWORD size, status;
BOOL ret;
session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ret = HttpSendRequest(request, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed %u\n", GetLastError());
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 200, "request failed with status %u\n", status);
+ test_status_code(request, 200);
InternetCloseHandle(request);
InternetCloseHandle(connect);
static void test_invalid_response_headers(int port)
{
HINTERNET session, connect, request;
- DWORD size, status;
+ DWORD size;
BOOL ret;
char buffer[256];
ret = HttpSendRequest(request, NULL, 0, NULL, 0);
ok(ret, "HttpSendRequest failed %u\n", GetLastError());
- status = 0;
- size = sizeof(status);
- ret = HttpQueryInfo( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
- ok(ret, "HttpQueryInfo failed\n");
- ok(status == 401, "unexpected status %u\n", status);
+ test_status_code(request, 401);
buffer[0] = 0;
size = sizeof(buffer);
static void test_response_without_headers(int port)
{
HINTERNET hi, hc, hr;
- DWORD r, count, size, status;
+ DWORD r, count, size;
char buffer[1024];
SetLastError(0xdeadbeef);
todo_wine ok(count == sizeof page1 - 1, "count was wrong\n");
todo_wine ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n");
- status = 0;
- size = sizeof(status);
- SetLastError(0xdeadbeef);
- r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
- todo_wine ok(r, "HttpQueryInfo failed %u\n", GetLastError());
- todo_wine ok(status == 200, "expected status 200 got %u\n", status);
+ test_status_code(hr, 200);
buffer[0] = 0;
size = sizeof(buffer);
ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
ok(index == 0, "expected 0 got %u\n", index);
- index = 0;
- size = sizeof(buffer);
- ret = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &size, &index);
- ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
- ok(index == 0, "expected 0 got %u\n", index);
-
- index = 0;
- size = sizeof(buffer);
- ret = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, buffer, &size, &index);
- ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
- ok(index == 0, "expected 0 got %u\n", index);
+ test_status_code(hr, 200);
index = 0xdeadbeef;
size = sizeof(buffer);
ok(ret, "InternetQueryOption failed %u\n", GetLastError());
ok(ctx == 3, "expected 3 got %lu\n", ctx);
+ /* INTERNET_OPTION_PROXY */
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, NULL);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, &ctx, NULL);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+
+ size = 0;
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, &size);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %u\n", error);
+ ok(size >= sizeof(INTERNET_PROXY_INFOA), "expected size to be greater or equal to the struct size\n");
+
InternetCloseHandle(req);
InternetCloseHandle(con);
InternetCloseHandle(ses);
{
HINTERNET ses, con, req;
static const char *types[] = { (const char *)6240, "*/*", "%p", "", (const char *)0xffffffff, "*/*", NULL };
- DWORD size;
+ DWORD size, error;
char buffer[32];
BOOL ret;
buffer[0] = 0;
size = sizeof(buffer);
+ SetLastError(0xdeadbeef);
ret = HttpQueryInfo(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
- ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
- ok(!strcmp(buffer, ", */*, %p, , , */*") || /* IE6 */
- !strcmp(buffer, "*/*, %p, */*"),
- "got '%s' expected '*/*, %%p, */*' or ', */*, %%p, , , */*'\n", buffer);
+ error = GetLastError();
+ ok(!ret || broken(ret), "HttpQueryInfo succeeded\n");
+ if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", error);
+ ok(broken(!strcmp(buffer, ", */*, %p, , , */*")) /* IE6 */ ||
+ broken(!strcmp(buffer, "*/*, %p, */*")) /* IE7/8 */ ||
+ !strcmp(buffer, ""), "got '%s' expected ''\n", buffer);
InternetCloseHandle(req);
InternetCloseHandle(con);
HANDLE wait;
DWORD thread;
unsigned int line;
+ DWORD expect_result;
+ BOOL is_aborted;
};
static CRITICAL_SECTION notification_cs;
EnterCriticalSection( ¬ification_cs );
+ if(info->is_aborted) {
+ LeaveCriticalSection(¬ification_cs);
+ return;
+ }
+
if (status == INTERNET_STATUS_HANDLE_CREATED)
{
DWORD size = sizeof(struct info *);
HttpQueryInfoA( handle, INTERNET_OPTION_CONTEXT_VALUE, &info, &size, 0 );
+ }else if(status == INTERNET_STATUS_REQUEST_COMPLETE) {
+ INTERNET_ASYNC_RESULT *ar = (INTERNET_ASYNC_RESULT*)buffer;
+
+ ok(buflen == sizeof(*ar), "unexpected buflen = %d\n", buflen);
+ if(info->expect_result == ERROR_SUCCESS) {
+ ok(ar->dwResult == 1, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
+ }else {
+ ok(!ar->dwResult, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
+ ok(ar->dwError == info->expect_result, "ar->dwError = %d, expected %d\n", ar->dwError, info->expect_result);
+ }
}
+
i = info->index;
if (i >= info->count)
{
return;
}
- while (info->test[i].status != status && info->test[i].optional &&
+ while (info->test[i].status != status &&
+ (info->test[i].optional || info->test[i].todo) &&
i < info->count - 1 &&
info->test[i].function == info->test[i + 1].function)
{
LeaveCriticalSection( ¬ification_cs );
}
-static void setup_test( struct info *info, enum api function, unsigned int line )
+static void setup_test( struct info *info, enum api function, unsigned int line, DWORD expect_result )
{
info->function = function;
info->line = line;
+ info->expect_result = expect_result;
}
+struct notification_data
+{
+ const struct notification *test;
+ const unsigned int count;
+ const char *method;
+ const char *host;
+ const char *path;
+ const char *data;
+ BOOL expect_conn_failure;
+};
+
static const struct notification async_send_request_ex_test[] =
{
{ internet_connect, INTERNET_STATUS_HANDLE_CREATED, 0 },
{ http_open_request, INTERNET_STATUS_HANDLE_CREATED, 0 },
{ http_send_request_ex, INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_COOKIE_SENT, 1, 0, 1 },
{ http_send_request_ex, INTERNET_STATUS_RESOLVING_NAME, 1, 0, 1 },
{ http_send_request_ex, INTERNET_STATUS_NAME_RESOLVED, 1, 0, 1 },
{ http_send_request_ex, INTERNET_STATUS_CONNECTING_TO_SERVER, 1 },
{ internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
};
-static void test_async_HttpSendRequestEx(void)
+static const struct notification async_send_request_ex_test2[] =
+{
+ { internet_connect, INTERNET_STATUS_HANDLE_CREATED, 0 },
+ { http_open_request, INTERNET_STATUS_HANDLE_CREATED, 0 },
+ { http_send_request_ex, INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_COOKIE_SENT, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_RESOLVING_NAME, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_NAME_RESOLVED, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_CONNECTING_TO_SERVER, 1, 1 },
+ { http_send_request_ex, INTERNET_STATUS_CONNECTED_TO_SERVER, 1, 1 },
+ { http_send_request_ex, INTERNET_STATUS_SENDING_REQUEST, 1 },
+ { http_send_request_ex, INTERNET_STATUS_REQUEST_SENT, 1 },
+ { http_send_request_ex, INTERNET_STATUS_REQUEST_COMPLETE, 1 },
+ { http_end_request, INTERNET_STATUS_RECEIVING_RESPONSE, 1 },
+ { http_end_request, INTERNET_STATUS_RESPONSE_RECEIVED, 1 },
+ { http_end_request, INTERNET_STATUS_REQUEST_COMPLETE, 1 },
+ { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0, 1 },
+ { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0, 1 },
+ { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, },
+ { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
+};
+
+static const struct notification async_send_request_ex_resolve_failure_test[] =
+{
+ { internet_connect, INTERNET_STATUS_HANDLE_CREATED, 0 },
+ { http_open_request, INTERNET_STATUS_HANDLE_CREATED, 0 },
+ { http_send_request_ex, INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_RESOLVING_NAME, 1 },
+ { http_send_request_ex, INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
+ { http_send_request_ex, INTERNET_STATUS_REQUEST_COMPLETE, 1 },
+ { http_end_request, INTERNET_STATUS_REQUEST_COMPLETE, 1 },
+ { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0, 1 },
+ { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0, 1 },
+ { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, },
+ { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
+};
+
+static const struct notification_data notification_data[] = {
+ {
+ async_send_request_ex_test,
+ sizeof(async_send_request_ex_test)/sizeof(async_send_request_ex_test[0]),
+ "POST",
+ "test.winehq.org",
+ "tests/posttest.php",
+ "Public ID=codeweavers"
+ },
+ {
+ async_send_request_ex_test2,
+ sizeof(async_send_request_ex_test)/sizeof(async_send_request_ex_test[0]),
+ "POST",
+ "test.winehq.org",
+ "tests/posttest.php"
+ },
+ {
+ async_send_request_ex_resolve_failure_test,
+ sizeof(async_send_request_ex_resolve_failure_test)/sizeof(async_send_request_ex_resolve_failure_test[0]),
+ "GET",
+ "brokenhost",
+ "index.html",
+ NULL,
+ TRUE
+ }
+};
+
+static void test_async_HttpSendRequestEx(const struct notification_data *nd)
{
BOOL ret;
HINTERNET ses, req, con;
DWORD size, written, error;
INTERNET_BUFFERSA b;
static const char *accept[2] = {"*/*", NULL};
- static char data[] = "Public ID=codeweavers";
char buffer[32];
+ trace("Async HttpSendRequestEx test (%s %s)\n", nd->method, nd->host);
+
InitializeCriticalSection( ¬ification_cs );
- info.test = async_send_request_ex_test;
- info.count = sizeof(async_send_request_ex_test)/sizeof(async_send_request_ex_test[0]);
+ info.test = nd->test;
+ info.count = nd->count;
info.index = 0;
info.wait = CreateEvent( NULL, FALSE, FALSE, NULL );
info.thread = GetCurrentThreadId();
+ info.is_aborted = FALSE;
ses = InternetOpen( "winetest", 0, NULL, NULL, INTERNET_FLAG_ASYNC );
ok( ses != NULL, "InternetOpen failed\n" );
pInternetSetStatusCallbackA( ses, check_notification );
- setup_test( &info, internet_connect, __LINE__ );
- con = InternetConnect( ses, "crossover.codeweavers.com", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)&info );
+ setup_test( &info, internet_connect, __LINE__, ERROR_SUCCESS );
+ con = InternetConnect( ses, nd->host, 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)&info );
ok( con != NULL, "InternetConnect failed %u\n", GetLastError() );
WaitForSingleObject( info.wait, 10000 );
- setup_test( &info, http_open_request, __LINE__ );
- req = HttpOpenRequest( con, "POST", "posttest.php", NULL, NULL, accept, 0, (DWORD_PTR)&info );
+ setup_test( &info, http_open_request, __LINE__, ERROR_SUCCESS );
+ req = HttpOpenRequest( con, nd->method, nd->path, NULL, NULL, accept, 0, (DWORD_PTR)&info );
ok( req != NULL, "HttpOpenRequest failed %u\n", GetLastError() );
WaitForSingleObject( info.wait, 10000 );
- memset( &b, 0, sizeof(INTERNET_BUFFERSA) );
- b.dwStructSize = sizeof(INTERNET_BUFFERSA);
- b.lpcszHeader = "Content-Type: application/x-www-form-urlencoded";
- b.dwHeadersLength = strlen( b.lpcszHeader );
- b.dwBufferTotal = strlen( data );
+ if(nd->data) {
+ memset( &b, 0, sizeof(INTERNET_BUFFERSA) );
+ b.dwStructSize = sizeof(INTERNET_BUFFERSA);
+ b.lpcszHeader = "Content-Type: application/x-www-form-urlencoded";
+ b.dwHeadersLength = strlen( b.lpcszHeader );
+ b.dwBufferTotal = nd->data ? strlen( nd->data ) : 0;
+ }
- setup_test( &info, http_send_request_ex, __LINE__ );
- ret = HttpSendRequestExA( req, &b, NULL, 0x28, 0 );
+ setup_test( &info, http_send_request_ex, __LINE__,
+ nd->expect_conn_failure ? ERROR_INTERNET_NAME_NOT_RESOLVED : ERROR_SUCCESS );
+ ret = HttpSendRequestExA( req, nd->data ? &b : NULL, NULL, 0x28, 0 );
ok( !ret && GetLastError() == ERROR_IO_PENDING, "HttpSendRequestExA failed %d %u\n", ret, GetLastError() );
- WaitForSingleObject( info.wait, 10000 );
+ error = WaitForSingleObject( info.wait, 10000 );
+ if(error != WAIT_OBJECT_0) {
+ skip("WaitForSingleObject returned %d, assuming DNS problem\n", error);
+ info.is_aborted = TRUE;
+ goto abort;
+ }
size = sizeof(buffer);
SetLastError( 0xdeadbeef );
ret = HttpQueryInfoA( req, HTTP_QUERY_CONTENT_ENCODING, buffer, &size, 0 );
error = GetLastError();
ok( !ret, "HttpQueryInfoA failed %u\n", GetLastError() );
- todo_wine
- ok( error == ERROR_INTERNET_INCORRECT_HANDLE_STATE,
- "expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %u\n", error );
-
- written = 0;
- size = strlen( data );
- setup_test( &info, internet_writefile, __LINE__ );
- ret = InternetWriteFile( req, data, size, &written );
- ok( ret, "InternetWriteFile failed %u\n", GetLastError() );
- ok( written == size, "expected %u got %u\n", written, size );
-
- WaitForSingleObject( info.wait, 10000 );
+ if(nd->expect_conn_failure) {
+ ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND got %u\n", error );
+ }else {
+ todo_wine
+ ok(error == ERROR_INTERNET_INCORRECT_HANDLE_STATE,
+ "expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %u\n", error );
+ }
- SetLastError( 0xdeadbeef );
- ret = HttpEndRequestA( req, (void *)data, 0x28, 0 );
- error = GetLastError();
- ok( !ret, "HttpEndRequestA succeeded\n" );
- ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error );
+ if (nd->data)
+ {
+ written = 0;
+ size = strlen( nd->data );
+ setup_test( &info, internet_writefile, __LINE__, ERROR_SUCCESS );
+ ret = InternetWriteFile( req, nd->data, size, &written );
+ ok( ret, "InternetWriteFile failed %u\n", GetLastError() );
+ ok( written == size, "expected %u got %u\n", written, size );
+
+ WaitForSingleObject( info.wait, 10000 );
+
+ SetLastError( 0xdeadbeef );
+ ret = HttpEndRequestA( req, (void *)nd->data, 0x28, 0 );
+ error = GetLastError();
+ ok( !ret, "HttpEndRequestA succeeded\n" );
+ ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error );
+ }
SetLastError( 0xdeadbeef );
- setup_test( &info, http_end_request, __LINE__ );
+ setup_test( &info, http_end_request, __LINE__,
+ nd->expect_conn_failure ? ERROR_INTERNET_OPERATION_CANCELLED : ERROR_SUCCESS);
ret = HttpEndRequestA( req, NULL, 0x28, 0 );
error = GetLastError();
ok( !ret, "HttpEndRequestA succeeded\n" );
WaitForSingleObject( info.wait, 10000 );
- setup_test( &info, internet_close_handle, __LINE__ );
+ setup_test( &info, internet_close_handle, __LINE__, ERROR_SUCCESS );
+ abort:
InternetCloseHandle( req );
InternetCloseHandle( con );
InternetCloseHandle( ses );
InternetReadFile_test(0, &test_data[2]);
InternetReadFileExA_test(INTERNET_FLAG_ASYNC);
test_open_url_async();
- test_async_HttpSendRequestEx();
+ test_async_HttpSendRequestEx(¬ification_data[0]);
+ test_async_HttpSendRequestEx(¬ification_data[1]);
+ test_async_HttpSendRequestEx(¬ification_data[2]);
InternetOpenRequest_test();
test_http_cache();
InternetOpenUrlA_test();
if (!strcmp(lpCacheEntryInfo->lpszSourceUrlName, TEST_URL))
{
found = TRUE;
+ ret = TRUE;
break;
}
SetLastError(0xdeadbeef);
ret = FindNextUrlCacheEntry(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
}
}
- ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
if (!ret)
break;
}
- ok(found, "committed url cache entry not found during enumeration\n");
+ ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
+ ok(found, "Committed url cache entry not found during enumeration\n");
ret = FindCloseUrlCache(hEnumHandle);
ok(ret, "FindCloseUrlCache failed with error %d\n", GetLastError());
ret = GetUrlCacheEntryInfoEx(TEST_URL, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
- check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
+ if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
cbCacheEntryInfo = 100000;
SetLastError(0xdeadbeef);
/* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(TEST_URL, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
+ ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(TEST_URL, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
+ ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
info = HeapAlloc(GetProcessHeap(), 0, size);
ret = GetUrlCacheEntryInfo(TEST_URL, info, &size);
+ ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
GetSystemTimeAsFileTime(&info->ExpireTime);
exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
exp_time.u.HighPart = info->ExpireTime.dwHighDateTime;
HANDLE hFile;
BYTE zero_byte = 0;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo;
+ LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo2;
DWORD cbCacheEntryInfo;
static const FILETIME filetime_zero;
FILETIME now;
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
- ret = CommitUrlCacheEntry(TEST_URL1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, NULL, 0, NULL, NULL);
+ ret = CommitUrlCacheEntry(TEST_URL1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
ret = GetUrlCacheEntryInfo(TEST_URL1, NULL, &cbCacheEntryInfo);
lpCacheEntryInfo->CacheEntryType);
ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
U(*lpCacheEntryInfo).dwExemptDelta);
- HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
- /* A subsequent commit with a different time/type doesn't change the type */
+ /* Make sure there is a notable change in timestamps */
+ Sleep(1000);
+
+ /* A subsequent commit with a different time/type doesn't change most of the entry */
GetSystemTimeAsFileTime(&now);
ret = CommitUrlCacheEntry(TEST_URL1, NULL, now, now, NORMAL_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), NULL, NULL);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
- lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
- ret = GetUrlCacheEntryInfo(TEST_URL1, lpCacheEntryInfo, &cbCacheEntryInfo);
+ lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
+ ret = GetUrlCacheEntryInfo(TEST_URL1, lpCacheEntryInfo2, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
/* but it does change the time.. */
todo_wine
- ok(memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
+ ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
"expected positive ExpireTime\n");
todo_wine
- ok(memcmp(&lpCacheEntryInfo->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
+ ok(memcmp(&lpCacheEntryInfo2->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
"expected positive LastModifiedTime\n");
- ok(lpCacheEntryInfo->CacheEntryType == (NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY) ||
- broken(lpCacheEntryInfo->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
+ ok(lpCacheEntryInfo2->CacheEntryType == (NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY) ||
+ broken(lpCacheEntryInfo2->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
"expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
- lpCacheEntryInfo->CacheEntryType);
+ lpCacheEntryInfo2->CacheEntryType);
/* and set the headers. */
todo_wine
- ok(lpCacheEntryInfo->dwHeaderInfoSize == 19,
- "expected headers size 19, got %d\n",
- lpCacheEntryInfo->dwHeaderInfoSize);
+ ok(lpCacheEntryInfo2->dwHeaderInfoSize == 19,
+ "expected headers size 19, got %d\n",
+ lpCacheEntryInfo2->dwHeaderInfoSize);
+ /* Hit rate gets incremented by 1 */
+ todo_wine
+ ok((lpCacheEntryInfo->dwHitRate + 1) == lpCacheEntryInfo2->dwHitRate,
+ "HitRate not incremented by one on commit\n");
+ /* Last access time should be updated */
+ todo_wine
+ ok(!(lpCacheEntryInfo->LastAccessTime.dwHighDateTime == lpCacheEntryInfo2->LastAccessTime.dwHighDateTime &&
+ lpCacheEntryInfo->LastAccessTime.dwLowDateTime == lpCacheEntryInfo2->LastAccessTime.dwLowDateTime),
+ "Last accessed time was not updated by commit\n");
+ /* File extension should be unset */
+ todo_wine
+ ok(lpCacheEntryInfo2->lpszFileExtension == NULL,
+ "Fileextension isn't unset: %s\n",
+ lpCacheEntryInfo2->lpszFileExtension);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
+ HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
ret = CommitUrlCacheEntry(TEST_URL, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
ret = RetrieveUrlCacheEntryFile(TEST_URL, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
- check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
+ if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(TEST_URL, NULL, &cbCacheEntryInfo);
- ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
+ ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
if (pDeleteUrlCacheEntryA)
{
ret = pDeleteUrlCacheEntryA(TEST_URL);
- todo_wine
ok(!ret, "Expected failure\n");
- todo_wine
ok(GetLastError() == ERROR_SHARING_VIOLATION,
"Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
check_file_exists(filenameA);
}
+
+ lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
+ memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
+ ret = GetUrlCacheEntryInfo(TEST_URL, lpCacheEntryInfo, &cbCacheEntryInfo);
+ ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+ ok(lpCacheEntryInfo->CacheEntryType & DELETED_CACHE_ENTRY,
+ "CacheEntryType hasn't DELETED_CACHE_ENTRY set, (flags %08x)\n",
+ lpCacheEntryInfo->CacheEntryType);
+ HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
+
if (pUnlockUrlCacheEntryFileA)
{
check_file_exists(filenameA);
ret = pUnlockUrlCacheEntryFileA(TEST_URL, 0);
- todo_wine
ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
/* By unlocking the already-deleted cache entry, the file associated
* with it is deleted..
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
ret = CreateUrlCacheEntry(TEST_URL, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(TEST_URL, NULL, &cbCacheEntryInfo);
- ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
+ ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
- "expected dwExemptDelta 864000, got %d\n",
+ "expected dwExemptDelta 86400, got %d\n",
U(*lpCacheEntryInfo).dwExemptDelta);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
if (pDeleteUrlCacheEntryA)
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(TEST_URL, NULL, &cbCacheEntryInfo);
- ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
+ ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
- "expected dwExemptDelta 864000, got %d\n",
+ "expected dwExemptDelta 86400, got %d\n",
U(*lpCacheEntryInfo).dwExemptDelta);
U(*lpCacheEntryInfo).dwExemptDelta = 0;
ret = SetUrlCacheEntryInfoA(TEST_URL, lpCacheEntryInfo,
ok(lpCacheEntryInfo->CacheEntryType & (NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY),
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
+
+ /* Recommit of Url entry keeps dwExemptDelta */
+ U(*lpCacheEntryInfo).dwExemptDelta = 8600;
+ ret = SetUrlCacheEntryInfoA(TEST_URL, lpCacheEntryInfo,
+ CACHE_ENTRY_EXEMPT_DELTA_FC);
+ ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+
+ ret = CreateUrlCacheEntry(TEST_URL, 0, "html", filenameA1, 0);
+ ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+ create_and_write_file(filenameA1, &zero_byte, sizeof(zero_byte));
+
+ ret = CommitUrlCacheEntry(TEST_URL, filenameA1, filetime_zero, filetime_zero,
+ NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY,
+ (LPBYTE)ok_header, strlen(ok_header), "html", NULL);
+ ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
+
+ ret = GetUrlCacheEntryInfo(TEST_URL, lpCacheEntryInfo, &cbCacheEntryInfo);
+ ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+ ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600,
+ "expected dwExemptDelta 8600, got %d\n",
+ U(*lpCacheEntryInfo).dwExemptDelta);
+
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
+
if (pDeleteUrlCacheEntryA)
{
ret = pDeleteUrlCacheEntryA(TEST_URL);