Commit ffecc7f4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ieframe: Implement SetQueryNetSessionCount.

parent 9446458f
......@@ -385,3 +385,12 @@ static inline LPSTR co_strdupWtoA(LPCWSTR str)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
return ret;
}
enum SessionOp
{
SESSION_QUERY,
SESSION_INCREMENT,
SESSION_DECREMENT
};
LONG WINAPI SetQueryNetSessionCount(DWORD session_op);
......@@ -7,3 +7,4 @@
@ stdcall -private DllUnregisterServer()
@ stdcall IEGetWriteableHKCU(ptr)
@ stdcall OpenURL(long long str long)
@ stdcall SetQueryNetSessionCount(long)
......@@ -285,3 +285,25 @@ HRESULT WINAPI IEGetWriteableHKCU(HKEY *pkey)
FIXME("(%p) stub\n", pkey);
return E_NOTIMPL;
}
/***********************************************************************
* SetQueryNetSessionCount (ieframe.@)
*/
LONG WINAPI SetQueryNetSessionCount(DWORD session_op)
{
static LONG session_count;
TRACE("(%x)\n", session_op);
switch(session_op)
{
case SESSION_QUERY:
return session_count;
case SESSION_INCREMENT:
return InterlockedIncrement(&session_count);
case SESSION_DECREMENT:
return InterlockedDecrement(&session_count);
};
return 0;
}
......@@ -555,6 +555,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
on_offlineconnected_change(This);
on_silent_change(This);
SetQueryNetSessionCount(SESSION_INCREMENT);
return S_OK;
}
......
......@@ -173,6 +173,15 @@ static const WCHAR *current_url;
static int wb_version, expect_update_commands_enable, set_update_commands_enable;
static BOOL nav_back_todo, nav_forward_todo; /* FIXME */
enum SessionOp
{
SESSION_QUERY,
SESSION_INCREMENT,
SESSION_DECREMENT
};
static LONG (WINAPI *pSetQueryNetSessionCount)(DWORD);
#define BUSY_FAIL 2
#define DWL_EXPECT_BEFORE_NAVIGATE 0x01
......@@ -1946,6 +1955,7 @@ static void test_ClientSite(IWebBrowser2 *unk, IOleClientSite *client, BOOL stop
{
IOleObject *oleobj;
IOleInPlaceObject *inplace;
DWORD session_count;
HWND hwnd;
HRESULT hres;
......@@ -1969,6 +1979,8 @@ static void test_ClientSite(IWebBrowser2 *unk, IOleClientSite *client, BOOL stop
ok((hwnd == NULL) ^ (client == NULL), "unexpected hwnd %p\n", hwnd);
if(client) {
session_count = pSetQueryNetSessionCount(SESSION_QUERY);
SET_EXPECT(GetContainer);
SET_EXPECT(Site_GetWindow);
SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
......@@ -1995,6 +2007,9 @@ static void test_ClientSite(IWebBrowser2 *unk, IOleClientSite *client, BOOL stop
ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
if(client) {
DWORD count = pSetQueryNetSessionCount(SESSION_QUERY);
ok(count == session_count + 1, "count = %u expected %u\n", count, session_count + 1);
CHECK_CALLED(GetContainer);
CHECK_CALLED(Site_GetWindow);
CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
......@@ -3837,6 +3852,7 @@ static void test_WebBrowser(DWORD flags, BOOL do_close)
test_EnumVerbs(webbrowser);
test_LocationURL(webbrowser, L"");
test_ConnectionPoint(webbrowser, TRUE);
test_ClientSite(webbrowser, &ClientSite, !do_download);
test_Extent(webbrowser);
test_wb_funcs(webbrowser, TRUE);
......@@ -4401,6 +4417,29 @@ static void test_SetAdvise(void)
IWebBrowser2_Release(browser);
}
static void test_SetQueryNetSessionCount(void)
{
LONG count;
count = pSetQueryNetSessionCount(SESSION_QUERY);
ok(count == 0, "count = %d\n", count);
count = pSetQueryNetSessionCount(SESSION_INCREMENT);
ok(count == 1, "count = %d\n", count);
count = pSetQueryNetSessionCount(SESSION_QUERY);
ok(count == 1, "count = %d\n", count);
count = pSetQueryNetSessionCount(0xdeadbeef);
ok(count == 0, "count = %d\n", count);
count = pSetQueryNetSessionCount(SESSION_DECREMENT);
ok(count == 0, "count = %d\n", count);
count = pSetQueryNetSessionCount(SESSION_QUERY);
ok(count == 0, "count = %d\n", count);
}
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
if(IsEqualGUID(riid, &outer_test_iid)) {
......@@ -4460,8 +4499,14 @@ static void test_com_aggregation(void)
START_TEST(webbrowser)
{
HMODULE ieframe = LoadLibraryW(L"ieframe.dll");
pSetQueryNetSessionCount = (void*)GetProcAddress(ieframe, "SetQueryNetSessionCount");
OleInitialize(NULL);
test_SetQueryNetSessionCount();
container_hwnd = create_container_window();
trace("Testing WebBrowser (no download)...\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment