2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
39 #include "shdeprecated.h"
44 #include "docobjectservice.h"
46 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
47 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
49 #define DEFINE_EXPECT(func) \
50 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
52 #define SET_EXPECT(func) \
53 expect_ ## func = TRUE
55 #define CHECK_EXPECT2(func) \
57 ok(expect_ ##func, "unexpected call " #func "\n"); \
58 called_ ## func = TRUE; \
61 #define CHECK_EXPECT(func) \
63 CHECK_EXPECT2(func); \
64 expect_ ## func = FALSE; \
67 #define CHECK_CALLED(func) \
69 ok(called_ ## func, "expected " #func "\n"); \
70 expect_ ## func = called_ ## func = FALSE; \
73 #define CLEAR_CALLED(func) \
74 expect_ ## func = called_ ## func = FALSE
76 DEFINE_EXPECT(GetContainer
);
77 DEFINE_EXPECT(Site_GetWindow
);
78 DEFINE_EXPECT(ShowObject
);
79 DEFINE_EXPECT(CanInPlaceActivate
);
80 DEFINE_EXPECT(OnInPlaceActivate
);
81 DEFINE_EXPECT(OnUIActivate
);
82 DEFINE_EXPECT(GetWindowContext
);
83 DEFINE_EXPECT(Frame_GetWindow
);
84 DEFINE_EXPECT(Frame_SetActiveObject
);
85 DEFINE_EXPECT(UIWindow_SetActiveObject
);
86 DEFINE_EXPECT(SetMenu
);
87 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
88 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
89 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
90 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
91 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
92 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
93 DEFINE_EXPECT(Invoke_STATUSTEXTCHANGE
);
94 DEFINE_EXPECT(Invoke_PROPERTYCHANGE
);
95 DEFINE_EXPECT(Invoke_DOWNLOADBEGIN
);
96 DEFINE_EXPECT(Invoke_BEFORENAVIGATE2
);
97 DEFINE_EXPECT(Invoke_SETSECURELOCKICON
);
98 DEFINE_EXPECT(Invoke_FILEDOWNLOAD
);
99 DEFINE_EXPECT(Invoke_COMMANDSTATECHANGE
);
100 DEFINE_EXPECT(Invoke_DOWNLOADCOMPLETE
);
101 DEFINE_EXPECT(Invoke_ONMENUBAR
);
102 DEFINE_EXPECT(Invoke_ONADDRESSBAR
);
103 DEFINE_EXPECT(Invoke_ONSTATUSBAR
);
104 DEFINE_EXPECT(Invoke_ONTOOLBAR
);
105 DEFINE_EXPECT(Invoke_ONFULLSCREEN
);
106 DEFINE_EXPECT(Invoke_ONTHEATERMODE
);
107 DEFINE_EXPECT(Invoke_WINDOWSETRESIZABLE
);
108 DEFINE_EXPECT(Invoke_TITLECHANGE
);
109 DEFINE_EXPECT(Invoke_NAVIGATECOMPLETE2
);
110 DEFINE_EXPECT(Invoke_PROGRESSCHANGE
);
111 DEFINE_EXPECT(Invoke_DOCUMENTCOMPLETE
);
112 DEFINE_EXPECT(Invoke_282
);
113 DEFINE_EXPECT(EnableModeless_TRUE
);
114 DEFINE_EXPECT(EnableModeless_FALSE
);
115 DEFINE_EXPECT(GetHostInfo
);
116 DEFINE_EXPECT(GetOptionKeyPath
);
117 DEFINE_EXPECT(GetOverridesKeyPath
);
118 DEFINE_EXPECT(SetStatusText
);
119 DEFINE_EXPECT(UpdateUI
);
120 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
121 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
122 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
123 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
124 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
125 DEFINE_EXPECT(Exec_SETTITLE
);
126 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
127 DEFINE_EXPECT(Exec_STOP
);
128 DEFINE_EXPECT(Exec_IDM_STOP
);
129 DEFINE_EXPECT(QueryStatus_STOP
);
130 DEFINE_EXPECT(QueryStatus_IDM_STOP
);
131 DEFINE_EXPECT(DocHost_EnableModeless_TRUE
);
132 DEFINE_EXPECT(DocHost_EnableModeless_FALSE
);
133 DEFINE_EXPECT(DocHost_TranslateAccelerator
);
134 DEFINE_EXPECT(GetDropTarget
);
135 DEFINE_EXPECT(TranslateUrl
);
136 DEFINE_EXPECT(ShowUI
);
137 DEFINE_EXPECT(HideUI
);
138 DEFINE_EXPECT(RequestUIActivate
);
139 DEFINE_EXPECT(ControlSite_TranslateAccelerator
);
140 DEFINE_EXPECT(OnFocus
);
142 static const WCHAR wszItem
[] = {'i','t','e','m',0};
143 static const WCHAR emptyW
[] = {0};
145 static VARIANT_BOOL exvb
;
147 static IWebBrowser2
*wb
;
149 static HWND container_hwnd
, shell_embedding_hwnd
;
150 static BOOL is_downloading
, is_first_load
, use_container_olecmd
;
151 static HRESULT hr_dochost_TranslateAccelerator
= E_NOTIMPL
;
152 static HRESULT hr_site_TranslateAccelerator
= E_NOTIMPL
;
153 static const char *current_url
;
155 #define DWL_EXPECT_BEFORE_NAVIGATE 0x01
156 #define DWL_FROM_PUT_HREF 0x02
158 static DWORD dwl_flags
;
160 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
163 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
164 return lstrcmpA(stra
, buf
);
167 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
169 IUnknown
*unk1
, *unk2
;
174 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
175 IUnknown_Release(unk1
);
176 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
177 IUnknown_Release(unk2
);
182 static const char *debugstr_guid(REFIID riid
)
186 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
187 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
188 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
189 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
194 static BSTR
a2bstr(const char *str
)
199 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
200 ret
= SysAllocStringLen(NULL
, len
);
201 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
206 #define create_WebBrowser(a) _create_WebBrowser(__LINE__,a)
207 static HRESULT
_create_WebBrowser(unsigned line
, IUnknown
**unk
)
211 hres
= CoCreateInstance(&CLSID_WebBrowser
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
212 &IID_IUnknown
, (void**)unk
);
213 ok_(__FILE__
,line
)(hres
== S_OK
, "Creating WebBrowser object failed: %08x\n", hres
);
217 #define test_LocationURL(a,b) _test_LocationURL(__LINE__,a,b)
218 static void _test_LocationURL(unsigned line
, IUnknown
*unk
, const char *exurl
)
221 BSTR url
= (void*)0xdeadbeef;
224 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
225 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
229 hres
= IWebBrowser2_get_LocationURL(wb
, &url
);
230 ok_(__FILE__
,line
) (hres
== (*exurl
? S_OK
: S_FALSE
), "get_LocationURL failed: %08x\n", hres
);
231 ok_(__FILE__
,line
) (!strcmp_wa(url
, exurl
), "unexpected URL: %s\n", wine_dbgstr_w(url
));
234 IWebBrowser2_Release(wb
);
237 #define test_ready_state(ex) _test_ready_state(__LINE__,ex);
238 static void _test_ready_state(unsigned line
, READYSTATE exstate
)
243 hres
= IWebBrowser2_get_ReadyState(wb
, &state
);
244 ok_(__FILE__
,line
)(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
245 ok_(__FILE__
,line
)(state
== exstate
, "ReadyState = %d, expected %d\n", state
, exstate
);
248 #define get_document(u) _get_document(__LINE__,u)
249 static IDispatch
*_get_document(unsigned line
, IUnknown
*unk
)
251 IHTMLDocument2
*html_doc
;
256 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
257 ok_(__FILE__
,line
)(hres
== S_OK
, "QueryInterface(IID_IWebBrowser2) failed: %08x\n", hres
);
260 hres
= IWebBrowser2_get_Document(wb
, &disp
);
261 IWebBrowser2_Release(wb
);
262 ok_(__FILE__
,line
)(hres
== S_OK
, "get_Document failed: %08x\n", hres
);
263 ok_(__FILE__
,line
)(disp
!= NULL
, "doc_disp == NULL\n");
265 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&html_doc
);
266 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IHTMLDocument iface: %08x\n", hres
);
267 ok(disp
== (IDispatch
*)html_doc
, "disp != html_doc\n");
268 IHTMLDocument_Release(html_doc
);
273 #define get_dochost(u) _get_dochost(__LINE__,u)
274 static IOleClientSite
*_get_dochost(unsigned line
, IUnknown
*unk
)
276 IOleClientSite
*client_site
;
281 doc
= _get_document(line
, unk
);
282 hres
= IDispatch_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
283 IDispatch_Release(doc
);
284 ok_(__FILE__
,line
)(hres
== S_OK
, "Got 0x%08x\n", hres
);
286 hres
= IOleObject_GetClientSite(oleobj
, &client_site
);
287 IOleObject_Release(oleobj
);
288 ok_(__FILE__
,line
)(hres
== S_OK
, "Got 0x%08x\n", hres
);
293 static HRESULT
QueryInterface(REFIID
,void**);
295 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
296 REFIID riid
, void **ppv
)
298 ok(0, "unexpected call\n");
299 return E_NOINTERFACE
;
302 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
307 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
312 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
313 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
315 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
316 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
317 ok(!pCmdText
, "pCmdText != NULL\n");
319 switch(prgCmds
[0].cmdID
) {
321 CHECK_EXPECT2(QueryStatus_STOP
);
322 prgCmds
[0].cmdf
= OLECMDF_SUPPORTED
;
324 case OLECMDID_SETPROGRESSTEXT
:
325 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
326 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
330 * IDM_STOP is a command specific to CGID_MSHTML (not an OLECMDID command).
331 * This command appears here for the ExecWB and QueryStatusWB tests in order
332 * to help demonstrate that these routines use a NULL pguidCmdGroup.
334 CHECK_EXPECT(QueryStatus_IDM_STOP
);
338 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
344 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
345 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
349 case OLECMDID_SETPROGRESSMAX
:
350 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
351 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
352 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
354 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
355 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
357 case OLECMDID_SETPROGRESSPOS
:
358 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
359 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
360 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
362 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
363 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
365 case OLECMDID_SETDOWNLOADSTATE
:
367 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
|| !nCmdexecopt
,
368 "nCmdexecopts=%08x\n", nCmdexecopt
);
370 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
371 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
372 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
373 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
374 switch(V_I4(pvaIn
)) {
376 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_0
);
379 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1
);
382 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
385 case OLECMDID_UPDATECOMMANDS
:
386 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
387 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
388 ok(!pvaIn
, "pvaIn != NULL\n");
389 ok(!pvaOut
, "pvaOut=%p, expected NULL\n", pvaOut
);
391 case OLECMDID_SETTITLE
:
392 CHECK_EXPECT(Exec_SETTITLE
);
393 /* TODO: test args */
396 CHECK_EXPECT(Exec_STOP
);
400 * IDM_STOP is a command specific to CGID_MSHTML (not an OLECMDID command).
401 * This command appears here for the ExecWB and QueryStatusWB tests in order
402 * to help demonstrate that these routines use a NULL pguidCmdGroup.
404 CHECK_EXPECT(Exec_IDM_STOP
);
405 return OLECMDERR_E_NOTSUPPORTED
;
407 ok(0, "unexpected nsCmdID %d\n", nCmdID
);
409 }else if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
418 case 101: /* TODO (IE8) */
421 ok(0, "unexpected nCmdID %d\n", nCmdID
);
423 }else if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
426 case 140: /* TODO (Win7) */
429 ok(0, "unexpected nCmdID %d\n", nCmdID
);
431 }else if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
436 ok(0, "unexpected nCmdID %d of CGID_DocHostCmdPriv\n", nCmdID
);
438 }else if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
440 case 6041: /* TODO */
443 ok(0, "unexpected nCmdID %d of CGID_DocHostCommandHandler\n", nCmdID
);
446 ok(0, "unexpected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup
));
452 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
453 OleCommandTarget_QueryInterface
,
454 OleCommandTarget_AddRef
,
455 OleCommandTarget_Release
,
456 OleCommandTarget_QueryStatus
,
457 OleCommandTarget_Exec
460 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
462 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
464 if(IsEqualGUID(&IID_ITargetContainer
, riid
))
465 return E_NOINTERFACE
; /* TODO */
467 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
468 if(use_container_olecmd
)
470 *ppv
= &OleCommandTarget
;
474 return E_NOINTERFACE
;
477 ok(0, "unexpected call\n");
478 return E_NOINTERFACE
;
481 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
486 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
491 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
492 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
494 ok(0, "unexpected call\n");
498 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
499 IEnumUnknown
**ppenum
)
501 ok(0, "unexpected call\n");
505 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
507 ok(0, "unexpected call\n");
511 static const IOleContainerVtbl OleContainerVtbl
= {
512 OleContainer_QueryInterface
,
514 OleContainer_Release
,
515 OleContainer_ParseDisplayName
,
516 OleContainer_EnumObjects
,
517 OleContainer_LockContainer
520 static IOleContainer OleContainer
= { &OleContainerVtbl
};
522 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
524 return QueryInterface(riid
, ppv
);
527 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
532 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
537 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
539 ok(0, "unexpected call\n");
543 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
546 ok(0, "unexpected call\n");
550 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
551 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
553 ok(0, "unexpected call\n");
557 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
558 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
559 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
561 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
562 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
563 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
564 ok(V_VT(pVarResult
) == VT_EMPTY
, "V_VT(pVarResult)=%d\n", V_VT(pVarResult
));
565 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
566 ok(pDispParams
->rgvarg
== NULL
, "pDispParams->rgvarg = %p\n", pDispParams
->rgvarg
);
567 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
568 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
569 ok(pDispParams
->cArgs
== 0, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
570 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
572 switch(dispIdMember
) {
573 case DISPID_AMBIENT_USERMODE
:
574 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
576 case DISPID_AMBIENT_DLCONTROL
:
577 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
578 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
580 case DISPID_AMBIENT_USERAGENT
:
581 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
582 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
584 case DISPID_AMBIENT_PALETTE
:
585 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
586 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
588 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
589 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
590 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
591 V_VT(pVarResult
) = VT_BOOL
;
592 V_BOOL(pVarResult
) = VARIANT_FALSE
;
594 case DISPID_AMBIENT_SILENT
:
595 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
596 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
597 V_VT(pVarResult
) = VT_BOOL
;
598 V_BOOL(pVarResult
) = VARIANT_FALSE
;
602 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
606 static IDispatchVtbl DispatchVtbl
= {
607 Dispatch_QueryInterface
,
610 Dispatch_GetTypeInfoCount
,
611 Dispatch_GetTypeInfo
,
612 Dispatch_GetIDsOfNames
,
616 static IDispatch Dispatch
= { &DispatchVtbl
};
618 static HRESULT WINAPI
WebBrowserEvents2_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
622 if(IsEqualGUID(&DIID_DWebBrowserEvents2
, riid
)) {
627 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
628 return E_NOINTERFACE
;
631 #define test_invoke_bool(p,s) _test_invoke_bool(__LINE__,p,s)
632 static void _test_invoke_bool(unsigned line
, const DISPPARAMS
*params
, BOOL strict
)
634 ok_(__FILE__
,line
) (params
->rgvarg
!= NULL
, "rgvarg == NULL\n");
635 ok_(__FILE__
,line
) (params
->cArgs
== 1, "cArgs=%d, expected 1\n", params
->cArgs
);
636 ok_(__FILE__
,line
) (V_VT(params
->rgvarg
) == VT_BOOL
, "V_VT(arg)=%d\n", V_VT(params
->rgvarg
));
638 ok_(__FILE__
,line
) (V_BOOL(params
->rgvarg
) == exvb
, "V_VT(arg)=%x, expected %x\n",
639 V_BOOL(params
->rgvarg
), exvb
);
641 ok_(__FILE__
,line
) (!V_BOOL(params
->rgvarg
) == !exvb
, "V_VT(arg)=%x, expected %x\n",
642 V_BOOL(params
->rgvarg
), exvb
);
645 static void test_OnBeforeNavigate(const VARIANT
*disp
, const VARIANT
*url
, const VARIANT
*flags
,
646 const VARIANT
*frame
, const VARIANT
*post_data
, const VARIANT
*headers
, const VARIANT
*cancel
)
648 ok(V_VT(disp
) == VT_DISPATCH
, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp
));
649 ok(V_DISPATCH(disp
) != NULL
, "V_DISPATCH(disp) == NULL\n");
650 ok(V_DISPATCH(disp
) == (IDispatch
*)wb
, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp
), wb
);
652 ok(V_VT(url
) == (VT_BYREF
|VT_VARIANT
), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url
));
653 ok(V_VARIANTREF(url
) != NULL
, "V_VARIANTREF(url) == NULL)\n");
654 if(V_VARIANTREF(url
)) {
655 ok(V_VT(V_VARIANTREF(url
)) == VT_BSTR
, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
656 V_VT(V_VARIANTREF(url
)));
657 ok(V_BSTR(V_VARIANTREF(url
)) != NULL
, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
658 ok(!strcmp_wa(V_BSTR(V_VARIANTREF(url
)), current_url
), "unexpected url %s, expected %s\n",
659 wine_dbgstr_w(V_BSTR(V_VARIANTREF(url
))), current_url
);
662 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
664 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
666 ok(V_VARIANTREF(flags
) != NULL
, "V_VARIANTREF(flags) == NULL)\n");
667 if(V_VARIANTREF(flags
)) {
668 ok(V_VT(V_VARIANTREF(flags
)) == VT_I4
, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
669 V_VT(V_VARIANTREF(flags
)));
671 ok(V_I4(V_VARIANTREF(flags
)) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0\n",
672 V_I4(V_VARIANTREF(flags
)));
674 ok((V_I4(V_VARIANTREF(flags
)) & ~0x40) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0x40 or 0\n",
675 V_I4(V_VARIANTREF(flags
)));
679 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
681 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
683 ok(V_VARIANTREF(frame
) != NULL
, "V_VARIANTREF(frame) == NULL)\n");
684 if(V_VARIANTREF(frame
)) {
685 ok(V_VT(V_VARIANTREF(frame
)) == VT_BSTR
, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
686 V_VT(V_VARIANTREF(frame
)));
687 ok(V_BSTR(V_VARIANTREF(frame
)) == NULL
, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
688 V_BSTR(V_VARIANTREF(frame
)));
691 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
693 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
695 ok(V_VARIANTREF(post_data
) != NULL
, "V_VARIANTREF(post_data) == NULL)\n");
696 if(V_VARIANTREF(post_data
)) {
697 ok(V_VT(V_VARIANTREF(post_data
)) == (VT_VARIANT
|VT_BYREF
),
698 "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
699 V_VT(V_VARIANTREF(post_data
)));
700 ok(V_VARIANTREF(V_VARIANTREF(post_data
)) != NULL
,
701 "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
702 if(V_VARIANTREF(V_VARIANTREF(post_data
))) {
703 ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == VT_EMPTY
,
704 "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
705 V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))));
707 if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == (VT_UI1
|VT_ARRAY
)) {
708 const SAFEARRAY
*sa
= V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data
)));
710 ok(sa
->cDims
== 1, "sa->cDims = %d, expected 1\n", sa
->cDims
);
711 ok(sa
->fFeatures
== 0, "sa->fFeatures = %d, expected 0\n", sa
->fFeatures
);
716 ok(V_VT(headers
) == (VT_BYREF
|VT_VARIANT
), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
718 ok(V_VARIANTREF(headers
) != NULL
, "V_VARIANTREF(headers) == NULL)\n");
719 if(V_VARIANTREF(headers
)) {
720 ok(V_VT(V_VARIANTREF(headers
)) == VT_BSTR
, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
721 V_VT(V_VARIANTREF(headers
)));
722 ok(V_BSTR(V_VARIANTREF(headers
)) == NULL
, "V_BSTR(V_VARIANTREF(heders)) = %p, expected NULL\n",
723 V_BSTR(V_VARIANTREF(headers
)));
726 ok(V_VT(cancel
) == (VT_BYREF
|VT_BOOL
), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
728 ok(V_BOOLREF(cancel
) != NULL
, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
729 if(V_BOOLREF(cancel
))
730 ok(*V_BOOLREF(cancel
) == VARIANT_FALSE
, "*V_BOOLREF(calcel) = %x, expected VARIANT_FALSE\n",
734 static HRESULT WINAPI
WebBrowserEvents2_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
735 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
736 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
738 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
739 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
740 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
741 ok(pVarResult
== NULL
, "pVarResult=%p\n", pVarResult
);
742 ok(wFlags
== DISPATCH_METHOD
, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags
);
743 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
744 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
745 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
747 switch(dispIdMember
) {
748 case DISPID_STATUSTEXTCHANGE
:
749 CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE
);
751 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
752 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
753 ok(V_VT(pDispParams
->rgvarg
) == VT_BSTR
, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
754 V_VT(pDispParams
->rgvarg
));
755 /* TODO: Check text */
758 case DISPID_PROPERTYCHANGE
:
759 CHECK_EXPECT2(Invoke_PROPERTYCHANGE
);
761 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
762 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
763 /* TODO: Check args */
766 case DISPID_DOWNLOADBEGIN
:
767 CHECK_EXPECT(Invoke_DOWNLOADBEGIN
);
769 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
770 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
771 test_ready_state(READYSTATE_LOADING
);
774 case DISPID_BEFORENAVIGATE2
:
775 CHECK_EXPECT(Invoke_BEFORENAVIGATE2
);
777 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
778 ok(pDispParams
->cArgs
== 7, "cArgs=%d, expected 7\n", pDispParams
->cArgs
);
779 test_OnBeforeNavigate(pDispParams
->rgvarg
+6, pDispParams
->rgvarg
+5, pDispParams
->rgvarg
+4,
780 pDispParams
->rgvarg
+3, pDispParams
->rgvarg
+2, pDispParams
->rgvarg
+1,
781 pDispParams
->rgvarg
);
782 test_ready_state((dwl_flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
785 case DISPID_SETSECURELOCKICON
:
786 CHECK_EXPECT2(Invoke_SETSECURELOCKICON
);
788 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
789 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
790 /* TODO: Check args */
793 case DISPID_FILEDOWNLOAD
:
794 CHECK_EXPECT(Invoke_FILEDOWNLOAD
);
796 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
797 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
798 /* TODO: Check args */
801 case DISPID_COMMANDSTATECHANGE
:
802 CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE
);
804 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
805 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
806 /* TODO: Check args */
809 case DISPID_DOWNLOADCOMPLETE
:
810 CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE
);
812 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
813 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
814 test_ready_state(READYSTATE_LOADING
);
817 case DISPID_ONMENUBAR
:
818 CHECK_EXPECT(Invoke_ONMENUBAR
);
819 test_invoke_bool(pDispParams
, TRUE
);
822 case DISPID_ONADDRESSBAR
:
823 CHECK_EXPECT(Invoke_ONADDRESSBAR
);
824 test_invoke_bool(pDispParams
, TRUE
);
827 case DISPID_ONSTATUSBAR
:
828 CHECK_EXPECT(Invoke_ONSTATUSBAR
);
829 test_invoke_bool(pDispParams
, TRUE
);
832 case DISPID_ONTOOLBAR
:
833 CHECK_EXPECT(Invoke_ONTOOLBAR
);
834 test_invoke_bool(pDispParams
, FALSE
);
837 case DISPID_ONFULLSCREEN
:
838 CHECK_EXPECT(Invoke_ONFULLSCREEN
);
839 test_invoke_bool(pDispParams
, TRUE
);
842 case DISPID_ONTHEATERMODE
:
843 CHECK_EXPECT(Invoke_ONTHEATERMODE
);
844 test_invoke_bool(pDispParams
, TRUE
);
847 case DISPID_WINDOWSETRESIZABLE
:
848 CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE
);
849 test_invoke_bool(pDispParams
, TRUE
);
852 case DISPID_TITLECHANGE
:
853 CHECK_EXPECT2(Invoke_TITLECHANGE
);
857 case DISPID_NAVIGATECOMPLETE2
:
858 CHECK_EXPECT(Invoke_NAVIGATECOMPLETE2
);
860 test_ready_state((dwl_flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
863 case DISPID_PROGRESSCHANGE
:
864 CHECK_EXPECT(Invoke_PROGRESSCHANGE
);
868 case DISPID_DOCUMENTCOMPLETE
:
869 CHECK_EXPECT(Invoke_DOCUMENTCOMPLETE
);
871 test_ready_state(READYSTATE_COMPLETE
);
874 case 282: /* FIXME */
875 CHECK_EXPECT2(Invoke_282
);
879 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
885 static IDispatchVtbl WebBrowserEvents2Vtbl
= {
886 WebBrowserEvents2_QueryInterface
,
889 Dispatch_GetTypeInfoCount
,
890 Dispatch_GetTypeInfo
,
891 Dispatch_GetIDsOfNames
,
892 WebBrowserEvents2_Invoke
895 static IDispatch WebBrowserEvents2
= { &WebBrowserEvents2Vtbl
};
897 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
899 return QueryInterface(riid
, ppv
);
902 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
907 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
912 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
914 ok(0, "unexpected call\n");
918 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
921 ok(0, "unexpected call\n");
925 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
927 CHECK_EXPECT(GetContainer
);
929 ok(ppContainer
!= NULL
, "ppContainer == NULL\n");
931 *ppContainer
= &OleContainer
;
936 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
938 CHECK_EXPECT(ShowObject
);
942 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
944 ok(0, "unexpected call\n");
948 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
950 ok(0, "unexpected call\n");
954 static const IOleClientSiteVtbl ClientSiteVtbl
= {
955 ClientSite_QueryInterface
,
958 ClientSite_SaveObject
,
959 ClientSite_GetMoniker
,
960 ClientSite_GetContainer
,
961 ClientSite_ShowObject
,
962 ClientSite_OnShowWindow
,
963 ClientSite_RequestNewObjectLayout
966 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
968 static HRESULT WINAPI
IOleControlSite_fnQueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
971 return E_NOINTERFACE
;
974 static ULONG WINAPI
IOleControlSite_fnAddRef(IOleControlSite
*iface
)
979 static ULONG WINAPI
IOleControlSite_fnRelease(IOleControlSite
*iface
)
984 static HRESULT WINAPI
IOleControlSite_fnOnControlInfoChanged(IOleControlSite
* This
)
986 ok(0, "unexpected call\n");
990 static HRESULT WINAPI
IOleControlSite_fnLockInPlaceActive(IOleControlSite
* This
,
993 ok(0, "unexpected call\n");
997 static HRESULT WINAPI
IOleControlSite_fnGetExtendedControl(IOleControlSite
* This
,
1000 ok(0, "unexpected call\n");
1004 static HRESULT WINAPI
IOleControlSite_fnTransformCoords(IOleControlSite
* This
,
1005 POINTL
*pPtlHimetric
,
1006 POINTF
*pPtfContainer
,
1009 ok(0, "unexpected call\n");
1013 static HRESULT WINAPI
IOleControlSite_fnTranslateAccelerator(IOleControlSite
* This
, MSG
*pMsg
,
1016 CHECK_EXPECT(ControlSite_TranslateAccelerator
);
1017 return hr_site_TranslateAccelerator
;
1020 static HRESULT WINAPI
IOleControlSite_fnOnFocus(IOleControlSite
* This
, BOOL fGotFocus
)
1022 CHECK_EXPECT2(OnFocus
);
1026 static HRESULT WINAPI
IOleControlSite_fnShowPropertyFrame(IOleControlSite
* This
)
1028 ok(0, "unexpected call\n");
1032 static IOleControlSiteVtbl ControlSiteVtbl
= {
1033 IOleControlSite_fnQueryInterface
,
1034 IOleControlSite_fnAddRef
,
1035 IOleControlSite_fnRelease
,
1036 IOleControlSite_fnOnControlInfoChanged
,
1037 IOleControlSite_fnLockInPlaceActive
,
1038 IOleControlSite_fnGetExtendedControl
,
1039 IOleControlSite_fnTransformCoords
,
1040 IOleControlSite_fnTranslateAccelerator
,
1041 IOleControlSite_fnOnFocus
,
1042 IOleControlSite_fnShowPropertyFrame
1045 static IOleControlSite ControlSite
= { &ControlSiteVtbl
};
1047 static HRESULT WINAPI
InPlaceUIWindow_QueryInterface(IOleInPlaceFrame
*iface
,
1048 REFIID riid
, void **ppv
)
1050 ok(0, "unexpected call\n");
1051 return E_NOINTERFACE
;
1054 static ULONG WINAPI
InPlaceUIWindow_AddRef(IOleInPlaceFrame
*iface
)
1059 static ULONG WINAPI
InPlaceUIWindow_Release(IOleInPlaceFrame
*iface
)
1064 static HRESULT WINAPI
InPlaceUIWindow_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1066 ok(0, "unexpected call\n");
1070 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1072 CHECK_EXPECT(Frame_GetWindow
);
1073 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1075 *phwnd
= container_hwnd
;
1079 static HRESULT WINAPI
InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1081 ok(0, "unexpected call\n");
1085 static HRESULT WINAPI
InPlaceUIWindow_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1087 ok(0, "unexpected call\n");
1091 static HRESULT WINAPI
InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1092 LPCBORDERWIDTHS pborderwidths
)
1094 ok(0, "unexpected call\n");
1098 static HRESULT WINAPI
InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame
*iface
,
1099 LPCBORDERWIDTHS pborderwidths
)
1101 ok(0, "unexpected call\n");
1105 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1106 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1108 CHECK_EXPECT(UIWindow_SetActiveObject
);
1109 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1110 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
1114 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1115 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1117 CHECK_EXPECT(Frame_SetActiveObject
);
1118 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1119 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
1123 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1124 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1126 ok(0, "unexpected call\n");
1130 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1131 HOLEMENU holemenu
, HWND hwndActiveObject
)
1133 CHECK_EXPECT(SetMenu
);
1134 ok(hmenuShared
== NULL
, "hmenuShared=%p\n", hmenuShared
);
1135 ok(holemenu
== NULL
, "holemenu=%p\n", holemenu
);
1136 ok(hwndActiveObject
== shell_embedding_hwnd
, "hwndActiveObject=%p, expected %p\n",
1137 hwndActiveObject
, shell_embedding_hwnd
);
1141 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1143 ok(0, "unexpected call\n");
1147 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1149 CHECK_EXPECT2(SetStatusText
);
1150 /* FIXME: Check pszStatusText */
1154 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1157 CHECK_EXPECT2(EnableModeless_TRUE
);
1159 CHECK_EXPECT2(EnableModeless_FALSE
);
1163 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1165 ok(0, "unexpected call\n");
1169 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1170 InPlaceUIWindow_QueryInterface
,
1171 InPlaceUIWindow_AddRef
,
1172 InPlaceUIWindow_Release
,
1173 InPlaceUIWindow_GetWindow
,
1174 InPlaceUIWindow_ContextSensitiveHelp
,
1175 InPlaceUIWindow_GetBorder
,
1176 InPlaceUIWindow_RequestBorderSpace
,
1177 InPlaceUIWindow_SetBorderSpace
,
1178 InPlaceUIWindow_SetActiveObject
,
1181 static IOleInPlaceUIWindow InPlaceUIWindow
= { (IOleInPlaceUIWindowVtbl
*)&InPlaceUIWindowVtbl
};
1183 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1184 InPlaceUIWindow_QueryInterface
,
1185 InPlaceUIWindow_AddRef
,
1186 InPlaceUIWindow_Release
,
1187 InPlaceFrame_GetWindow
,
1188 InPlaceUIWindow_ContextSensitiveHelp
,
1189 InPlaceUIWindow_GetBorder
,
1190 InPlaceUIWindow_RequestBorderSpace
,
1191 InPlaceUIWindow_SetBorderSpace
,
1192 InPlaceFrame_SetActiveObject
,
1193 InPlaceFrame_InsertMenus
,
1194 InPlaceFrame_SetMenu
,
1195 InPlaceFrame_RemoveMenus
,
1196 InPlaceFrame_SetStatusText
,
1197 InPlaceFrame_EnableModeless
,
1198 InPlaceFrame_TranslateAccelerator
1201 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1203 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
1205 return QueryInterface(riid
, ppv
);
1208 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
1213 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
1218 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
1220 CHECK_EXPECT(Site_GetWindow
);
1221 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1223 *phwnd
= container_hwnd
;
1227 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
1229 ok(0, "unexpected call\n");
1233 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1235 CHECK_EXPECT(CanInPlaceActivate
);
1239 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1241 CHECK_EXPECT(OnInPlaceActivate
);
1245 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
1247 CHECK_EXPECT(OnUIActivate
);
1251 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
1252 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1253 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1255 static const RECT pos_rect
= {2,1,1002,901};
1256 static const RECT clip_rect
= {10,10,990,890};
1258 CHECK_EXPECT(GetWindowContext
);
1260 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1262 *ppFrame
= &InPlaceFrame
;
1264 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1266 *ppDoc
= &InPlaceUIWindow
;
1268 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1270 memcpy(lprcPosRect
, &pos_rect
, sizeof(RECT
));
1272 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1274 memcpy(lprcClipRect
, &clip_rect
, sizeof(RECT
));
1276 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1278 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
1279 lpFrameInfo
->fMDIApp
= FALSE
;
1280 lpFrameInfo
->hwndFrame
= container_hwnd
;
1281 lpFrameInfo
->haccel
= NULL
;
1282 lpFrameInfo
->cAccelEntries
= 0;
1288 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtant
)
1290 ok(0, "unexpected call\n");
1294 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
1296 ok(0, "unexpected call\n");
1300 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
1302 ok(0, "unexpected call\n");
1306 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
1308 ok(0, "unexpected call\n");
1312 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
1314 ok(0, "unexpected call\n");
1318 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
, LPCRECT lprcPosRect
)
1320 ok(0, "unexpected call\n");
1324 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
,
1325 BOOL
*pNoRedraw
, DWORD dwFlags
)
1327 ok(0, "unexpected call\n");
1331 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
,
1334 ok(0, "unexpected call\n");
1338 static HRESULT WINAPI
InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
1340 CHECK_EXPECT2(RequestUIActivate
);
1344 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl
= {
1345 InPlaceSite_QueryInterface
,
1347 InPlaceSite_Release
,
1348 InPlaceSite_GetWindow
,
1349 InPlaceSite_ContextSensitiveHelp
,
1350 InPlaceSite_CanInPlaceActivate
,
1351 InPlaceSite_OnInPlaceActivate
,
1352 InPlaceSite_OnUIActivate
,
1353 InPlaceSite_GetWindowContext
,
1355 InPlaceSite_OnUIDeactivate
,
1356 InPlaceSite_OnInPlaceDeactivate
,
1357 InPlaceSite_DiscardUndoState
,
1358 InPlaceSite_DeactivateAndUndo
,
1359 InPlaceSite_OnPosRectChange
,
1360 InPlaceSite_OnInPlaceActivateEx
,
1361 InPlaceSite_OnInPlaceDeactivateEx
,
1362 InPlaceSite_RequestUIActivate
1365 static IOleInPlaceSiteEx InPlaceSite
= { &InPlaceSiteExVtbl
};
1367 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
1369 return QueryInterface(riid
, ppv
);
1372 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
1377 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
1382 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
1383 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
1385 ok(0, "unexpected call %d %p %p %p\n", dwID
, ppt
, pcmdtReserved
, pdicpReserved
);
1389 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
1391 CHECK_EXPECT2(GetHostInfo
);
1392 ok(pInfo
!= NULL
, "pInfo=NULL\n");
1394 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
) || broken(!pInfo
->cbSize
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
1395 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
1396 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
1397 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
1398 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
1403 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
1404 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
1405 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
1407 CHECK_EXPECT(ShowUI
);
1411 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
1413 CHECK_EXPECT(HideUI
);
1417 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
1419 CHECK_EXPECT(UpdateUI
);
1423 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
1426 CHECK_EXPECT(DocHost_EnableModeless_TRUE
);
1428 CHECK_EXPECT(DocHost_EnableModeless_FALSE
);
1433 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1435 ok(0, "unexpected call\n");
1439 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1441 ok(0, "unexpected call\n");
1445 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
1446 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
1448 ok(0, "unexpected call\n");
1452 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
1453 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
1455 CHECK_EXPECT(DocHost_TranslateAccelerator
);
1456 ok(pguidCmdGroup
!= NULL
, "Got NULL pguidCmdGroup.\n");
1458 ok(IsEqualGUID(pguidCmdGroup
, &CGID_MSHTML
), "Unexpected pguidCmdGroup\n");
1459 ok(lpMsg
!= NULL
, "Got NULL lpMsg.\n");
1460 return hr_dochost_TranslateAccelerator
;
1463 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
1464 LPOLESTR
*pchKey
, DWORD dw
)
1466 CHECK_EXPECT(GetOptionKeyPath
);
1467 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1469 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1470 ok(!dw
, "dw=%x\n", dw
);
1474 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
1475 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
1477 CHECK_EXPECT(GetDropTarget
);
1481 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
1483 ok(0, "unexpected call\n");
1487 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
1488 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
1490 if(is_downloading
&& !(dwl_flags
& DWL_EXPECT_BEFORE_NAVIGATE
))
1491 todo_wine
CHECK_EXPECT(TranslateUrl
);
1493 CHECK_EXPECT(TranslateUrl
);
1497 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
1498 IDataObject
**ppPORet
)
1500 ok(0, "unexpected call\n");
1504 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
1505 LPOLESTR
*pchKey
, DWORD dw
)
1507 CHECK_EXPECT(GetOverridesKeyPath
);
1508 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1510 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1511 ok(!dw
, "dw=%x\n", dw
);
1515 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
1516 DocHostUIHandler_QueryInterface
,
1517 DocHostUIHandler_AddRef
,
1518 DocHostUIHandler_Release
,
1519 DocHostUIHandler_ShowContextMenu
,
1520 DocHostUIHandler_GetHostInfo
,
1521 DocHostUIHandler_ShowUI
,
1522 DocHostUIHandler_HideUI
,
1523 DocHostUIHandler_UpdateUI
,
1524 DocHostUIHandler_EnableModeless
,
1525 DocHostUIHandler_OnDocWindowActivate
,
1526 DocHostUIHandler_OnFrameWindowActivate
,
1527 DocHostUIHandler_ResizeBorder
,
1528 DocHostUIHandler_TranslateAccelerator
,
1529 DocHostUIHandler_GetOptionKeyPath
,
1530 DocHostUIHandler_GetDropTarget
,
1531 DocHostUIHandler_GetExternal
,
1532 DocHostUIHandler_TranslateUrl
,
1533 DocHostUIHandler_FilterDataObject
,
1534 DocHostUIHandler_GetOverrideKeyPath
1537 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
1540 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
1542 return QueryInterface(riid
, ppv
);
1545 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
1550 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
1555 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
,
1556 REFGUID guidService
, REFIID riid
, void **ppv
)
1560 if(!winetest_interactive
)
1561 return E_NOINTERFACE
;
1563 if (IsEqualGUID(&SID_STopLevelBrowser
, guidService
))
1564 trace("Service SID_STopLevelBrowser\n");
1565 else if (IsEqualGUID(&SID_SEditCommandTarget
, guidService
))
1566 trace("Service SID_SEditCommandTarget\n");
1567 else if (IsEqualGUID(&IID_ITargetFrame2
, guidService
))
1568 trace("Service IID_ITargetFrame2\n");
1569 else if (IsEqualGUID(&SID_SInternetSecurityManager
, guidService
))
1570 trace("Service SID_SInternetSecurityManager\n");
1571 else if (IsEqualGUID(&SID_SOleUndoManager
, guidService
))
1572 trace("Service SID_SOleUndoManager\n");
1573 else if (IsEqualGUID(&SID_IMimeInfo
, guidService
))
1574 trace("Service SID_IMimeInfo\n");
1575 else if (IsEqualGUID(&SID_STopWindow
, guidService
))
1576 trace("Service SID_STopWindow\n");
1578 /* 30D02401-6A81-11D0-8274-00C04FD5AE38 Explorer Bar: Search */
1579 /* D1E7AFEC-6A2E-11D0-8C78-00C04FD918B4 no info */
1580 /* A9227C3C-7F8E-11D0-8CB0-00A0C92DBFE8 no info */
1581 /* 371EA634-DC5C-11D1-BA57-00C04FC2040E one reference to IVersionHost */
1582 /* 3050F429-98B5-11CF-BB82-00AA00BDCE0B IID_IElementBehaviorFactory */
1583 /* 6D12FE80-7911-11CF-9534-0000C05BAE0B SID_DefView */
1584 /* AD7F6C62-F6BD-11D2-959B-006097C553C8 no info */
1585 /* 53A2D5B1-D2FC-11D0-84E0-006097C9987D no info */
1586 /* 3050F312-98B5-11CF-BB82-00AA00BDCE0B HTMLFrameBaseClass */
1587 /* 639447BD-B2D3-44B9-9FB0-510F23CB45E4 no info */
1588 /* 20C46561-8491-11CF-960C-0080C7F4EE85 no info */
1591 trace("Service %s not supported\n", debugstr_guid(guidService
));
1593 return E_NOINTERFACE
;
1597 static const IServiceProviderVtbl ServiceProviderVtbl
= {
1598 ServiceProvider_QueryInterface
,
1599 ServiceProvider_AddRef
,
1600 ServiceProvider_Release
,
1601 ServiceProvider_QueryService
1604 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
1607 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
1611 if(IsEqualGUID(&IID_IUnknown
, riid
)
1612 || IsEqualGUID(&IID_IOleClientSite
, riid
))
1614 else if(IsEqualGUID(&IID_IOleWindow
, riid
)
1615 || IsEqualGUID(&IID_IOleInPlaceSite
, riid
)
1616 || IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
1617 *ppv
= &InPlaceSite
;
1618 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
)
1619 || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
1620 *ppv
= &DocHostUIHandler
;
1621 else if(IsEqualGUID(&IID_IDispatch
, riid
))
1623 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
1624 *ppv
= &ServiceProvider
;
1625 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
1626 trace("interface IID_IDocHostShowUI\n");
1627 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
1628 *ppv
= &ControlSite
;
1629 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
1630 trace("interface IID_IOleCommandTarget\n");
1632 /* B6EA2050-048A-11D1-82B9-00C04FB9942E IAxWinHostWindow */
1636 /* are there more interfaces, that a host can support? */
1637 trace("%s: interface not supported\n", debugstr_guid(riid
));
1640 return (*ppv
) ? S_OK
: E_NOINTERFACE
;
1643 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1645 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
1648 static HWND
create_container_window(void)
1650 static const WCHAR wszWebBrowserContainer
[] =
1651 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1652 static WNDCLASSEXW wndclass
= {
1653 sizeof(WNDCLASSEXW
),
1656 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
1657 wszWebBrowserContainer
,
1661 RegisterClassExW(&wndclass
);
1662 return CreateWindowW(wszWebBrowserContainer
, wszWebBrowserContainer
,
1663 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
1664 CW_USEDEFAULT
, NULL
, NULL
, NULL
, NULL
);
1667 static void test_DoVerb(IUnknown
*unk
)
1670 RECT rect
= {0,0,1000,1000};
1673 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1674 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1678 SET_EXPECT(CanInPlaceActivate
);
1679 SET_EXPECT(Site_GetWindow
);
1680 SET_EXPECT(OnInPlaceActivate
);
1681 SET_EXPECT(GetWindowContext
);
1682 SET_EXPECT(ShowObject
);
1683 SET_EXPECT(GetContainer
);
1684 SET_EXPECT(Frame_GetWindow
);
1685 SET_EXPECT(OnUIActivate
);
1686 SET_EXPECT(Frame_SetActiveObject
);
1687 SET_EXPECT(UIWindow_SetActiveObject
);
1688 SET_EXPECT(SetMenu
);
1689 SET_EXPECT(OnFocus
);
1691 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1692 0, (HWND
)0xdeadbeef, &rect
);
1693 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1695 CHECK_CALLED(CanInPlaceActivate
);
1696 CHECK_CALLED(Site_GetWindow
);
1697 CHECK_CALLED(OnInPlaceActivate
);
1698 CHECK_CALLED(GetWindowContext
);
1699 CHECK_CALLED(ShowObject
);
1700 CHECK_CALLED(GetContainer
);
1701 CHECK_CALLED(Frame_GetWindow
);
1702 CHECK_CALLED(OnUIActivate
);
1703 CHECK_CALLED(Frame_SetActiveObject
);
1704 CHECK_CALLED(UIWindow_SetActiveObject
);
1705 CHECK_CALLED(SetMenu
);
1706 todo_wine
CHECK_CALLED(OnFocus
);
1708 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1709 0, (HWND
)0xdeadbeef, &rect
);
1710 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1712 IOleObject_Release(oleobj
);
1715 static void test_GetMiscStatus(IOleObject
*oleobj
)
1720 for(i
=0; i
<10; i
++) {
1722 hres
= IOleObject_GetMiscStatus(oleobj
, i
, &st
);
1723 ok(hres
== S_OK
, "GetMiscStatus failed: %08x\n", hres
);
1724 ok(st
== (OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
1725 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
),
1726 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1727 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st
);
1731 static void test_SetHostNames(IOleObject
*oleobj
)
1735 static const WCHAR test_appW
[] = {'t','e','s','t',' ','a','p','p',0};
1737 hres
= IOleObject_SetHostNames(oleobj
, test_appW
, (void*)0xdeadbeef);
1738 ok(hres
== S_OK
, "SetHostNames failed: %08x\n", hres
);
1741 static void test_ClientSite(IUnknown
*unk
, IOleClientSite
*client
, BOOL stop_download
)
1744 IOleInPlaceObject
*inplace
;
1748 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1749 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1753 test_GetMiscStatus(oleobj
);
1754 test_SetHostNames(oleobj
);
1756 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceObject
, (void**)&inplace
);
1757 ok(hres
== S_OK
, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres
);
1759 IOleObject_Release(oleobj
);
1763 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1764 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1765 ok((hwnd
== NULL
) ^ (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1768 SET_EXPECT(GetContainer
);
1769 SET_EXPECT(Site_GetWindow
);
1770 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1771 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1772 }else if(stop_download
) {
1773 SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
1774 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
1775 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
1778 hres
= IOleObject_SetClientSite(oleobj
, client
);
1779 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1782 CHECK_CALLED(GetContainer
);
1783 CHECK_CALLED(Site_GetWindow
);
1784 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1785 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1786 }else if(stop_download
) {
1787 todo_wine
CHECK_CALLED(Invoke_DOWNLOADCOMPLETE
);
1788 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
1789 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
1792 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1793 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1794 ok((hwnd
== NULL
) == (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1796 shell_embedding_hwnd
= hwnd
;
1798 test_SetHostNames(oleobj
);
1800 IOleInPlaceObject_Release(inplace
);
1801 IOleObject_Release(oleobj
);
1804 static void test_ClassInfo(IUnknown
*unk
)
1806 IProvideClassInfo2
*class_info
;
1810 hres
= IUnknown_QueryInterface(unk
, &IID_IProvideClassInfo2
, (void**)&class_info
);
1811 ok(hres
== S_OK
, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres
);
1815 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, &guid
);
1816 ok(hres
== S_OK
, "GetGUID failed: %08x\n", hres
);
1817 ok(IsEqualGUID(&DIID_DWebBrowserEvents2
, &guid
), "wrong guid\n");
1819 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, &guid
);
1820 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1821 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1823 hres
= IProvideClassInfo2_GetGUID(class_info
, 2, &guid
);
1824 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1825 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1827 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, NULL
);
1828 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1830 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, NULL
);
1831 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1833 IProvideClassInfo2_Release(class_info
);
1836 static void test_ie_funcs(IUnknown
*unk
)
1846 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
1847 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
1854 hres
= IWebBrowser2_get_HWND(wb
, &hwnd
);
1855 ok(hres
== E_FAIL
, "get_HWND failed: %08x, expected E_FAIL\n", hres
);
1856 ok(hwnd
== 0, "unexpected hwnd %x\n", hwnd
);
1860 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1861 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1862 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1864 SET_EXPECT(Invoke_ONMENUBAR
);
1865 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= VARIANT_FALSE
));
1866 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1867 CHECK_CALLED(Invoke_ONMENUBAR
);
1869 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1870 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1871 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1873 SET_EXPECT(Invoke_ONMENUBAR
);
1874 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= 100));
1875 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1876 CHECK_CALLED(Invoke_ONMENUBAR
);
1878 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1879 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1880 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1884 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1885 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1886 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1888 SET_EXPECT(Invoke_ONADDRESSBAR
);
1889 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_FALSE
));
1890 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1891 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1893 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1894 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1895 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1897 SET_EXPECT(Invoke_ONADDRESSBAR
);
1898 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= 100));
1899 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1900 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1902 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1903 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1904 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1906 SET_EXPECT(Invoke_ONADDRESSBAR
);
1907 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_TRUE
));
1908 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1909 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1913 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1914 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1915 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1917 SET_EXPECT(Invoke_ONSTATUSBAR
);
1918 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_TRUE
));
1919 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1920 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1922 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1923 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1924 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1926 SET_EXPECT(Invoke_ONSTATUSBAR
);
1927 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_FALSE
));
1928 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1929 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1931 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1932 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1933 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1935 SET_EXPECT(Invoke_ONSTATUSBAR
);
1936 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= 100));
1937 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1938 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1940 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1941 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1942 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1946 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1947 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1950 SET_EXPECT(Invoke_ONTOOLBAR
);
1951 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_FALSE
));
1952 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1953 CHECK_CALLED(Invoke_ONTOOLBAR
);
1955 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1956 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1957 ok(i
== VARIANT_FALSE
, "b=%x\n", i
);
1959 SET_EXPECT(Invoke_ONTOOLBAR
);
1960 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= 100));
1961 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1962 CHECK_CALLED(Invoke_ONTOOLBAR
);
1964 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1965 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1968 SET_EXPECT(Invoke_ONTOOLBAR
);
1969 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_TRUE
));
1970 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1971 CHECK_CALLED(Invoke_ONTOOLBAR
);
1975 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1976 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1977 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1979 SET_EXPECT(Invoke_ONFULLSCREEN
);
1980 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_TRUE
));
1981 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1982 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1984 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1985 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1986 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1988 SET_EXPECT(Invoke_ONFULLSCREEN
);
1989 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= 100));
1990 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1991 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1993 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1994 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1995 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1997 SET_EXPECT(Invoke_ONFULLSCREEN
);
1998 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_FALSE
));
1999 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
2000 CHECK_CALLED(Invoke_ONFULLSCREEN
);
2004 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2005 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2006 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2008 SET_EXPECT(Invoke_ONTHEATERMODE
);
2009 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_TRUE
));
2010 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2011 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2013 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2014 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2015 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2017 SET_EXPECT(Invoke_ONTHEATERMODE
);
2018 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= 100));
2019 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2020 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2022 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2023 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2024 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2026 SET_EXPECT(Invoke_ONTHEATERMODE
);
2027 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_FALSE
));
2028 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2029 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2034 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
2035 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
2036 ok(b
== 0x100, "b=%x\n", b
);
2038 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
2039 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_TRUE
));
2040 ok(hres
== S_OK
, "put_Resizable failed: %08x\n", hres
);
2041 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE
);
2043 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
2044 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_FALSE
));
2045 ok(hres
== S_OK
, "put_Resizable failed: %08x\n", hres
);
2046 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE
);
2048 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
2049 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
2050 ok(b
== 0x100, "b=%x\n", b
);
2055 hres
= IWebBrowser2_get_Application(wb
, &disp
);
2056 ok(hres
== S_OK
, "get_Application failed: %08x\n", hres
);
2057 ok(disp
== (void*)wb
, "disp=%p, expected %p\n", disp
, wb
);
2059 IDispatch_Release(disp
);
2061 hres
= IWebBrowser2_get_Application(wb
, NULL
);
2062 ok(hres
== E_POINTER
, "get_Application failed: %08x, expected E_POINTER\n", hres
);
2065 hres
= IWebBrowser2_get_Name(wb
, &sName
);
2066 ok(hres
== S_OK
, "getName failed: %08x, expected S_OK\n", hres
);
2067 if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == LANG_ENGLISH
)
2068 ok(!strcmp_wa(sName
, "Microsoft Web Browser Control"), "got '%s', expected 'Microsoft Web Browser Control'\n", wine_dbgstr_w(sName
));
2069 else /* Non-English cannot be blank. */
2070 ok(sName
!=NULL
, "get_Name return a NULL string.\n");
2071 SysFreeString(sName
);
2075 hres
= IWebBrowser2_Quit(wb
);
2076 ok(hres
== E_FAIL
, "Quit failed: %08x, expected E_FAIL\n", hres
);
2078 IWebBrowser2_Release(wb
);
2081 static void test_Silent(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2087 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2088 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2089 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2091 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
2092 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2095 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2096 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2097 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2099 hres
= IWebBrowser2_put_Silent(wb
, 100);
2100 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2103 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2104 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2105 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2107 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_FALSE
);
2108 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2111 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2112 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2113 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2116 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
2117 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2119 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2122 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
2123 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2126 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
2129 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2130 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2131 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2134 static void test_Offline(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2140 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2141 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2142 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2144 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
2145 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2148 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2149 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2150 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2152 hres
= IWebBrowser2_put_Offline(wb
, 100);
2153 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2156 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2157 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2158 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2160 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_FALSE
);
2161 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2164 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2165 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2166 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2169 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
2170 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2172 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2175 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
2176 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2179 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2182 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2183 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2184 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2187 static void test_ambient_unknown(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2191 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2192 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2193 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2194 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2195 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2196 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2198 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_UNKNOWN
);
2199 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2201 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2202 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
2203 CHECK_EXPECT(Invoke_AMBIENT_USERMODE
);
2204 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2205 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2206 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2208 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2209 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
2210 CLEAR_CALLED(Invoke_AMBIENT_USERMODE
);
2211 CLEAR_CALLED(Invoke_AMBIENT_DLCONTROL
);
2212 CLEAR_CALLED(Invoke_AMBIENT_USERAGENT
);
2213 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
);
2216 static void test_wb_funcs(IUnknown
*unk
, BOOL is_clientsite
)
2219 IOleControl
*control
;
2222 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2223 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
2225 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2226 ok(hres
== S_OK
, "Could not get IOleControl interface: %08x\n", hres
);
2228 test_Silent(wb
, control
, is_clientsite
);
2229 test_Offline(wb
, control
, is_clientsite
);
2230 test_ambient_unknown(wb
, control
, is_clientsite
);
2232 IWebBrowser_Release(wb
);
2233 IOleControl_Release(control
);
2236 static void test_GetControlInfo(IUnknown
*unk
)
2238 IOleControl
*control
;
2242 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2243 ok(hres
== S_OK
, "Could not get IOleControl: %08x\n", hres
);
2247 hres
= IOleControl_GetControlInfo(control
, &info
);
2248 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2249 hres
= IOleControl_GetControlInfo(control
, NULL
);
2250 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2252 IOleControl_Release(control
);
2255 static void test_Extent(IUnknown
*unk
)
2258 SIZE size
, expected
;
2264 /* default aspect ratio is 96dpi / 96dpi */
2266 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
2267 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
2269 if (dpi_x
!= 96 || dpi_y
!= 96)
2270 trace("dpi: %d / %d\n", dpi_y
, dpi_y
);
2272 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
2273 ok(hres
== S_OK
, "Could not get IOleObkect: %08x\n", hres
);
2277 size
.cx
= size
.cy
= 0xdeadbeef;
2278 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2279 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2280 /* Default size is 50x20 pixels, in himetric units */
2281 expected
.cx
= MulDiv( 50, 2540, dpi_x
);
2282 expected
.cy
= MulDiv( 20, 2540, dpi_y
);
2283 ok(size
.cx
== expected
.cx
&& size
.cy
== expected
.cy
, "size = {%d %d} (expected %d %d)\n",
2284 size
.cx
, size
.cy
, expected
.cx
, expected
.cy
);
2288 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2289 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2291 size
.cx
= size
.cy
= 0xdeadbeef;
2292 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2293 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2294 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2296 size
.cx
= size
.cy
= 0xdeadbeef;
2297 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2298 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2299 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2303 hres
= IOleObject_SetExtent(oleobj
, 0, &size
);
2304 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2306 size
.cx
= size
.cy
= 0xdeadbeef;
2307 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2308 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2309 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2311 size
.cx
= size
.cy
= 0xdeadbeef;
2312 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2313 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2314 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2318 hres
= IOleObject_SetExtent(oleobj
, 0xdeadbeef, &size
);
2319 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2321 size
.cx
= size
.cy
= 0xdeadbeef;
2322 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2323 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2324 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2326 size
.cx
= size
.cy
= 0xdeadbeef;
2327 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2328 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2329 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2331 IOleObject_Release(oleobj
);
2334 static void test_ConnectionPoint(IUnknown
*unk
, BOOL init
)
2336 IConnectionPointContainer
*container
;
2337 IConnectionPoint
*point
;
2340 static DWORD dw
= 100;
2342 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2343 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2347 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &DIID_DWebBrowserEvents2
, &point
);
2348 IConnectionPointContainer_Release(container
);
2349 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2354 hres
= IConnectionPoint_Advise(point
, (IUnknown
*)&WebBrowserEvents2
, &dw
);
2355 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2356 ok(dw
== 1, "dw=%d, expected 1\n", dw
);
2358 hres
= IConnectionPoint_Unadvise(point
, dw
);
2359 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
2362 IConnectionPoint_Release(point
);
2365 static void test_Navigate2(IUnknown
*unk
)
2367 IWebBrowser2
*webbrowser
;
2371 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&webbrowser
);
2372 ok(hres
== S_OK
, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres
);
2376 test_LocationURL(unk
, is_first_load
? "" : current_url
);
2377 test_ready_state(is_first_load
? READYSTATE_UNINITIALIZED
: READYSTATE_COMPLETE
);
2379 V_VT(&url
) = VT_BSTR
;
2380 V_BSTR(&url
) = a2bstr("about:blank");
2381 current_url
= "about:blank";
2384 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2385 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2386 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2387 SET_EXPECT(Invoke_DOWNLOADBEGIN
);
2388 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2389 SET_EXPECT(EnableModeless_FALSE
);
2390 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2391 SET_EXPECT(SetStatusText
);
2392 SET_EXPECT(GetHostInfo
);
2393 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2394 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2395 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2396 SET_EXPECT(GetOptionKeyPath
);
2397 SET_EXPECT(GetOverridesKeyPath
);
2398 if (use_container_olecmd
) SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2399 if (use_container_olecmd
) SET_EXPECT(Exec_SETPROGRESSMAX
);
2400 if (use_container_olecmd
) SET_EXPECT(Exec_SETPROGRESSPOS
);
2401 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2402 SET_EXPECT(Invoke_FILEDOWNLOAD
);
2403 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2404 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2405 SET_EXPECT(EnableModeless_TRUE
);
2406 if (!use_container_olecmd
) SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
2409 hres
= IWebBrowser2_Navigate2(webbrowser
, &url
, NULL
, NULL
, NULL
, NULL
);
2410 ok(hres
== S_OK
, "Navigate2 failed: %08x\n", hres
);
2413 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
2414 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2415 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2416 todo_wine
CHECK_CALLED(Invoke_DOWNLOADBEGIN
);
2417 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2418 CHECK_CALLED(EnableModeless_FALSE
);
2419 CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2420 CHECK_CALLED(SetStatusText
);
2421 CHECK_CALLED(GetHostInfo
);
2422 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
2423 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
2424 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
2425 CHECK_CALLED(GetOptionKeyPath
);
2426 CHECK_CALLED(GetOverridesKeyPath
);
2427 if (use_container_olecmd
) todo_wine
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
2428 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2429 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2430 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2431 todo_wine
CHECK_CALLED(Invoke_FILEDOWNLOAD
);
2432 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2433 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2434 CHECK_CALLED(EnableModeless_TRUE
);
2438 IWebBrowser2_Release(webbrowser
);
2440 test_ready_state(READYSTATE_LOADING
);
2443 static void test_QueryStatusWB(IWebBrowser2
*webbrowser
, BOOL use_custom_target
, BOOL has_document
)
2445 HRESULT hres
, success_state
;
2446 OLECMDF success_flags
;
2447 enum OLECMDF status
;
2450 * We can tell the difference between the custom container target and the built-in target
2451 * since the custom target returns OLECMDF_SUPPORTED instead of OLECMDF_ENABLED.
2453 if (use_custom_target
)
2454 success_flags
= OLECMDF_SUPPORTED
;
2456 success_flags
= OLECMDF_ENABLED
;
2458 /* When no target is available (no document or custom target) an error is returned */
2460 success_state
= S_OK
;
2462 success_state
= E_UNEXPECTED
;
2465 * Test a safe operation that exists as both a high-numbered MSHTML id and an OLECMDID.
2466 * These tests show that QueryStatusWB uses a NULL pguidCmdGroup, since OLECMDID_STOP
2467 * is enabled and IDM_STOP is not.
2469 status
= 0xdeadbeef;
2470 if (use_custom_target
) SET_EXPECT(QueryStatus_STOP
);
2471 hres
= IWebBrowser2_QueryStatusWB(webbrowser
, OLECMDID_STOP
, &status
);
2472 ok(hres
== success_state
, "QueryStatusWB failed: %08x %08x\n", hres
, success_state
);
2473 if (!use_custom_target
&& has_document
)
2474 todo_wine
ok((has_document
&& status
== success_flags
) || (!has_document
&& status
== 0xdeadbeef),
2475 "OLECMDID_STOP not enabled/supported: %08x %08x\n", status
, success_flags
);
2477 ok((has_document
&& status
== success_flags
) || (!has_document
&& status
== 0xdeadbeef),
2478 "OLECMDID_STOP not enabled/supported: %08x %08x\n", status
, success_flags
);
2479 status
= 0xdeadbeef;
2480 if (use_custom_target
) SET_EXPECT(QueryStatus_IDM_STOP
);
2481 hres
= IWebBrowser2_QueryStatusWB(webbrowser
, IDM_STOP
, &status
);
2482 ok(hres
== success_state
, "QueryStatusWB failed: %08x %08x\n", hres
, success_state
);
2483 ok((has_document
&& status
== 0) || (!has_document
&& status
== 0xdeadbeef),
2484 "IDM_STOP is enabled/supported: %08x %d\n", status
, has_document
);
2487 static void test_ExecWB(IWebBrowser2
*webbrowser
, BOOL use_custom_target
, BOOL has_document
)
2489 HRESULT hres
, olecmdid_state
, idm_state
;
2491 /* When no target is available (no document or custom target) an error is returned */
2494 olecmdid_state
= S_OK
;
2495 idm_state
= OLECMDERR_E_NOTSUPPORTED
;
2499 olecmdid_state
= E_UNEXPECTED
;
2500 idm_state
= E_UNEXPECTED
;
2504 * Test a safe operation that exists as both a high-numbered MSHTML id and an OLECMDID.
2505 * These tests show that QueryStatusWB uses a NULL pguidCmdGroup, since OLECMDID_STOP
2506 * succeeds (S_OK) and IDM_STOP does not (OLECMDERR_E_NOTSUPPORTED).
2508 if (use_custom_target
)
2509 SET_EXPECT(Exec_STOP
);
2510 hres
= IWebBrowser2_ExecWB(webbrowser
, OLECMDID_STOP
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);
2511 if (!use_custom_target
&& has_document
)
2512 todo_wine
ok(hres
== olecmdid_state
, "ExecWB failed: %08x %08x\n", hres
, olecmdid_state
);
2514 ok(hres
== olecmdid_state
, "ExecWB failed: %08x %08x\n", hres
, olecmdid_state
);
2515 if (use_custom_target
)
2516 SET_EXPECT(Exec_IDM_STOP
);
2517 hres
= IWebBrowser2_ExecWB(webbrowser
, IDM_STOP
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);
2518 ok(hres
== idm_state
, "ExecWB failed: %08x %08x\n", hres
, idm_state
);
2521 static void test_download(DWORD flags
)
2525 is_downloading
= TRUE
;
2528 test_ready_state((flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
2530 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2531 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2532 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2533 SET_EXPECT(TranslateUrl
);
2535 SET_EXPECT(Exec_SETPROGRESSMAX
);
2536 SET_EXPECT(Exec_SETPROGRESSPOS
);
2537 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2538 SET_EXPECT(DocHost_EnableModeless_FALSE
);
2539 SET_EXPECT(DocHost_EnableModeless_TRUE
);
2540 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2541 SET_EXPECT(Invoke_282
);
2542 SET_EXPECT(EnableModeless_FALSE
);
2543 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2544 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2545 SET_EXPECT(SetStatusText
);
2546 SET_EXPECT(EnableModeless_TRUE
);
2548 SET_EXPECT(GetHostInfo
);
2549 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2550 SET_EXPECT(Invoke_TITLECHANGE
);
2551 SET_EXPECT(Invoke_NAVIGATECOMPLETE2
);
2553 SET_EXPECT(GetDropTarget
);
2554 SET_EXPECT(Invoke_PROGRESSCHANGE
);
2555 SET_EXPECT(Invoke_DOCUMENTCOMPLETE
);
2557 SET_EXPECT(UpdateUI
);
2558 SET_EXPECT(Exec_UPDATECOMMANDS
);
2559 SET_EXPECT(QueryStatus_STOP
);
2561 while(!called_Invoke_DOCUMENTCOMPLETE
&& GetMessage(&msg
, NULL
, 0, 0)) {
2562 TranslateMessage(&msg
);
2563 DispatchMessage(&msg
);
2566 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2567 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2568 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2569 CHECK_CALLED(TranslateUrl
);
2571 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2572 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2573 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2574 CLEAR_CALLED(DocHost_EnableModeless_FALSE
); /* IE 7 */
2575 CLEAR_CALLED(DocHost_EnableModeless_TRUE
); /* IE 7 */
2576 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2577 CLEAR_CALLED(Invoke_282
); /* IE 7 */
2579 todo_wine
CHECK_CALLED(EnableModeless_FALSE
);
2581 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2582 CLEAR_CALLED(Invoke_COMMANDSTATECHANGE
);
2583 todo_wine
CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2584 todo_wine
CHECK_CALLED(SetStatusText
);
2586 todo_wine
CHECK_CALLED(EnableModeless_TRUE
);
2588 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2590 todo_wine
CHECK_CALLED(GetHostInfo
);
2591 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2592 todo_wine
CHECK_CALLED(Invoke_TITLECHANGE
);
2593 CHECK_CALLED(Invoke_NAVIGATECOMPLETE2
);
2595 todo_wine
CHECK_CALLED(GetDropTarget
);
2596 todo_wine
CHECK_CALLED(Invoke_PROGRESSCHANGE
);
2597 CHECK_CALLED(Invoke_DOCUMENTCOMPLETE
);
2599 is_downloading
= FALSE
;
2601 test_ready_state(READYSTATE_COMPLETE
);
2603 while(!called_Exec_UPDATECOMMANDS
&& GetMessage(&msg
, NULL
, 0, 0)) {
2604 TranslateMessage(&msg
);
2605 DispatchMessage(&msg
);
2608 CHECK_CALLED(UpdateUI
);
2609 CHECK_CALLED(Exec_UPDATECOMMANDS
);
2610 CLEAR_CALLED(QueryStatus_STOP
);
2613 static void test_olecmd(IUnknown
*unk
, BOOL loaded
)
2615 IOleCommandTarget
*cmdtrg
;
2619 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2620 ok(hres
== S_OK
, "Could not get IOleCommandTarget iface: %08x\n", hres
);
2624 cmds
[0].cmdID
= OLECMDID_SPELL
;
2625 cmds
[0].cmdf
= 0xdeadbeef;
2626 cmds
[1].cmdID
= OLECMDID_REFRESH
;
2627 cmds
[1].cmdf
= 0xdeadbeef;
2628 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmds
, NULL
);
2630 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2631 ok(cmds
[0].cmdf
== OLECMDF_SUPPORTED
, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2632 ok(cmds
[1].cmdf
== (OLECMDF_ENABLED
|OLECMDF_SUPPORTED
),
2633 "OLECMDID_REFRESH cmdf = %x\n", cmds
[1].cmdf
);
2635 ok(hres
== 0x80040104, "QueryStatus failed: %08x\n", hres
);
2636 ok(cmds
[0].cmdf
== 0xdeadbeef, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2637 ok(cmds
[1].cmdf
== 0xdeadbeef, "OLECMDID_REFRESH cmdf = %x\n", cmds
[0].cmdf
);
2640 IOleCommandTarget_Release(cmdtrg
);
2643 static void test_IServiceProvider(IUnknown
*unk
)
2645 IServiceProvider
*servprov
= (void*)0xdeadbeef;
2647 IUnknown
*ret
= NULL
;
2649 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&servprov
);
2650 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
2654 hres
= IServiceProvider_QueryService(servprov
, &SID_STopLevelBrowser
, &IID_IBrowserService2
, (LPVOID
*)&ret
);
2655 ok(hres
== E_FAIL
, "QueryService returned %08x, expected E_FAIL\n", hres
);
2656 ok(ret
== NULL
, "ret returned %p, expected NULL\n", ret
);
2659 IUnknown_Release(ret
);
2662 IServiceProvider_Release(servprov
);
2665 static void test_put_href(IUnknown
*unk
)
2667 IHTMLLocation
*location
;
2668 IHTMLDocument2
*doc
;
2669 IDispatch
*doc_disp
;
2673 doc_disp
= get_document(unk
);
2675 hres
= IDispatch_QueryInterface(doc_disp
, &IID_IHTMLDocument2
, (void**)&doc
);
2676 IDispatch_Release(doc_disp
);
2677 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2 failed: %08x\n", hres
);
2680 hres
= IHTMLDocument2_get_location(doc
, &location
);
2681 IHTMLDocument2_Release(doc
);
2682 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2683 ok(location
!= NULL
, "location == NULL\n");
2685 SET_EXPECT(TranslateUrl
);
2686 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2687 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2689 dwl_flags
= DWL_FROM_PUT_HREF
;
2691 str
= a2bstr("about:test");
2692 current_url
= "about:test";
2693 is_first_load
= FALSE
;
2694 hres
= IHTMLLocation_put_href(location
, str
);
2696 CHECK_CALLED(TranslateUrl
);
2697 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2698 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2700 IHTMLLocation_Release(location
);
2702 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
2704 test_ready_state(READYSTATE_COMPLETE
);
2707 static void test_QueryInterface(IUnknown
*unk
)
2709 IQuickActivate
*qa
= (IQuickActivate
*)0xdeadbeef;
2710 IRunnableObject
*runnable
= (IRunnableObject
*)0xdeadbeef;
2711 IPerPropertyBrowsing
*propbrowse
= (void*)0xdeadbeef;
2712 IOleInPlaceSite
*inplace
= (void*)0xdeadbeef;
2713 IOleCache
*cache
= (void*)0xdeadbeef;
2714 IObjectWithSite
*site
= (void*)0xdeadbeef;
2715 IViewObjectEx
*viewex
= (void*)0xdeadbeef;
2716 IOleLink
*link
= (void*)0xdeadbeef;
2717 IMarshal
*marshal
= (void*)0xdeadbeef;
2718 IStdMarshalInfo
*marshalinfo
= (void*)0xdeadbeef;
2721 hres
= IUnknown_QueryInterface(unk
, &IID_IQuickActivate
, (void**)&qa
);
2722 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2723 ok(qa
== NULL
, "qa=%p, expected NULL\n", qa
);
2725 hres
= IUnknown_QueryInterface(unk
, &IID_IRunnableObject
, (void**)&runnable
);
2726 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2727 ok(runnable
== NULL
, "runnable=%p, expected NULL\n", runnable
);
2729 hres
= IUnknown_QueryInterface(unk
, &IID_IPerPropertyBrowsing
, (void**)&propbrowse
);
2730 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2731 ok(propbrowse
== NULL
, "propbrowse=%p, expected NULL\n", propbrowse
);
2733 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCache
, (void**)&cache
);
2734 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2735 ok(cache
== NULL
, "cache=%p, expected NULL\n", cache
);
2737 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceSite
, (void**)&inplace
);
2738 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2739 ok(inplace
== NULL
, "inplace=%p, expected NULL\n", inplace
);
2741 hres
= IUnknown_QueryInterface(unk
, &IID_IObjectWithSite
, (void**)&site
);
2742 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2743 ok(site
== NULL
, "site=%p, expected NULL\n", site
);
2745 hres
= IUnknown_QueryInterface(unk
, &IID_IViewObjectEx
, (void**)&viewex
);
2746 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2747 ok(viewex
== NULL
, "viewex=%p, expected NULL\n", viewex
);
2749 hres
= IUnknown_QueryInterface(unk
, &IID_IOleLink
, (void**)&link
);
2750 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2751 ok(link
== NULL
, "link=%p, expected NULL\n", link
);
2753 hres
= IUnknown_QueryInterface(unk
, &IID_IMarshal
, (void**)&marshal
);
2754 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2755 ok(marshal
== NULL
, "marshal=%p, expected NULL\n", marshal
);
2757 hres
= IUnknown_QueryInterface(unk
, &IID_IStdMarshalInfo
, (void**)&marshalinfo
);
2758 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2759 ok(marshalinfo
== NULL
, "marshalinfo=%p, expected NULL\n", marshalinfo
);
2763 static void test_UIActivate(IUnknown
*unk
, BOOL activate
)
2765 IOleDocumentView
*docview
;
2769 disp
= get_document(unk
);
2771 hres
= IDispatch_QueryInterface(disp
, &IID_IOleDocumentView
, (void**)&docview
);
2772 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2773 if(SUCCEEDED(hres
)) {
2775 SET_EXPECT(RequestUIActivate
);
2778 SET_EXPECT(OnFocus
);
2781 hres
= IOleDocumentView_UIActivate(docview
, activate
);
2783 todo_wine
ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2785 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2789 CHECK_CALLED(RequestUIActivate
);
2790 CHECK_CALLED(ShowUI
);
2791 CHECK_CALLED(HideUI
);
2792 CHECK_CALLED(OnFocus
);
2796 IOleDocumentView_Release(docview
);
2799 IDispatch_Release(disp
);
2802 static void test_TranslateAccelerator(IUnknown
*unk
)
2804 IOleClientSite
*doc_clientsite
;
2805 IOleInPlaceActiveObject
*pao
;
2815 test_Navigate2(unk
);
2817 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&pao
);
2818 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2819 if(SUCCEEDED(hres
)) {
2820 /* One accelerator that should be handled by mshtml */
2821 msg_a
.message
= WM_KEYDOWN
;
2822 msg_a
.wParam
= VK_F1
;
2823 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
2824 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
2826 /* And one that should not */
2827 msg_a
.message
= WM_KEYDOWN
;
2828 msg_a
.wParam
= VK_F5
;
2829 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
2830 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
2832 IOleInPlaceActiveObject_Release(pao
);
2835 test_UIActivate(unk
, TRUE
);
2837 /* Test again after UIActivate */
2838 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&pao
);
2839 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2840 if(SUCCEEDED(hres
)) {
2841 /* One accelerator that should be handled by mshtml */
2842 msg_a
.message
= WM_KEYDOWN
;
2843 msg_a
.wParam
= VK_F1
;
2844 SET_EXPECT(DocHost_TranslateAccelerator
);
2845 SET_EXPECT(ControlSite_TranslateAccelerator
);
2846 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
2847 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
2848 todo_wine
CHECK_CALLED(DocHost_TranslateAccelerator
);
2849 todo_wine
CHECK_CALLED(ControlSite_TranslateAccelerator
);
2851 /* And one that should not */
2852 msg_a
.message
= WM_KEYDOWN
;
2853 msg_a
.wParam
= VK_F5
;
2854 SET_EXPECT(DocHost_TranslateAccelerator
);
2855 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
2856 todo_wine
ok(hres
== S_OK
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
2857 todo_wine
CHECK_CALLED(DocHost_TranslateAccelerator
);
2859 IOleInPlaceActiveObject_Release(pao
);
2862 doc_clientsite
= get_dochost(unk
);
2863 if(doc_clientsite
) {
2864 IDocHostUIHandler2
*dochost
;
2865 IOleControlSite
*doc_controlsite
;
2868 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IOleInPlaceFrame
, (void**)&unk_test
);
2869 ok(hres
== E_NOINTERFACE
, "Got 0x%08x\n", hres
);
2870 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
2872 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostShowUI
, (void**)&unk_test
);
2873 todo_wine
ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2874 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
2876 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostUIHandler
, (void**)&unk_test
);
2877 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2878 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
2880 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostUIHandler2
, (void**)&dochost
);
2881 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2882 if(SUCCEEDED(hres
)) {
2883 msg_a
.message
= WM_KEYDOWN
;
2884 hr_dochost_TranslateAccelerator
= 0xdeadbeef;
2885 for(keycode
= 0; keycode
<= 0x100; keycode
++) {
2886 msg_a
.wParam
= keycode
;
2887 SET_EXPECT(DocHost_TranslateAccelerator
);
2888 hres
= IDocHostUIHandler_TranslateAccelerator(dochost
, &msg_a
, &CGID_MSHTML
, 1234);
2889 ok(hres
== 0xdeadbeef, "Got 0x%08x\n", hres
);
2890 CHECK_CALLED(DocHost_TranslateAccelerator
);
2892 hr_dochost_TranslateAccelerator
= E_NOTIMPL
;
2894 SET_EXPECT(DocHost_TranslateAccelerator
);
2895 hres
= IDocHostUIHandler_TranslateAccelerator(dochost
, &msg_a
, &CGID_MSHTML
, 1234);
2896 ok(hres
== E_NOTIMPL
, "Got 0x%08x\n", hres
);
2897 CHECK_CALLED(DocHost_TranslateAccelerator
);
2899 IDocHostUIHandler2_Release(dochost
);
2902 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IOleControlSite
, (void**)&doc_controlsite
);
2903 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
2904 if(SUCCEEDED(hres
)) {
2905 msg_a
.message
= WM_KEYDOWN
;
2906 hr_site_TranslateAccelerator
= 0xdeadbeef;
2907 for(keycode
= 0; keycode
< 0x100; keycode
++) {
2908 msg_a
.wParam
= keycode
;
2909 SET_EXPECT(ControlSite_TranslateAccelerator
);
2910 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
2911 if(keycode
== 0x9 || keycode
== 0x75)
2912 todo_wine
ok(hres
== S_OK
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
2914 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
2916 CHECK_CALLED(ControlSite_TranslateAccelerator
);
2918 msg_a
.wParam
= VK_LEFT
;
2919 SET_EXPECT(ControlSite_TranslateAccelerator
);
2920 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
2921 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
2922 CHECK_CALLED(ControlSite_TranslateAccelerator
);
2924 hr_site_TranslateAccelerator
= S_OK
;
2925 SET_EXPECT(ControlSite_TranslateAccelerator
);
2926 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
2927 ok(hres
== S_OK
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
2928 CHECK_CALLED(ControlSite_TranslateAccelerator
);
2930 hr_site_TranslateAccelerator
= E_NOTIMPL
;
2931 SET_EXPECT(ControlSite_TranslateAccelerator
);
2932 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
2933 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
2934 CHECK_CALLED(ControlSite_TranslateAccelerator
);
2936 IOleControlSite_Release(doc_controlsite
);
2939 IOleClientSite_Release(doc_clientsite
);
2942 test_UIActivate(unk
, FALSE
);
2945 static void test_dochost_qs(IUnknown
*unk
)
2947 IOleClientSite
*client_site
;
2948 IServiceProvider
*serv_prov
;
2952 client_site
= get_dochost(unk
);
2953 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IServiceProvider
, (void**)&serv_prov
);
2954 IOleClientSite_Release(client_site
);
2955 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
2957 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&service
);
2958 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
2959 ok(iface_cmp(service
, unk
), "service != unk\n");
2960 IUnknown_Release(service
);
2962 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IWebBrowserApp
, &IID_IHlinkFrame
, (void**)&service
);
2963 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
2964 ok(iface_cmp(service
, unk
), "service != unk\n");
2965 IUnknown_Release(service
);
2967 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IShellBrowser
, (void**)&service
);
2968 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
2969 IUnknown_Release(service
);
2971 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IBrowserService
, (void**)&service
);
2972 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
2973 IUnknown_Release(service
);
2975 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IDocObjectService
, (void**)&service
);
2976 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
2977 IUnknown_Release(service
);
2979 IServiceProvider_Release(serv_prov
);
2982 static void test_WebBrowser(BOOL do_download
)
2984 IUnknown
*unk
= NULL
;
2988 if (FAILED(create_WebBrowser(&unk
)))
2991 is_downloading
= FALSE
;
2992 is_first_load
= TRUE
;
2993 use_container_olecmd
= TRUE
;
2995 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2996 ok(hres
== S_OK
, "Could not get IWebBrowser2 iface: %08x\n", hres
);
2998 test_QueryStatusWB(wb
, FALSE
, FALSE
);
2999 test_ExecWB(wb
, FALSE
, FALSE
);
3000 test_QueryInterface(unk
);
3001 test_ready_state(READYSTATE_UNINITIALIZED
);
3002 test_ClassInfo(unk
);
3003 test_LocationURL(unk
, "");
3004 test_ConnectionPoint(unk
, TRUE
);
3005 test_ClientSite(unk
, &ClientSite
, !do_download
);
3007 test_wb_funcs(unk
, TRUE
);
3009 test_olecmd(unk
, FALSE
);
3010 test_Navigate2(unk
);
3011 test_QueryStatusWB(wb
, TRUE
, TRUE
);
3012 test_ExecWB(wb
, TRUE
, TRUE
);
3015 IDispatch
*doc
, *doc2
;
3018 test_olecmd(unk
, TRUE
);
3019 doc
= get_document(unk
);
3022 test_download(DWL_FROM_PUT_HREF
);
3023 doc2
= get_document(unk
);
3024 ok(doc
== doc2
, "doc != doc2\n");
3025 IDispatch_Release(doc2
);
3027 test_Navigate2(unk
);
3028 test_download(DWL_EXPECT_BEFORE_NAVIGATE
);
3029 test_TranslateAccelerator(unk
);
3030 doc2
= get_document(unk
);
3031 ok(doc
== doc2
, "doc != doc2\n");
3032 IDispatch_Release(doc2
);
3033 IDispatch_Release(doc2
);
3035 test_dochost_qs(unk
);
3038 test_ClientSite(unk
, NULL
, !do_download
);
3040 test_GetControlInfo(unk
);
3041 test_wb_funcs(unk
, FALSE
);
3042 test_ConnectionPoint(unk
, FALSE
);
3043 test_IServiceProvider(unk
);
3045 IWebBrowser2_Release(wb
);
3046 ref
= IUnknown_Release(unk
);
3047 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3050 static void test_WebBrowser_NoContainerOlecmd(void)
3052 IUnknown
*unk
= NULL
;
3056 is_downloading
= FALSE
;
3057 is_first_load
= TRUE
;
3058 use_container_olecmd
= FALSE
;
3061 if (FAILED(create_WebBrowser(&unk
)))
3063 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
3064 ok(hres
== S_OK
, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres
);
3067 test_ConnectionPoint(unk
, TRUE
);
3068 test_ClientSite(unk
, &ClientSite
, TRUE
);
3070 test_Navigate2(unk
);
3072 /* Tests of interest */
3073 test_QueryStatusWB(wb
, FALSE
, TRUE
);
3074 test_ExecWB(wb
, FALSE
, TRUE
);
3077 IWebBrowser2_Release(wb
);
3078 test_ClientSite(unk
, NULL
, TRUE
);
3079 test_ConnectionPoint(unk
, FALSE
);
3080 ref
= IUnknown_Release(unk
);
3081 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3084 static BOOL
check_ie(void)
3086 IHTMLDocument5
*doc
;
3089 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
3090 &IID_IHTMLDocument5
, (void**)&doc
);
3094 IHTMLDocument5_Release(doc
);
3098 START_TEST(webbrowser
)
3100 OleInitialize(NULL
);
3103 container_hwnd
= create_container_window();
3105 trace("Testing WebBrowser (no download)...\n");
3106 test_WebBrowser(FALSE
);
3107 trace("Testing WebBrowser...\n");
3108 test_WebBrowser(TRUE
);
3109 trace("Testing WebBrowser w/o container-based olecmd...\n");
3110 test_WebBrowser_NoContainerOlecmd();
3112 win_skip("Skipping tests on too old IE\n");