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>
40 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
42 #define DEFINE_EXPECT(func) \
43 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
45 #define SET_EXPECT(func) \
46 expect_ ## func = TRUE
48 #define CHECK_EXPECT2(func) \
50 ok(expect_ ##func, "unexpected call " #func "\n"); \
51 called_ ## func = TRUE; \
54 #define CHECK_EXPECT(func) \
56 CHECK_EXPECT2(func); \
57 expect_ ## func = FALSE; \
60 #define CHECK_CALLED(func) \
62 ok(called_ ## func, "expected " #func "\n"); \
63 expect_ ## func = called_ ## func = FALSE; \
66 DEFINE_EXPECT(GetContainer);
67 DEFINE_EXPECT(Site_GetWindow);
68 DEFINE_EXPECT(ShowObject);
69 DEFINE_EXPECT(CanInPlaceActivate);
70 DEFINE_EXPECT(OnInPlaceActivate);
71 DEFINE_EXPECT(OnUIActivate);
72 DEFINE_EXPECT(GetWindowContext);
73 DEFINE_EXPECT(Frame_GetWindow);
74 DEFINE_EXPECT(Frame_SetActiveObject);
75 DEFINE_EXPECT(UIWindow_SetActiveObject);
76 DEFINE_EXPECT(SetMenu);
77 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
78 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
79 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
80 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
81 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
82 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
83 DEFINE_EXPECT(Invoke_STATUSTEXTCHANGE);
84 DEFINE_EXPECT(Invoke_PROPERTYCHANGE);
85 DEFINE_EXPECT(Invoke_DOWNLOADBEGIN);
86 DEFINE_EXPECT(Invoke_BEFORENAVIGATE2);
87 DEFINE_EXPECT(Invoke_SETSECURELOCKICON);
88 DEFINE_EXPECT(Invoke_FILEDOWNLOAD);
89 DEFINE_EXPECT(Invoke_COMMANDSTATECHANGE);
90 DEFINE_EXPECT(Invoke_DOWNLOADCOMPLETE);
91 DEFINE_EXPECT(Invoke_ONMENUBAR);
92 DEFINE_EXPECT(Invoke_ONADDRESSBAR);
93 DEFINE_EXPECT(Invoke_ONSTATUSBAR);
94 DEFINE_EXPECT(Invoke_ONTOOLBAR);
95 DEFINE_EXPECT(Invoke_ONFULLSCREEN);
96 DEFINE_EXPECT(Invoke_ONTHEATERMODE);
97 DEFINE_EXPECT(Invoke_WINDOWSETRESIZABLE);
98 DEFINE_EXPECT(EnableModeless_TRUE);
99 DEFINE_EXPECT(EnableModeless_FALSE);
100 DEFINE_EXPECT(GetHostInfo);
101 DEFINE_EXPECT(GetOptionKeyPath);
102 DEFINE_EXPECT(GetOverridesKeyPath);
103 DEFINE_EXPECT(SetStatusText);
104 DEFINE_EXPECT(UpdateUI);
105 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
106 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
107 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
108 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
109 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
111 static const WCHAR wszItem[] = {'i','t','e','m',0};
112 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
113 static const WCHAR emptyW[] = {0};
115 static VARIANT_BOOL exvb;
116 static IWebBrowser2 *wb;
118 static HWND container_hwnd, shell_embedding_hwnd;
120 static const char *debugstr_w(LPCWSTR str)
122 static char buf[1024];
125 WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
129 static const char *debugstr_guid(REFIID riid)
133 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
134 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
135 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
136 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
141 #define test_LocationURL(a,b) _test_LocationURL(__LINE__,a,b)
142 static void _test_LocationURL(unsigned line, IUnknown *unk, LPCWSTR exurl)
145 BSTR url = (void*)0xdeadbeef;
148 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
149 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
153 hres = IWebBrowser2_get_LocationURL(wb, &url);
154 ok_(__FILE__,line) (hres == (*exurl ? S_OK : S_FALSE), "get_LocationURL failed: %08x\n", hres);
155 ok_(__FILE__,line) (!lstrcmpW(url, exurl), "unexpected URL: %s\n", debugstr_w(url));
158 IWebBrowser2_Release(wb);
161 static HRESULT QueryInterface(REFIID,void**);
163 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
164 REFIID riid, void **ppv)
166 ok(0, "unexpected call\n");
167 return E_NOINTERFACE;
170 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
175 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
180 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
181 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
183 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
184 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
185 ok(!pCmdText, "pCmdText != NULL\n");
187 switch(prgCmds[0].cmdID) {
188 case OLECMDID_SETPROGRESSTEXT:
189 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
190 prgCmds[0].cmdf = OLECMDF_ENABLED;
193 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
199 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
200 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
204 case OLECMDID_SETPROGRESSMAX:
205 CHECK_EXPECT(Exec_SETPROGRESSMAX);
206 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
207 ok(pvaIn != NULL, "pvaIn == NULL\n");
209 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
210 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
212 case OLECMDID_SETPROGRESSPOS:
213 CHECK_EXPECT(Exec_SETPROGRESSPOS);
214 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
215 ok(pvaIn != NULL, "pvaIn == NULL\n");
217 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
218 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
220 case OLECMDID_SETDOWNLOADSTATE:
221 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
222 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
223 ok(pvaIn != NULL, "pvaIn == NULL\n");
224 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
225 switch(V_I4(pvaIn)) {
227 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
230 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1);
233 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
237 ok(0, "unexpected nsCmdID %d\n", nCmdID);
239 }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
242 return E_FAIL; /* TODO */
244 return E_FAIL; /* TODO */
246 ok(0, "unexpected nCmdID %d\n", nCmdID);
249 ok(0, "unepected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
255 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
256 OleCommandTarget_QueryInterface,
257 OleCommandTarget_AddRef,
258 OleCommandTarget_Release,
259 OleCommandTarget_QueryStatus,
260 OleCommandTarget_Exec
263 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
265 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
267 if(IsEqualGUID(&IID_ITargetContainer, riid))
268 return E_NOINTERFACE; /* TODO */
270 if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
271 *ppv = &OleCommandTarget;
275 ok(0, "unexpected call\n");
276 return E_NOINTERFACE;
279 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
284 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
289 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
290 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
292 ok(0, "unexpected call\n");
296 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
297 IEnumUnknown **ppenum)
299 ok(0, "unexpected call\n");
303 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
305 ok(0, "unexpected call\n");
309 static const IOleContainerVtbl OleContainerVtbl = {
310 OleContainer_QueryInterface,
312 OleContainer_Release,
313 OleContainer_ParseDisplayName,
314 OleContainer_EnumObjects,
315 OleContainer_LockContainer
318 static IOleContainer OleContainer = { &OleContainerVtbl };
320 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
322 return QueryInterface(riid, ppv);
325 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
330 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
335 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
337 ok(0, "unexpected call\n");
341 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
344 ok(0, "unexpected call\n");
348 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
349 UINT cNames, LCID lcid, DISPID *rgDispId)
351 ok(0, "unexpected call\n");
355 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
356 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
357 EXCEPINFO *pExcepInfo, UINT *puArgErr)
359 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
360 ok(pDispParams != NULL, "pDispParams == NULL\n");
361 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
362 ok(V_VT(pVarResult) == VT_EMPTY, "V_VT(pVarResult)=%d\n", V_VT(pVarResult));
363 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
364 ok(pDispParams->rgvarg == NULL, "pDispParams->rgvarg = %p\n", pDispParams->rgvarg);
365 ok(pDispParams->rgdispidNamedArgs == NULL,
366 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
367 ok(pDispParams->cArgs == 0, "pDispParams->cArgs = %d\n", pDispParams->cArgs);
368 ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
370 switch(dispIdMember) {
371 case DISPID_AMBIENT_USERMODE:
372 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
374 case DISPID_AMBIENT_DLCONTROL:
375 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL);
376 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
378 case DISPID_AMBIENT_USERAGENT:
379 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
380 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
382 case DISPID_AMBIENT_PALETTE:
383 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
384 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
386 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
387 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
388 ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
389 V_VT(pVarResult) = VT_BOOL;
390 V_BOOL(pVarResult) = VARIANT_FALSE;
392 case DISPID_AMBIENT_SILENT:
393 CHECK_EXPECT(Invoke_AMBIENT_SILENT);
394 ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
395 V_VT(pVarResult) = VT_BOOL;
396 V_BOOL(pVarResult) = VARIANT_FALSE;
400 ok(0, "unexpected dispIdMember %d\n", dispIdMember);
404 static IDispatchVtbl DispatchVtbl = {
405 Dispatch_QueryInterface,
408 Dispatch_GetTypeInfoCount,
409 Dispatch_GetTypeInfo,
410 Dispatch_GetIDsOfNames,
414 static IDispatch Dispatch = { &DispatchVtbl };
416 static HRESULT WINAPI WebBrowserEvents2_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
420 if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) {
425 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
426 return E_NOINTERFACE;
429 #define test_invoke_bool(p,s) _test_invoke_bool(__LINE__,p,s)
430 static void _test_invoke_bool(unsigned line, const DISPPARAMS *params, BOOL strict)
432 ok_(__FILE__,line) (params->rgvarg != NULL, "rgvarg == NULL\n");
433 ok_(__FILE__,line) (params->cArgs == 1, "cArgs=%d, expected 1\n", params->cArgs);
434 ok_(__FILE__,line) (V_VT(params->rgvarg) == VT_BOOL, "V_VT(arg)=%d\n", V_VT(params->rgvarg));
436 ok_(__FILE__,line) (V_BOOL(params->rgvarg) == exvb, "V_VT(arg)=%x, expected %x\n",
437 V_BOOL(params->rgvarg), exvb);
439 ok_(__FILE__,line) (!V_BOOL(params->rgvarg) == !exvb, "V_VT(arg)=%x, expected %x\n",
440 V_BOOL(params->rgvarg), exvb);
443 static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const VARIANT *flags,
444 const VARIANT *frame, const VARIANT *post_data, const VARIANT *headers, const VARIANT *cancel)
446 ok(V_VT(disp) == VT_DISPATCH, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp));
447 ok(V_DISPATCH(disp) != NULL, "V_DISPATCH(disp) == NULL\n");
448 ok(V_DISPATCH(disp) == (IDispatch*)wb, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp), wb);
450 ok(V_VT(url) == (VT_BYREF|VT_VARIANT), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url));
451 ok(V_VARIANTREF(url) != NULL, "V_VARIANTREF(url) == NULL)\n");
452 if(V_VARIANTREF(url)) {
453 ok(V_VT(V_VARIANTREF(url)) == VT_BSTR, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
454 V_VT(V_VARIANTREF(url)));
455 ok(V_BSTR(V_VARIANTREF(url)) != NULL, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
456 ok(!lstrcmpW(V_BSTR(V_VARIANTREF(url)), about_blankW), "unexpected url %s\n",
457 debugstr_w(V_BSTR(V_VARIANTREF(url))));
460 ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
462 ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
464 ok(V_VARIANTREF(flags) != NULL, "V_VARIANTREF(flags) == NULL)\n");
465 if(V_VARIANTREF(flags)) {
466 ok(V_VT(V_VARIANTREF(flags)) == VT_I4, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
467 V_VT(V_VARIANTREF(flags)));
468 ok(V_I4(V_VARIANTREF(flags)) == 0, "V_I4(V_VARIANTREF(flags)) = %d, expected 0\n",
469 V_I4(V_VARIANTREF(flags)));
472 ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
474 ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
476 ok(V_VARIANTREF(frame) != NULL, "V_VARIANTREF(frame) == NULL)\n");
477 if(V_VARIANTREF(frame)) {
478 ok(V_VT(V_VARIANTREF(frame)) == VT_BSTR, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
479 V_VT(V_VARIANTREF(frame)));
480 ok(V_BSTR(V_VARIANTREF(frame)) == NULL, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
481 V_BSTR(V_VARIANTREF(frame)));
484 ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
486 ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
488 ok(V_VARIANTREF(post_data) != NULL, "V_VARIANTREF(post_data) == NULL)\n");
489 if(V_VARIANTREF(post_data)) {
490 ok(V_VT(V_VARIANTREF(post_data)) == (VT_VARIANT|VT_BYREF),
491 "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
492 V_VT(V_VARIANTREF(post_data)));
493 ok(V_VARIANTREF(V_VARIANTREF(post_data)) != NULL,
494 "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
495 if(V_VARIANTREF(V_VARIANTREF(post_data))) {
496 ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == VT_EMPTY,
497 "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
498 V_VT(V_VARIANTREF(V_VARIANTREF(post_data))));
500 if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == (VT_UI1|VT_ARRAY)) {
501 const SAFEARRAY *sa = V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data)));
503 ok(sa->cDims == 1, "sa->cDims = %d, expected 1\n", sa->cDims);
504 ok(sa->fFeatures == 0, "sa->fFeatures = %d, expected 0\n", sa->fFeatures);
509 ok(V_VT(headers) == (VT_BYREF|VT_VARIANT), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
511 ok(V_VARIANTREF(headers) != NULL, "V_VARIANTREF(headers) == NULL)\n");
512 if(V_VARIANTREF(headers)) {
513 ok(V_VT(V_VARIANTREF(headers)) == VT_BSTR, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
514 V_VT(V_VARIANTREF(headers)));
515 ok(V_BSTR(V_VARIANTREF(headers)) == NULL, "V_BSTR(V_VARIANTREF(heders)) = %p, expected NULL\n",
516 V_BSTR(V_VARIANTREF(headers)));
519 ok(V_VT(cancel) == (VT_BYREF|VT_BOOL), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
521 ok(V_BOOLREF(cancel) != NULL, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
522 if(V_BOOLREF(cancel))
523 ok(*V_BOOLREF(cancel) == VARIANT_FALSE, "*V_BOOLREF(calcel) = %x, expected VARIANT_FALSE\n",
527 static HRESULT WINAPI WebBrowserEvents2_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
528 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
529 EXCEPINFO *pExcepInfo, UINT *puArgErr)
531 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
532 ok(pDispParams != NULL, "pDispParams == NULL\n");
533 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
534 ok(pVarResult == NULL, "pVarResult=%p\n", pVarResult);
535 ok(wFlags == DISPATCH_METHOD, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags);
536 ok(pDispParams->rgdispidNamedArgs == NULL,
537 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
538 ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
540 switch(dispIdMember) {
541 case DISPID_STATUSTEXTCHANGE:
542 CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE);
544 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
545 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
546 ok(V_VT(pDispParams->rgvarg) == VT_BSTR, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
547 V_VT(pDispParams->rgvarg));
548 /* TODO: Check text */
551 case DISPID_PROPERTYCHANGE:
552 CHECK_EXPECT2(Invoke_PROPERTYCHANGE);
554 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
555 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
556 /* TODO: Check args */
559 case DISPID_DOWNLOADBEGIN:
560 CHECK_EXPECT(Invoke_DOWNLOADBEGIN);
562 ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
563 ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
566 case DISPID_BEFORENAVIGATE2:
567 CHECK_EXPECT(Invoke_BEFORENAVIGATE2);
569 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
570 ok(pDispParams->cArgs == 7, "cArgs=%d, expected 7\n", pDispParams->cArgs);
571 test_OnBeforeNavigate(pDispParams->rgvarg+6, pDispParams->rgvarg+5, pDispParams->rgvarg+4,
572 pDispParams->rgvarg+3, pDispParams->rgvarg+2, pDispParams->rgvarg+1,
573 pDispParams->rgvarg);
576 case DISPID_SETSECURELOCKICON:
577 CHECK_EXPECT(Invoke_SETSECURELOCKICON);
579 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
580 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
581 /* TODO: Check args */
584 case DISPID_FILEDOWNLOAD:
585 CHECK_EXPECT(Invoke_FILEDOWNLOAD);
587 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
588 ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
589 /* TODO: Check args */
592 case DISPID_COMMANDSTATECHANGE:
593 CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE);
595 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
596 ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
597 /* TODO: Check args */
600 case DISPID_DOWNLOADCOMPLETE:
601 CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE);
603 ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
604 ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
607 case DISPID_ONMENUBAR:
608 CHECK_EXPECT(Invoke_ONMENUBAR);
609 test_invoke_bool(pDispParams, TRUE);
612 case DISPID_ONADDRESSBAR:
613 CHECK_EXPECT(Invoke_ONADDRESSBAR);
614 test_invoke_bool(pDispParams, TRUE);
617 case DISPID_ONSTATUSBAR:
618 CHECK_EXPECT(Invoke_ONSTATUSBAR);
619 test_invoke_bool(pDispParams, TRUE);
622 case DISPID_ONTOOLBAR:
623 CHECK_EXPECT(Invoke_ONTOOLBAR);
624 test_invoke_bool(pDispParams, FALSE);
627 case DISPID_ONFULLSCREEN:
628 CHECK_EXPECT(Invoke_ONFULLSCREEN);
629 test_invoke_bool(pDispParams, TRUE);
632 case DISPID_ONTHEATERMODE:
633 CHECK_EXPECT(Invoke_ONTHEATERMODE);
634 test_invoke_bool(pDispParams, TRUE);
637 case DISPID_WINDOWSETRESIZABLE:
638 CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE);
639 test_invoke_bool(pDispParams, TRUE);
643 ok(0, "unexpected dispIdMember %d\n", dispIdMember);
649 static IDispatchVtbl WebBrowserEvents2Vtbl = {
650 WebBrowserEvents2_QueryInterface,
653 Dispatch_GetTypeInfoCount,
654 Dispatch_GetTypeInfo,
655 Dispatch_GetIDsOfNames,
656 WebBrowserEvents2_Invoke
659 static IDispatch WebBrowserEvents2 = { &WebBrowserEvents2Vtbl };
661 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
663 return QueryInterface(riid, ppv);
666 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
671 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
676 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
678 ok(0, "unexpected call\n");
682 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
685 ok(0, "unexpected call\n");
689 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
691 CHECK_EXPECT(GetContainer);
693 ok(ppContainer != NULL, "ppContainer == NULL\n");
695 *ppContainer = &OleContainer;
700 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
702 CHECK_EXPECT(ShowObject);
706 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
708 ok(0, "unexpected call\n");
712 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
714 ok(0, "unexpected call\n");
718 static const IOleClientSiteVtbl ClientSiteVtbl = {
719 ClientSite_QueryInterface,
722 ClientSite_SaveObject,
723 ClientSite_GetMoniker,
724 ClientSite_GetContainer,
725 ClientSite_ShowObject,
726 ClientSite_OnShowWindow,
727 ClientSite_RequestNewObjectLayout
730 static IOleClientSite ClientSite = { &ClientSiteVtbl };
732 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceFrame *iface,
733 REFIID riid, void **ppv)
735 ok(0, "unexpected call\n");
736 return E_NOINTERFACE;
739 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceFrame *iface)
744 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceFrame *iface)
749 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
751 ok(0, "unexpected call\n");
755 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
757 CHECK_EXPECT(Frame_GetWindow);
758 ok(phwnd != NULL, "phwnd == NULL\n");
760 *phwnd = container_hwnd;
764 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
766 ok(0, "unexpected call\n");
770 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
772 ok(0, "unexpected call\n");
776 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame *iface,
777 LPCBORDERWIDTHS pborderwidths)
779 ok(0, "unexpected call\n");
783 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame *iface,
784 LPCBORDERWIDTHS pborderwidths)
786 ok(0, "unexpected call\n");
790 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
791 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
793 CHECK_EXPECT(UIWindow_SetActiveObject);
794 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
795 ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
799 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
800 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
802 CHECK_EXPECT(Frame_SetActiveObject);
803 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
804 ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
808 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
809 LPOLEMENUGROUPWIDTHS lpMenuWidths)
811 ok(0, "unexpected call\n");
815 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
816 HOLEMENU holemenu, HWND hwndActiveObject)
818 CHECK_EXPECT(SetMenu);
819 ok(hmenuShared == NULL, "hmenuShared=%p\n", hmenuShared);
820 ok(holemenu == NULL, "holemenu=%p\n", holemenu);
821 ok(hwndActiveObject == shell_embedding_hwnd, "hwndActiveObject=%p, expected %p\n",
822 hwndActiveObject, shell_embedding_hwnd);
826 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
828 ok(0, "unexpected call\n");
832 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
834 CHECK_EXPECT2(SetStatusText);
835 /* FIXME: Check pszStatusText */
839 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
842 CHECK_EXPECT(EnableModeless_TRUE);
844 CHECK_EXPECT(EnableModeless_FALSE);
848 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
850 ok(0, "unexpected call\n");
854 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
855 InPlaceUIWindow_QueryInterface,
856 InPlaceUIWindow_AddRef,
857 InPlaceUIWindow_Release,
858 InPlaceUIWindow_GetWindow,
859 InPlaceUIWindow_ContextSensitiveHelp,
860 InPlaceUIWindow_GetBorder,
861 InPlaceUIWindow_RequestBorderSpace,
862 InPlaceUIWindow_SetBorderSpace,
863 InPlaceUIWindow_SetActiveObject,
866 static IOleInPlaceUIWindow InPlaceUIWindow = { (IOleInPlaceUIWindowVtbl*)&InPlaceUIWindowVtbl };
868 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
869 InPlaceUIWindow_QueryInterface,
870 InPlaceUIWindow_AddRef,
871 InPlaceUIWindow_Release,
872 InPlaceFrame_GetWindow,
873 InPlaceUIWindow_ContextSensitiveHelp,
874 InPlaceUIWindow_GetBorder,
875 InPlaceUIWindow_RequestBorderSpace,
876 InPlaceUIWindow_SetBorderSpace,
877 InPlaceFrame_SetActiveObject,
878 InPlaceFrame_InsertMenus,
879 InPlaceFrame_SetMenu,
880 InPlaceFrame_RemoveMenus,
881 InPlaceFrame_SetStatusText,
882 InPlaceFrame_EnableModeless,
883 InPlaceFrame_TranslateAccelerator
886 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
888 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
890 return QueryInterface(riid, ppv);
893 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
898 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
903 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
905 CHECK_EXPECT(Site_GetWindow);
906 ok(phwnd != NULL, "phwnd == NULL\n");
908 *phwnd = container_hwnd;
912 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
914 ok(0, "unexpected call\n");
918 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
920 CHECK_EXPECT(CanInPlaceActivate);
924 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
926 CHECK_EXPECT(OnInPlaceActivate);
930 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
932 CHECK_EXPECT(OnUIActivate);
936 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
937 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
938 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
940 static const RECT pos_rect = {2,1,1002,901};
941 static const RECT clip_rect = {10,10,990,890};
943 CHECK_EXPECT(GetWindowContext);
945 ok(ppFrame != NULL, "ppFrame = NULL\n");
947 *ppFrame = &InPlaceFrame;
949 ok(ppDoc != NULL, "ppDoc = NULL\n");
951 *ppDoc = &InPlaceUIWindow;
953 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
955 memcpy(lprcPosRect, &pos_rect, sizeof(RECT));
957 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
959 memcpy(lprcClipRect, &clip_rect, sizeof(RECT));
961 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
963 lpFrameInfo->cb = sizeof(*lpFrameInfo);
964 lpFrameInfo->fMDIApp = FALSE;
965 lpFrameInfo->hwndFrame = container_hwnd;
966 lpFrameInfo->haccel = NULL;
967 lpFrameInfo->cAccelEntries = 0;
973 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtant)
975 ok(0, "unexpected call\n");
979 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
981 ok(0, "unexpected call\n");
985 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
987 ok(0, "unexpected call\n");
991 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
993 ok(0, "unexpected call\n");
997 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
999 ok(0, "unexpected call\n");
1003 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface, LPCRECT lprcPosRect)
1005 ok(0, "unexpected call\n");
1009 static HRESULT WINAPI InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface,
1010 BOOL *pNoRedraw, DWORD dwFlags)
1012 ok(0, "unexpected call\n");
1016 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface,
1019 ok(0, "unexpected call\n");
1023 static HRESULT WINAPI InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx *iface)
1025 ok(0, "unexpected call\n");
1029 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl = {
1030 InPlaceSite_QueryInterface,
1032 InPlaceSite_Release,
1033 InPlaceSite_GetWindow,
1034 InPlaceSite_ContextSensitiveHelp,
1035 InPlaceSite_CanInPlaceActivate,
1036 InPlaceSite_OnInPlaceActivate,
1037 InPlaceSite_OnUIActivate,
1038 InPlaceSite_GetWindowContext,
1040 InPlaceSite_OnUIDeactivate,
1041 InPlaceSite_OnInPlaceDeactivate,
1042 InPlaceSite_DiscardUndoState,
1043 InPlaceSite_DeactivateAndUndo,
1044 InPlaceSite_OnPosRectChange,
1045 InPlaceSite_OnInPlaceActivateEx,
1046 InPlaceSite_OnInPlaceDeactivateEx,
1047 InPlaceSite_RequestUIActivate
1050 static IOleInPlaceSiteEx InPlaceSite = { &InPlaceSiteExVtbl };
1052 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
1054 return QueryInterface(riid, ppv);
1057 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
1062 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
1067 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
1068 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
1070 ok(0, "unexpected call %d %p %p %p\n", dwID, ppt, pcmdtReserved, pdicpReserved);
1074 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
1076 CHECK_EXPECT(GetHostInfo);
1077 ok(pInfo != NULL, "pInfo=NULL\n");
1079 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
1080 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
1081 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
1082 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
1083 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
1088 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
1089 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
1090 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
1092 ok(0, "unexpected call\n");
1096 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
1098 ok(0, "unexpected call\n");
1102 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
1104 CHECK_EXPECT(UpdateUI);
1108 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
1110 ok(0, "unexpected call\n");
1114 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1116 ok(0, "unexpected call\n");
1120 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1122 ok(0, "unexpected call\n");
1126 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
1127 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
1129 ok(0, "unexpected call\n");
1133 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
1134 const GUID *pguidCmdGroup, DWORD nCmdID)
1136 ok(0, "unexpected call\n");
1140 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
1141 LPOLESTR *pchKey, DWORD dw)
1143 CHECK_EXPECT(GetOptionKeyPath);
1144 ok(pchKey != NULL, "pchKey==NULL\n");
1146 ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1147 ok(!dw, "dw=%x\n", dw);
1151 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
1152 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
1154 ok(0, "unexpected call\n");
1158 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
1160 ok(0, "unexpected call\n");
1164 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
1165 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
1167 ok(0, "unexpected call\n");
1171 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
1172 IDataObject **ppPORet)
1174 ok(0, "unexpected call\n");
1178 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
1179 LPOLESTR *pchKey, DWORD dw)
1181 CHECK_EXPECT(GetOverridesKeyPath);
1182 ok(pchKey != NULL, "pchKey==NULL\n");
1184 ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1185 ok(!dw, "dw=%x\n", dw);
1189 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
1190 DocHostUIHandler_QueryInterface,
1191 DocHostUIHandler_AddRef,
1192 DocHostUIHandler_Release,
1193 DocHostUIHandler_ShowContextMenu,
1194 DocHostUIHandler_GetHostInfo,
1195 DocHostUIHandler_ShowUI,
1196 DocHostUIHandler_HideUI,
1197 DocHostUIHandler_UpdateUI,
1198 DocHostUIHandler_EnableModeless,
1199 DocHostUIHandler_OnDocWindowActivate,
1200 DocHostUIHandler_OnFrameWindowActivate,
1201 DocHostUIHandler_ResizeBorder,
1202 DocHostUIHandler_TranslateAccelerator,
1203 DocHostUIHandler_GetOptionKeyPath,
1204 DocHostUIHandler_GetDropTarget,
1205 DocHostUIHandler_GetExternal,
1206 DocHostUIHandler_TranslateUrl,
1207 DocHostUIHandler_FilterDataObject,
1208 DocHostUIHandler_GetOverrideKeyPath
1211 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
1213 static HRESULT QueryInterface(REFIID riid, void **ppv)
1217 if(IsEqualGUID(&IID_IUnknown, riid)
1218 || IsEqualGUID(&IID_IOleClientSite, riid))
1220 else if(IsEqualGUID(&IID_IOleWindow, riid)
1221 || IsEqualGUID(&IID_IOleInPlaceSite, riid)
1222 || IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
1223 *ppv = &InPlaceSite;
1224 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)
1225 || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
1226 *ppv = &DocHostUIHandler;
1227 else if(IsEqualGUID(&IID_IDispatch, riid))
1233 return E_NOINTERFACE;
1236 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1238 return DefWindowProcW(hwnd, msg, wParam, lParam);
1241 static HWND create_container_window(void)
1243 static const WCHAR wszWebBrowserContainer[] =
1244 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1245 static WNDCLASSEXW wndclass = {
1246 sizeof(WNDCLASSEXW),
1249 0, 0, NULL, NULL, NULL, NULL, NULL,
1250 wszWebBrowserContainer,
1254 RegisterClassExW(&wndclass);
1255 return CreateWindowW(wszWebBrowserContainer, wszWebBrowserContainer,
1256 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
1257 CW_USEDEFAULT, NULL, NULL, NULL, NULL);
1260 static void test_DoVerb(IUnknown *unk)
1263 RECT rect = {0,0,1000,1000};
1266 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1267 ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1271 SET_EXPECT(CanInPlaceActivate);
1272 SET_EXPECT(Site_GetWindow);
1273 SET_EXPECT(OnInPlaceActivate);
1274 SET_EXPECT(GetWindowContext);
1275 SET_EXPECT(ShowObject);
1276 SET_EXPECT(GetContainer);
1277 SET_EXPECT(Frame_GetWindow);
1278 SET_EXPECT(OnUIActivate);
1279 SET_EXPECT(Frame_SetActiveObject);
1280 SET_EXPECT(UIWindow_SetActiveObject);
1281 SET_EXPECT(SetMenu);
1283 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1284 0, (HWND)0xdeadbeef, &rect);
1285 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1287 CHECK_CALLED(CanInPlaceActivate);
1288 CHECK_CALLED(Site_GetWindow);
1289 CHECK_CALLED(OnInPlaceActivate);
1290 CHECK_CALLED(GetWindowContext);
1291 CHECK_CALLED(ShowObject);
1292 CHECK_CALLED(GetContainer);
1293 CHECK_CALLED(Frame_GetWindow);
1294 CHECK_CALLED(OnUIActivate);
1295 CHECK_CALLED(Frame_SetActiveObject);
1296 CHECK_CALLED(UIWindow_SetActiveObject);
1297 CHECK_CALLED(SetMenu);
1299 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1300 0, (HWND)0xdeadbeef, &rect);
1301 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1303 IOleObject_Release(oleobj);
1306 static void test_GetMiscStatus(IOleObject *oleobj)
1311 for(i=0; i<10; i++) {
1313 hres = IOleObject_GetMiscStatus(oleobj, i, &st);
1314 ok(hres == S_OK, "GetMiscStatus failed: %08x\n", hres);
1315 ok(st == (OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
1316 |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE),
1317 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1318 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st);
1322 static void test_SetHostNames(IOleObject *oleobj)
1326 static const WCHAR test_appW[] = {'t','e','s','t',' ','a','p','p',0};
1328 hres = IOleObject_SetHostNames(oleobj, test_appW, (void*)0xdeadbeef);
1329 ok(hres == S_OK, "SetHostNames failed: %08x\n", hres);
1332 static void test_ClientSite(IUnknown *unk, IOleClientSite *client)
1335 IOleInPlaceObject *inplace;
1339 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1340 ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1344 test_GetMiscStatus(oleobj);
1345 test_SetHostNames(oleobj);
1347 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObject, (void**)&inplace);
1348 ok(hres == S_OK, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres);
1350 IOleObject_Release(oleobj);
1354 hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1355 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1356 ok((hwnd == NULL) ^ (client == NULL), "unexpected hwnd %p\n", hwnd);
1359 SET_EXPECT(GetContainer);
1360 SET_EXPECT(Site_GetWindow);
1361 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1362 SET_EXPECT(Invoke_AMBIENT_SILENT);
1364 SET_EXPECT(Invoke_DOWNLOADCOMPLETE);
1365 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1366 SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1369 hres = IOleObject_SetClientSite(oleobj, client);
1370 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
1373 CHECK_CALLED(GetContainer);
1374 CHECK_CALLED(Site_GetWindow);
1375 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1376 CHECK_CALLED(Invoke_AMBIENT_SILENT);
1378 todo_wine CHECK_CALLED(Invoke_DOWNLOADCOMPLETE);
1379 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1380 todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1383 hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1384 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1385 ok((hwnd == NULL) == (client == NULL), "unexpected hwnd %p\n", hwnd);
1387 shell_embedding_hwnd = hwnd;
1389 test_SetHostNames(oleobj);
1391 IOleInPlaceObject_Release(inplace);
1392 IOleObject_Release(oleobj);
1395 static void test_ClassInfo(IUnknown *unk)
1397 IProvideClassInfo2 *class_info;
1401 hres = IUnknown_QueryInterface(unk, &IID_IProvideClassInfo2, (void**)&class_info);
1402 ok(hres == S_OK, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres);
1406 hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid);
1407 ok(hres == S_OK, "GetGUID failed: %08x\n", hres);
1408 ok(IsEqualGUID(&DIID_DWebBrowserEvents2, &guid), "wrong guid\n");
1410 hres = IProvideClassInfo2_GetGUID(class_info, 0, &guid);
1411 ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1412 ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1414 hres = IProvideClassInfo2_GetGUID(class_info, 2, &guid);
1415 ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1416 ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1418 hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, NULL);
1419 ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1421 hres = IProvideClassInfo2_GetGUID(class_info, 0, NULL);
1422 ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1424 IProvideClassInfo2_Release(class_info);
1427 static void test_ie_funcs(IUnknown *unk)
1436 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1437 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1444 hres = IWebBrowser2_get_HWND(wb, &hwnd);
1445 ok(hres == E_FAIL, "get_HWND failed: %08x, expected E_FAIL\n", hres);
1446 ok(hwnd == 0, "unexpected hwnd %lx\n", hwnd);
1450 hres = IWebBrowser2_get_MenuBar(wb, &b);
1451 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1452 ok(b == VARIANT_TRUE, "b=%x\n", b);
1454 SET_EXPECT(Invoke_ONMENUBAR);
1455 hres = IWebBrowser2_put_MenuBar(wb, (exvb = VARIANT_FALSE));
1456 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1457 CHECK_CALLED(Invoke_ONMENUBAR);
1459 hres = IWebBrowser2_get_MenuBar(wb, &b);
1460 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1461 ok(b == VARIANT_FALSE, "b=%x\n", b);
1463 SET_EXPECT(Invoke_ONMENUBAR);
1464 hres = IWebBrowser2_put_MenuBar(wb, (exvb = 100));
1465 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1466 CHECK_CALLED(Invoke_ONMENUBAR);
1468 hres = IWebBrowser2_get_MenuBar(wb, &b);
1469 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1470 ok(b == VARIANT_TRUE, "b=%x\n", b);
1474 hres = IWebBrowser2_get_AddressBar(wb, &b);
1475 ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1476 ok(b == VARIANT_TRUE, "b=%x\n", b);
1478 SET_EXPECT(Invoke_ONADDRESSBAR);
1479 hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_FALSE));
1480 ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1481 CHECK_CALLED(Invoke_ONADDRESSBAR);
1483 hres = IWebBrowser2_get_AddressBar(wb, &b);
1484 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1485 ok(b == VARIANT_FALSE, "b=%x\n", b);
1487 SET_EXPECT(Invoke_ONADDRESSBAR);
1488 hres = IWebBrowser2_put_AddressBar(wb, (exvb = 100));
1489 ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1490 CHECK_CALLED(Invoke_ONADDRESSBAR);
1492 hres = IWebBrowser2_get_AddressBar(wb, &b);
1493 ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1494 ok(b == VARIANT_TRUE, "b=%x\n", b);
1496 SET_EXPECT(Invoke_ONADDRESSBAR);
1497 hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_TRUE));
1498 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1499 CHECK_CALLED(Invoke_ONADDRESSBAR);
1503 hres = IWebBrowser2_get_StatusBar(wb, &b);
1504 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1505 ok(b == VARIANT_TRUE, "b=%x\n", b);
1507 SET_EXPECT(Invoke_ONSTATUSBAR);
1508 hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_TRUE));
1509 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1510 CHECK_CALLED(Invoke_ONSTATUSBAR);
1512 hres = IWebBrowser2_get_StatusBar(wb, &b);
1513 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1514 ok(b == VARIANT_TRUE, "b=%x\n", b);
1516 SET_EXPECT(Invoke_ONSTATUSBAR);
1517 hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_FALSE));
1518 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1519 CHECK_CALLED(Invoke_ONSTATUSBAR);
1521 hres = IWebBrowser2_get_StatusBar(wb, &b);
1522 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1523 ok(b == VARIANT_FALSE, "b=%x\n", b);
1525 SET_EXPECT(Invoke_ONSTATUSBAR);
1526 hres = IWebBrowser2_put_StatusBar(wb, (exvb = 100));
1527 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1528 CHECK_CALLED(Invoke_ONSTATUSBAR);
1530 hres = IWebBrowser2_get_StatusBar(wb, &b);
1531 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1532 ok(b == VARIANT_TRUE, "b=%x\n", b);
1536 hres = IWebBrowser2_get_ToolBar(wb, &i);
1537 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1540 SET_EXPECT(Invoke_ONTOOLBAR);
1541 hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_FALSE));
1542 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1543 CHECK_CALLED(Invoke_ONTOOLBAR);
1545 hres = IWebBrowser2_get_ToolBar(wb, &i);
1546 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1547 ok(i == VARIANT_FALSE, "b=%x\n", i);
1549 SET_EXPECT(Invoke_ONTOOLBAR);
1550 hres = IWebBrowser2_put_ToolBar(wb, (exvb = 100));
1551 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1552 CHECK_CALLED(Invoke_ONTOOLBAR);
1554 hres = IWebBrowser2_get_ToolBar(wb, &i);
1555 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1558 SET_EXPECT(Invoke_ONTOOLBAR);
1559 hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_TRUE));
1560 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1561 CHECK_CALLED(Invoke_ONTOOLBAR);
1565 hres = IWebBrowser2_get_FullScreen(wb, &b);
1566 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1567 ok(b == VARIANT_FALSE, "b=%x\n", b);
1569 SET_EXPECT(Invoke_ONFULLSCREEN);
1570 hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_TRUE));
1571 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1572 CHECK_CALLED(Invoke_ONFULLSCREEN);
1574 hres = IWebBrowser2_get_FullScreen(wb, &b);
1575 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1576 ok(b == VARIANT_TRUE, "b=%x\n", b);
1578 SET_EXPECT(Invoke_ONFULLSCREEN);
1579 hres = IWebBrowser2_put_FullScreen(wb, (exvb = 100));
1580 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1581 CHECK_CALLED(Invoke_ONFULLSCREEN);
1583 hres = IWebBrowser2_get_FullScreen(wb, &b);
1584 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1585 ok(b == VARIANT_TRUE, "b=%x\n", b);
1587 SET_EXPECT(Invoke_ONFULLSCREEN);
1588 hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_FALSE));
1589 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1590 CHECK_CALLED(Invoke_ONFULLSCREEN);
1594 hres = IWebBrowser2_get_TheaterMode(wb, &b);
1595 ok(hres == S_OK, "get_TheaterMode failed: %08x\n", hres);
1596 ok(b == VARIANT_FALSE, "b=%x\n", b);
1598 SET_EXPECT(Invoke_ONTHEATERMODE);
1599 hres = IWebBrowser2_put_TheaterMode(wb, (exvb = VARIANT_TRUE));
1600 ok(hres == S_OK, "put_TheaterMode failed: %08x\n", hres);
1601 CHECK_CALLED(Invoke_ONTHEATERMODE);
1603 hres = IWebBrowser2_get_TheaterMode(wb, &b);
1604 ok(hres == S_OK, "get_TheaterMode failed: %08x\n", hres);
1605 ok(b == VARIANT_TRUE, "b=%x\n", b);
1607 SET_EXPECT(Invoke_ONTHEATERMODE);
1608 hres = IWebBrowser2_put_TheaterMode(wb, (exvb = 100));
1609 ok(hres == S_OK, "put_TheaterMode failed: %08x\n", hres);
1610 CHECK_CALLED(Invoke_ONTHEATERMODE);
1612 hres = IWebBrowser2_get_TheaterMode(wb, &b);
1613 ok(hres == S_OK, "get_TheaterMode failed: %08x\n", hres);
1614 ok(b == VARIANT_TRUE, "b=%x\n", b);
1616 SET_EXPECT(Invoke_ONTHEATERMODE);
1617 hres = IWebBrowser2_put_TheaterMode(wb, (exvb = VARIANT_FALSE));
1618 ok(hres == S_OK, "put_TheaterMode failed: %08x\n", hres);
1619 CHECK_CALLED(Invoke_ONTHEATERMODE);
1624 hres = IWebBrowser2_get_Resizable(wb, &b);
1625 ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1626 ok(b == 0x100, "b=%x\n", b);
1628 SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1629 hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_TRUE));
1630 ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1631 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1633 SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1634 hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_FALSE));
1635 ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1636 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1638 hres = IWebBrowser2_get_Resizable(wb, &b);
1639 ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1640 ok(b == 0x100, "b=%x\n", b);
1645 hres = IWebBrowser2_get_Application(wb, &disp);
1646 ok(hres == S_OK, "get_Application failed: %08x\n", hres);
1647 ok(disp == (void*)wb, "disp=%p, expected %p\n", disp, wb);
1649 IDispatch_Release(disp);
1651 hres = IWebBrowser2_get_Application(wb, NULL);
1652 ok(hres == E_POINTER, "get_Application failed: %08x, expected E_POINTER\n", hres);
1656 hres = IWebBrowser2_Quit(wb);
1657 ok(hres == E_FAIL, "Quit failed: %08x, expected E_FAIL\n", hres);
1659 IWebBrowser2_Release(wb);
1662 static void test_Silent(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1668 hres = IWebBrowser2_get_Silent(wb, &b);
1669 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1670 ok(b == VARIANT_FALSE, "b=%x\n", b);
1672 hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1673 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1676 hres = IWebBrowser2_get_Silent(wb, &b);
1677 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1678 ok(b == VARIANT_TRUE, "b=%x\n", b);
1680 hres = IWebBrowser2_put_Silent(wb, 100);
1681 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1684 hres = IWebBrowser2_get_Silent(wb, &b);
1685 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1686 ok(b == VARIANT_TRUE, "b=%x\n", b);
1688 hres = IWebBrowser2_put_Silent(wb, VARIANT_FALSE);
1689 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1692 hres = IWebBrowser2_get_Silent(wb, &b);
1693 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1694 ok(b == VARIANT_FALSE, "b=%x\n", b);
1697 hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1698 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1700 SET_EXPECT(Invoke_AMBIENT_SILENT);
1703 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
1704 ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1707 CHECK_CALLED(Invoke_AMBIENT_SILENT);
1710 hres = IWebBrowser2_get_Silent(wb, &b);
1711 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1712 ok(b == VARIANT_FALSE, "b=%x\n", b);
1715 static void test_Offline(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1721 hres = IWebBrowser2_get_Offline(wb, &b);
1722 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1723 ok(b == VARIANT_FALSE, "b=%x\n", b);
1725 hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1726 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1729 hres = IWebBrowser2_get_Offline(wb, &b);
1730 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1731 ok(b == VARIANT_TRUE, "b=%x\n", b);
1733 hres = IWebBrowser2_put_Offline(wb, 100);
1734 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1737 hres = IWebBrowser2_get_Offline(wb, &b);
1738 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1739 ok(b == VARIANT_TRUE, "b=%x\n", b);
1741 hres = IWebBrowser2_put_Offline(wb, VARIANT_FALSE);
1742 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1745 hres = IWebBrowser2_get_Offline(wb, &b);
1746 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1747 ok(b == VARIANT_FALSE, "b=%x\n", b);
1750 hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1751 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1753 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1756 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
1757 ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1760 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1763 hres = IWebBrowser2_get_Offline(wb, &b);
1764 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1765 ok(b == VARIANT_FALSE, "b=%x\n", b);
1768 static void test_wb_funcs(IUnknown *unk, BOOL is_clientsite)
1771 IOleControl *control;
1774 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1775 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1777 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1778 ok(hres == S_OK, "Could not get IOleControl interface: %08x\n", hres);
1780 test_Silent(wb, control, is_clientsite);
1781 test_Offline(wb, control, is_clientsite);
1783 IWebBrowser_Release(wb);
1784 IOleControl_Release(control);
1787 static void test_GetControlInfo(IUnknown *unk)
1789 IOleControl *control;
1793 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1794 ok(hres == S_OK, "Could not get IOleControl: %08x\n", hres);
1798 hres = IOleControl_GetControlInfo(control, &info);
1799 ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1800 hres = IOleControl_GetControlInfo(control, NULL);
1801 ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1803 IOleControl_Release(control);
1806 static void test_Extent(IUnknown *unk)
1812 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1813 ok(hres == S_OK, "Could not get IOleObkect: %08x\n", hres);
1817 size.cx = size.cy = 0xdeadbeef;
1818 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1819 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1820 ok(size.cx == 1323 && size.cy == 529, "size = {%d %d}\n", size.cx, size.cy);
1824 hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &size);
1825 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1827 size.cx = size.cy = 0xdeadbeef;
1828 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1829 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1830 ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1832 size.cx = size.cy = 0xdeadbeef;
1833 hres = IOleObject_GetExtent(oleobj, 0, &size);
1834 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1835 ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1839 hres = IOleObject_SetExtent(oleobj, 0, &size);
1840 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1842 size.cx = size.cy = 0xdeadbeef;
1843 hres = IOleObject_GetExtent(oleobj, 0, &size);
1844 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1845 ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1847 size.cx = size.cy = 0xdeadbeef;
1848 hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1849 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1850 ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1854 hres = IOleObject_SetExtent(oleobj, 0xdeadbeef, &size);
1855 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1857 size.cx = size.cy = 0xdeadbeef;
1858 hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1859 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1860 ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1862 size.cx = size.cy = 0xdeadbeef;
1863 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1864 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1865 ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1867 IOleObject_Release(oleobj);
1870 static void test_ConnectionPoint(IUnknown *unk, BOOL init)
1872 IConnectionPointContainer *container;
1873 IConnectionPoint *point;
1876 static DWORD dw = 100;
1878 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
1879 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
1883 hres = IConnectionPointContainer_FindConnectionPoint(container, &DIID_DWebBrowserEvents2, &point);
1884 IConnectionPointContainer_Release(container);
1885 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
1890 hres = IConnectionPoint_Advise(point, (IUnknown*)&WebBrowserEvents2, &dw);
1891 ok(hres == S_OK, "Advise failed: %08x\n", hres);
1892 ok(dw == 1, "dw=%d, expected 1\n", dw);
1894 hres = IConnectionPoint_Unadvise(point, dw);
1895 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
1898 IConnectionPoint_Release(point);
1901 static void test_Navigate2(IUnknown *unk)
1903 IWebBrowser2 *webbrowser;
1907 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&webbrowser);
1908 ok(hres == S_OK, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres);
1912 test_LocationURL(unk, emptyW);
1914 V_VT(&url) = VT_BSTR;
1915 V_BSTR(&url) = SysAllocString(about_blankW);
1917 SET_EXPECT(Invoke_AMBIENT_USERMODE);
1918 SET_EXPECT(Invoke_PROPERTYCHANGE);
1919 SET_EXPECT(Invoke_BEFORENAVIGATE2);
1920 SET_EXPECT(Invoke_DOWNLOADBEGIN);
1921 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
1922 SET_EXPECT(EnableModeless_FALSE);
1923 SET_EXPECT(Invoke_STATUSTEXTCHANGE);
1924 SET_EXPECT(SetStatusText);
1925 SET_EXPECT(GetHostInfo);
1926 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
1927 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
1928 SET_EXPECT(Invoke_AMBIENT_PALETTE);
1929 SET_EXPECT(GetOptionKeyPath);
1930 SET_EXPECT(GetOverridesKeyPath);
1931 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
1932 SET_EXPECT(Exec_SETPROGRESSMAX);
1933 SET_EXPECT(Exec_SETPROGRESSPOS);
1934 SET_EXPECT(Invoke_SETSECURELOCKICON);
1935 SET_EXPECT(Invoke_FILEDOWNLOAD);
1936 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1937 SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1938 SET_EXPECT(EnableModeless_TRUE);
1940 hres = IWebBrowser2_Navigate2(webbrowser, &url, NULL, NULL, NULL, NULL);
1941 ok(hres == S_OK, "Navigate2 failed: %08x\n", hres);
1943 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
1944 todo_wine CHECK_CALLED(Invoke_PROPERTYCHANGE);
1945 CHECK_CALLED(Invoke_BEFORENAVIGATE2);
1946 todo_wine CHECK_CALLED(Invoke_DOWNLOADBEGIN);
1947 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
1948 CHECK_CALLED(EnableModeless_FALSE);
1949 CHECK_CALLED(Invoke_STATUSTEXTCHANGE);
1950 CHECK_CALLED(SetStatusText);
1951 CHECK_CALLED(GetHostInfo);
1952 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
1953 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
1954 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
1955 CHECK_CALLED(GetOptionKeyPath);
1956 CHECK_CALLED(GetOverridesKeyPath);
1957 todo_wine CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
1958 todo_wine CHECK_CALLED(Exec_SETPROGRESSMAX);
1959 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
1960 todo_wine CHECK_CALLED(Invoke_SETSECURELOCKICON);
1961 todo_wine CHECK_CALLED(Invoke_FILEDOWNLOAD);
1962 todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1963 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1964 CHECK_CALLED(EnableModeless_TRUE);
1967 IWebBrowser2_Release(webbrowser);
1970 static void test_QueryInterface(IUnknown *unk)
1972 IQuickActivate *qa = (IQuickActivate*)0xdeadbeef;
1973 IRunnableObject *runnable = (IRunnableObject*)0xdeadbeef;
1974 IPerPropertyBrowsing *propbrowse = (void*)0xdeadbeef;
1975 IOleInPlaceSite *inplace = (void*)0xdeadbeef;
1976 IOleCache *cache = (void*)0xdeadbeef;
1977 IObjectWithSite *site = (void*)0xdeadbeef;
1980 hres = IUnknown_QueryInterface(unk, &IID_IQuickActivate, (void**)&qa);
1981 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1982 ok(qa == NULL, "qa=%p, ezpected NULL\n", qa);
1984 hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&runnable);
1985 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1986 ok(runnable == NULL, "runnable=%p, ezpected NULL\n", runnable);
1988 hres = IUnknown_QueryInterface(unk, &IID_IPerPropertyBrowsing, (void**)&propbrowse);
1989 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1990 ok(propbrowse == NULL, "propbrowse=%p, ezpected NULL\n", runnable);
1992 hres = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&cache);
1993 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1994 ok(cache == NULL, "cache=%p, ezpected NULL\n", runnable);
1996 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceSite, (void**)&inplace);
1997 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1998 ok(inplace == NULL, "inplace=%p, ezpected NULL\n", runnable);
2000 hres = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void**)&site);
2001 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
2002 ok(site == NULL, "inplace=%p, ezpected NULL\n", runnable);
2005 static void test_WebBrowser(void)
2007 IUnknown *unk = NULL;
2011 hres = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
2012 &IID_IUnknown, (void**)&unk);
2013 ok(hres == S_OK, "CoCreateInterface failed: %08x\n", hres);
2017 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
2018 ok(hres == S_OK, "Could not get IWebBrowser2 iface: %08x\n", hres);
2020 test_QueryInterface(unk);
2021 test_ClassInfo(unk);
2022 test_LocationURL(unk, emptyW);
2023 test_ConnectionPoint(unk, TRUE);
2024 test_ClientSite(unk, &ClientSite);
2026 test_wb_funcs(unk, TRUE);
2028 test_Navigate2(unk);
2029 test_ClientSite(unk, NULL);
2031 test_GetControlInfo(unk);
2032 test_wb_funcs(unk, FALSE);
2033 test_ConnectionPoint(unk, FALSE);
2035 IWebBrowser2_Release(wb);
2036 ref = IUnknown_Release(unk);
2037 ok(ref == 0, "ref=%d, expected 0\n", ref);
2040 static void gecko_installer_workaround(BOOL disable)
2045 static BOOL has_url = FALSE;
2046 static char url[2048];
2048 if(!disable && !has_url)
2051 res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
2052 if(res != ERROR_SUCCESS)
2056 DWORD type, size = sizeof(url);
2058 res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
2059 if(res == ERROR_SUCCESS && type == REG_SZ)
2062 RegDeleteValue(hkey, "GeckoUrl");
2064 RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
2070 START_TEST(webbrowser)
2072 gecko_installer_workaround(TRUE);
2074 container_hwnd = create_container_window();
2076 OleInitialize(NULL);
2082 gecko_installer_workaround(FALSE);