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_WINDOWCLOSING
);
113 DEFINE_EXPECT(Invoke_282
);
114 DEFINE_EXPECT(EnableModeless_TRUE
);
115 DEFINE_EXPECT(EnableModeless_FALSE
);
116 DEFINE_EXPECT(GetHostInfo
);
117 DEFINE_EXPECT(GetOptionKeyPath
);
118 DEFINE_EXPECT(GetOverridesKeyPath
);
119 DEFINE_EXPECT(SetStatusText
);
120 DEFINE_EXPECT(UpdateUI
);
121 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
122 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
123 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
124 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
125 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
126 DEFINE_EXPECT(Exec_SETTITLE
);
127 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
128 DEFINE_EXPECT(Exec_STOP
);
129 DEFINE_EXPECT(Exec_IDM_STOP
);
130 DEFINE_EXPECT(Exec_DocHostCommandHandler_2300
);
131 DEFINE_EXPECT(QueryStatus_STOP
);
132 DEFINE_EXPECT(QueryStatus_IDM_STOP
);
133 DEFINE_EXPECT(DocHost_EnableModeless_TRUE
);
134 DEFINE_EXPECT(DocHost_EnableModeless_FALSE
);
135 DEFINE_EXPECT(DocHost_TranslateAccelerator
);
136 DEFINE_EXPECT(GetDropTarget
);
137 DEFINE_EXPECT(TranslateUrl
);
138 DEFINE_EXPECT(ShowUI
);
139 DEFINE_EXPECT(HideUI
);
140 DEFINE_EXPECT(OnUIDeactivate
);
141 DEFINE_EXPECT(OnInPlaceDeactivate
);
142 DEFINE_EXPECT(RequestUIActivate
);
143 DEFINE_EXPECT(ControlSite_TranslateAccelerator
);
144 DEFINE_EXPECT(OnFocus
);
145 DEFINE_EXPECT(GetExternal
);
147 static const WCHAR wszItem
[] = {'i','t','e','m',0};
148 static const WCHAR emptyW
[] = {0};
150 static VARIANT_BOOL exvb
;
152 static IWebBrowser2
*wb
;
154 static HWND container_hwnd
, shell_embedding_hwnd
;
155 static BOOL is_downloading
, is_first_load
, use_container_olecmd
, test_close
, is_http
, use_container_dochostui
;
156 static HRESULT hr_dochost_TranslateAccelerator
= E_NOTIMPL
;
157 static HRESULT hr_site_TranslateAccelerator
= E_NOTIMPL
;
158 static const char *current_url
;
159 static int wb_version
;
161 #define DWL_EXPECT_BEFORE_NAVIGATE 0x01
162 #define DWL_FROM_PUT_HREF 0x02
163 #define DWL_FROM_GOBACK 0x04
164 #define DWL_FROM_GOFORWARD 0x08
165 #define DWL_HTTP 0x10
166 #define DWL_REFRESH 0x20
168 static DWORD dwl_flags
;
171 /* Returns true if the user interface is in English. Note that this does not
172 * presume of the formatting of dates, numbers, etc.
174 static BOOL
is_lang_english(void)
176 static HMODULE hkernel32
= NULL
;
177 static LANGID (WINAPI
*pGetThreadUILanguage
)(void) = NULL
;
178 static LANGID (WINAPI
*pGetUserDefaultUILanguage
)(void) = NULL
;
182 hkernel32
= GetModuleHandleA("kernel32.dll");
183 pGetThreadUILanguage
= (void*)GetProcAddress(hkernel32
, "GetThreadUILanguage");
184 pGetUserDefaultUILanguage
= (void*)GetProcAddress(hkernel32
, "GetUserDefaultUILanguage");
186 if (pGetThreadUILanguage
)
187 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH
;
188 if (pGetUserDefaultUILanguage
)
189 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH
;
191 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
194 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
197 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
198 return lstrcmpA(stra
, buf
);
201 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
203 IUnknown
*unk1
, *unk2
;
208 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
209 IUnknown_Release(unk1
);
210 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
211 IUnknown_Release(unk2
);
216 static const char *debugstr_guid(REFIID riid
)
220 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
221 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
222 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
223 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
228 static BSTR
a2bstr(const char *str
)
233 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
234 ret
= SysAllocStringLen(NULL
, len
);
235 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
240 #define create_webbrowser() _create_webbrowser(__LINE__)
241 static IWebBrowser2
*_create_webbrowser(unsigned line
)
248 hres
= CoCreateInstance(&CLSID_WebBrowser
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
249 &IID_IWebBrowser2
, (void**)&ret
);
250 ok_(__FILE__
,line
)(hres
== S_OK
, "Creating WebBrowser object failed: %08x\n", hres
);
254 #define test_LocationURL(a,b) _test_LocationURL(__LINE__,a,b)
255 static void _test_LocationURL(unsigned line
, IWebBrowser2
*wb
, const char *exurl
)
257 BSTR url
= (void*)0xdeadbeef;
260 hres
= IWebBrowser2_get_LocationURL(wb
, &url
);
261 ok_(__FILE__
,line
) (hres
== (*exurl
? S_OK
: S_FALSE
), "get_LocationURL failed: %08x\n", hres
);
264 ok_(__FILE__
,line
) (!strcmp_wa(url
, exurl
), "unexpected URL: %s\n", wine_dbgstr_w(url
));
269 #define test_ready_state(ex) _test_ready_state(__LINE__,ex);
270 static void _test_ready_state(unsigned line
, READYSTATE exstate
)
275 hres
= IWebBrowser2_get_ReadyState(wb
, &state
);
276 ok_(__FILE__
,line
)(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
277 ok_(__FILE__
,line
)(state
== exstate
, "ReadyState = %d, expected %d\n", state
, exstate
);
280 #define get_document(u) _get_document(__LINE__,u)
281 static IHTMLDocument2
*_get_document(unsigned line
, IWebBrowser2
*wb
)
283 IHTMLDocument2
*html_doc
;
288 hres
= IWebBrowser2_get_Document(wb
, &disp
);
289 ok_(__FILE__
,line
)(hres
== S_OK
, "get_Document failed: %08x\n", hres
);
290 ok_(__FILE__
,line
)(disp
!= NULL
, "doc_disp == NULL\n");
292 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&html_doc
);
293 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IHTMLDocument iface: %08x\n", hres
);
294 ok(disp
== (IDispatch
*)html_doc
, "disp != html_doc\n");
295 IDispatch_Release(disp
);
300 #define get_dochost(u) _get_dochost(__LINE__,u)
301 static IOleClientSite
*_get_dochost(unsigned line
, IWebBrowser2
*unk
)
303 IOleClientSite
*client_site
;
308 doc
= _get_document(line
, unk
);
309 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
310 IHTMLDocument2_Release(doc
);
311 ok_(__FILE__
,line
)(hres
== S_OK
, "Got 0x%08x\n", hres
);
313 hres
= IOleObject_GetClientSite(oleobj
, &client_site
);
314 IOleObject_Release(oleobj
);
315 ok_(__FILE__
,line
)(hres
== S_OK
, "Got 0x%08x\n", hres
);
320 static HRESULT
QueryInterface(REFIID
,void**);
322 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
323 REFIID riid
, void **ppv
)
325 ok(0, "unexpected call\n");
326 return E_NOINTERFACE
;
329 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
334 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
339 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
340 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
342 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
343 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
344 ok(!pCmdText
, "pCmdText != NULL\n");
346 switch(prgCmds
[0].cmdID
) {
348 CHECK_EXPECT2(QueryStatus_STOP
);
349 prgCmds
[0].cmdf
= OLECMDF_SUPPORTED
;
351 case OLECMDID_SETPROGRESSTEXT
:
352 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
353 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
357 * IDM_STOP is a command specific to CGID_MSHTML (not an OLECMDID command).
358 * This command appears here for the ExecWB and QueryStatusWB tests in order
359 * to help demonstrate that these routines use a NULL pguidCmdGroup.
361 CHECK_EXPECT(QueryStatus_IDM_STOP
);
365 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
371 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
372 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
376 case OLECMDID_SETPROGRESSMAX
:
377 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
378 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
379 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
381 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
382 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
384 case OLECMDID_SETPROGRESSPOS
:
385 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
386 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
387 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
389 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
390 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
392 case OLECMDID_SETDOWNLOADSTATE
:
394 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
|| !nCmdexecopt
,
395 "nCmdexecopts=%08x\n", nCmdexecopt
);
397 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
398 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
399 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
400 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
401 switch(V_I4(pvaIn
)) {
403 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_0
);
406 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1
);
409 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
412 case OLECMDID_UPDATECOMMANDS
:
413 CHECK_EXPECT2(Exec_UPDATECOMMANDS
);
414 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
415 ok(!pvaIn
, "pvaIn != NULL\n");
416 ok(!pvaOut
, "pvaOut=%p, expected NULL\n", pvaOut
);
418 case OLECMDID_SETTITLE
:
419 CHECK_EXPECT(Exec_SETTITLE
);
420 /* TODO: test args */
423 CHECK_EXPECT(Exec_STOP
);
427 * IDM_STOP is a command specific to CGID_MSHTML (not an OLECMDID command).
428 * This command appears here for the ExecWB and QueryStatusWB tests in order
429 * to help demonstrate that these routines use a NULL pguidCmdGroup.
431 CHECK_EXPECT(Exec_IDM_STOP
);
432 return OLECMDERR_E_NOTSUPPORTED
;
433 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
434 case 6058: /* TODO */
437 ok(0, "unexpected nsCmdID %d\n", nCmdID
);
439 }else if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
449 case 101: /* TODO (IE8) */
450 case 109: /* TODO (IE9) */
451 case 113: /* TODO (IE10) */
454 ok(0, "unexpected nCmdID %d\n", nCmdID
);
456 }else if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
459 case 134: /* TODO (IE10) */
460 case 136: /* TODO (IE10) */
462 case 140: /* TODO (Win7) */
466 ok(0, "unexpected nCmdID %d\n", nCmdID
);
468 }else if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
473 ok(0, "unexpected nCmdID %d of CGID_DocHostCmdPriv\n", nCmdID
);
475 }else if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
477 case 6041: /* TODO */
480 CHECK_EXPECT(Exec_DocHostCommandHandler_2300
);
483 ok(0, "unexpected nCmdID %d of CGID_DocHostCommandHandler\n", nCmdID
);
486 ok(0, "unexpected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup
));
492 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
493 OleCommandTarget_QueryInterface
,
494 OleCommandTarget_AddRef
,
495 OleCommandTarget_Release
,
496 OleCommandTarget_QueryStatus
,
497 OleCommandTarget_Exec
500 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
502 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
504 if(IsEqualGUID(&IID_ITargetContainer
, riid
))
505 return E_NOINTERFACE
; /* TODO */
507 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
508 if(use_container_olecmd
)
510 *ppv
= &OleCommandTarget
;
514 return E_NOINTERFACE
;
517 ok(0, "unexpected call\n");
518 return E_NOINTERFACE
;
521 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
526 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
531 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
532 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
534 ok(0, "unexpected call\n");
538 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
539 IEnumUnknown
**ppenum
)
541 ok(0, "unexpected call\n");
545 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
547 ok(0, "unexpected call\n");
551 static const IOleContainerVtbl OleContainerVtbl
= {
552 OleContainer_QueryInterface
,
554 OleContainer_Release
,
555 OleContainer_ParseDisplayName
,
556 OleContainer_EnumObjects
,
557 OleContainer_LockContainer
560 static IOleContainer OleContainer
= { &OleContainerVtbl
};
562 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
564 return QueryInterface(riid
, ppv
);
567 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
572 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
577 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
579 ok(0, "unexpected call\n");
583 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
586 ok(0, "unexpected call\n");
590 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
591 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
593 ok(0, "unexpected call\n");
597 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
598 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
599 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
601 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
602 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
603 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
604 ok(V_VT(pVarResult
) == VT_EMPTY
, "V_VT(pVarResult)=%d\n", V_VT(pVarResult
));
605 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
606 ok(pDispParams
->rgvarg
== NULL
, "pDispParams->rgvarg = %p\n", pDispParams
->rgvarg
);
607 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
608 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
609 ok(pDispParams
->cArgs
== 0, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
610 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
612 switch(dispIdMember
) {
613 case DISPID_AMBIENT_USERMODE
:
614 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
616 case DISPID_AMBIENT_DLCONTROL
:
617 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
618 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
620 case DISPID_AMBIENT_USERAGENT
:
621 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
622 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
624 case DISPID_AMBIENT_PALETTE
:
625 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
626 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
628 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
629 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
630 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
631 V_VT(pVarResult
) = VT_BOOL
;
632 V_BOOL(pVarResult
) = VARIANT_FALSE
;
634 case DISPID_AMBIENT_SILENT
:
635 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
636 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
637 V_VT(pVarResult
) = VT_BOOL
;
638 V_BOOL(pVarResult
) = VARIANT_FALSE
;
642 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
646 static IDispatchVtbl DispatchVtbl
= {
647 Dispatch_QueryInterface
,
650 Dispatch_GetTypeInfoCount
,
651 Dispatch_GetTypeInfo
,
652 Dispatch_GetIDsOfNames
,
656 static IDispatch Dispatch
= { &DispatchVtbl
};
658 static HRESULT WINAPI
WebBrowserEvents2_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
662 if(IsEqualGUID(&DIID_DWebBrowserEvents2
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
667 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
668 return E_NOINTERFACE
;
671 #define test_invoke_bool(p,s) _test_invoke_bool(__LINE__,p,s)
672 static void _test_invoke_bool(unsigned line
, const DISPPARAMS
*params
, BOOL strict
)
674 ok_(__FILE__
,line
) (params
->rgvarg
!= NULL
, "rgvarg == NULL\n");
675 ok_(__FILE__
,line
) (params
->cArgs
== 1, "cArgs=%d, expected 1\n", params
->cArgs
);
676 ok_(__FILE__
,line
) (V_VT(params
->rgvarg
) == VT_BOOL
, "V_VT(arg)=%d\n", V_VT(params
->rgvarg
));
678 ok_(__FILE__
,line
) (V_BOOL(params
->rgvarg
) == exvb
, "V_VT(arg)=%x, expected %x\n",
679 V_BOOL(params
->rgvarg
), exvb
);
681 ok_(__FILE__
,line
) (!V_BOOL(params
->rgvarg
) == !exvb
, "V_VT(arg)=%x, expected %x\n",
682 V_BOOL(params
->rgvarg
), exvb
);
685 static void test_OnBeforeNavigate(const VARIANT
*disp
, const VARIANT
*url
, const VARIANT
*flags
,
686 const VARIANT
*frame
, const VARIANT
*post_data
, const VARIANT
*headers
, const VARIANT
*cancel
)
688 ok(V_VT(disp
) == VT_DISPATCH
, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp
));
689 ok(V_DISPATCH(disp
) != NULL
, "V_DISPATCH(disp) == NULL\n");
690 ok(V_DISPATCH(disp
) == (IDispatch
*)wb
, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp
), wb
);
692 ok(V_VT(url
) == (VT_BYREF
|VT_VARIANT
), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url
));
693 ok(V_VARIANTREF(url
) != NULL
, "V_VARIANTREF(url) == NULL)\n");
694 if(V_VARIANTREF(url
)) {
695 ok(V_VT(V_VARIANTREF(url
)) == VT_BSTR
, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
696 V_VT(V_VARIANTREF(url
)));
697 ok(V_BSTR(V_VARIANTREF(url
)) != NULL
, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
698 ok(!strcmp_wa(V_BSTR(V_VARIANTREF(url
)), current_url
), "unexpected url %s, expected %s\n",
699 wine_dbgstr_w(V_BSTR(V_VARIANTREF(url
))), current_url
);
702 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
704 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
706 ok(V_VARIANTREF(flags
) != NULL
, "V_VARIANTREF(flags) == NULL)\n");
707 if(V_VARIANTREF(flags
)) {
708 ok(V_VT(V_VARIANTREF(flags
)) == VT_I4
, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
709 V_VT(V_VARIANTREF(flags
)));
711 ok(V_I4(V_VARIANTREF(flags
)) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0\n",
712 V_I4(V_VARIANTREF(flags
)));
714 ok((V_I4(V_VARIANTREF(flags
)) & ~0x40) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0x40 or 0\n",
715 V_I4(V_VARIANTREF(flags
)));
719 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
721 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
723 ok(V_VARIANTREF(frame
) != NULL
, "V_VARIANTREF(frame) == NULL)\n");
724 if(V_VARIANTREF(frame
)) {
725 ok(V_VT(V_VARIANTREF(frame
)) == VT_BSTR
, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
726 V_VT(V_VARIANTREF(frame
)));
727 ok(V_BSTR(V_VARIANTREF(frame
)) == NULL
, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
728 V_BSTR(V_VARIANTREF(frame
)));
731 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
733 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
735 ok(V_VARIANTREF(post_data
) != NULL
, "V_VARIANTREF(post_data) == NULL)\n");
736 if(V_VARIANTREF(post_data
)) {
737 ok(V_VT(V_VARIANTREF(post_data
)) == (VT_VARIANT
|VT_BYREF
),
738 "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
739 V_VT(V_VARIANTREF(post_data
)));
740 ok(V_VARIANTREF(V_VARIANTREF(post_data
)) != NULL
,
741 "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
742 if(V_VARIANTREF(V_VARIANTREF(post_data
))) {
743 ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == VT_EMPTY
,
744 "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
745 V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))));
747 if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == (VT_UI1
|VT_ARRAY
)) {
748 const SAFEARRAY
*sa
= V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data
)));
750 ok(sa
->cDims
== 1, "sa->cDims = %d, expected 1\n", sa
->cDims
);
751 ok(sa
->fFeatures
== 0, "sa->fFeatures = %d, expected 0\n", sa
->fFeatures
);
756 ok(V_VT(headers
) == (VT_BYREF
|VT_VARIANT
), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
758 ok(V_VARIANTREF(headers
) != NULL
, "V_VARIANTREF(headers) == NULL)\n");
759 if(V_VARIANTREF(headers
)) {
760 ok(V_VT(V_VARIANTREF(headers
)) == VT_BSTR
, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
761 V_VT(V_VARIANTREF(headers
)));
762 ok(V_BSTR(V_VARIANTREF(headers
)) == NULL
, "V_BSTR(V_VARIANTREF(headers)) = %p, expected NULL\n",
763 V_BSTR(V_VARIANTREF(headers
)));
766 ok(V_VT(cancel
) == (VT_BYREF
|VT_BOOL
), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
768 ok(V_BOOLREF(cancel
) != NULL
, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
769 if(V_BOOLREF(cancel
))
770 ok(*V_BOOLREF(cancel
) == VARIANT_FALSE
, "*V_BOOLREF(cancel) = %x, expected VARIANT_FALSE\n",
774 static void test_navigatecomplete2(DISPPARAMS
*dp
)
778 CHECK_EXPECT(Invoke_NAVIGATECOMPLETE2
);
780 ok(dp
->rgvarg
!= NULL
, "rgvarg == NULL\n");
781 ok(dp
->cArgs
== 2, "cArgs=%d, expected 2\n", dp
->cArgs
);
783 ok(V_VT(dp
->rgvarg
) == (VT_BYREF
|VT_VARIANT
), "V_VT(dp->rgvarg) = %d\n", V_VT(dp
->rgvarg
));
784 v
= V_VARIANTREF(dp
->rgvarg
);
785 ok(V_VT(v
) == VT_BSTR
, "V_VT(url) = %d\n", V_VT(v
));
786 ok(!strcmp_wa(V_BSTR(v
), current_url
), "url=%s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), current_url
);
788 ok(V_VT(dp
->rgvarg
+1) == VT_DISPATCH
, "V_VT(dp->rgvarg+1) = %d\n", V_VT(dp
->rgvarg
+1));
789 ok(V_DISPATCH(dp
->rgvarg
+1) == (IDispatch
*)wb
, "V_DISPATCH=%p, wb=%p\n", V_DISPATCH(dp
->rgvarg
+1), wb
);
791 test_ready_state((dwl_flags
& (DWL_FROM_PUT_HREF
|DWL_FROM_GOBACK
|DWL_FROM_GOFORWARD
))
792 ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
795 static void test_documentcomplete(DISPPARAMS
*dp
)
799 CHECK_EXPECT(Invoke_DOCUMENTCOMPLETE
);
801 ok(dp
->rgvarg
!= NULL
, "rgvarg == NULL\n");
802 ok(dp
->cArgs
== 2, "cArgs=%d, expected 2\n", dp
->cArgs
);
804 ok(V_VT(dp
->rgvarg
) == (VT_BYREF
|VT_VARIANT
), "V_VT(dp->rgvarg) = %d\n", V_VT(dp
->rgvarg
));
805 v
= V_VARIANTREF(dp
->rgvarg
);
806 ok(V_VT(v
) == VT_BSTR
, "V_VT(url) = %d\n", V_VT(v
));
807 ok(!strcmp_wa(V_BSTR(v
), current_url
), "url=%s, expected %s\n", wine_dbgstr_w(V_BSTR(v
)), current_url
);
809 ok(V_VT(dp
->rgvarg
+1) == VT_DISPATCH
, "V_VT(dp->rgvarg+1) = %d\n", V_VT(dp
->rgvarg
+1));
810 ok(V_DISPATCH(dp
->rgvarg
+1) == (IDispatch
*)wb
, "V_DISPATCH=%p, wb=%p\n", V_DISPATCH(dp
->rgvarg
+1), wb
);
812 test_ready_state(READYSTATE_COMPLETE
);
815 static HRESULT WINAPI
WebBrowserEvents2_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
816 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
817 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
819 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
820 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
821 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
822 ok(pVarResult
== NULL
, "pVarResult=%p\n", pVarResult
);
823 ok(wFlags
== DISPATCH_METHOD
, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags
);
824 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
825 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
826 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
828 switch(dispIdMember
) {
829 case DISPID_STATUSTEXTCHANGE
:
830 CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE
);
832 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
833 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
834 ok(V_VT(pDispParams
->rgvarg
) == VT_BSTR
, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
835 V_VT(pDispParams
->rgvarg
));
836 /* TODO: Check text */
839 case DISPID_PROPERTYCHANGE
:
840 CHECK_EXPECT2(Invoke_PROPERTYCHANGE
);
842 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
843 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
844 /* TODO: Check args */
847 case DISPID_DOWNLOADBEGIN
:
848 CHECK_EXPECT(Invoke_DOWNLOADBEGIN
);
850 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
851 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
852 test_ready_state(READYSTATE_LOADING
);
855 case DISPID_BEFORENAVIGATE2
:
856 CHECK_EXPECT(Invoke_BEFORENAVIGATE2
);
858 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
859 ok(pDispParams
->cArgs
== 7, "cArgs=%d, expected 7\n", pDispParams
->cArgs
);
860 test_OnBeforeNavigate(pDispParams
->rgvarg
+6, pDispParams
->rgvarg
+5, pDispParams
->rgvarg
+4,
861 pDispParams
->rgvarg
+3, pDispParams
->rgvarg
+2, pDispParams
->rgvarg
+1,
862 pDispParams
->rgvarg
);
863 test_ready_state((dwl_flags
& (DWL_FROM_PUT_HREF
|DWL_FROM_GOFORWARD
)) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
866 case DISPID_SETSECURELOCKICON
:
867 CHECK_EXPECT2(Invoke_SETSECURELOCKICON
);
869 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
870 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
871 /* TODO: Check args */
874 case DISPID_FILEDOWNLOAD
:
875 CHECK_EXPECT(Invoke_FILEDOWNLOAD
);
877 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
878 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
879 /* TODO: Check args */
882 case DISPID_COMMANDSTATECHANGE
:
883 CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE
);
885 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
886 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
888 ok(V_VT(pDispParams
->rgvarg
) == VT_BOOL
, "V_VT(pDispParams->rgvarg) = %d\n", V_VT(pDispParams
->rgvarg
));
889 ok(V_VT(pDispParams
->rgvarg
+1) == VT_I4
, "V_VT(pDispParams->rgvarg+1) = %d\n", V_VT(pDispParams
->rgvarg
+1));
891 /* TODO: Check args */
894 case DISPID_DOWNLOADCOMPLETE
:
895 CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE
);
897 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
898 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
899 test_ready_state(READYSTATE_LOADING
);
902 case DISPID_ONMENUBAR
:
903 CHECK_EXPECT(Invoke_ONMENUBAR
);
904 test_invoke_bool(pDispParams
, TRUE
);
907 case DISPID_ONADDRESSBAR
:
908 CHECK_EXPECT(Invoke_ONADDRESSBAR
);
909 test_invoke_bool(pDispParams
, TRUE
);
912 case DISPID_ONSTATUSBAR
:
913 CHECK_EXPECT(Invoke_ONSTATUSBAR
);
914 test_invoke_bool(pDispParams
, TRUE
);
917 case DISPID_ONTOOLBAR
:
918 CHECK_EXPECT(Invoke_ONTOOLBAR
);
919 test_invoke_bool(pDispParams
, FALSE
);
922 case DISPID_ONFULLSCREEN
:
923 CHECK_EXPECT(Invoke_ONFULLSCREEN
);
924 test_invoke_bool(pDispParams
, TRUE
);
927 case DISPID_ONTHEATERMODE
:
928 CHECK_EXPECT(Invoke_ONTHEATERMODE
);
929 test_invoke_bool(pDispParams
, TRUE
);
932 case DISPID_WINDOWSETRESIZABLE
:
933 CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE
);
934 test_invoke_bool(pDispParams
, TRUE
);
937 case DISPID_TITLECHANGE
:
938 CHECK_EXPECT2(Invoke_TITLECHANGE
);
942 case DISPID_NAVIGATECOMPLETE2
:
943 test_navigatecomplete2(pDispParams
);
946 case DISPID_PROGRESSCHANGE
:
947 CHECK_EXPECT2(Invoke_PROGRESSCHANGE
);
951 case DISPID_DOCUMENTCOMPLETE
:
952 test_documentcomplete(pDispParams
);
955 case DISPID_WINDOWCLOSING
: {
956 VARIANT
*is_child
= pDispParams
->rgvarg
+1, *cancel
= pDispParams
->rgvarg
;
958 CHECK_EXPECT(Invoke_WINDOWCLOSING
);
960 ok(pDispParams
->cArgs
== 2, "pdp->cArgs = %d\n", pDispParams
->cArgs
);
961 ok(V_VT(is_child
) == VT_BOOL
, "V_VT(is_child) = %d\n", V_VT(is_child
));
962 ok(!V_BOOL(is_child
), "V_BOOL(is_child) = %x\n", V_BOOL(is_child
));
963 ok(V_VT(cancel
) == (VT_BYREF
|VT_BOOL
), "V_VT(cancel) = %d\n", V_VT(cancel
));
964 ok(!*V_BOOLREF(cancel
), "*V_BOOLREF(cancel) = %x\n", *V_BOOLREF(cancel
));
966 *V_BOOLREF(cancel
) = VARIANT_TRUE
;
970 case 282: /* FIXME */
971 CHECK_EXPECT2(Invoke_282
);
974 case 290: /* FIXME: IE10 */
978 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
984 static IDispatchVtbl WebBrowserEvents2Vtbl
= {
985 WebBrowserEvents2_QueryInterface
,
988 Dispatch_GetTypeInfoCount
,
989 Dispatch_GetTypeInfo
,
990 Dispatch_GetIDsOfNames
,
991 WebBrowserEvents2_Invoke
994 static IDispatch WebBrowserEvents2
= { &WebBrowserEvents2Vtbl
};
996 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
998 return QueryInterface(riid
, ppv
);
1001 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1006 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1011 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1013 ok(0, "unexpected call\n");
1017 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1020 ok(0, "unexpected call\n");
1024 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1026 CHECK_EXPECT(GetContainer
);
1028 ok(ppContainer
!= NULL
, "ppContainer == NULL\n");
1030 *ppContainer
= &OleContainer
;
1035 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1037 CHECK_EXPECT(ShowObject
);
1041 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1043 ok(0, "unexpected call\n");
1047 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1049 ok(0, "unexpected call\n");
1053 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1054 ClientSite_QueryInterface
,
1057 ClientSite_SaveObject
,
1058 ClientSite_GetMoniker
,
1059 ClientSite_GetContainer
,
1060 ClientSite_ShowObject
,
1061 ClientSite_OnShowWindow
,
1062 ClientSite_RequestNewObjectLayout
1065 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1067 static HRESULT WINAPI
IOleControlSite_fnQueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
1070 return E_NOINTERFACE
;
1073 static ULONG WINAPI
IOleControlSite_fnAddRef(IOleControlSite
*iface
)
1078 static ULONG WINAPI
IOleControlSite_fnRelease(IOleControlSite
*iface
)
1083 static HRESULT WINAPI
IOleControlSite_fnOnControlInfoChanged(IOleControlSite
* This
)
1085 ok(0, "unexpected call\n");
1089 static HRESULT WINAPI
IOleControlSite_fnLockInPlaceActive(IOleControlSite
* This
,
1092 ok(0, "unexpected call\n");
1096 static HRESULT WINAPI
IOleControlSite_fnGetExtendedControl(IOleControlSite
* This
,
1099 ok(0, "unexpected call\n");
1103 static HRESULT WINAPI
IOleControlSite_fnTransformCoords(IOleControlSite
* This
,
1104 POINTL
*pPtlHimetric
,
1105 POINTF
*pPtfContainer
,
1108 ok(0, "unexpected call\n");
1112 static HRESULT WINAPI
IOleControlSite_fnTranslateAccelerator(IOleControlSite
* This
, MSG
*pMsg
,
1115 CHECK_EXPECT(ControlSite_TranslateAccelerator
);
1116 return hr_site_TranslateAccelerator
;
1119 static HRESULT WINAPI
IOleControlSite_fnOnFocus(IOleControlSite
* This
, BOOL fGotFocus
)
1121 CHECK_EXPECT2(OnFocus
);
1125 static HRESULT WINAPI
IOleControlSite_fnShowPropertyFrame(IOleControlSite
* This
)
1127 ok(0, "unexpected call\n");
1131 static IOleControlSiteVtbl ControlSiteVtbl
= {
1132 IOleControlSite_fnQueryInterface
,
1133 IOleControlSite_fnAddRef
,
1134 IOleControlSite_fnRelease
,
1135 IOleControlSite_fnOnControlInfoChanged
,
1136 IOleControlSite_fnLockInPlaceActive
,
1137 IOleControlSite_fnGetExtendedControl
,
1138 IOleControlSite_fnTransformCoords
,
1139 IOleControlSite_fnTranslateAccelerator
,
1140 IOleControlSite_fnOnFocus
,
1141 IOleControlSite_fnShowPropertyFrame
1144 static IOleControlSite ControlSite
= { &ControlSiteVtbl
};
1146 static HRESULT WINAPI
InPlaceUIWindow_QueryInterface(IOleInPlaceFrame
*iface
,
1147 REFIID riid
, void **ppv
)
1149 ok(0, "unexpected call\n");
1150 return E_NOINTERFACE
;
1153 static ULONG WINAPI
InPlaceUIWindow_AddRef(IOleInPlaceFrame
*iface
)
1158 static ULONG WINAPI
InPlaceUIWindow_Release(IOleInPlaceFrame
*iface
)
1163 static HRESULT WINAPI
InPlaceUIWindow_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1165 ok(0, "unexpected call\n");
1169 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1171 CHECK_EXPECT(Frame_GetWindow
);
1172 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1174 *phwnd
= container_hwnd
;
1178 static HRESULT WINAPI
InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1180 ok(0, "unexpected call\n");
1184 static HRESULT WINAPI
InPlaceUIWindow_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1186 ok(0, "unexpected call\n");
1190 static HRESULT WINAPI
InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1191 LPCBORDERWIDTHS pborderwidths
)
1193 ok(0, "unexpected call\n");
1197 static HRESULT WINAPI
InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame
*iface
,
1198 LPCBORDERWIDTHS pborderwidths
)
1200 ok(0, "unexpected call\n");
1204 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1205 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1207 CHECK_EXPECT(UIWindow_SetActiveObject
);
1209 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1210 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
1212 ok(!pActiveObject
, "pActiveObject != NULL\n");
1213 ok(!pszObjName
, "pszObjName != NULL\n");
1218 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1219 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1221 CHECK_EXPECT(Frame_SetActiveObject
);
1223 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1224 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
1226 ok(!pActiveObject
, "pActiveObject != NULL\n");
1227 ok(!pszObjName
, "pszObjName != NULL\n");
1232 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1233 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1235 ok(0, "unexpected call\n");
1239 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1240 HOLEMENU holemenu
, HWND hwndActiveObject
)
1242 CHECK_EXPECT(SetMenu
);
1243 ok(hmenuShared
== NULL
, "hmenuShared=%p\n", hmenuShared
);
1244 ok(holemenu
== NULL
, "holemenu=%p\n", holemenu
);
1245 ok(hwndActiveObject
== shell_embedding_hwnd
, "hwndActiveObject=%p, expected %p\n",
1246 hwndActiveObject
, shell_embedding_hwnd
);
1250 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1252 ok(0, "unexpected call\n");
1256 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1258 CHECK_EXPECT2(SetStatusText
);
1259 /* FIXME: Check pszStatusText */
1263 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1266 CHECK_EXPECT2(EnableModeless_TRUE
);
1268 CHECK_EXPECT2(EnableModeless_FALSE
);
1272 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1274 ok(0, "unexpected call\n");
1278 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1279 InPlaceUIWindow_QueryInterface
,
1280 InPlaceUIWindow_AddRef
,
1281 InPlaceUIWindow_Release
,
1282 InPlaceUIWindow_GetWindow
,
1283 InPlaceUIWindow_ContextSensitiveHelp
,
1284 InPlaceUIWindow_GetBorder
,
1285 InPlaceUIWindow_RequestBorderSpace
,
1286 InPlaceUIWindow_SetBorderSpace
,
1287 InPlaceUIWindow_SetActiveObject
,
1290 static IOleInPlaceUIWindow InPlaceUIWindow
= { (IOleInPlaceUIWindowVtbl
*)&InPlaceUIWindowVtbl
};
1292 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1293 InPlaceUIWindow_QueryInterface
,
1294 InPlaceUIWindow_AddRef
,
1295 InPlaceUIWindow_Release
,
1296 InPlaceFrame_GetWindow
,
1297 InPlaceUIWindow_ContextSensitiveHelp
,
1298 InPlaceUIWindow_GetBorder
,
1299 InPlaceUIWindow_RequestBorderSpace
,
1300 InPlaceUIWindow_SetBorderSpace
,
1301 InPlaceFrame_SetActiveObject
,
1302 InPlaceFrame_InsertMenus
,
1303 InPlaceFrame_SetMenu
,
1304 InPlaceFrame_RemoveMenus
,
1305 InPlaceFrame_SetStatusText
,
1306 InPlaceFrame_EnableModeless
,
1307 InPlaceFrame_TranslateAccelerator
1310 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1312 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
1314 return QueryInterface(riid
, ppv
);
1317 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
1322 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
1327 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
1329 CHECK_EXPECT(Site_GetWindow
);
1330 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1332 *phwnd
= container_hwnd
;
1336 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
1338 ok(0, "unexpected call\n");
1342 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1344 CHECK_EXPECT(CanInPlaceActivate
);
1348 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1350 CHECK_EXPECT(OnInPlaceActivate
);
1354 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
1356 CHECK_EXPECT(OnUIActivate
);
1360 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
1361 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1362 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1364 static const RECT pos_rect
= {2,1,1002,901};
1365 static const RECT clip_rect
= {10,10,990,890};
1367 CHECK_EXPECT(GetWindowContext
);
1369 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1371 *ppFrame
= &InPlaceFrame
;
1373 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1375 *ppDoc
= &InPlaceUIWindow
;
1377 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1379 memcpy(lprcPosRect
, &pos_rect
, sizeof(RECT
));
1381 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1383 memcpy(lprcClipRect
, &clip_rect
, sizeof(RECT
));
1385 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1387 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
1388 lpFrameInfo
->fMDIApp
= FALSE
;
1389 lpFrameInfo
->hwndFrame
= container_hwnd
;
1390 lpFrameInfo
->haccel
= NULL
;
1391 lpFrameInfo
->cAccelEntries
= 0;
1397 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtant
)
1399 ok(0, "unexpected call\n");
1403 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
1405 CHECK_EXPECT(OnUIDeactivate
);
1406 ok(!fUndoable
, "fUndoable should be FALSE\n");
1410 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
1412 CHECK_EXPECT(OnInPlaceDeactivate
);
1416 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
1418 ok(0, "unexpected call\n");
1422 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
1424 ok(0, "unexpected call\n");
1428 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
, LPCRECT lprcPosRect
)
1430 ok(0, "unexpected call\n");
1434 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
,
1435 BOOL
*pNoRedraw
, DWORD dwFlags
)
1437 ok(0, "unexpected call\n");
1441 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
,
1444 ok(0, "unexpected call\n");
1448 static HRESULT WINAPI
InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
1450 CHECK_EXPECT2(RequestUIActivate
);
1454 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl
= {
1455 InPlaceSite_QueryInterface
,
1457 InPlaceSite_Release
,
1458 InPlaceSite_GetWindow
,
1459 InPlaceSite_ContextSensitiveHelp
,
1460 InPlaceSite_CanInPlaceActivate
,
1461 InPlaceSite_OnInPlaceActivate
,
1462 InPlaceSite_OnUIActivate
,
1463 InPlaceSite_GetWindowContext
,
1465 InPlaceSite_OnUIDeactivate
,
1466 InPlaceSite_OnInPlaceDeactivate
,
1467 InPlaceSite_DiscardUndoState
,
1468 InPlaceSite_DeactivateAndUndo
,
1469 InPlaceSite_OnPosRectChange
,
1470 InPlaceSite_OnInPlaceActivateEx
,
1471 InPlaceSite_OnInPlaceDeactivateEx
,
1472 InPlaceSite_RequestUIActivate
1475 static IOleInPlaceSiteEx InPlaceSite
= { &InPlaceSiteExVtbl
};
1477 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
1479 return QueryInterface(riid
, ppv
);
1482 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
1487 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
1492 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
1493 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
1495 ok(0, "unexpected call %d %p %p %p\n", dwID
, ppt
, pcmdtReserved
, pdicpReserved
);
1499 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
1501 CHECK_EXPECT2(GetHostInfo
);
1502 ok(pInfo
!= NULL
, "pInfo=NULL\n");
1504 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
) || broken(!pInfo
->cbSize
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
1505 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
1506 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
1507 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
1508 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
1513 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
1514 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
1515 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
1517 CHECK_EXPECT(ShowUI
);
1521 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
1523 CHECK_EXPECT(HideUI
);
1527 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
1529 CHECK_EXPECT2(UpdateUI
);
1533 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
1536 CHECK_EXPECT(DocHost_EnableModeless_TRUE
);
1538 CHECK_EXPECT(DocHost_EnableModeless_FALSE
);
1543 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1545 ok(0, "unexpected call\n");
1549 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1551 ok(0, "unexpected call\n");
1555 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
1556 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
1558 ok(0, "unexpected call\n");
1562 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
1563 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
1565 CHECK_EXPECT(DocHost_TranslateAccelerator
);
1566 ok(pguidCmdGroup
!= NULL
, "Got NULL pguidCmdGroup.\n");
1568 ok(IsEqualGUID(pguidCmdGroup
, &CGID_MSHTML
), "Unexpected pguidCmdGroup\n");
1569 ok(lpMsg
!= NULL
, "Got NULL lpMsg.\n");
1570 return hr_dochost_TranslateAccelerator
;
1573 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
1574 LPOLESTR
*pchKey
, DWORD dw
)
1576 CHECK_EXPECT(GetOptionKeyPath
);
1577 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1579 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1580 ok(!dw
, "dw=%x\n", dw
);
1584 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
1585 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
1587 CHECK_EXPECT(GetDropTarget
);
1591 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
1593 CHECK_EXPECT(GetExternal
);
1598 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
1599 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
1601 if(is_downloading
&& !(dwl_flags
& DWL_EXPECT_BEFORE_NAVIGATE
))
1602 todo_wine
CHECK_EXPECT(TranslateUrl
);
1604 CHECK_EXPECT(TranslateUrl
);
1608 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
1609 IDataObject
**ppPORet
)
1611 ok(0, "unexpected call\n");
1615 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
1616 LPOLESTR
*pchKey
, DWORD dw
)
1618 CHECK_EXPECT(GetOverridesKeyPath
);
1619 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1621 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1622 ok(!dw
, "dw=%x\n", dw
);
1626 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
1627 DocHostUIHandler_QueryInterface
,
1628 DocHostUIHandler_AddRef
,
1629 DocHostUIHandler_Release
,
1630 DocHostUIHandler_ShowContextMenu
,
1631 DocHostUIHandler_GetHostInfo
,
1632 DocHostUIHandler_ShowUI
,
1633 DocHostUIHandler_HideUI
,
1634 DocHostUIHandler_UpdateUI
,
1635 DocHostUIHandler_EnableModeless
,
1636 DocHostUIHandler_OnDocWindowActivate
,
1637 DocHostUIHandler_OnFrameWindowActivate
,
1638 DocHostUIHandler_ResizeBorder
,
1639 DocHostUIHandler_TranslateAccelerator
,
1640 DocHostUIHandler_GetOptionKeyPath
,
1641 DocHostUIHandler_GetDropTarget
,
1642 DocHostUIHandler_GetExternal
,
1643 DocHostUIHandler_TranslateUrl
,
1644 DocHostUIHandler_FilterDataObject
,
1645 DocHostUIHandler_GetOverrideKeyPath
1648 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
1651 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
1653 return QueryInterface(riid
, ppv
);
1656 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
1661 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
1666 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
,
1667 REFGUID guidService
, REFIID riid
, void **ppv
)
1671 if(!winetest_interactive
)
1672 return E_NOINTERFACE
;
1674 if (IsEqualGUID(&SID_STopLevelBrowser
, guidService
))
1675 trace("Service SID_STopLevelBrowser\n");
1676 else if (IsEqualGUID(&SID_SEditCommandTarget
, guidService
))
1677 trace("Service SID_SEditCommandTarget\n");
1678 else if (IsEqualGUID(&IID_ITargetFrame2
, guidService
))
1679 trace("Service IID_ITargetFrame2\n");
1680 else if (IsEqualGUID(&SID_SInternetSecurityManager
, guidService
))
1681 trace("Service SID_SInternetSecurityManager\n");
1682 else if (IsEqualGUID(&SID_SOleUndoManager
, guidService
))
1683 trace("Service SID_SOleUndoManager\n");
1684 else if (IsEqualGUID(&SID_IMimeInfo
, guidService
))
1685 trace("Service SID_IMimeInfo\n");
1686 else if (IsEqualGUID(&SID_STopWindow
, guidService
))
1687 trace("Service SID_STopWindow\n");
1689 /* 30D02401-6A81-11D0-8274-00C04FD5AE38 Explorer Bar: Search */
1690 /* D1E7AFEC-6A2E-11D0-8C78-00C04FD918B4 no info */
1691 /* A9227C3C-7F8E-11D0-8CB0-00A0C92DBFE8 no info */
1692 /* 371EA634-DC5C-11D1-BA57-00C04FC2040E one reference to IVersionHost */
1693 /* 3050F429-98B5-11CF-BB82-00AA00BDCE0B IID_IElementBehaviorFactory */
1694 /* 6D12FE80-7911-11CF-9534-0000C05BAE0B SID_DefView */
1695 /* AD7F6C62-F6BD-11D2-959B-006097C553C8 no info */
1696 /* 53A2D5B1-D2FC-11D0-84E0-006097C9987D no info */
1697 /* 3050F312-98B5-11CF-BB82-00AA00BDCE0B HTMLFrameBaseClass */
1698 /* 639447BD-B2D3-44B9-9FB0-510F23CB45E4 no info */
1699 /* 20C46561-8491-11CF-960C-0080C7F4EE85 no info */
1702 trace("Service %s not supported\n", debugstr_guid(guidService
));
1704 return E_NOINTERFACE
;
1708 static const IServiceProviderVtbl ServiceProviderVtbl
= {
1709 ServiceProvider_QueryInterface
,
1710 ServiceProvider_AddRef
,
1711 ServiceProvider_Release
,
1712 ServiceProvider_QueryService
1715 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
1718 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
1722 if(IsEqualGUID(&IID_IUnknown
, riid
)
1723 || IsEqualGUID(&IID_IOleClientSite
, riid
))
1725 else if(IsEqualGUID(&IID_IOleWindow
, riid
)
1726 || IsEqualGUID(&IID_IOleInPlaceSite
, riid
)
1727 || IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
1728 *ppv
= &InPlaceSite
;
1729 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
)
1730 || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
1731 *ppv
= use_container_dochostui
? &DocHostUIHandler
: NULL
;
1732 else if(IsEqualGUID(&IID_IDispatch
, riid
))
1734 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
1735 *ppv
= &ServiceProvider
;
1736 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
1737 trace("interface IID_IDocHostShowUI\n");
1738 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
1739 *ppv
= &ControlSite
;
1740 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
1741 trace("interface IID_IOleCommandTarget\n");
1743 /* B6EA2050-048A-11D1-82B9-00C04FB9942E IAxWinHostWindow */
1747 /* are there more interfaces, that a host can support? */
1748 trace("%s: interface not supported\n", debugstr_guid(riid
));
1751 return (*ppv
) ? S_OK
: E_NOINTERFACE
;
1754 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1756 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
1759 static HWND
create_container_window(void)
1761 static const WCHAR wszWebBrowserContainer
[] =
1762 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1763 static WNDCLASSEXW wndclass
= {
1764 sizeof(WNDCLASSEXW
),
1767 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
1768 wszWebBrowserContainer
,
1772 RegisterClassExW(&wndclass
);
1773 return CreateWindowW(wszWebBrowserContainer
, wszWebBrowserContainer
,
1774 WS_OVERLAPPEDWINDOW
, 10, 10, 600, 600, NULL
, NULL
, NULL
, NULL
);
1777 static void test_DoVerb(IWebBrowser2
*unk
)
1780 RECT rect
= {0,0,1000,1000};
1783 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1784 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1788 SET_EXPECT(CanInPlaceActivate
);
1789 SET_EXPECT(Site_GetWindow
);
1790 SET_EXPECT(OnInPlaceActivate
);
1791 SET_EXPECT(GetWindowContext
);
1792 SET_EXPECT(ShowObject
);
1793 SET_EXPECT(GetContainer
);
1794 SET_EXPECT(Frame_GetWindow
);
1795 SET_EXPECT(OnUIActivate
);
1796 SET_EXPECT(Frame_SetActiveObject
);
1797 SET_EXPECT(UIWindow_SetActiveObject
);
1798 SET_EXPECT(SetMenu
);
1799 SET_EXPECT(OnFocus
);
1801 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1802 0, (HWND
)0xdeadbeef, &rect
);
1803 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1805 CHECK_CALLED(CanInPlaceActivate
);
1806 CHECK_CALLED(Site_GetWindow
);
1807 CHECK_CALLED(OnInPlaceActivate
);
1808 CHECK_CALLED(GetWindowContext
);
1809 CHECK_CALLED(ShowObject
);
1810 CHECK_CALLED(GetContainer
);
1811 CHECK_CALLED(Frame_GetWindow
);
1812 CHECK_CALLED(OnUIActivate
);
1813 CHECK_CALLED(Frame_SetActiveObject
);
1814 CHECK_CALLED(UIWindow_SetActiveObject
);
1815 CHECK_CALLED(SetMenu
);
1816 todo_wine
CHECK_CALLED(OnFocus
);
1818 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1819 0, (HWND
)0xdeadbeef, &rect
);
1820 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1822 IOleObject_Release(oleobj
);
1825 static void call_DoVerb(IWebBrowser2
*unk
, LONG verb
)
1828 RECT rect
= {60,60,600,600};
1831 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1832 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1836 hres
= IOleObject_DoVerb(oleobj
, verb
, NULL
, &ClientSite
,
1837 -1, container_hwnd
, &rect
);
1838 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1840 IOleObject_Release(oleobj
);
1843 static HWND
get_hwnd(IWebBrowser2
*unk
)
1845 IOleInPlaceObject
*inplace
;
1849 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleInPlaceObject
, (void**)&inplace
);
1850 ok(hres
== S_OK
, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres
);
1852 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1853 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1855 IOleInPlaceObject_Release(inplace
);
1859 static void test_GetMiscStatus(IOleObject
*oleobj
)
1864 for(i
=0; i
<10; i
++) {
1866 hres
= IOleObject_GetMiscStatus(oleobj
, i
, &st
);
1867 ok(hres
== S_OK
, "GetMiscStatus failed: %08x\n", hres
);
1868 ok(st
== (OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
1869 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
),
1870 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1871 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st
);
1875 static void test_SetHostNames(IOleObject
*oleobj
)
1879 static const WCHAR test_appW
[] = {'t','e','s','t',' ','a','p','p',0};
1881 hres
= IOleObject_SetHostNames(oleobj
, test_appW
, (void*)0xdeadbeef);
1882 ok(hres
== S_OK
, "SetHostNames failed: %08x\n", hres
);
1885 static void test_ClientSite(IWebBrowser2
*unk
, IOleClientSite
*client
, BOOL stop_download
)
1888 IOleInPlaceObject
*inplace
;
1892 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1893 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1897 test_GetMiscStatus(oleobj
);
1898 test_SetHostNames(oleobj
);
1900 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleInPlaceObject
, (void**)&inplace
);
1901 ok(hres
== S_OK
, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres
);
1903 IOleObject_Release(oleobj
);
1907 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1908 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1909 ok((hwnd
== NULL
) ^ (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1912 SET_EXPECT(GetContainer
);
1913 SET_EXPECT(Site_GetWindow
);
1914 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1915 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1916 }else if(stop_download
) {
1917 SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
1918 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
1919 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
1921 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
1922 SET_EXPECT(Invoke_PROGRESSCHANGE
);
1925 hres
= IOleObject_SetClientSite(oleobj
, client
);
1926 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1929 CHECK_CALLED(GetContainer
);
1930 CHECK_CALLED(Site_GetWindow
);
1931 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1932 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1933 }else if(stop_download
) {
1934 todo_wine
CHECK_CALLED(Invoke_DOWNLOADCOMPLETE
);
1935 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
1936 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
1938 CLEAR_CALLED(Invoke_STATUSTEXTCHANGE
); /* Called by IE9 */
1939 CLEAR_CALLED(Invoke_PROGRESSCHANGE
);
1942 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1943 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1944 ok((hwnd
== NULL
) == (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1946 shell_embedding_hwnd
= hwnd
;
1948 test_SetHostNames(oleobj
);
1950 IOleInPlaceObject_Release(inplace
);
1951 IOleObject_Release(oleobj
);
1954 static void test_ClassInfo(IWebBrowser2
*unk
)
1956 IProvideClassInfo2
*class_info
;
1957 TYPEATTR
*type_attr
;
1958 ITypeInfo
*typeinfo
;
1962 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IProvideClassInfo2
, (void**)&class_info
);
1963 ok(hres
== S_OK
, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres
);
1967 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, &guid
);
1968 ok(hres
== S_OK
, "GetGUID failed: %08x\n", hres
);
1969 ok(IsEqualGUID(wb_version
> 1 ? &DIID_DWebBrowserEvents2
: &DIID_DWebBrowserEvents
, &guid
), "wrong guid\n");
1971 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, &guid
);
1972 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1973 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1975 hres
= IProvideClassInfo2_GetGUID(class_info
, 2, &guid
);
1976 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1977 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1979 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, NULL
);
1980 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1982 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, NULL
);
1983 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1986 hres
= IProvideClassInfo2_GetClassInfo(class_info
, &typeinfo
);
1987 ok(hres
== S_OK
, "GetClassInfo failed: %08x\n", hres
);
1988 ok(typeinfo
!= NULL
, "typeinfo == NULL\n");
1990 hres
= ITypeInfo_GetTypeAttr(typeinfo
, &type_attr
);
1991 ok(hres
== S_OK
, "GetTypeAtr failed: %08x\n", hres
);
1993 ok(IsEqualGUID(&type_attr
->guid
, wb_version
> 1 ? &CLSID_WebBrowser
: &CLSID_WebBrowser_V1
),
1994 "guid = %s\n", debugstr_guid(&type_attr
->guid
));
1996 ITypeInfo_ReleaseTypeAttr(typeinfo
, type_attr
);
1997 ITypeInfo_Release(typeinfo
);
1999 IProvideClassInfo2_Release(class_info
);
2002 static void test_EnumVerbs(IWebBrowser2
*wb
)
2004 IEnumOLEVERB
*enum_verbs
;
2010 hres
= IWebBrowser2_QueryInterface(wb
, &IID_IOleObject
, (void**)&oleobj
);
2011 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
2013 hres
= IOleObject_EnumVerbs(oleobj
, &enum_verbs
);
2014 IOleObject_Release(oleobj
);
2015 ok(hres
== S_OK
, "EnumVerbs failed: %08x\n", hres
);
2016 ok(enum_verbs
!= NULL
, "enum_verbs == NULL\n");
2018 fetched
= 0xdeadbeef;
2019 hres
= IEnumOLEVERB_Next(enum_verbs
, sizeof(verbs
)/sizeof(*verbs
), verbs
, &fetched
);
2020 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2021 ok(!fetched
, "fetched = %d\n", fetched
);
2023 fetched
= 0xdeadbeef;
2024 hres
= IEnumOLEVERB_Next(enum_verbs
, 1, verbs
, &fetched
);
2025 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2026 ok(!fetched
, "fetched = %d\n", fetched
);
2028 hres
= IEnumOLEVERB_Reset(enum_verbs
);
2029 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
2031 fetched
= 0xdeadbeef;
2032 hres
= IEnumOLEVERB_Next(enum_verbs
, 1, verbs
, &fetched
);
2033 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2034 ok(!fetched
, "fetched = %d\n", fetched
);
2036 hres
= IEnumOLEVERB_Next(enum_verbs
, 1, verbs
, NULL
);
2037 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2039 hres
= IEnumOLEVERB_Skip(enum_verbs
, 20);
2040 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
2042 fetched
= 0xdeadbeef;
2043 hres
= IEnumOLEVERB_Next(enum_verbs
, 1, verbs
, &fetched
);
2044 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
2045 ok(!fetched
, "fetched = %d\n", fetched
);
2047 IEnumOLEVERB_Release(enum_verbs
);
2050 static void test_ie_funcs(IWebBrowser2
*wb
)
2062 hres
= IWebBrowser2_get_HWND(wb
, &hwnd
);
2063 ok(hres
== E_FAIL
, "get_HWND failed: %08x, expected E_FAIL\n", hres
);
2064 ok(hwnd
== 0, "unexpected hwnd %x\n", hwnd
);
2068 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
2069 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
2070 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2072 SET_EXPECT(Invoke_ONMENUBAR
);
2073 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= VARIANT_FALSE
));
2074 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
2075 CHECK_CALLED(Invoke_ONMENUBAR
);
2077 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
2078 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
2079 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2081 SET_EXPECT(Invoke_ONMENUBAR
);
2082 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= 100));
2083 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
2084 CHECK_CALLED(Invoke_ONMENUBAR
);
2086 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
2087 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
2088 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2092 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
2093 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
2094 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2096 SET_EXPECT(Invoke_ONADDRESSBAR
);
2097 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_FALSE
));
2098 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
2099 CHECK_CALLED(Invoke_ONADDRESSBAR
);
2101 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
2102 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
2103 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2105 SET_EXPECT(Invoke_ONADDRESSBAR
);
2106 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= 100));
2107 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
2108 CHECK_CALLED(Invoke_ONADDRESSBAR
);
2110 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
2111 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
2112 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2114 SET_EXPECT(Invoke_ONADDRESSBAR
);
2115 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_TRUE
));
2116 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
2117 CHECK_CALLED(Invoke_ONADDRESSBAR
);
2121 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
2122 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
2123 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2125 SET_EXPECT(Invoke_ONSTATUSBAR
);
2126 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_TRUE
));
2127 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
2128 CHECK_CALLED(Invoke_ONSTATUSBAR
);
2130 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
2131 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
2132 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2134 SET_EXPECT(Invoke_ONSTATUSBAR
);
2135 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_FALSE
));
2136 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
2137 CHECK_CALLED(Invoke_ONSTATUSBAR
);
2139 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
2140 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
2141 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2143 SET_EXPECT(Invoke_ONSTATUSBAR
);
2144 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= 100));
2145 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
2146 CHECK_CALLED(Invoke_ONSTATUSBAR
);
2148 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
2149 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
2150 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2154 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
2155 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
2158 SET_EXPECT(Invoke_ONTOOLBAR
);
2159 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_FALSE
));
2160 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
2161 CHECK_CALLED(Invoke_ONTOOLBAR
);
2163 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
2164 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
2165 ok(i
== VARIANT_FALSE
, "b=%x\n", i
);
2167 SET_EXPECT(Invoke_ONTOOLBAR
);
2168 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= 100));
2169 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
2170 CHECK_CALLED(Invoke_ONTOOLBAR
);
2172 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
2173 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
2176 SET_EXPECT(Invoke_ONTOOLBAR
);
2177 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_TRUE
));
2178 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
2179 CHECK_CALLED(Invoke_ONTOOLBAR
);
2183 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
2184 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
2185 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2187 SET_EXPECT(Invoke_ONFULLSCREEN
);
2188 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_TRUE
));
2189 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
2190 CHECK_CALLED(Invoke_ONFULLSCREEN
);
2192 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
2193 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
2194 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2196 SET_EXPECT(Invoke_ONFULLSCREEN
);
2197 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= 100));
2198 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
2199 CHECK_CALLED(Invoke_ONFULLSCREEN
);
2201 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
2202 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
2203 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2205 SET_EXPECT(Invoke_ONFULLSCREEN
);
2206 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_FALSE
));
2207 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
2208 CHECK_CALLED(Invoke_ONFULLSCREEN
);
2212 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2213 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2214 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2216 SET_EXPECT(Invoke_ONTHEATERMODE
);
2217 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_TRUE
));
2218 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2219 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2221 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2222 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2223 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2225 SET_EXPECT(Invoke_ONTHEATERMODE
);
2226 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= 100));
2227 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2228 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2230 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
2231 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
2232 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2234 SET_EXPECT(Invoke_ONTHEATERMODE
);
2235 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_FALSE
));
2236 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
2237 CHECK_CALLED(Invoke_ONTHEATERMODE
);
2242 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
2243 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
2244 ok(b
== 0x100, "b=%x\n", b
);
2246 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
2247 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_TRUE
));
2248 ok(hres
== S_OK
, "put_Resizable failed: %08x\n", hres
);
2249 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE
);
2251 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
2252 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_FALSE
));
2253 ok(hres
== S_OK
, "put_Resizable failed: %08x\n", hres
);
2254 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE
);
2256 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
2257 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
2258 ok(b
== 0x100, "b=%x\n", b
);
2263 hres
= IWebBrowser2_get_Application(wb
, &disp
);
2264 ok(hres
== S_OK
, "get_Application failed: %08x\n", hres
);
2265 ok(disp
== (void*)wb
, "disp=%p, expected %p\n", disp
, wb
);
2267 IDispatch_Release(disp
);
2269 hres
= IWebBrowser2_get_Application(wb
, NULL
);
2270 ok(hres
== E_POINTER
, "get_Application failed: %08x, expected E_POINTER\n", hres
);
2273 hres
= IWebBrowser2_get_Name(wb
, &sName
);
2274 ok(hres
== S_OK
, "getName failed: %08x, expected S_OK\n", hres
);
2275 if (is_lang_english())
2276 ok(!strcmp_wa(sName
, "Microsoft Web Browser Control"), "got '%s', expected 'Microsoft Web Browser Control'\n", wine_dbgstr_w(sName
));
2277 else /* Non-English cannot be blank. */
2278 ok(sName
!=NULL
, "get_Name return a NULL string.\n");
2279 SysFreeString(sName
);
2283 hres
= IWebBrowser2_Quit(wb
);
2284 ok(hres
== E_FAIL
, "Quit failed: %08x, expected E_FAIL\n", hres
);
2287 static void test_Silent(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2293 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2294 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2295 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2297 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
2298 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2301 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2302 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2303 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2305 hres
= IWebBrowser2_put_Silent(wb
, 100);
2306 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2309 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2310 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2311 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2313 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_FALSE
);
2314 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2317 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2318 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2319 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2322 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
2323 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
2325 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2328 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
2329 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2332 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
2335 hres
= IWebBrowser2_get_Silent(wb
, &b
);
2336 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
2337 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2340 static void test_Offline(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2346 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2347 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2348 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2350 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
2351 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2354 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2355 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2356 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2358 hres
= IWebBrowser2_put_Offline(wb
, 100);
2359 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2362 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2363 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2364 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
2366 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_FALSE
);
2367 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2370 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2371 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2372 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2375 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
2376 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
2378 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2381 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
2382 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2385 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2388 hres
= IWebBrowser2_get_Offline(wb
, &b
);
2389 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
2390 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
2393 static void test_ambient_unknown(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
2397 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2398 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2399 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2400 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2401 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2402 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2404 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_UNKNOWN
);
2405 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
2407 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2408 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
2409 CHECK_EXPECT(Invoke_AMBIENT_USERMODE
);
2410 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2411 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2412 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2414 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2415 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
2416 CLEAR_CALLED(Invoke_AMBIENT_USERMODE
);
2417 CLEAR_CALLED(Invoke_AMBIENT_DLCONTROL
);
2418 CLEAR_CALLED(Invoke_AMBIENT_USERAGENT
);
2419 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
);
2422 static void test_wb_funcs(IWebBrowser2
*wb
, BOOL is_clientsite
)
2424 IOleControl
*control
;
2427 hres
= IWebBrowser2_QueryInterface(wb
, &IID_IOleControl
, (void**)&control
);
2428 ok(hres
== S_OK
, "Could not get IOleControl interface: %08x\n", hres
);
2430 test_Silent(wb
, control
, is_clientsite
);
2431 test_Offline(wb
, control
, is_clientsite
);
2432 test_ambient_unknown(wb
, control
, is_clientsite
);
2434 IOleControl_Release(control
);
2437 static void test_GetControlInfo(IWebBrowser2
*unk
)
2439 IOleControl
*control
;
2443 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2444 ok(hres
== S_OK
, "Could not get IOleControl: %08x\n", hres
);
2448 hres
= IOleControl_GetControlInfo(control
, &info
);
2449 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, expected E_NOTIMPL\n", hres
);
2450 hres
= IOleControl_GetControlInfo(control
, NULL
);
2451 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, expected E_NOTIMPL\n", hres
);
2453 IOleControl_Release(control
);
2456 static void test_Extent(IWebBrowser2
*unk
)
2459 SIZE size
, expected
;
2465 /* default aspect ratio is 96dpi / 96dpi */
2467 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
2468 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
2470 if (dpi_x
!= 96 || dpi_y
!= 96)
2471 trace("dpi: %d / %d\n", dpi_y
, dpi_y
);
2473 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
2474 ok(hres
== S_OK
, "Could not get IOleObkect: %08x\n", hres
);
2478 size
.cx
= size
.cy
= 0xdeadbeef;
2479 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2480 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2481 /* Default size is 50x20 pixels, in himetric units */
2482 expected
.cx
= MulDiv( 50, 2540, dpi_x
);
2483 expected
.cy
= MulDiv( 20, 2540, dpi_y
);
2484 ok(size
.cx
== expected
.cx
&& size
.cy
== expected
.cy
, "size = {%d %d} (expected %d %d)\n",
2485 size
.cx
, size
.cy
, expected
.cx
, expected
.cy
);
2489 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2490 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2492 size
.cx
= size
.cy
= 0xdeadbeef;
2493 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2494 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2495 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2497 size
.cx
= size
.cy
= 0xdeadbeef;
2498 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2499 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2500 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2504 hres
= IOleObject_SetExtent(oleobj
, 0, &size
);
2505 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2507 size
.cx
= size
.cy
= 0xdeadbeef;
2508 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2509 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2510 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2512 size
.cx
= size
.cy
= 0xdeadbeef;
2513 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2514 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2515 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2519 hres
= IOleObject_SetExtent(oleobj
, 0xdeadbeef, &size
);
2520 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2522 size
.cx
= size
.cy
= 0xdeadbeef;
2523 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2524 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2525 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2527 size
.cx
= size
.cy
= 0xdeadbeef;
2528 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2529 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2530 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2532 IOleObject_Release(oleobj
);
2535 static void test_ConnectionPoint(IWebBrowser2
*unk
, BOOL init
)
2537 IConnectionPointContainer
*container
;
2538 IConnectionPoint
*point
;
2541 static DWORD dw
= 100;
2543 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2544 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2548 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &DIID_DWebBrowserEvents2
, &point
);
2549 IConnectionPointContainer_Release(container
);
2550 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2555 hres
= IConnectionPoint_Advise(point
, (IUnknown
*)&WebBrowserEvents2
, &dw
);
2556 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2557 ok(dw
== 1, "dw=%d, expected 1\n", dw
);
2559 hres
= IConnectionPoint_Unadvise(point
, dw
);
2560 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
2563 IConnectionPoint_Release(point
);
2566 static void test_Navigate2(IWebBrowser2
*webbrowser
, const char *nav_url
)
2572 test_LocationURL(webbrowser
, is_first_load
? "" : current_url
);
2573 test_ready_state(is_first_load
? READYSTATE_UNINITIALIZED
: READYSTATE_COMPLETE
);
2575 is_http
= !memcmp(nav_url
, "http:", 5);
2576 V_VT(&url
) = VT_BSTR
;
2577 V_BSTR(&url
) = a2bstr(current_url
= nav_url
);
2579 if((is_file
= !strncasecmp(nav_url
, "file://", 7)))
2580 current_url
= nav_url
+ 7;
2583 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2584 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2585 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2586 SET_EXPECT(Invoke_DOWNLOADBEGIN
);
2587 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2588 SET_EXPECT(EnableModeless_FALSE
);
2589 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2590 SET_EXPECT(SetStatusText
);
2591 if(use_container_dochostui
)
2592 SET_EXPECT(GetHostInfo
);
2593 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2594 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2595 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2596 if(use_container_dochostui
) {
2597 SET_EXPECT(GetOptionKeyPath
);
2598 SET_EXPECT(GetOverridesKeyPath
);
2600 if (use_container_olecmd
) SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2601 if (use_container_olecmd
) SET_EXPECT(Exec_SETPROGRESSMAX
);
2602 if (use_container_olecmd
) SET_EXPECT(Exec_SETPROGRESSPOS
);
2603 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2604 SET_EXPECT(Invoke_FILEDOWNLOAD
);
2605 if (use_container_olecmd
) SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2606 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2607 SET_EXPECT(EnableModeless_TRUE
);
2608 if (!use_container_olecmd
) SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
2609 if (is_file
) SET_EXPECT(Invoke_PROGRESSCHANGE
);
2612 hres
= IWebBrowser2_Navigate2(webbrowser
, &url
, NULL
, NULL
, NULL
, NULL
);
2613 ok(hres
== S_OK
, "Navigate2 failed: %08x\n", hres
);
2616 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
2617 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2618 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2619 todo_wine
CHECK_CALLED(Invoke_DOWNLOADBEGIN
);
2620 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2621 CHECK_CALLED(EnableModeless_FALSE
);
2622 CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2623 CHECK_CALLED(SetStatusText
);
2624 if(use_container_dochostui
)
2625 CHECK_CALLED(GetHostInfo
);
2626 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
2627 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
2628 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* Not called by IE9 */
2629 if(use_container_dochostui
) {
2630 CLEAR_CALLED(GetOptionKeyPath
);
2631 CHECK_CALLED(GetOverridesKeyPath
);
2633 if (use_container_olecmd
) todo_wine
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
2634 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2635 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2636 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2637 todo_wine
CHECK_CALLED(Invoke_FILEDOWNLOAD
);
2638 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2639 if (use_container_olecmd
) todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2640 CHECK_CALLED(EnableModeless_TRUE
);
2641 if (is_file
) todo_wine
CHECK_CALLED(Invoke_PROGRESSCHANGE
);
2646 test_ready_state(READYSTATE_LOADING
);
2649 static void test_QueryStatusWB(IWebBrowser2
*webbrowser
, BOOL use_custom_target
, BOOL has_document
)
2651 HRESULT hres
, success_state
;
2652 OLECMDF success_flags
;
2653 enum OLECMDF status
;
2656 * We can tell the difference between the custom container target and the built-in target
2657 * since the custom target returns OLECMDF_SUPPORTED instead of OLECMDF_ENABLED.
2659 if (use_custom_target
)
2660 success_flags
= OLECMDF_SUPPORTED
;
2662 success_flags
= OLECMDF_ENABLED
;
2664 /* When no target is available (no document or custom target) an error is returned */
2666 success_state
= S_OK
;
2668 success_state
= E_UNEXPECTED
;
2671 * Test a safe operation that exists as both a high-numbered MSHTML id and an OLECMDID.
2672 * These tests show that QueryStatusWB uses a NULL pguidCmdGroup, since OLECMDID_STOP
2673 * is enabled and IDM_STOP is not.
2675 status
= 0xdeadbeef;
2676 if (use_custom_target
) SET_EXPECT(QueryStatus_STOP
);
2677 hres
= IWebBrowser2_QueryStatusWB(webbrowser
, OLECMDID_STOP
, &status
);
2678 ok(hres
== success_state
, "QueryStatusWB failed: %08x %08x\n", hres
, success_state
);
2679 if (!use_custom_target
&& has_document
)
2680 todo_wine
ok((has_document
&& status
== success_flags
) || (!has_document
&& status
== 0xdeadbeef),
2681 "OLECMDID_STOP not enabled/supported: %08x %08x\n", status
, success_flags
);
2683 ok((has_document
&& status
== success_flags
) || (!has_document
&& status
== 0xdeadbeef),
2684 "OLECMDID_STOP not enabled/supported: %08x %08x\n", status
, success_flags
);
2685 status
= 0xdeadbeef;
2686 if (use_custom_target
) SET_EXPECT(QueryStatus_IDM_STOP
);
2687 hres
= IWebBrowser2_QueryStatusWB(webbrowser
, IDM_STOP
, &status
);
2688 ok(hres
== success_state
, "QueryStatusWB failed: %08x %08x\n", hres
, success_state
);
2689 ok((has_document
&& status
== 0) || (!has_document
&& status
== 0xdeadbeef),
2690 "IDM_STOP is enabled/supported: %08x %d\n", status
, has_document
);
2693 static void test_ExecWB(IWebBrowser2
*webbrowser
, BOOL use_custom_target
, BOOL has_document
)
2695 HRESULT hres
, olecmdid_state
, idm_state
;
2697 /* When no target is available (no document or custom target) an error is returned */
2700 olecmdid_state
= S_OK
;
2701 idm_state
= OLECMDERR_E_NOTSUPPORTED
;
2705 olecmdid_state
= E_UNEXPECTED
;
2706 idm_state
= E_UNEXPECTED
;
2710 * Test a safe operation that exists as both a high-numbered MSHTML id and an OLECMDID.
2711 * These tests show that QueryStatusWB uses a NULL pguidCmdGroup, since OLECMDID_STOP
2712 * succeeds (S_OK) and IDM_STOP does not (OLECMDERR_E_NOTSUPPORTED).
2714 if(use_custom_target
) {
2715 SET_EXPECT(Exec_STOP
);
2716 }else if(has_document
) {
2717 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2718 SET_EXPECT(SetStatusText
);
2720 hres
= IWebBrowser2_ExecWB(webbrowser
, OLECMDID_STOP
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);
2721 if(!use_custom_target
&& has_document
) {
2722 todo_wine
ok(hres
== olecmdid_state
, "ExecWB failed: %08x %08x\n", hres
, olecmdid_state
);
2723 CLEAR_CALLED(Invoke_STATUSTEXTCHANGE
); /* Called by IE9 */
2724 CLEAR_CALLED(SetStatusText
); /* Called by IE9 */
2726 ok(hres
== olecmdid_state
, "ExecWB failed: %08x %08x\n", hres
, olecmdid_state
);
2728 if (use_custom_target
)
2729 SET_EXPECT(Exec_IDM_STOP
);
2730 hres
= IWebBrowser2_ExecWB(webbrowser
, IDM_STOP
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);
2731 ok(hres
== idm_state
, "ExecWB failed: %08x %08x\n", hres
, idm_state
);
2734 static void test_download(DWORD flags
)
2736 BOOL
*b
= (flags
& DWL_REFRESH
) ? &called_Exec_SETDOWNLOADSTATE_0
: &called_Invoke_DOCUMENTCOMPLETE
;
2739 is_downloading
= TRUE
;
2742 test_ready_state((flags
& (DWL_FROM_PUT_HREF
|DWL_FROM_GOBACK
|DWL_FROM_GOFORWARD
|DWL_REFRESH
))
2743 ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
2745 if((is_http
&& !(flags
& (DWL_FROM_GOBACK
|DWL_FROM_GOFORWARD
|DWL_REFRESH
))) || (flags
& DWL_EXPECT_BEFORE_NAVIGATE
))
2746 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2748 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2749 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2750 SET_EXPECT(TranslateUrl
);
2752 SET_EXPECT(Exec_SETPROGRESSMAX
);
2753 SET_EXPECT(Exec_SETPROGRESSPOS
);
2754 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2755 SET_EXPECT(DocHost_EnableModeless_FALSE
);
2756 SET_EXPECT(DocHost_EnableModeless_TRUE
);
2757 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2758 SET_EXPECT(Invoke_282
);
2759 SET_EXPECT(EnableModeless_FALSE
);
2760 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2761 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2762 SET_EXPECT(SetStatusText
);
2763 SET_EXPECT(EnableModeless_TRUE
);
2765 SET_EXPECT(GetHostInfo
);
2766 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2767 SET_EXPECT(Invoke_TITLECHANGE
);
2768 if(!(flags
& DWL_REFRESH
))
2769 SET_EXPECT(Invoke_NAVIGATECOMPLETE2
);
2771 SET_EXPECT(GetDropTarget
);
2772 SET_EXPECT(Invoke_PROGRESSCHANGE
);
2773 if(!(flags
& DWL_REFRESH
))
2774 SET_EXPECT(Invoke_DOCUMENTCOMPLETE
);
2776 if(flags
& DWL_HTTP
)
2777 SET_EXPECT(Exec_SETTITLE
);
2778 SET_EXPECT(UpdateUI
);
2779 SET_EXPECT(Exec_UPDATECOMMANDS
);
2780 SET_EXPECT(QueryStatus_STOP
);
2782 while(!*b
&& GetMessage(&msg
, NULL
, 0, 0)) {
2783 TranslateMessage(&msg
);
2784 DispatchMessage(&msg
);
2787 if((is_http
&& !(flags
& (DWL_FROM_GOBACK
|DWL_FROM_GOFORWARD
|DWL_REFRESH
))) || (flags
& DWL_EXPECT_BEFORE_NAVIGATE
))
2788 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2790 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2791 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2792 CHECK_CALLED(TranslateUrl
);
2794 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2795 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2796 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2797 CLEAR_CALLED(DocHost_EnableModeless_FALSE
); /* IE 7 */
2798 CLEAR_CALLED(DocHost_EnableModeless_TRUE
); /* IE 7 */
2799 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2800 CLEAR_CALLED(Invoke_282
); /* IE 7 */
2802 todo_wine
CHECK_CALLED(EnableModeless_FALSE
);
2804 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2805 CLEAR_CALLED(Invoke_COMMANDSTATECHANGE
);
2806 todo_wine
CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2807 todo_wine
CHECK_CALLED(SetStatusText
);
2809 todo_wine
CHECK_CALLED(EnableModeless_TRUE
);
2811 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2813 todo_wine
CHECK_CALLED(GetHostInfo
);
2814 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2815 todo_wine
CHECK_CALLED(Invoke_TITLECHANGE
);
2816 if(!(flags
& DWL_REFRESH
))
2817 CHECK_CALLED(Invoke_NAVIGATECOMPLETE2
);
2819 todo_wine
CHECK_CALLED(GetDropTarget
);
2820 if(!(flags
& DWL_REFRESH
))
2821 CHECK_CALLED(Invoke_DOCUMENTCOMPLETE
);
2823 is_downloading
= FALSE
;
2825 test_ready_state(READYSTATE_COMPLETE
);
2827 while(!called_Exec_UPDATECOMMANDS
&& GetMessage(&msg
, NULL
, 0, 0)) {
2828 TranslateMessage(&msg
);
2829 DispatchMessage(&msg
);
2832 todo_wine
CHECK_CALLED(Invoke_PROGRESSCHANGE
);
2833 if(flags
& DWL_HTTP
)
2834 CLEAR_CALLED(Exec_SETTITLE
); /* FIXME: make it more strict */
2835 CHECK_CALLED(UpdateUI
);
2836 CHECK_CALLED(Exec_UPDATECOMMANDS
);
2837 CLEAR_CALLED(QueryStatus_STOP
);
2840 static void test_Refresh(IWebBrowser2
*webbrowser
)
2844 trace("Refresh...\n");
2846 SET_EXPECT(Exec_DocHostCommandHandler_2300
);
2847 hres
= IWebBrowser2_Refresh(webbrowser
);
2848 ok(hres
== S_OK
, "Refresh failed: %08x\n", hres
);
2849 CHECK_CALLED(Exec_DocHostCommandHandler_2300
);
2851 test_download(DWL_REFRESH
);
2854 static void test_olecmd(IWebBrowser2
*unk
, BOOL loaded
)
2856 IOleCommandTarget
*cmdtrg
;
2860 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2861 ok(hres
== S_OK
, "Could not get IOleCommandTarget iface: %08x\n", hres
);
2865 cmds
[0].cmdID
= OLECMDID_SPELL
;
2866 cmds
[0].cmdf
= 0xdeadbeef;
2867 cmds
[1].cmdID
= OLECMDID_REFRESH
;
2868 cmds
[1].cmdf
= 0xdeadbeef;
2869 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmds
, NULL
);
2871 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2872 ok(cmds
[0].cmdf
== OLECMDF_SUPPORTED
, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2873 ok(cmds
[1].cmdf
== (OLECMDF_ENABLED
|OLECMDF_SUPPORTED
),
2874 "OLECMDID_REFRESH cmdf = %x\n", cmds
[1].cmdf
);
2876 ok(hres
== 0x80040104, "QueryStatus failed: %08x\n", hres
);
2877 ok(cmds
[0].cmdf
== 0xdeadbeef, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2878 ok(cmds
[1].cmdf
== 0xdeadbeef, "OLECMDID_REFRESH cmdf = %x\n", cmds
[0].cmdf
);
2881 IOleCommandTarget_Release(cmdtrg
);
2884 static void test_IServiceProvider(IWebBrowser2
*unk
)
2886 IServiceProvider
*servprov
= (void*)0xdeadbeef;
2890 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&servprov
);
2891 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
2895 hres
= IServiceProvider_QueryService(servprov
, &SID_STopLevelBrowser
, &IID_IBrowserService2
, (LPVOID
*)&iface
);
2896 ok(hres
== E_FAIL
, "QueryService returned %08x, expected E_FAIL\n", hres
);
2897 ok(!iface
, "QueryService returned %p, expected NULL\n", iface
);
2899 IUnknown_Release(iface
);
2901 hres
= IServiceProvider_QueryService(servprov
, &SID_SHTMLWindow
, &IID_IHTMLWindow2
, (LPVOID
*)&iface
);
2902 ok(hres
== S_OK
, "QueryService returned %08x, expected S_OK\n", hres
);
2903 ok(iface
!= NULL
, "QueryService returned NULL\n");
2905 IUnknown_Release(iface
);
2907 IServiceProvider_Release(servprov
);
2910 static void test_put_href(IWebBrowser2
*unk
, const char *url
)
2912 IHTMLLocation
*location
;
2913 IHTMLDocument2
*doc
;
2917 doc
= get_document(unk
);
2920 hres
= IHTMLDocument2_get_location(doc
, &location
);
2921 IHTMLDocument2_Release(doc
);
2922 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2923 ok(location
!= NULL
, "location == NULL\n");
2925 SET_EXPECT(TranslateUrl
);
2926 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2928 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2930 dwl_flags
= DWL_FROM_PUT_HREF
;
2932 is_http
= !memcmp(url
, "http:", 5);
2933 str
= a2bstr(current_url
= url
);
2934 is_first_load
= FALSE
;
2935 hres
= IHTMLLocation_put_href(location
, str
);
2937 CHECK_CALLED(TranslateUrl
);
2938 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2940 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2942 IHTMLLocation_Release(location
);
2944 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
2946 test_ready_state(READYSTATE_COMPLETE
);
2949 static void test_go_back(IWebBrowser2
*wb
, const char *back_url
)
2953 current_url
= back_url
;
2955 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2956 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2957 hres
= IWebBrowser2_GoBack(wb
);
2958 ok(hres
== S_OK
, "GoBack failed: %08x\n", hres
);
2959 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2960 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2963 static void test_go_forward(IWebBrowser2
*wb
, const char *forward_url
)
2967 current_url
= forward_url
;
2968 dwl_flags
|= DWL_FROM_GOFORWARD
;
2970 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2971 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2972 hres
= IWebBrowser2_GoForward(wb
);
2973 ok(hres
== S_OK
, "GoForward failed: %08x\n", hres
);
2974 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2975 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2978 static void test_QueryInterface(IWebBrowser2
*wb
)
2980 IQuickActivate
*qa
= (IQuickActivate
*)0xdeadbeef;
2981 IRunnableObject
*runnable
= (IRunnableObject
*)0xdeadbeef;
2982 IPerPropertyBrowsing
*propbrowse
= (void*)0xdeadbeef;
2983 IOleInPlaceSite
*inplace
= (void*)0xdeadbeef;
2984 IOleCache
*cache
= (void*)0xdeadbeef;
2985 IObjectWithSite
*site
= (void*)0xdeadbeef;
2986 IViewObjectEx
*viewex
= (void*)0xdeadbeef;
2987 IOleLink
*link
= (void*)0xdeadbeef;
2988 IMarshal
*marshal
= (void*)0xdeadbeef;
2989 IUnknown
*unk
= (IUnknown
*)wb
;
2992 hres
= IUnknown_QueryInterface(unk
, &IID_IQuickActivate
, (void**)&qa
);
2993 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2994 ok(qa
== NULL
, "qa=%p, expected NULL\n", qa
);
2996 hres
= IUnknown_QueryInterface(unk
, &IID_IRunnableObject
, (void**)&runnable
);
2997 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2998 ok(runnable
== NULL
, "runnable=%p, expected NULL\n", runnable
);
3000 hres
= IUnknown_QueryInterface(unk
, &IID_IPerPropertyBrowsing
, (void**)&propbrowse
);
3001 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3002 ok(propbrowse
== NULL
, "propbrowse=%p, expected NULL\n", propbrowse
);
3004 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCache
, (void**)&cache
);
3005 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3006 ok(cache
== NULL
, "cache=%p, expected NULL\n", cache
);
3008 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceSite
, (void**)&inplace
);
3009 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3010 ok(inplace
== NULL
, "inplace=%p, expected NULL\n", inplace
);
3012 hres
= IUnknown_QueryInterface(unk
, &IID_IObjectWithSite
, (void**)&site
);
3013 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3014 ok(site
== NULL
, "site=%p, expected NULL\n", site
);
3016 hres
= IUnknown_QueryInterface(unk
, &IID_IViewObjectEx
, (void**)&viewex
);
3017 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3018 ok(viewex
== NULL
, "viewex=%p, expected NULL\n", viewex
);
3020 hres
= IUnknown_QueryInterface(unk
, &IID_IOleLink
, (void**)&link
);
3021 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3022 ok(link
== NULL
, "link=%p, expected NULL\n", link
);
3024 hres
= IUnknown_QueryInterface(unk
, &IID_IMarshal
, (void**)&marshal
);
3025 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3026 ok(marshal
== NULL
, "marshal=%p, expected NULL\n", marshal
);
3030 static void test_UIActivate(IWebBrowser2
*unk
, BOOL activate
)
3032 IOleDocumentView
*docview
;
3033 IHTMLDocument2
*doc
;
3036 doc
= get_document(unk
);
3038 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&docview
);
3039 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3040 if(SUCCEEDED(hres
)) {
3042 SET_EXPECT(RequestUIActivate
);
3045 SET_EXPECT(OnFocus
);
3048 hres
= IOleDocumentView_UIActivate(docview
, activate
);
3050 todo_wine
ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3052 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3056 CHECK_CALLED(RequestUIActivate
);
3057 CHECK_CALLED(ShowUI
);
3058 CHECK_CALLED(HideUI
);
3059 CHECK_CALLED(OnFocus
);
3063 IOleDocumentView_Release(docview
);
3066 IHTMLDocument2_Release(doc
);
3069 static void test_external(IWebBrowser2
*unk
)
3071 IDocHostUIHandler2
*dochost
;
3072 IOleClientSite
*client
;
3076 client
= get_dochost(unk
);
3078 hres
= IOleClientSite_QueryInterface(client
, &IID_IDocHostUIHandler2
, (void**)&dochost
);
3079 ok(hres
== S_OK
, "Could not get IDocHostUIHandler2 iface: %08x\n", hres
);
3080 IOleClientSite_Release(client
);
3082 if(use_container_dochostui
)
3083 SET_EXPECT(GetExternal
);
3084 disp
= (void*)0xdeadbeef;
3085 hres
= IDocHostUIHandler2_GetExternal(dochost
, &disp
);
3086 if(use_container_dochostui
) {
3087 CHECK_CALLED(GetExternal
);
3088 ok(hres
== S_FALSE
, "GetExternal failed: %08x\n", hres
);
3089 ok(!disp
, "disp = %p\n", disp
);
3091 IShellUIHelper
*uihelper
;
3093 ok(hres
== S_OK
, "GetExternal failed: %08x\n", hres
);
3094 ok(disp
!= NULL
, "disp == NULL\n");
3096 hres
= IDispatch_QueryInterface(disp
, &IID_IShellUIHelper
, (void**)&uihelper
);
3097 ok(hres
== S_OK
, "Could not get IShellUIHelper iface: %08x\n", hres
);
3098 IShellUIHelper_Release(uihelper
);
3101 IDocHostUIHandler2_Release(dochost
);
3104 static void test_htmlwindow_close(IWebBrowser2
*wb
)
3106 IHTMLWindow2
*window
;
3107 IHTMLDocument2
*doc
;
3110 doc
= get_document(wb
);
3112 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3113 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3114 IHTMLDocument2_Release(doc
);
3116 SET_EXPECT(Invoke_WINDOWCLOSING
);
3118 hres
= IHTMLWindow2_close(window
);
3119 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
3121 CHECK_CALLED(Invoke_WINDOWCLOSING
);
3123 IHTMLWindow2_Release(window
);
3126 static void test_TranslateAccelerator(IWebBrowser2
*unk
)
3128 IOleClientSite
*doc_clientsite
;
3129 IOleInPlaceActiveObject
*pao
;
3139 test_Navigate2(unk
, "about:blank");
3141 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&pao
);
3142 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3143 if(SUCCEEDED(hres
)) {
3144 /* One accelerator that should be handled by mshtml */
3145 msg_a
.message
= WM_KEYDOWN
;
3146 msg_a
.wParam
= VK_F1
;
3147 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
3148 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
3150 /* And one that should not */
3151 msg_a
.message
= WM_KEYDOWN
;
3152 msg_a
.wParam
= VK_F5
;
3153 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
3154 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
3156 IOleInPlaceActiveObject_Release(pao
);
3159 test_UIActivate(unk
, TRUE
);
3161 /* Test again after UIActivate */
3162 hres
= IWebBrowser2_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&pao
);
3163 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3164 if(SUCCEEDED(hres
)) {
3165 /* One accelerator that should be handled by mshtml */
3166 msg_a
.message
= WM_KEYDOWN
;
3167 msg_a
.wParam
= VK_F1
;
3168 SET_EXPECT(DocHost_TranslateAccelerator
);
3169 SET_EXPECT(ControlSite_TranslateAccelerator
);
3170 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
3171 ok(hres
== S_FALSE
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
3172 todo_wine
CHECK_CALLED(DocHost_TranslateAccelerator
);
3173 todo_wine
CHECK_CALLED(ControlSite_TranslateAccelerator
);
3175 /* And one that should not */
3176 msg_a
.message
= WM_KEYDOWN
;
3177 msg_a
.wParam
= VK_F5
;
3178 SET_EXPECT(DocHost_TranslateAccelerator
);
3179 hres
= IOleInPlaceActiveObject_TranslateAccelerator(pao
, &msg_a
);
3180 todo_wine
ok(hres
== S_OK
, "Got 0x%08x (%04x::%02lx)\n", hres
, msg_a
.message
, msg_a
.wParam
);
3181 todo_wine
CHECK_CALLED(DocHost_TranslateAccelerator
);
3183 IOleInPlaceActiveObject_Release(pao
);
3186 doc_clientsite
= get_dochost(unk
);
3187 if(doc_clientsite
) {
3188 IDocHostUIHandler2
*dochost
;
3189 IOleControlSite
*doc_controlsite
;
3192 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IOleInPlaceFrame
, (void**)&unk_test
);
3193 ok(hres
== E_NOINTERFACE
, "Got 0x%08x\n", hres
);
3194 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
3196 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostShowUI
, (void**)&unk_test
);
3197 todo_wine
ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3198 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
3200 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostUIHandler
, (void**)&unk_test
);
3201 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3202 if(SUCCEEDED(hres
)) IUnknown_Release(unk_test
);
3204 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IDocHostUIHandler2
, (void**)&dochost
);
3205 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3206 if(SUCCEEDED(hres
)) {
3207 msg_a
.message
= WM_KEYDOWN
;
3208 hr_dochost_TranslateAccelerator
= 0xdeadbeef;
3209 for(keycode
= 0; keycode
<= 0x100; keycode
++) {
3210 msg_a
.wParam
= keycode
;
3211 SET_EXPECT(DocHost_TranslateAccelerator
);
3212 hres
= IDocHostUIHandler2_TranslateAccelerator(dochost
, &msg_a
, &CGID_MSHTML
, 1234);
3213 ok(hres
== 0xdeadbeef, "Got 0x%08x\n", hres
);
3214 CHECK_CALLED(DocHost_TranslateAccelerator
);
3216 hr_dochost_TranslateAccelerator
= E_NOTIMPL
;
3218 SET_EXPECT(DocHost_TranslateAccelerator
);
3219 hres
= IDocHostUIHandler2_TranslateAccelerator(dochost
, &msg_a
, &CGID_MSHTML
, 1234);
3220 ok(hres
== E_NOTIMPL
, "Got 0x%08x\n", hres
);
3221 CHECK_CALLED(DocHost_TranslateAccelerator
);
3223 IDocHostUIHandler2_Release(dochost
);
3226 hres
= IOleClientSite_QueryInterface(doc_clientsite
, &IID_IOleControlSite
, (void**)&doc_controlsite
);
3227 ok(hres
== S_OK
, "Got 0x%08x\n", hres
);
3228 if(SUCCEEDED(hres
)) {
3229 msg_a
.message
= WM_KEYDOWN
;
3230 hr_site_TranslateAccelerator
= 0xdeadbeef;
3231 for(keycode
= 0; keycode
< 0x100; keycode
++) {
3232 msg_a
.wParam
= keycode
;
3233 SET_EXPECT(ControlSite_TranslateAccelerator
);
3234 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
3235 if(keycode
== 0x9 || keycode
== 0x75)
3236 todo_wine
ok(hres
== S_OK
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
3238 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
3240 CHECK_CALLED(ControlSite_TranslateAccelerator
);
3242 msg_a
.wParam
= VK_LEFT
;
3243 SET_EXPECT(ControlSite_TranslateAccelerator
);
3244 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
3245 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
3246 CHECK_CALLED(ControlSite_TranslateAccelerator
);
3248 hr_site_TranslateAccelerator
= S_OK
;
3249 SET_EXPECT(ControlSite_TranslateAccelerator
);
3250 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
3251 ok(hres
== S_OK
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
3252 CHECK_CALLED(ControlSite_TranslateAccelerator
);
3254 hr_site_TranslateAccelerator
= E_NOTIMPL
;
3255 SET_EXPECT(ControlSite_TranslateAccelerator
);
3256 hres
= IOleControlSite_TranslateAccelerator(doc_controlsite
, &msg_a
, 0);
3257 ok(hres
== S_FALSE
, "Got 0x%08x (keycode: %04x)\n", hres
, keycode
);
3258 CHECK_CALLED(ControlSite_TranslateAccelerator
);
3260 IOleControlSite_Release(doc_controlsite
);
3263 IOleClientSite_Release(doc_clientsite
);
3266 test_UIActivate(unk
, FALSE
);
3269 static void test_dochost_qs(IWebBrowser2
*webbrowser
)
3271 IOleClientSite
*client_site
;
3272 IServiceProvider
*serv_prov
;
3276 client_site
= get_dochost(webbrowser
);
3277 hres
= IOleClientSite_QueryInterface(client_site
, &IID_IServiceProvider
, (void**)&serv_prov
);
3278 IOleClientSite_Release(client_site
);
3279 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
3281 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&service
);
3282 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
3283 ok(iface_cmp(service
, (IUnknown
*)webbrowser
), "service != unk\n");
3284 IUnknown_Release(service
);
3286 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IWebBrowserApp
, &IID_IHlinkFrame
, (void**)&service
);
3287 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
3288 ok(iface_cmp(service
, (IUnknown
*)webbrowser
), "service != unk\n");
3289 IUnknown_Release(service
);
3291 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IShellBrowser
, (void**)&service
);
3292 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
3293 IUnknown_Release(service
);
3295 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IBrowserService
, (void**)&service
);
3296 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
3297 IUnknown_Release(service
);
3299 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IShellBrowser
, &IID_IDocObjectService
, (void**)&service
);
3300 ok(hres
== S_OK
, "QueryService failed: %08x\n", hres
);
3301 IUnknown_Release(service
);
3303 IServiceProvider_Release(serv_prov
);
3306 static void test_Close(IWebBrowser2
*wb
, BOOL do_download
)
3309 IOleClientSite
*ocs
;
3312 hres
= IWebBrowser2_QueryInterface(wb
, &IID_IOleObject
, (void**)&oo
);
3313 ok(hres
== S_OK
, "QueryInterface failed: %08x\n", hres
);
3319 SET_EXPECT(Frame_SetActiveObject
);
3320 SET_EXPECT(UIWindow_SetActiveObject
);
3321 SET_EXPECT(OnUIDeactivate
);
3322 SET_EXPECT(OnFocus
);
3323 SET_EXPECT(OnInPlaceDeactivate
);
3324 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
3326 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
3327 SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
3329 hres
= IOleObject_Close(oo
, OLECLOSE_NOSAVE
);
3330 ok(hres
== S_OK
, "OleObject_Close failed: %x\n", hres
);
3331 CHECK_CALLED(Frame_SetActiveObject
);
3332 CHECK_CALLED(UIWindow_SetActiveObject
);
3333 CHECK_CALLED(OnUIDeactivate
);
3334 todo_wine
CHECK_CALLED(OnFocus
);
3335 CHECK_CALLED(OnInPlaceDeactivate
);
3336 CLEAR_CALLED(Invoke_STATUSTEXTCHANGE
); /* Called by IE9 */
3338 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
3339 todo_wine
CHECK_CALLED(Invoke_DOWNLOADCOMPLETE
);
3342 hres
= IOleObject_GetClientSite(oo
, &ocs
);
3343 ok(hres
== S_OK
, "hres = %x\n", hres
);
3344 ok(!ocs
, "ocs != NULL\n");
3346 hres
= IOleObject_Close(oo
, OLECLOSE_NOSAVE
);
3347 ok(hres
== S_OK
, "OleObject_Close failed: %x\n", hres
);
3350 IOleObject_Release(oo
);
3353 #define TEST_DOWNLOAD 0x0001
3354 #define TEST_NOOLECMD 0x0002
3355 #define TEST_NODOCHOST 0x0004
3357 static void init_test(IWebBrowser2
*webbrowser
, DWORD flags
)
3361 is_downloading
= (flags
& TEST_DOWNLOAD
) != 0;
3362 is_first_load
= TRUE
;
3364 use_container_olecmd
= !(flags
& TEST_NOOLECMD
);
3365 use_container_dochostui
= !(flags
& TEST_NODOCHOST
);
3368 static void test_WebBrowser(BOOL do_download
, BOOL do_close
)
3370 IWebBrowser2
*webbrowser
;
3373 webbrowser
= create_webbrowser();
3377 init_test(webbrowser
, do_download
? TEST_DOWNLOAD
: 0);
3379 test_QueryStatusWB(webbrowser
, FALSE
, FALSE
);
3380 test_ExecWB(webbrowser
, FALSE
, FALSE
);
3381 test_QueryInterface(webbrowser
);
3382 test_ready_state(READYSTATE_UNINITIALIZED
);
3383 test_ClassInfo(webbrowser
);
3384 test_EnumVerbs(webbrowser
);
3385 test_LocationURL(webbrowser
, "");
3386 test_ConnectionPoint(webbrowser
, TRUE
);
3387 test_ClientSite(webbrowser
, &ClientSite
, !do_download
);
3388 test_Extent(webbrowser
);
3389 test_wb_funcs(webbrowser
, TRUE
);
3390 test_DoVerb(webbrowser
);
3391 test_olecmd(webbrowser
, FALSE
);
3392 test_Navigate2(webbrowser
, "about:blank");
3393 test_QueryStatusWB(webbrowser
, TRUE
, TRUE
);
3394 test_ExecWB(webbrowser
, TRUE
, TRUE
);
3397 IHTMLDocument2
*doc
, *doc2
;
3400 test_olecmd(webbrowser
, TRUE
);
3401 doc
= get_document(webbrowser
);
3403 test_put_href(webbrowser
, "about:test");
3404 test_download(DWL_FROM_PUT_HREF
);
3405 doc2
= get_document(webbrowser
);
3406 ok(doc
== doc2
, "doc != doc2\n");
3407 IHTMLDocument2_Release(doc2
);
3409 trace("Navigate2 repeated...\n");
3410 test_Navigate2(webbrowser
, "about:blank");
3411 test_download(DWL_EXPECT_BEFORE_NAVIGATE
);
3412 doc2
= get_document(webbrowser
);
3413 ok(doc
== doc2
, "doc != doc2\n");
3414 IHTMLDocument2_Release(doc2
);
3415 IHTMLDocument2_Release(doc
);
3418 trace("Navigate2 http URL...\n");
3419 test_ready_state(READYSTATE_COMPLETE
);
3420 test_Navigate2(webbrowser
, "http://test.winehq.org/tests/hello.html");
3421 test_download(DWL_EXPECT_BEFORE_NAVIGATE
|DWL_HTTP
);
3423 test_Refresh(webbrowser
);
3425 trace("put_href http URL...\n");
3426 test_put_href(webbrowser
, "http://www.winehq.org/");
3427 test_download(DWL_FROM_PUT_HREF
|DWL_HTTP
);
3429 trace("GoBack...\n");
3430 test_go_back(webbrowser
, "http://test.winehq.org/tests/hello.html");
3431 test_download(DWL_FROM_GOBACK
|DWL_HTTP
);
3433 trace("GoForward...\n");
3434 test_go_forward(webbrowser
, "http://www.winehq.org/");
3435 test_download(DWL_FROM_GOFORWARD
|DWL_HTTP
);
3438 test_EnumVerbs(webbrowser
);
3439 test_TranslateAccelerator(webbrowser
);
3441 test_dochost_qs(webbrowser
);
3444 test_external(webbrowser
);
3445 test_htmlwindow_close(webbrowser
);
3448 test_Close(webbrowser
, do_download
);
3450 test_ClientSite(webbrowser
, NULL
, !do_download
);
3451 test_ie_funcs(webbrowser
);
3452 test_GetControlInfo(webbrowser
);
3453 test_wb_funcs(webbrowser
, FALSE
);
3454 test_ConnectionPoint(webbrowser
, FALSE
);
3455 test_IServiceProvider(webbrowser
);
3457 ref
= IWebBrowser2_Release(webbrowser
);
3458 ok(ref
== 0 || broken(do_download
&& !do_close
), "ref=%d, expected 0\n", ref
);
3461 static void test_WebBrowserV1(void)
3467 hres
= CoCreateInstance(&CLSID_WebBrowser_V1
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
3468 &IID_IWebBrowser2
, (void**)&wb
);
3469 ok(hres
== S_OK
, "Could not get WebBrowserV1 instance: %08x\n", hres
);
3474 test_QueryStatusWB(wb
, FALSE
, FALSE
);
3475 test_ExecWB(wb
, FALSE
, FALSE
);
3476 test_QueryInterface(wb
);
3477 test_ready_state(READYSTATE_UNINITIALIZED
);
3481 ref
= IWebBrowser2_Release(wb
);
3482 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3485 static void test_WebBrowser_slim_container(void)
3487 IWebBrowser2
*webbrowser
;
3490 webbrowser
= create_webbrowser();
3491 init_test(webbrowser
, TEST_NOOLECMD
|TEST_NODOCHOST
);
3493 test_ConnectionPoint(webbrowser
, TRUE
);
3494 test_ClientSite(webbrowser
, &ClientSite
, TRUE
);
3495 test_DoVerb(webbrowser
);
3496 test_Navigate2(webbrowser
, "about:blank");
3498 /* Tests of interest */
3499 test_QueryStatusWB(webbrowser
, FALSE
, TRUE
);
3500 test_ExecWB(webbrowser
, FALSE
, TRUE
);
3501 test_external(webbrowser
);
3504 test_ClientSite(webbrowser
, NULL
, TRUE
);
3505 test_ConnectionPoint(webbrowser
, FALSE
);
3507 ref
= IWebBrowser2_Release(webbrowser
);
3508 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3511 static void test_WebBrowser_DoVerb(void)
3513 IWebBrowser2
*webbrowser
;
3519 webbrowser
= create_webbrowser();
3520 init_test(webbrowser
, 0);
3522 test_ClientSite(webbrowser
, &ClientSite
, FALSE
);
3524 SET_EXPECT(CanInPlaceActivate
);
3525 SET_EXPECT(Site_GetWindow
);
3526 SET_EXPECT(OnInPlaceActivate
);
3527 SET_EXPECT(GetWindowContext
);
3528 SET_EXPECT(ShowObject
);
3529 SET_EXPECT(GetContainer
);
3530 SET_EXPECT(Frame_GetWindow
);
3531 call_DoVerb(webbrowser
, OLEIVERB_INPLACEACTIVATE
);
3532 CHECK_CALLED(CanInPlaceActivate
);
3533 CHECK_CALLED(Site_GetWindow
);
3534 CHECK_CALLED(OnInPlaceActivate
);
3535 CHECK_CALLED(GetWindowContext
);
3536 CHECK_CALLED(ShowObject
);
3537 CHECK_CALLED(GetContainer
);
3538 CHECK_CALLED(Frame_GetWindow
);
3540 hwnd
= get_hwnd(webbrowser
);
3542 memset(&rect
, 0xa, sizeof(rect
));
3543 res
= GetWindowRect(hwnd
, &rect
);
3544 ok(res
, "GetWindowRect failed: %u\n", GetLastError());
3546 SET_EXPECT(OnInPlaceDeactivate
);
3547 call_DoVerb(webbrowser
, OLEIVERB_HIDE
);
3548 CHECK_CALLED(OnInPlaceDeactivate
);
3550 test_ClientSite(webbrowser
, NULL
, FALSE
);
3552 ref
= IWebBrowser2_Release(webbrowser
);
3553 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3557 /* Check if Internet Explorer is configured to run in "Enhanced Security Configuration" (aka hardened mode) */
3558 /* Note: this code is duplicated in dlls/mshtml/tests/mshtml_test.h and dlls/urlmon/tests/sec_mgr.c */
3559 static BOOL
is_ie_hardened(void)
3562 DWORD ie_harden
, type
, size
;
3565 if(RegOpenKeyEx(HKEY_CURRENT_USER
, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap",
3566 0, KEY_QUERY_VALUE
, &zone_map
) == ERROR_SUCCESS
) {
3567 size
= sizeof(DWORD
);
3568 if (RegQueryValueEx(zone_map
, "IEHarden", NULL
, &type
, (LPBYTE
) &ie_harden
, &size
) != ERROR_SUCCESS
||
3569 type
!= REG_DWORD
) {
3572 RegCloseKey(zone_map
);
3575 return ie_harden
!= 0;
3578 static void test_FileProtocol(void)
3580 IWebBrowser2
*webbrowser
;
3583 char file_path
[MAX_PATH
];
3584 char file_url
[MAX_PATH
] = "File://";
3586 static const char test_file
[] = "wine_test.html";
3588 GetTempPathA(MAX_PATH
, file_path
);
3589 strcat(file_path
, test_file
);
3591 webbrowser
= create_webbrowser();
3595 init_test(webbrowser
, 0);
3597 file
= CreateFileA(file_path
, GENERIC_WRITE
, 0, NULL
,
3598 CREATE_NEW
, FILE_ATTRIBUTE_NORMAL
, NULL
);
3599 if(file
== INVALID_HANDLE_VALUE
&& GetLastError() != ERROR_FILE_EXISTS
){
3600 ok(0, "CreateFile failed\n");
3605 GetLongPathNameA(file_path
, file_path
, sizeof(file_path
));
3606 strcat(file_url
, file_path
);
3608 test_ConnectionPoint(webbrowser
, TRUE
);
3609 test_ClientSite(webbrowser
, &ClientSite
, TRUE
);
3610 test_DoVerb(webbrowser
);
3611 test_Navigate2(webbrowser
, file_url
);
3612 test_ClientSite(webbrowser
, NULL
, TRUE
);
3614 ref
= IWebBrowser2_Release(webbrowser
);
3615 ok(ref
== 0, "ref=%u, expected 0\n", ref
);
3617 if(file
!= INVALID_HANDLE_VALUE
)
3618 DeleteFileA(file_path
);
3621 START_TEST(webbrowser
)
3623 OleInitialize(NULL
);
3625 container_hwnd
= create_container_window();
3627 trace("Testing WebBrowser (no download)...\n");
3628 test_WebBrowser(FALSE
, FALSE
);
3629 test_WebBrowser(FALSE
, TRUE
);
3631 if(!is_ie_hardened()) {
3632 trace("Testing WebBrowser...\n");
3633 test_WebBrowser(TRUE
, FALSE
);
3635 win_skip("Skipping http tests in hardened mode\n");
3638 trace("Testing WebBrowser DoVerb\n");
3639 test_WebBrowser_DoVerb();
3640 trace("Testing WebBrowser (with close)...\n");
3641 test_WebBrowser(TRUE
, TRUE
);
3642 trace("Testing WebBrowser w/o container-based olecmd...\n");
3643 test_WebBrowser_slim_container();
3644 trace("Testing WebBrowserV1...\n");
3645 test_WebBrowserV1();
3646 test_FileProtocol();