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>
38 #define DEFINE_EXPECT(func) \
39 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
41 #define SET_EXPECT(func) \
42 expect_ ## func = TRUE
44 #define CHECK_EXPECT2(func) \
46 ok(expect_ ##func, "unexpected call " #func "\n"); \
47 called_ ## func = TRUE; \
50 #define CHECK_EXPECT(func) \
52 CHECK_EXPECT2(func); \
53 expect_ ## func = FALSE; \
56 #define CHECK_CALLED(func) \
58 ok(called_ ## func, "expected " #func "\n"); \
59 expect_ ## func = called_ ## func = FALSE; \
62 DEFINE_EXPECT(GetContainer);
63 DEFINE_EXPECT(Site_GetWindow);
64 DEFINE_EXPECT(ShowObject);
65 DEFINE_EXPECT(CanInPlaceActivate);
66 DEFINE_EXPECT(OnInPlaceActivate);
67 DEFINE_EXPECT(OnUIActivate);
68 DEFINE_EXPECT(GetWindowContext);
69 DEFINE_EXPECT(Frame_GetWindow);
70 DEFINE_EXPECT(Frame_SetActiveObject);
71 DEFINE_EXPECT(UIWindow_SetActiveObject);
72 DEFINE_EXPECT(SetMenu);
73 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
74 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
75 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
76 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
77 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
78 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
79 DEFINE_EXPECT(Invoke_STATUSTEXTCHANGE);
80 DEFINE_EXPECT(Invoke_PROPERTYCHANGE);
81 DEFINE_EXPECT(Invoke_DOWNLOADBEGIN);
82 DEFINE_EXPECT(Invoke_BEFORENAVIGATE2);
83 DEFINE_EXPECT(Invoke_SETSECURELOCKICON);
84 DEFINE_EXPECT(Invoke_FILEDOWNLOAD);
85 DEFINE_EXPECT(Invoke_COMMANDSTATECHANGE);
86 DEFINE_EXPECT(Invoke_DOWNLOADCOMPLETE);
87 DEFINE_EXPECT(Invoke_ONMENUBAR);
88 DEFINE_EXPECT(Invoke_ONADDRESSBAR);
89 DEFINE_EXPECT(Invoke_ONSTATUSBAR);
90 DEFINE_EXPECT(Invoke_ONTOOLBAR);
91 DEFINE_EXPECT(Invoke_ONFULLSCREEN);
92 DEFINE_EXPECT(Invoke_WINDOWSETRESIZABLE);
93 DEFINE_EXPECT(EnableModeless_TRUE);
94 DEFINE_EXPECT(EnableModeless_FALSE);
95 DEFINE_EXPECT(GetHostInfo);
96 DEFINE_EXPECT(GetOptionKeyPath);
97 DEFINE_EXPECT(GetOverridesKeyPath);
98 DEFINE_EXPECT(SetStatusText);
99 DEFINE_EXPECT(UpdateUI);
100 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
101 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
102 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
103 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
104 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
106 static const WCHAR wszItem[] = {'i','t','e','m',0};
107 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
109 static VARIANT_BOOL exvb;
110 static IWebBrowser2 *wb;
112 static HWND container_hwnd, shell_embedding_hwnd;
114 static const char *debugstr_w(LPCWSTR str)
116 static char buf[1024];
119 WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
123 static const char *debugstr_guid(REFIID riid)
127 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
128 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
129 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
130 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
135 static HRESULT QueryInterface(REFIID,void**);
137 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
138 REFIID riid, void **ppv)
140 ok(0, "unexpected call\n");
141 return E_NOINTERFACE;
144 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
149 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
154 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
155 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
157 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
158 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
159 ok(!pCmdText, "pCmdText != NULL\n");
161 switch(prgCmds[0].cmdID) {
162 case OLECMDID_SETPROGRESSTEXT:
163 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
164 prgCmds[0].cmdf = OLECMDF_ENABLED;
167 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
173 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
174 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
178 case OLECMDID_SETPROGRESSMAX:
179 CHECK_EXPECT(Exec_SETPROGRESSMAX);
180 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
181 ok(pvaIn != NULL, "pvaIn == NULL\n");
183 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
184 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
186 case OLECMDID_SETPROGRESSPOS:
187 CHECK_EXPECT(Exec_SETPROGRESSPOS);
188 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
189 ok(pvaIn != NULL, "pvaIn == NULL\n");
191 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
192 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
194 case OLECMDID_SETDOWNLOADSTATE:
195 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
196 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
197 ok(pvaIn != NULL, "pvaIn == NULL\n");
198 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
199 switch(V_I4(pvaIn)) {
201 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
204 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1);
207 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
211 ok(0, "unexpected nsCmdID %d\n", nCmdID);
213 }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
216 return E_FAIL; /* TODO */
218 return E_FAIL; /* TODO */
220 ok(0, "unexpected nCmdID %d\n", nCmdID);
223 ok(0, "unepected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup));
229 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
230 OleCommandTarget_QueryInterface,
231 OleCommandTarget_AddRef,
232 OleCommandTarget_Release,
233 OleCommandTarget_QueryStatus,
234 OleCommandTarget_Exec
237 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
239 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
241 if(IsEqualGUID(&IID_ITargetContainer, riid))
242 return E_NOINTERFACE; /* TODO */
244 if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
245 *ppv = &OleCommandTarget;
249 ok(0, "unexpected call\n");
250 return E_NOINTERFACE;
253 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
258 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
263 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
264 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
266 ok(0, "unexpected call\n");
270 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
271 IEnumUnknown **ppenum)
273 ok(0, "unexpected call\n");
277 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
279 ok(0, "unexpected call\n");
283 static const IOleContainerVtbl OleContainerVtbl = {
284 OleContainer_QueryInterface,
286 OleContainer_Release,
287 OleContainer_ParseDisplayName,
288 OleContainer_EnumObjects,
289 OleContainer_LockContainer
292 static IOleContainer OleContainer = { &OleContainerVtbl };
294 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
296 return QueryInterface(riid, ppv);
299 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
304 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
309 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
311 ok(0, "unexpected call\n");
315 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
318 ok(0, "unexpected call\n");
322 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
323 UINT cNames, LCID lcid, DISPID *rgDispId)
325 ok(0, "unexpected call\n");
329 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
330 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
331 EXCEPINFO *pExcepInfo, UINT *puArgErr)
333 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
334 ok(pDispParams != NULL, "pDispParams == NULL\n");
335 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
336 ok(V_VT(pVarResult) == VT_EMPTY, "V_VT(pVarResult)=%d\n", V_VT(pVarResult));
337 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
338 ok(pDispParams->rgvarg == NULL, "pDispParams->rgvarg = %p\n", pDispParams->rgvarg);
339 ok(pDispParams->rgdispidNamedArgs == NULL,
340 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
341 ok(pDispParams->cArgs == 0, "pDispParams->cArgs = %d\n", pDispParams->cArgs);
342 ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
344 switch(dispIdMember) {
345 case DISPID_AMBIENT_USERMODE:
346 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
348 case DISPID_AMBIENT_DLCONTROL:
349 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL);
350 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
352 case DISPID_AMBIENT_USERAGENT:
353 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
354 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
356 case DISPID_AMBIENT_PALETTE:
357 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
358 ok(puArgErr != NULL, "puArgErr=%p\n", puArgErr);
360 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
361 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
362 ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
363 V_VT(pVarResult) = VT_BOOL;
364 V_BOOL(pVarResult) = VARIANT_FALSE;
366 case DISPID_AMBIENT_SILENT:
367 CHECK_EXPECT(Invoke_AMBIENT_SILENT);
368 ok(puArgErr == NULL, "puArgErr=%p\n", puArgErr);
369 V_VT(pVarResult) = VT_BOOL;
370 V_BOOL(pVarResult) = VARIANT_FALSE;
374 ok(0, "unexpected dispIdMember %d\n", dispIdMember);
378 static IDispatchVtbl DispatchVtbl = {
379 Dispatch_QueryInterface,
382 Dispatch_GetTypeInfoCount,
383 Dispatch_GetTypeInfo,
384 Dispatch_GetIDsOfNames,
388 static IDispatch Dispatch = { &DispatchVtbl };
390 static HRESULT WINAPI WebBrowserEvents2_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
394 if(IsEqualGUID(&DIID_DWebBrowserEvents2, riid)) {
399 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
400 return E_NOINTERFACE;
403 #define test_invoke_bool(p) _test_invoke_bool(__LINE__,p)
404 static void _test_invoke_bool(unsigned line, const DISPPARAMS *params)
406 ok_(__FILE__,line) (params->rgvarg != NULL, "rgvarg == NULL\n");
407 ok_(__FILE__,line) (params->cArgs == 1, "cArgs=%d, expected 1\n", params->cArgs);
408 ok_(__FILE__,line) (V_VT(params->rgvarg) == VT_BOOL, "V_VT(arg)=%d\n", V_VT(params->rgvarg));
409 ok_(__FILE__,line) (V_BOOL(params->rgvarg) == exvb, "V_VT(arg)=%x, expected %x\n",
410 V_BOOL(params->rgvarg), exvb);
413 static void test_OnBeforeNavigate(const VARIANT *disp, const VARIANT *url, const VARIANT *flags,
414 const VARIANT *frame, const VARIANT *post_data, const VARIANT *headers, const VARIANT *cancel)
416 ok(V_VT(disp) == VT_DISPATCH, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp));
417 ok(V_DISPATCH(disp) != NULL, "V_DISPATCH(disp) == NULL\n");
418 ok(V_DISPATCH(disp) == (IDispatch*)wb, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp), wb);
420 ok(V_VT(url) == (VT_BYREF|VT_VARIANT), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url));
421 ok(V_VARIANTREF(url) != NULL, "V_VARIANTREF(url) == NULL)\n");
422 if(V_VARIANTREF(url)) {
423 ok(V_VT(V_VARIANTREF(url)) == VT_BSTR, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
424 V_VT(V_VARIANTREF(url)));
425 ok(V_BSTR(V_VARIANTREF(url)) != NULL, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
426 ok(!lstrcmpW(V_BSTR(V_VARIANTREF(url)), about_blankW), "unexpected url %s\n",
427 debugstr_w(V_BSTR(V_VARIANTREF(url))));
430 ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
432 ok(V_VT(flags) == (VT_BYREF|VT_VARIANT), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
434 ok(V_VARIANTREF(flags) != NULL, "V_VARIANTREF(flags) == NULL)\n");
435 if(V_VARIANTREF(flags)) {
436 ok(V_VT(V_VARIANTREF(flags)) == VT_I4, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
437 V_VT(V_VARIANTREF(flags)));
438 ok(V_I4(V_VARIANTREF(flags)) == 0, "V_I4(V_VARIANTREF(flags)) = %d, expected 0\n",
439 V_I4(V_VARIANTREF(flags)));
442 ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
444 ok(V_VT(frame) == (VT_BYREF|VT_VARIANT), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
446 ok(V_VARIANTREF(frame) != NULL, "V_VARIANTREF(frame) == NULL)\n");
447 if(V_VARIANTREF(frame)) {
448 ok(V_VT(V_VARIANTREF(frame)) == VT_BSTR, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
449 V_VT(V_VARIANTREF(frame)));
450 ok(V_BSTR(V_VARIANTREF(frame)) == NULL, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
451 V_BSTR(V_VARIANTREF(frame)));
454 ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
456 ok(V_VT(post_data) == (VT_BYREF|VT_VARIANT), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
458 ok(V_VARIANTREF(post_data) != NULL, "V_VARIANTREF(post_data) == NULL)\n");
459 if(V_VARIANTREF(post_data)) {
460 ok(V_VT(V_VARIANTREF(post_data)) == (VT_VARIANT|VT_BYREF),
461 "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
462 V_VT(V_VARIANTREF(post_data)));
463 ok(V_VARIANTREF(V_VARIANTREF(post_data)) != NULL,
464 "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
465 if(V_VARIANTREF(V_VARIANTREF(post_data))) {
466 ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == VT_EMPTY,
467 "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
468 V_VT(V_VARIANTREF(V_VARIANTREF(post_data))));
470 if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) == (VT_UI1|VT_ARRAY)) {
471 const SAFEARRAY *sa = V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data)));
473 ok(sa->cDims == 1, "sa->cDims = %d, expected 1\n", sa->cDims);
474 ok(sa->fFeatures == 0, "sa->fFeatures = %d, expected 0\n", sa->fFeatures);
479 ok(V_VT(headers) == (VT_BYREF|VT_VARIANT), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
481 ok(V_VARIANTREF(headers) != NULL, "V_VARIANTREF(headers) == NULL)\n");
482 if(V_VARIANTREF(headers)) {
483 ok(V_VT(V_VARIANTREF(headers)) == VT_BSTR, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
484 V_VT(V_VARIANTREF(headers)));
485 ok(V_BSTR(V_VARIANTREF(headers)) == NULL, "V_BSTR(V_VARIANTREF(heders)) = %p, expected NULL\n",
486 V_BSTR(V_VARIANTREF(headers)));
489 ok(V_VT(cancel) == (VT_BYREF|VT_BOOL), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
491 ok(V_BOOLREF(cancel) != NULL, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
492 if(V_BOOLREF(cancel))
493 ok(*V_BOOLREF(cancel) == VARIANT_FALSE, "*V_BOOLREF(calcel) = %x, expected VARIANT_FALSE\n",
497 static HRESULT WINAPI WebBrowserEvents2_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
498 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
499 EXCEPINFO *pExcepInfo, UINT *puArgErr)
501 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
502 ok(pDispParams != NULL, "pDispParams == NULL\n");
503 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
504 ok(pVarResult == NULL, "pVarResult=%p\n", pVarResult);
505 ok(wFlags == DISPATCH_METHOD, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags);
506 ok(pDispParams->rgdispidNamedArgs == NULL,
507 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
508 ok(pDispParams->cNamedArgs == 0, "pDispParams->cNamedArgs = %d\n", pDispParams->cNamedArgs);
510 switch(dispIdMember) {
511 case DISPID_STATUSTEXTCHANGE:
512 CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE);
514 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
515 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
516 ok(V_VT(pDispParams->rgvarg) == VT_BSTR, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
517 V_VT(pDispParams->rgvarg));
518 /* TODO: Check text */
521 case DISPID_PROPERTYCHANGE:
522 CHECK_EXPECT2(Invoke_PROPERTYCHANGE);
524 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
525 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
526 /* TODO: Check args */
529 case DISPID_DOWNLOADBEGIN:
530 CHECK_EXPECT(Invoke_DOWNLOADBEGIN);
532 ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
533 ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
536 case DISPID_BEFORENAVIGATE2:
537 CHECK_EXPECT(Invoke_BEFORENAVIGATE2);
539 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
540 ok(pDispParams->cArgs == 7, "cArgs=%d, expected 7\n", pDispParams->cArgs);
541 test_OnBeforeNavigate(pDispParams->rgvarg+6, pDispParams->rgvarg+5, pDispParams->rgvarg+4,
542 pDispParams->rgvarg+3, pDispParams->rgvarg+2, pDispParams->rgvarg+1,
543 pDispParams->rgvarg);
546 case DISPID_SETSECURELOCKICON:
547 CHECK_EXPECT(Invoke_SETSECURELOCKICON);
549 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
550 ok(pDispParams->cArgs == 1, "cArgs=%d, expected 1\n", pDispParams->cArgs);
551 /* TODO: Check args */
554 case DISPID_FILEDOWNLOAD:
555 CHECK_EXPECT(Invoke_FILEDOWNLOAD);
557 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
558 ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
559 /* TODO: Check args */
562 case DISPID_COMMANDSTATECHANGE:
563 CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE);
565 ok(pDispParams->rgvarg != NULL, "rgvarg == NULL\n");
566 ok(pDispParams->cArgs == 2, "cArgs=%d, expected 2\n", pDispParams->cArgs);
567 /* TODO: Check args */
570 case DISPID_DOWNLOADCOMPLETE:
571 CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE);
573 ok(pDispParams->rgvarg == NULL, "rgvarg=%p, expected NULL\n", pDispParams->rgvarg);
574 ok(pDispParams->cArgs == 0, "cArgs=%d, expected 0\n", pDispParams->cArgs);
577 case DISPID_ONMENUBAR:
578 CHECK_EXPECT(Invoke_ONMENUBAR);
579 test_invoke_bool(pDispParams);
582 case DISPID_ONADDRESSBAR:
583 CHECK_EXPECT(Invoke_ONADDRESSBAR);
584 test_invoke_bool(pDispParams);
587 case DISPID_ONSTATUSBAR:
588 CHECK_EXPECT(Invoke_ONSTATUSBAR);
589 test_invoke_bool(pDispParams);
592 case DISPID_ONTOOLBAR:
593 CHECK_EXPECT(Invoke_ONTOOLBAR);
594 test_invoke_bool(pDispParams);
597 case DISPID_ONFULLSCREEN:
598 CHECK_EXPECT(Invoke_ONFULLSCREEN);
599 test_invoke_bool(pDispParams);
602 case DISPID_WINDOWSETRESIZABLE:
603 CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE);
604 test_invoke_bool(pDispParams);
608 ok(0, "unexpected dispIdMember %d\n", dispIdMember);
614 static IDispatchVtbl WebBrowserEvents2Vtbl = {
615 WebBrowserEvents2_QueryInterface,
618 Dispatch_GetTypeInfoCount,
619 Dispatch_GetTypeInfo,
620 Dispatch_GetIDsOfNames,
621 WebBrowserEvents2_Invoke
624 static IDispatch WebBrowserEvents2 = { &WebBrowserEvents2Vtbl };
626 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
628 return QueryInterface(riid, ppv);
631 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
636 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
641 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
643 ok(0, "unexpected call\n");
647 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAsign, DWORD dwWhichMoniker,
650 ok(0, "unexpected call\n");
654 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
656 CHECK_EXPECT(GetContainer);
658 ok(ppContainer != NULL, "ppContainer == NULL\n");
660 *ppContainer = &OleContainer;
665 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
667 CHECK_EXPECT(ShowObject);
671 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
673 ok(0, "unexpected call\n");
677 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
679 ok(0, "unexpected call\n");
683 static const IOleClientSiteVtbl ClientSiteVtbl = {
684 ClientSite_QueryInterface,
687 ClientSite_SaveObject,
688 ClientSite_GetMoniker,
689 ClientSite_GetContainer,
690 ClientSite_ShowObject,
691 ClientSite_OnShowWindow,
692 ClientSite_RequestNewObjectLayout
695 static IOleClientSite ClientSite = { &ClientSiteVtbl };
697 static HRESULT WINAPI InPlaceUIWindow_QueryInterface(IOleInPlaceFrame *iface,
698 REFIID riid, void **ppv)
700 ok(0, "unexpected call\n");
701 return E_NOINTERFACE;
704 static ULONG WINAPI InPlaceUIWindow_AddRef(IOleInPlaceFrame *iface)
709 static ULONG WINAPI InPlaceUIWindow_Release(IOleInPlaceFrame *iface)
714 static HRESULT WINAPI InPlaceUIWindow_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
716 ok(0, "unexpected call\n");
720 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
722 CHECK_EXPECT(Frame_GetWindow);
723 ok(phwnd != NULL, "phwnd == NULL\n");
725 *phwnd = container_hwnd;
729 static HRESULT WINAPI InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
731 ok(0, "unexpected call\n");
735 static HRESULT WINAPI InPlaceUIWindow_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
737 ok(0, "unexpected call\n");
741 static HRESULT WINAPI InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame *iface,
742 LPCBORDERWIDTHS pborderwidths)
744 ok(0, "unexpected call\n");
748 static HRESULT WINAPI InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame *iface,
749 LPCBORDERWIDTHS pborderwidths)
751 ok(0, "unexpected call\n");
755 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
756 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
758 CHECK_EXPECT(UIWindow_SetActiveObject);
759 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
760 ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
764 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
765 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
767 CHECK_EXPECT(Frame_SetActiveObject);
768 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
769 ok(!lstrcmpW(pszObjName, wszItem), "unexpected pszObjName\n");
773 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
774 LPOLEMENUGROUPWIDTHS lpMenuWidths)
776 ok(0, "unexpected call\n");
780 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
781 HOLEMENU holemenu, HWND hwndActiveObject)
783 CHECK_EXPECT(SetMenu);
784 ok(hmenuShared == NULL, "hmenuShared=%p\n", hmenuShared);
785 ok(holemenu == NULL, "holemenu=%p\n", holemenu);
786 ok(hwndActiveObject == shell_embedding_hwnd, "hwndActiveObject=%p, expected %p\n",
787 hwndActiveObject, shell_embedding_hwnd);
791 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
793 ok(0, "unexpected call\n");
797 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
799 CHECK_EXPECT2(SetStatusText);
800 /* FIXME: Check pszStatusText */
804 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
807 CHECK_EXPECT(EnableModeless_TRUE);
809 CHECK_EXPECT(EnableModeless_FALSE);
813 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
815 ok(0, "unexpected call\n");
819 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
820 InPlaceUIWindow_QueryInterface,
821 InPlaceUIWindow_AddRef,
822 InPlaceUIWindow_Release,
823 InPlaceUIWindow_GetWindow,
824 InPlaceUIWindow_ContextSensitiveHelp,
825 InPlaceUIWindow_GetBorder,
826 InPlaceUIWindow_RequestBorderSpace,
827 InPlaceUIWindow_SetBorderSpace,
828 InPlaceUIWindow_SetActiveObject,
831 static IOleInPlaceUIWindow InPlaceUIWindow = { (IOleInPlaceUIWindowVtbl*)&InPlaceUIWindowVtbl };
833 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
834 InPlaceUIWindow_QueryInterface,
835 InPlaceUIWindow_AddRef,
836 InPlaceUIWindow_Release,
837 InPlaceFrame_GetWindow,
838 InPlaceUIWindow_ContextSensitiveHelp,
839 InPlaceUIWindow_GetBorder,
840 InPlaceUIWindow_RequestBorderSpace,
841 InPlaceUIWindow_SetBorderSpace,
842 InPlaceFrame_SetActiveObject,
843 InPlaceFrame_InsertMenus,
844 InPlaceFrame_SetMenu,
845 InPlaceFrame_RemoveMenus,
846 InPlaceFrame_SetStatusText,
847 InPlaceFrame_EnableModeless,
848 InPlaceFrame_TranslateAccelerator
851 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
853 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
855 return QueryInterface(riid, ppv);
858 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
863 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
868 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
870 CHECK_EXPECT(Site_GetWindow);
871 ok(phwnd != NULL, "phwnd == NULL\n");
873 *phwnd = container_hwnd;
877 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
879 ok(0, "unexpected call\n");
883 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
885 CHECK_EXPECT(CanInPlaceActivate);
889 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
891 CHECK_EXPECT(OnInPlaceActivate);
895 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
897 CHECK_EXPECT(OnUIActivate);
901 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
902 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
903 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
905 static const RECT pos_rect = {2,1,1002,901};
906 static const RECT clip_rect = {10,10,990,890};
908 CHECK_EXPECT(GetWindowContext);
910 ok(ppFrame != NULL, "ppFrame = NULL\n");
912 *ppFrame = &InPlaceFrame;
914 ok(ppDoc != NULL, "ppDoc = NULL\n");
916 *ppDoc = &InPlaceUIWindow;
918 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
920 memcpy(lprcPosRect, &pos_rect, sizeof(RECT));
922 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
924 memcpy(lprcClipRect, &clip_rect, sizeof(RECT));
926 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
928 lpFrameInfo->cb = sizeof(*lpFrameInfo);
929 lpFrameInfo->fMDIApp = FALSE;
930 lpFrameInfo->hwndFrame = container_hwnd;
931 lpFrameInfo->haccel = NULL;
932 lpFrameInfo->cAccelEntries = 0;
938 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtant)
940 ok(0, "unexpected call\n");
944 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
946 ok(0, "unexpected call\n");
950 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
952 ok(0, "unexpected call\n");
956 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
958 ok(0, "unexpected call\n");
962 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
964 ok(0, "unexpected call\n");
968 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface, LPCRECT lprcPosRect)
970 ok(0, "unexpected call\n");
974 static HRESULT WINAPI InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface,
975 BOOL *pNoRedraw, DWORD dwFlags)
977 ok(0, "unexpected call\n");
981 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface,
984 ok(0, "unexpected call\n");
988 static HRESULT WINAPI InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx *iface)
990 ok(0, "unexpected call\n");
994 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl = {
995 InPlaceSite_QueryInterface,
998 InPlaceSite_GetWindow,
999 InPlaceSite_ContextSensitiveHelp,
1000 InPlaceSite_CanInPlaceActivate,
1001 InPlaceSite_OnInPlaceActivate,
1002 InPlaceSite_OnUIActivate,
1003 InPlaceSite_GetWindowContext,
1005 InPlaceSite_OnUIDeactivate,
1006 InPlaceSite_OnInPlaceDeactivate,
1007 InPlaceSite_DiscardUndoState,
1008 InPlaceSite_DeactivateAndUndo,
1009 InPlaceSite_OnPosRectChange,
1010 InPlaceSite_OnInPlaceActivateEx,
1011 InPlaceSite_OnInPlaceDeactivateEx,
1012 InPlaceSite_RequestUIActivate
1015 static IOleInPlaceSiteEx InPlaceSite = { &InPlaceSiteExVtbl };
1017 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
1019 return QueryInterface(riid, ppv);
1022 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
1027 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
1032 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
1033 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
1035 ok(0, "unexpected call %d %p %p %p\n", dwID, ppt, pcmdtReserved, pdicpReserved);
1039 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
1041 CHECK_EXPECT(GetHostInfo);
1042 ok(pInfo != NULL, "pInfo=NULL\n");
1044 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
1045 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
1046 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
1047 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
1048 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
1053 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
1054 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
1055 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
1057 ok(0, "unexpected call\n");
1061 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
1063 ok(0, "unexpected call\n");
1067 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
1069 CHECK_EXPECT(UpdateUI);
1073 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
1075 ok(0, "unexpected call\n");
1079 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1081 ok(0, "unexpected call\n");
1085 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
1087 ok(0, "unexpected call\n");
1091 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
1092 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
1094 ok(0, "unexpected call\n");
1098 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
1099 const GUID *pguidCmdGroup, DWORD nCmdID)
1101 ok(0, "unexpected call\n");
1105 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
1106 LPOLESTR *pchKey, DWORD dw)
1108 CHECK_EXPECT(GetOptionKeyPath);
1109 ok(pchKey != NULL, "pchKey==NULL\n");
1111 ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1112 ok(!dw, "dw=%x\n", dw);
1116 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
1117 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
1119 ok(0, "unexpected call\n");
1123 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
1125 ok(0, "unexpected call\n");
1129 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
1130 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
1132 ok(0, "unexpected call\n");
1136 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
1137 IDataObject **ppPORet)
1139 ok(0, "unexpected call\n");
1143 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
1144 LPOLESTR *pchKey, DWORD dw)
1146 CHECK_EXPECT(GetOverridesKeyPath);
1147 ok(pchKey != NULL, "pchKey==NULL\n");
1149 ok(*pchKey == NULL, "*pchKey=%p\n", *pchKey);
1150 ok(!dw, "dw=%x\n", dw);
1154 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
1155 DocHostUIHandler_QueryInterface,
1156 DocHostUIHandler_AddRef,
1157 DocHostUIHandler_Release,
1158 DocHostUIHandler_ShowContextMenu,
1159 DocHostUIHandler_GetHostInfo,
1160 DocHostUIHandler_ShowUI,
1161 DocHostUIHandler_HideUI,
1162 DocHostUIHandler_UpdateUI,
1163 DocHostUIHandler_EnableModeless,
1164 DocHostUIHandler_OnDocWindowActivate,
1165 DocHostUIHandler_OnFrameWindowActivate,
1166 DocHostUIHandler_ResizeBorder,
1167 DocHostUIHandler_TranslateAccelerator,
1168 DocHostUIHandler_GetOptionKeyPath,
1169 DocHostUIHandler_GetDropTarget,
1170 DocHostUIHandler_GetExternal,
1171 DocHostUIHandler_TranslateUrl,
1172 DocHostUIHandler_FilterDataObject,
1173 DocHostUIHandler_GetOverrideKeyPath
1176 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
1178 static HRESULT QueryInterface(REFIID riid, void **ppv)
1182 if(IsEqualGUID(&IID_IUnknown, riid)
1183 || IsEqualGUID(&IID_IOleClientSite, riid))
1185 else if(IsEqualGUID(&IID_IOleWindow, riid)
1186 || IsEqualGUID(&IID_IOleInPlaceSite, riid)
1187 || IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
1188 *ppv = &InPlaceSite;
1189 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid)
1190 || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
1191 *ppv = &DocHostUIHandler;
1192 else if(IsEqualGUID(&IID_IDispatch, riid))
1198 return E_NOINTERFACE;
1201 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
1203 return DefWindowProcW(hwnd, msg, wParam, lParam);
1206 static HWND create_container_window(void)
1208 static const WCHAR wszWebBrowserContainer[] =
1209 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1210 static WNDCLASSEXW wndclass = {
1211 sizeof(WNDCLASSEXW),
1214 0, 0, NULL, NULL, NULL, NULL, NULL,
1215 wszWebBrowserContainer,
1219 RegisterClassExW(&wndclass);
1220 return CreateWindowW(wszWebBrowserContainer, wszWebBrowserContainer,
1221 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
1222 CW_USEDEFAULT, NULL, NULL, NULL, NULL);
1225 static void test_DoVerb(IUnknown *unk)
1228 RECT rect = {0,0,1000,1000};
1231 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1232 ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1236 SET_EXPECT(CanInPlaceActivate);
1237 SET_EXPECT(Site_GetWindow);
1238 SET_EXPECT(OnInPlaceActivate);
1239 SET_EXPECT(GetWindowContext);
1240 SET_EXPECT(ShowObject);
1241 SET_EXPECT(GetContainer);
1242 SET_EXPECT(Frame_GetWindow);
1243 SET_EXPECT(OnUIActivate);
1244 SET_EXPECT(Frame_SetActiveObject);
1245 SET_EXPECT(UIWindow_SetActiveObject);
1246 SET_EXPECT(SetMenu);
1248 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1249 0, (HWND)0xdeadbeef, &rect);
1250 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1252 CHECK_CALLED(CanInPlaceActivate);
1253 CHECK_CALLED(Site_GetWindow);
1254 CHECK_CALLED(OnInPlaceActivate);
1255 CHECK_CALLED(GetWindowContext);
1256 CHECK_CALLED(ShowObject);
1257 CHECK_CALLED(GetContainer);
1258 CHECK_CALLED(Frame_GetWindow);
1259 CHECK_CALLED(OnUIActivate);
1260 CHECK_CALLED(Frame_SetActiveObject);
1261 CHECK_CALLED(UIWindow_SetActiveObject);
1262 CHECK_CALLED(SetMenu);
1264 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite,
1265 0, (HWND)0xdeadbeef, &rect);
1266 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
1268 IOleObject_Release(oleobj);
1271 static void test_GetMiscStatus(IOleObject *oleobj)
1276 for(i=0; i<10; i++) {
1278 hres = IOleObject_GetMiscStatus(oleobj, i, &st);
1279 ok(hres == S_OK, "GetMiscStatus failed: %08x\n", hres);
1280 ok(st == (OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
1281 |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE),
1282 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1283 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st);
1287 static void test_SetHostNames(IOleObject *oleobj)
1291 static const WCHAR test_appW[] = {'t','e','s','t',' ','a','p','p',0};
1293 hres = IOleObject_SetHostNames(oleobj, test_appW, (void*)0xdeadbeef);
1294 ok(hres == S_OK, "SetHostNames failed: %08x\n", hres);
1297 static void test_ClientSite(IUnknown *unk, IOleClientSite *client)
1300 IOleInPlaceObject *inplace;
1304 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1305 ok(hres == S_OK, "QueryInterface(IID_OleObject) failed: %08x\n", hres);
1309 test_GetMiscStatus(oleobj);
1310 test_SetHostNames(oleobj);
1312 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObject, (void**)&inplace);
1313 ok(hres == S_OK, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres);
1315 IOleObject_Release(oleobj);
1319 hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1320 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1321 ok((hwnd == NULL) ^ (client == NULL), "unexpected hwnd %p\n", hwnd);
1324 SET_EXPECT(GetContainer);
1325 SET_EXPECT(Site_GetWindow);
1326 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1327 SET_EXPECT(Invoke_AMBIENT_SILENT);
1329 SET_EXPECT(Invoke_DOWNLOADCOMPLETE);
1330 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1331 SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1334 hres = IOleObject_SetClientSite(oleobj, client);
1335 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
1338 CHECK_CALLED(GetContainer);
1339 CHECK_CALLED(Site_GetWindow);
1340 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1341 CHECK_CALLED(Invoke_AMBIENT_SILENT);
1343 todo_wine CHECK_CALLED(Invoke_DOWNLOADCOMPLETE);
1344 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1345 todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1348 hres = IOleInPlaceObject_GetWindow(inplace, &hwnd);
1349 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1350 ok((hwnd == NULL) == (client == NULL), "unexpected hwnd %p\n", hwnd);
1352 shell_embedding_hwnd = hwnd;
1354 test_SetHostNames(oleobj);
1356 IOleInPlaceObject_Release(inplace);
1357 IOleObject_Release(oleobj);
1360 static void test_ClassInfo(IUnknown *unk)
1362 IProvideClassInfo2 *class_info;
1366 hres = IUnknown_QueryInterface(unk, &IID_IProvideClassInfo2, (void**)&class_info);
1367 ok(hres == S_OK, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres);
1371 hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &guid);
1372 ok(hres == S_OK, "GetGUID failed: %08x\n", hres);
1373 ok(IsEqualGUID(&DIID_DWebBrowserEvents2, &guid), "wrong guid\n");
1375 hres = IProvideClassInfo2_GetGUID(class_info, 0, &guid);
1376 ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1377 ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1379 hres = IProvideClassInfo2_GetGUID(class_info, 2, &guid);
1380 ok(hres == E_FAIL, "GetGUID failed: %08x, expected E_FAIL\n", hres);
1381 ok(IsEqualGUID(&IID_NULL, &guid), "wrong guid\n");
1383 hres = IProvideClassInfo2_GetGUID(class_info, GUIDKIND_DEFAULT_SOURCE_DISP_IID, NULL);
1384 ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1386 hres = IProvideClassInfo2_GetGUID(class_info, 0, NULL);
1387 ok(hres == E_POINTER, "GetGUID failed: %08x, expected E_POINTER\n", hres);
1389 IProvideClassInfo2_Release(class_info);
1392 static void test_ie_funcs(IUnknown *unk)
1401 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1402 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1409 hres = IWebBrowser2_get_HWND(wb, &hwnd);
1410 ok(hres == E_FAIL, "get_HWND failed: %08x, expected E_FAIL\n", hres);
1411 ok(hwnd == 0, "unexpected hwnd %lx\n", hwnd);
1415 hres = IWebBrowser2_get_MenuBar(wb, &b);
1416 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1417 ok(b == VARIANT_TRUE, "b=%x\n", b);
1419 SET_EXPECT(Invoke_ONMENUBAR);
1420 hres = IWebBrowser2_put_MenuBar(wb, (exvb = VARIANT_FALSE));
1421 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1422 CHECK_CALLED(Invoke_ONMENUBAR);
1424 hres = IWebBrowser2_get_MenuBar(wb, &b);
1425 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1426 ok(b == VARIANT_FALSE, "b=%x\n", b);
1428 SET_EXPECT(Invoke_ONMENUBAR);
1429 hres = IWebBrowser2_put_MenuBar(wb, (exvb = 100));
1430 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1431 CHECK_CALLED(Invoke_ONMENUBAR);
1433 hres = IWebBrowser2_get_MenuBar(wb, &b);
1434 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1435 ok(b == VARIANT_TRUE, "b=%x\n", b);
1439 hres = IWebBrowser2_get_AddressBar(wb, &b);
1440 ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1441 ok(b == VARIANT_TRUE, "b=%x\n", b);
1443 SET_EXPECT(Invoke_ONADDRESSBAR);
1444 hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_FALSE));
1445 ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1446 CHECK_CALLED(Invoke_ONADDRESSBAR);
1448 hres = IWebBrowser2_get_AddressBar(wb, &b);
1449 ok(hres == S_OK, "get_MenuBar failed: %08x\n", hres);
1450 ok(b == VARIANT_FALSE, "b=%x\n", b);
1452 SET_EXPECT(Invoke_ONADDRESSBAR);
1453 hres = IWebBrowser2_put_AddressBar(wb, (exvb = 100));
1454 ok(hres == S_OK, "put_AddressBar failed: %08x\n", hres);
1455 CHECK_CALLED(Invoke_ONADDRESSBAR);
1457 hres = IWebBrowser2_get_AddressBar(wb, &b);
1458 ok(hres == S_OK, "get_AddressBar failed: %08x\n", hres);
1459 ok(b == VARIANT_TRUE, "b=%x\n", b);
1461 SET_EXPECT(Invoke_ONADDRESSBAR);
1462 hres = IWebBrowser2_put_AddressBar(wb, (exvb = VARIANT_TRUE));
1463 ok(hres == S_OK, "put_MenuBar failed: %08x\n", hres);
1464 CHECK_CALLED(Invoke_ONADDRESSBAR);
1468 hres = IWebBrowser2_get_StatusBar(wb, &b);
1469 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1470 ok(b == VARIANT_TRUE, "b=%x\n", b);
1472 SET_EXPECT(Invoke_ONSTATUSBAR);
1473 hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_TRUE));
1474 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1475 CHECK_CALLED(Invoke_ONSTATUSBAR);
1477 hres = IWebBrowser2_get_StatusBar(wb, &b);
1478 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1479 ok(b == VARIANT_TRUE, "b=%x\n", b);
1481 SET_EXPECT(Invoke_ONSTATUSBAR);
1482 hres = IWebBrowser2_put_StatusBar(wb, (exvb = VARIANT_FALSE));
1483 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1484 CHECK_CALLED(Invoke_ONSTATUSBAR);
1486 hres = IWebBrowser2_get_StatusBar(wb, &b);
1487 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1488 ok(b == VARIANT_FALSE, "b=%x\n", b);
1490 SET_EXPECT(Invoke_ONSTATUSBAR);
1491 hres = IWebBrowser2_put_StatusBar(wb, (exvb = 100));
1492 ok(hres == S_OK, "put_StatusBar failed: %08x\n", hres);
1493 CHECK_CALLED(Invoke_ONSTATUSBAR);
1495 hres = IWebBrowser2_get_StatusBar(wb, &b);
1496 ok(hres == S_OK, "get_StatusBar failed: %08x\n", hres);
1497 ok(b == VARIANT_TRUE, "b=%x\n", b);
1501 hres = IWebBrowser2_get_ToolBar(wb, &i);
1502 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1505 SET_EXPECT(Invoke_ONTOOLBAR);
1506 hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_FALSE));
1507 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1508 CHECK_CALLED(Invoke_ONTOOLBAR);
1510 hres = IWebBrowser2_get_ToolBar(wb, &i);
1511 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1512 ok(i == VARIANT_FALSE, "b=%x\n", i);
1514 SET_EXPECT(Invoke_ONTOOLBAR);
1515 hres = IWebBrowser2_put_ToolBar(wb, (exvb = 100));
1516 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1517 CHECK_CALLED(Invoke_ONTOOLBAR);
1519 hres = IWebBrowser2_get_ToolBar(wb, &i);
1520 ok(hres == S_OK, "get_ToolBar failed: %08x\n", hres);
1523 SET_EXPECT(Invoke_ONTOOLBAR);
1524 hres = IWebBrowser2_put_ToolBar(wb, (exvb = VARIANT_TRUE));
1525 ok(hres == S_OK, "put_ToolBar failed: %08x\n", hres);
1526 CHECK_CALLED(Invoke_ONTOOLBAR);
1530 hres = IWebBrowser2_get_FullScreen(wb, &b);
1531 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1532 ok(b == VARIANT_FALSE, "b=%x\n", b);
1534 SET_EXPECT(Invoke_ONFULLSCREEN);
1535 hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_TRUE));
1536 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1537 CHECK_CALLED(Invoke_ONFULLSCREEN);
1539 hres = IWebBrowser2_get_FullScreen(wb, &b);
1540 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1541 ok(b == VARIANT_TRUE, "b=%x\n", b);
1543 SET_EXPECT(Invoke_ONFULLSCREEN);
1544 hres = IWebBrowser2_put_FullScreen(wb, (exvb = 100));
1545 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1546 CHECK_CALLED(Invoke_ONFULLSCREEN);
1548 hres = IWebBrowser2_get_FullScreen(wb, &b);
1549 ok(hres == S_OK, "get_FullScreen failed: %08x\n", hres);
1550 ok(b == VARIANT_TRUE, "b=%x\n", b);
1552 SET_EXPECT(Invoke_ONFULLSCREEN);
1553 hres = IWebBrowser2_put_FullScreen(wb, (exvb = VARIANT_FALSE));
1554 ok(hres == S_OK, "put_FullScreen failed: %08x\n", hres);
1555 CHECK_CALLED(Invoke_ONFULLSCREEN);
1560 hres = IWebBrowser2_get_Resizable(wb, &b);
1561 ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1562 ok(b == 0x100, "b=%x\n", b);
1564 SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1565 hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_TRUE));
1566 ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1567 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1569 SET_EXPECT(Invoke_WINDOWSETRESIZABLE);
1570 hres = IWebBrowser2_put_Resizable(wb, (exvb = VARIANT_FALSE));
1571 ok(hres == S_OK, "put_Resizable failed: %08x\n", hres);
1572 CHECK_CALLED(Invoke_WINDOWSETRESIZABLE);
1574 hres = IWebBrowser2_get_Resizable(wb, &b);
1575 ok(hres == E_NOTIMPL, "get_Resizable failed: %08x\n", hres);
1576 ok(b == 0x100, "b=%x\n", b);
1581 hres = IWebBrowser2_get_Application(wb, &disp);
1582 ok(hres == S_OK, "get_Application failed: %08x\n", hres);
1583 ok(disp == (void*)wb, "disp=%p, expected %p\n", disp, wb);
1585 IDispatch_Release(disp);
1587 hres = IWebBrowser2_get_Application(wb, NULL);
1588 ok(hres == E_POINTER, "get_Application failed: %08x, expected E_POINTER\n", hres);
1592 hres = IWebBrowser2_Quit(wb);
1593 ok(hres == E_FAIL, "Quit failed: %08x, expected E_FAIL\n", hres);
1595 IWebBrowser2_Release(wb);
1598 static void test_Silent(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1604 hres = IWebBrowser2_get_Silent(wb, &b);
1605 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1606 ok(b == VARIANT_FALSE, "b=%x\n", b);
1608 hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1609 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1612 hres = IWebBrowser2_get_Silent(wb, &b);
1613 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1614 ok(b == VARIANT_TRUE, "b=%x\n", b);
1616 hres = IWebBrowser2_put_Silent(wb, 100);
1617 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1620 hres = IWebBrowser2_get_Silent(wb, &b);
1621 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1622 ok(b == VARIANT_TRUE, "b=%x\n", b);
1624 hres = IWebBrowser2_put_Silent(wb, VARIANT_FALSE);
1625 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1628 hres = IWebBrowser2_get_Silent(wb, &b);
1629 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1630 ok(b == VARIANT_FALSE, "b=%x\n", b);
1633 hres = IWebBrowser2_put_Silent(wb, VARIANT_TRUE);
1634 ok(hres == S_OK, "set_Silent failed: %08x\n", hres);
1636 SET_EXPECT(Invoke_AMBIENT_SILENT);
1639 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
1640 ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1643 CHECK_CALLED(Invoke_AMBIENT_SILENT);
1646 hres = IWebBrowser2_get_Silent(wb, &b);
1647 ok(hres == S_OK, "get_Silent failed: %08x\n", hres);
1648 ok(b == VARIANT_FALSE, "b=%x\n", b);
1651 static void test_Offline(IWebBrowser2 *wb, IOleControl *control, BOOL is_clientsite)
1657 hres = IWebBrowser2_get_Offline(wb, &b);
1658 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1659 ok(b == VARIANT_FALSE, "b=%x\n", b);
1661 hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1662 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1665 hres = IWebBrowser2_get_Offline(wb, &b);
1666 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1667 ok(b == VARIANT_TRUE, "b=%x\n", b);
1669 hres = IWebBrowser2_put_Offline(wb, 100);
1670 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1673 hres = IWebBrowser2_get_Offline(wb, &b);
1674 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1675 ok(b == VARIANT_TRUE, "b=%x\n", b);
1677 hres = IWebBrowser2_put_Offline(wb, VARIANT_FALSE);
1678 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1681 hres = IWebBrowser2_get_Offline(wb, &b);
1682 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1683 ok(b == VARIANT_FALSE, "b=%x\n", b);
1686 hres = IWebBrowser2_put_Offline(wb, VARIANT_TRUE);
1687 ok(hres == S_OK, "set_Offline failed: %08x\n", hres);
1689 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1692 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
1693 ok(hres == S_OK, "OnAmbientPropertyChange failed %08x\n", hres);
1696 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
1699 hres = IWebBrowser2_get_Offline(wb, &b);
1700 ok(hres == S_OK, "get_Offline failed: %08x\n", hres);
1701 ok(b == VARIANT_FALSE, "b=%x\n", b);
1704 static void test_wb_funcs(IUnknown *unk, BOOL is_clientsite)
1707 IOleControl *control;
1710 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1711 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
1713 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1714 ok(hres == S_OK, "Could not get IOleControl interface: %08x\n", hres);
1716 test_Silent(wb, control, is_clientsite);
1717 test_Offline(wb, control, is_clientsite);
1719 IWebBrowser_Release(wb);
1720 IOleControl_Release(control);
1723 static void test_GetControlInfo(IUnknown *unk)
1725 IOleControl *control;
1729 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
1730 ok(hres == S_OK, "Could not get IOleControl: %08x\n", hres);
1734 hres = IOleControl_GetControlInfo(control, &info);
1735 ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1736 hres = IOleControl_GetControlInfo(control, NULL);
1737 ok(hres == E_NOTIMPL, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres);
1739 IOleControl_Release(control);
1742 static void test_Extent(IUnknown *unk)
1748 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
1749 ok(hres == S_OK, "Could not get IOleObkect: %08x\n", hres);
1753 size.cx = size.cy = 0xdeadbeef;
1754 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1755 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1756 ok(size.cx == 1323 && size.cy == 529, "size = {%d %d}\n", size.cx, size.cy);
1760 hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &size);
1761 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1763 size.cx = size.cy = 0xdeadbeef;
1764 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1765 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1766 ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1768 size.cx = size.cy = 0xdeadbeef;
1769 hres = IOleObject_GetExtent(oleobj, 0, &size);
1770 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1771 ok(size.cx == 800 && size.cy == 700, "size = {%d %d}\n", size.cx, size.cy);
1775 hres = IOleObject_SetExtent(oleobj, 0, &size);
1776 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1778 size.cx = size.cy = 0xdeadbeef;
1779 hres = IOleObject_GetExtent(oleobj, 0, &size);
1780 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1781 ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1783 size.cx = size.cy = 0xdeadbeef;
1784 hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1785 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1786 ok(size.cx == 900 && size.cy == 800, "size = {%d %d}\n", size.cx, size.cy);
1790 hres = IOleObject_SetExtent(oleobj, 0xdeadbeef, &size);
1791 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
1793 size.cx = size.cy = 0xdeadbeef;
1794 hres = IOleObject_GetExtent(oleobj, 0xdeadbeef, &size);
1795 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1796 ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1798 size.cx = size.cy = 0xdeadbeef;
1799 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &size);
1800 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
1801 ok(size.cx == 1000 && size.cy == 900, "size = {%d %d}\n", size.cx, size.cy);
1803 IOleObject_Release(oleobj);
1806 static void test_ConnectionPoint(IUnknown *unk, BOOL init)
1808 IConnectionPointContainer *container;
1809 IConnectionPoint *point;
1812 static DWORD dw = 100;
1814 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
1815 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
1819 hres = IConnectionPointContainer_FindConnectionPoint(container, &DIID_DWebBrowserEvents2, &point);
1820 IConnectionPointContainer_Release(container);
1821 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
1826 hres = IConnectionPoint_Advise(point, (IUnknown*)&WebBrowserEvents2, &dw);
1827 ok(hres == S_OK, "Advise failed: %08x\n", hres);
1828 ok(dw == 1, "dw=%d, expected 1\n", dw);
1830 hres = IConnectionPoint_Unadvise(point, dw);
1831 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
1834 IConnectionPoint_Release(point);
1837 static void test_Navigate2(IUnknown *unk)
1839 IWebBrowser2 *webbrowser;
1843 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&webbrowser);
1844 ok(hres == S_OK, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres);
1848 V_VT(&url) = VT_BSTR;
1849 V_BSTR(&url) = SysAllocString(about_blankW);
1851 SET_EXPECT(Invoke_AMBIENT_USERMODE);
1852 SET_EXPECT(Invoke_PROPERTYCHANGE);
1853 SET_EXPECT(Invoke_BEFORENAVIGATE2);
1854 SET_EXPECT(Invoke_DOWNLOADBEGIN);
1855 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
1856 SET_EXPECT(EnableModeless_FALSE);
1857 SET_EXPECT(Invoke_STATUSTEXTCHANGE);
1858 SET_EXPECT(SetStatusText);
1859 SET_EXPECT(GetHostInfo);
1860 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
1861 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
1862 SET_EXPECT(Invoke_AMBIENT_PALETTE);
1863 SET_EXPECT(GetOptionKeyPath);
1864 SET_EXPECT(GetOverridesKeyPath);
1865 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
1866 SET_EXPECT(Exec_SETPROGRESSMAX);
1867 SET_EXPECT(Exec_SETPROGRESSPOS);
1868 SET_EXPECT(Invoke_SETSECURELOCKICON);
1869 SET_EXPECT(Invoke_FILEDOWNLOAD);
1870 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
1871 SET_EXPECT(Invoke_COMMANDSTATECHANGE);
1872 SET_EXPECT(EnableModeless_TRUE);
1874 hres = IWebBrowser2_Navigate2(webbrowser, &url, NULL, NULL, NULL, NULL);
1875 ok(hres == S_OK, "Navigate2 failed: %08x\n", hres);
1877 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
1878 todo_wine CHECK_CALLED(Invoke_PROPERTYCHANGE);
1879 CHECK_CALLED(Invoke_BEFORENAVIGATE2);
1880 todo_wine CHECK_CALLED(Invoke_DOWNLOADBEGIN);
1881 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
1882 CHECK_CALLED(EnableModeless_FALSE);
1883 CHECK_CALLED(Invoke_STATUSTEXTCHANGE);
1884 CHECK_CALLED(SetStatusText);
1885 CHECK_CALLED(GetHostInfo);
1886 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
1887 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
1888 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
1889 CHECK_CALLED(GetOptionKeyPath);
1890 CHECK_CALLED(GetOverridesKeyPath);
1891 todo_wine CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
1892 todo_wine CHECK_CALLED(Exec_SETPROGRESSMAX);
1893 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
1894 todo_wine CHECK_CALLED(Invoke_SETSECURELOCKICON);
1895 todo_wine CHECK_CALLED(Invoke_FILEDOWNLOAD);
1896 todo_wine CHECK_CALLED(Invoke_COMMANDSTATECHANGE);
1897 todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
1898 CHECK_CALLED(EnableModeless_TRUE);
1901 IWebBrowser2_Release(webbrowser);
1904 static void test_QueryInterface(IUnknown *unk)
1906 IQuickActivate *qa = (IQuickActivate*)0xdeadbeef;
1907 IRunnableObject *runnable = (IRunnableObject*)0xdeadbeef;
1908 IPerPropertyBrowsing *propbrowse = (void*)0xdeadbeef;
1909 IOleCache *cache = (void*)0xdeadbeef;
1912 hres = IUnknown_QueryInterface(unk, &IID_IQuickActivate, (void**)&qa);
1913 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1914 ok(qa == NULL, "qa=%p, ezpected NULL\n", qa);
1916 hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&runnable);
1917 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1918 ok(runnable == NULL, "runnable=%p, ezpected NULL\n", runnable);
1920 hres = IUnknown_QueryInterface(unk, &IID_IPerPropertyBrowsing, (void**)&propbrowse);
1921 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1922 ok(runnable == NULL, "runnable=%p, ezpected NULL\n", runnable);
1924 hres = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&cache);
1925 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
1926 ok(cache == NULL, "runnable=%p, ezpected NULL\n", runnable);
1929 static void test_WebBrowser(void)
1931 IUnknown *unk = NULL;
1935 hres = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
1936 &IID_IUnknown, (void**)&unk);
1937 ok(hres == S_OK, "CoCreateInterface failed: %08x\n", hres);
1941 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
1942 ok(hres == S_OK, "Could not get IWebBrowser2 iface: %08x\n", hres);
1944 test_QueryInterface(unk);
1945 test_ClassInfo(unk);
1946 test_ConnectionPoint(unk, TRUE);
1947 test_ClientSite(unk, &ClientSite);
1949 test_wb_funcs(unk, TRUE);
1951 test_Navigate2(unk);
1952 test_ClientSite(unk, NULL);
1954 test_GetControlInfo(unk);
1955 test_wb_funcs(unk, FALSE);
1956 test_ConnectionPoint(unk, FALSE);
1958 IWebBrowser2_Release(wb);
1959 ref = IUnknown_Release(unk);
1960 ok(ref == 0, "ref=%d, expected 0\n", ref);
1963 static void gecko_installer_workaround(BOOL disable)
1968 static BOOL has_url = FALSE;
1969 static char url[2048];
1971 if(!disable && !has_url)
1974 res = RegOpenKey(HKEY_CURRENT_USER, "Software\\Wine\\MSHTML", &hkey);
1975 if(res != ERROR_SUCCESS)
1979 DWORD type, size = sizeof(url);
1981 res = RegQueryValueEx(hkey, "GeckoUrl", NULL, &type, (PVOID)url, &size);
1982 if(res == ERROR_SUCCESS && type == REG_SZ)
1985 RegDeleteValue(hkey, "GeckoUrl");
1987 RegSetValueEx(hkey, "GeckoUrl", 0, REG_SZ, (PVOID)url, lstrlenA(url)+1);
1993 START_TEST(webbrowser)
1995 gecko_installer_workaround(TRUE);
1997 container_hwnd = create_container_window();
1999 OleInitialize(NULL);
2005 gecko_installer_workaround(FALSE);