2008-09-03 12:31:52 +02:00
|
|
|
/*
|
|
|
|
* test status notifications
|
|
|
|
*
|
|
|
|
* Copyright 2008 Hans Leidekker for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winhttp.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
static const WCHAR user_agent[] = {'w','i','n','e','t','e','s','t',0};
|
2014-02-05 15:31:21 +01:00
|
|
|
static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
enum api
|
|
|
|
{
|
|
|
|
winhttp_connect = 1,
|
|
|
|
winhttp_open_request,
|
|
|
|
winhttp_send_request,
|
|
|
|
winhttp_receive_response,
|
2008-09-07 21:36:40 +02:00
|
|
|
winhttp_query_data,
|
|
|
|
winhttp_read_data,
|
|
|
|
winhttp_write_data,
|
2008-09-03 12:31:52 +02:00
|
|
|
winhttp_close_handle
|
|
|
|
};
|
|
|
|
|
|
|
|
struct notification
|
|
|
|
{
|
|
|
|
enum api function; /* api responsible for notification */
|
|
|
|
unsigned int status; /* status received */
|
2013-11-27 08:51:57 +01:00
|
|
|
BOOL todo;
|
|
|
|
BOOL ignore;
|
|
|
|
BOOL skipped_for_proxy;
|
2008-09-03 12:31:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct info
|
|
|
|
{
|
|
|
|
enum api function;
|
|
|
|
const struct notification *test;
|
|
|
|
unsigned int count;
|
|
|
|
unsigned int index;
|
2008-09-07 21:29:44 +02:00
|
|
|
HANDLE wait;
|
2008-09-09 16:45:04 +02:00
|
|
|
unsigned int line;
|
2008-09-03 12:31:52 +02:00
|
|
|
};
|
|
|
|
|
2011-01-20 13:39:05 +01:00
|
|
|
static BOOL proxy_active(void)
|
|
|
|
{
|
|
|
|
WINHTTP_PROXY_INFO proxy_info;
|
|
|
|
BOOL active = FALSE;
|
|
|
|
|
|
|
|
if (WinHttpGetDefaultProxyConfiguration(&proxy_info))
|
|
|
|
{
|
|
|
|
active = (proxy_info.lpszProxy != NULL);
|
|
|
|
if (active)
|
2012-07-19 10:22:59 +02:00
|
|
|
GlobalFree(proxy_info.lpszProxy);
|
2011-01-20 13:39:05 +01:00
|
|
|
if (proxy_info.lpszProxyBypass != NULL)
|
2012-07-19 10:22:59 +02:00
|
|
|
GlobalFree(proxy_info.lpszProxyBypass);
|
2011-01-20 13:39:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
active = FALSE;
|
|
|
|
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
|
2008-09-03 12:31:52 +02:00
|
|
|
static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID buffer, DWORD buflen )
|
|
|
|
{
|
2008-09-09 16:45:04 +02:00
|
|
|
BOOL status_ok, function_ok;
|
2008-09-03 12:31:52 +02:00
|
|
|
struct info *info = (struct info *)context;
|
|
|
|
unsigned int i = info->index;
|
|
|
|
|
|
|
|
if (status == WINHTTP_CALLBACK_STATUS_HANDLE_CREATED)
|
|
|
|
{
|
|
|
|
DWORD size = sizeof(struct info *);
|
|
|
|
WinHttpQueryOption( handle, WINHTTP_OPTION_CONTEXT_VALUE, &info, &size );
|
|
|
|
}
|
2014-02-11 09:54:45 +01:00
|
|
|
ok(i < info->count, "%u: unexpected notification 0x%08x\n", info->line, status);
|
2008-09-03 12:31:52 +02:00
|
|
|
if (i >= info->count) return;
|
2008-09-09 16:45:04 +02:00
|
|
|
|
|
|
|
status_ok = (info->test[i].status == status);
|
|
|
|
function_ok = (info->test[i].function == info->function);
|
2008-09-28 21:35:57 +02:00
|
|
|
if (!info->test[i].ignore && !info->test[i].todo)
|
2008-09-03 12:31:52 +02:00
|
|
|
{
|
2008-09-09 16:45:04 +02:00
|
|
|
ok(status_ok, "%u: expected status 0x%08x got 0x%08x\n", info->line, info->test[i].status, status);
|
|
|
|
ok(function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function);
|
2008-09-03 12:31:52 +02:00
|
|
|
}
|
2008-09-28 21:35:57 +02:00
|
|
|
else if (!info->test[i].ignore)
|
2008-09-03 12:31:52 +02:00
|
|
|
{
|
2008-09-09 16:45:04 +02:00
|
|
|
todo_wine ok(status_ok, "%u: expected status 0x%08x got 0x%08x\n", info->line, info->test[i].status, status);
|
|
|
|
if (status_ok)
|
2008-09-07 21:36:40 +02:00
|
|
|
{
|
2008-09-09 16:45:04 +02:00
|
|
|
todo_wine ok(function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function);
|
2008-09-07 21:36:40 +02:00
|
|
|
}
|
2008-09-03 12:31:52 +02:00
|
|
|
}
|
2014-01-29 12:05:02 +01:00
|
|
|
if (status_ok && function_ok) info->index++;
|
2011-01-20 13:39:05 +01:00
|
|
|
if (proxy_active())
|
|
|
|
{
|
|
|
|
while (info->test[info->index].skipped_for_proxy)
|
|
|
|
info->index++;
|
|
|
|
}
|
|
|
|
|
2010-02-17 09:56:19 +01:00
|
|
|
if (status & (WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING))
|
|
|
|
{
|
|
|
|
SetEvent( info->wait );
|
|
|
|
}
|
2008-09-03 12:31:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct notification cache_test[] =
|
|
|
|
{
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
|
|
|
{ winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
|
2008-09-03 12:31:52 +02:00
|
|
|
};
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
static void setup_test( struct info *info, enum api function, unsigned int line )
|
|
|
|
{
|
|
|
|
info->function = function;
|
|
|
|
info->line = line;
|
|
|
|
}
|
|
|
|
|
2008-09-03 12:31:52 +02:00
|
|
|
static void test_connection_cache( void )
|
|
|
|
{
|
2015-07-22 10:02:01 +02:00
|
|
|
HANDLE ses, con, req, event;
|
2015-09-22 15:58:33 +02:00
|
|
|
DWORD size, status, err;
|
2015-07-22 10:02:01 +02:00
|
|
|
BOOL ret, unload = TRUE;
|
2008-09-03 12:31:52 +02:00
|
|
|
struct info info, *context = &info;
|
|
|
|
|
|
|
|
info.test = cache_test;
|
|
|
|
info.count = sizeof(cache_test) / sizeof(cache_test[0]);
|
|
|
|
info.index = 0;
|
2008-09-07 21:29:44 +02:00
|
|
|
info.wait = NULL;
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 );
|
|
|
|
ok(ses != NULL, "failed to open session %u\n", GetLastError());
|
|
|
|
|
2015-07-22 10:02:01 +02:00
|
|
|
event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT, &event, sizeof(event) );
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
win_skip("Unload event not supported\n");
|
|
|
|
unload = FALSE;
|
|
|
|
}
|
|
|
|
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpSetStatusCallback( ses, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_connect, __LINE__ );
|
2014-02-05 15:31:21 +01:00
|
|
|
con = WinHttpConnect( ses, test_winehq, 0, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
|
|
|
ok(req != NULL, "failed to open a request %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-09-22 15:58:33 +02:00
|
|
|
err = GetLastError();
|
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(ret, "failed to send request %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
|
|
|
ok(ret, "failed to receive response %u\n", GetLastError());
|
|
|
|
|
|
|
|
size = sizeof(status);
|
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
|
|
|
ok(ret, "failed unexpectedly %u\n", GetLastError());
|
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
|
|
|
|
2011-11-25 14:55:13 +01:00
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
|
|
|
ok(req != NULL, "failed to open a request %u\n", GetLastError());
|
|
|
|
|
|
|
|
ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-09-22 15:58:33 +02:00
|
|
|
err = GetLastError();
|
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2011-11-25 14:55:13 +01:00
|
|
|
ok(ret, "failed to send request %u\n", GetLastError());
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
|
|
|
ok(ret, "failed to receive response %u\n", GetLastError());
|
|
|
|
|
|
|
|
size = sizeof(status);
|
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
|
|
|
ok(ret, "failed unexpectedly %u\n", GetLastError());
|
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
WinHttpCloseHandle( con );
|
2015-07-22 10:02:01 +02:00
|
|
|
|
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 0 );
|
|
|
|
ok(status == WAIT_TIMEOUT, "got %08x\n", status);
|
|
|
|
}
|
|
|
|
|
2008-09-03 12:31:52 +02:00
|
|
|
WinHttpCloseHandle( ses );
|
|
|
|
|
2008-09-09 16:43:57 +02:00
|
|
|
Sleep(2000); /* make sure connection is evicted from cache */
|
2015-07-22 10:02:01 +02:00
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 0 );
|
|
|
|
ok(status == WAIT_OBJECT_0, "got %08x\n", status);
|
|
|
|
}
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
info.index = 0;
|
|
|
|
|
|
|
|
ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 );
|
|
|
|
ok(ses != NULL, "failed to open session %u\n", GetLastError());
|
|
|
|
|
2015-07-22 10:02:01 +02:00
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT, &event, sizeof(event) );
|
|
|
|
ok(ret, "failed to set unload option\n");
|
|
|
|
}
|
|
|
|
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpSetStatusCallback( ses, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_connect, __LINE__ );
|
2014-02-05 15:31:21 +01:00
|
|
|
con = WinHttpConnect( ses, test_winehq, 0, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
2011-11-25 14:55:13 +01:00
|
|
|
ok(req != NULL, "failed to open a request %u\n", GetLastError());
|
|
|
|
|
|
|
|
ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-09-22 15:58:33 +02:00
|
|
|
err = GetLastError();
|
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2011-11-25 14:55:13 +01:00
|
|
|
ok(ret, "failed to send request %u\n", GetLastError());
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
|
|
|
ok(ret, "failed to receive response %u\n", GetLastError());
|
|
|
|
|
|
|
|
size = sizeof(status);
|
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
|
|
|
ok(ret, "failed unexpectedly %u\n", GetLastError());
|
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
|
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(req != NULL, "failed to open a request %u\n", GetLastError());
|
|
|
|
|
|
|
|
ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-09-22 15:58:33 +02:00
|
|
|
err = GetLastError();
|
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(ret, "failed to send request %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
|
|
|
ok(ret, "failed to receive response %u\n", GetLastError());
|
|
|
|
|
|
|
|
size = sizeof(status);
|
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
|
|
|
ok(ret, "failed unexpectedly %u\n", GetLastError());
|
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
2014-12-09 12:44:38 +01:00
|
|
|
done:
|
2008-09-03 12:31:52 +02:00
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
WinHttpCloseHandle( con );
|
2015-07-22 10:02:01 +02:00
|
|
|
|
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 0 );
|
|
|
|
ok(status == WAIT_TIMEOUT, "got %08x\n", status);
|
|
|
|
}
|
|
|
|
|
2008-09-03 12:31:52 +02:00
|
|
|
WinHttpCloseHandle( ses );
|
2012-12-19 12:01:27 +01:00
|
|
|
|
|
|
|
Sleep(2000); /* make sure connection is evicted from cache */
|
2015-07-22 10:02:01 +02:00
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 0 );
|
|
|
|
ok(status == WAIT_OBJECT_0, "got %08x\n", status);
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseHandle( event );
|
2008-09-03 12:31:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct notification redirect_test[] =
|
|
|
|
{
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
|
|
|
{ winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
2014-02-05 15:31:21 +01:00
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE },
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT },
|
2014-02-05 15:31:21 +01:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE, TRUE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE, TRUE },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, FALSE, FALSE, TRUE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, FALSE, FALSE, TRUE },
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
|
2008-09-03 12:31:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void test_redirect( void )
|
|
|
|
{
|
|
|
|
HANDLE ses, con, req;
|
2015-09-22 15:58:33 +02:00
|
|
|
DWORD size, status, err;
|
2008-09-03 12:31:52 +02:00
|
|
|
BOOL ret;
|
|
|
|
struct info info, *context = &info;
|
|
|
|
|
|
|
|
info.test = redirect_test;
|
|
|
|
info.count = sizeof(redirect_test) / sizeof(redirect_test[0]);
|
|
|
|
info.index = 0;
|
2008-09-07 21:29:44 +02:00
|
|
|
info.wait = NULL;
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 );
|
|
|
|
ok(ses != NULL, "failed to open session %u\n", GetLastError());
|
|
|
|
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpSetStatusCallback( ses, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
|
|
|
ok(ret, "failed to set context value %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_connect, __LINE__ );
|
2014-02-05 15:31:21 +01:00
|
|
|
con = WinHttpConnect( ses, test_winehq, 0, 0 );
|
2008-09-03 12:31:52 +02:00
|
|
|
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
|
|
|
ok(req != NULL, "failed to open a request %u\n", GetLastError());
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-09-22 15:58:33 +02:00
|
|
|
err = GetLastError();
|
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
goto done;
|
|
|
|
}
|
2011-01-27 11:57:03 +01:00
|
|
|
ok(ret, "failed to send request %u\n", GetLastError());
|
2008-09-03 12:31:52 +02:00
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
2008-09-03 12:31:52 +02:00
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
|
|
|
ok(ret, "failed to receive response %u\n", GetLastError());
|
|
|
|
|
|
|
|
size = sizeof(status);
|
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
|
|
|
ok(ret, "failed unexpectedly %u\n", GetLastError());
|
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
2014-12-09 12:44:38 +01:00
|
|
|
done:
|
2008-09-03 12:31:52 +02:00
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
WinHttpCloseHandle( con );
|
|
|
|
WinHttpCloseHandle( ses );
|
|
|
|
}
|
|
|
|
|
2008-09-07 21:29:44 +02:00
|
|
|
static const struct notification async_test[] =
|
|
|
|
{
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
|
|
|
{ winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
|
2014-01-29 12:04:18 +01:00
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE },
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT },
|
2014-02-05 15:31:21 +01:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE, TRUE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE, TRUE },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, FALSE, FALSE, TRUE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, FALSE, FALSE, TRUE },
|
2013-09-23 10:03:01 +02:00
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
|
|
|
|
{ winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE },
|
|
|
|
{ winhttp_query_data, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE },
|
2013-11-27 08:51:57 +01:00
|
|
|
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, FALSE, TRUE },
|
|
|
|
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, FALSE, TRUE },
|
|
|
|
{ winhttp_read_data, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
|
|
|
|
{ winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
|
2008-09-07 21:29:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static void test_async( void )
|
|
|
|
{
|
2015-07-22 10:02:01 +02:00
|
|
|
HANDLE ses, con, req, event;
|
2015-08-03 11:27:31 +02:00
|
|
|
DWORD size, status, err;
|
2015-07-22 10:02:01 +02:00
|
|
|
BOOL ret, unload = TRUE;
|
2008-09-07 21:29:44 +02:00
|
|
|
struct info info, *context = &info;
|
2008-09-07 21:36:40 +02:00
|
|
|
char buffer[1024];
|
2008-09-07 21:29:44 +02:00
|
|
|
|
|
|
|
info.test = async_test;
|
|
|
|
info.count = sizeof(async_test) / sizeof(async_test[0]);
|
|
|
|
info.index = 0;
|
2013-10-14 15:58:44 +02:00
|
|
|
info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
|
2008-09-07 21:29:44 +02:00
|
|
|
|
|
|
|
ses = WinHttpOpen( user_agent, 0, NULL, NULL, WINHTTP_FLAG_ASYNC );
|
|
|
|
ok(ses != NULL, "failed to open session %u\n", GetLastError());
|
|
|
|
|
2015-07-22 10:02:01 +02:00
|
|
|
event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT, &event, sizeof(event) );
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
win_skip("Unload event not supported\n");
|
|
|
|
unload = FALSE;
|
|
|
|
}
|
|
|
|
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpSetStatusCallback( ses, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
ret = WinHttpSetOption( ses, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(ret, "failed to set context value %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_connect, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2014-02-05 15:31:21 +01:00
|
|
|
con = WinHttpConnect( ses, test_winehq, 0, 0 );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(con != NULL, "failed to open a connection %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS || broken(err == WSAEINVAL) /* < win7 */, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_open_request, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(req != NULL, "failed to open a request %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_send_request, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
2015-09-22 15:58:33 +02:00
|
|
|
if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT))
|
2014-12-09 12:44:38 +01:00
|
|
|
{
|
|
|
|
skip("connection failed, skipping\n");
|
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
WinHttpCloseHandle( con );
|
|
|
|
WinHttpCloseHandle( ses );
|
|
|
|
CloseHandle( info.wait );
|
|
|
|
return;
|
|
|
|
}
|
2015-08-03 11:27:31 +02:00
|
|
|
ok(ret, "failed to send request %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
|
|
|
WaitForSingleObject( info.wait, INFINITE );
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_receive_response, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
ret = WinHttpReceiveResponse( req, NULL );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(ret, "failed to receive response %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
|
|
|
WaitForSingleObject( info.wait, INFINITE );
|
|
|
|
|
|
|
|
size = sizeof(status);
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:29:44 +02:00
|
|
|
ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &status, &size, NULL );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(ret, "failed unexpectedly %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
ok(status == 200, "request failed unexpectedly %u\n", status);
|
2015-08-03 11:27:31 +02:00
|
|
|
ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err);
|
2008-09-07 21:29:44 +02:00
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_query_data, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:36:40 +02:00
|
|
|
ret = WinHttpQueryDataAvailable( req, NULL );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(ret, "failed to query data available %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS || err == ERROR_IO_PENDING || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err);
|
2008-09-07 21:36:40 +02:00
|
|
|
|
|
|
|
WaitForSingleObject( info.wait, INFINITE );
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_read_data, __LINE__ );
|
2015-08-03 11:27:31 +02:00
|
|
|
SetLastError( 0xdeadbeef );
|
2008-09-07 21:36:40 +02:00
|
|
|
ret = WinHttpReadData( req, buffer, sizeof(buffer), NULL );
|
2015-08-03 11:27:31 +02:00
|
|
|
err = GetLastError();
|
|
|
|
ok(ret, "failed to read data %u\n", err);
|
|
|
|
ok(err == ERROR_SUCCESS, "got %u\n", err);
|
2008-09-07 21:36:40 +02:00
|
|
|
|
|
|
|
WaitForSingleObject( info.wait, INFINITE );
|
|
|
|
|
2008-09-09 16:45:04 +02:00
|
|
|
setup_test( &info, winhttp_close_handle, __LINE__ );
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpCloseHandle( req );
|
|
|
|
WinHttpCloseHandle( con );
|
2015-07-22 10:02:01 +02:00
|
|
|
|
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 0 );
|
|
|
|
ok(status == WAIT_TIMEOUT, "got %08x\n", status);
|
|
|
|
}
|
2008-09-07 21:29:44 +02:00
|
|
|
WinHttpCloseHandle( ses );
|
2010-02-17 09:56:19 +01:00
|
|
|
|
|
|
|
WaitForSingleObject( info.wait, INFINITE );
|
2015-07-22 10:02:01 +02:00
|
|
|
|
|
|
|
if (unload)
|
|
|
|
{
|
|
|
|
status = WaitForSingleObject( event, 2000 );
|
|
|
|
ok(status == WAIT_OBJECT_0, "got %08x\n", status);
|
|
|
|
}
|
|
|
|
CloseHandle( event );
|
2008-09-07 21:29:44 +02:00
|
|
|
CloseHandle( info.wait );
|
|
|
|
}
|
|
|
|
|
2008-09-03 12:31:52 +02:00
|
|
|
START_TEST (notification)
|
|
|
|
{
|
|
|
|
test_connection_cache();
|
|
|
|
test_redirect();
|
2008-09-09 16:43:57 +02:00
|
|
|
Sleep(2000); /* make sure previous connection is evicted from cache */
|
2008-09-07 21:29:44 +02:00
|
|
|
test_async();
|
2008-09-03 12:31:52 +02:00
|
|
|
}
|