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>
43 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
44 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
46 #define DEFINE_EXPECT(func) \
47 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
49 #define SET_EXPECT(func) \
50 expect_ ## func = TRUE
52 #define CHECK_EXPECT2(func) \
54 ok(expect_ ##func, "unexpected call " #func "\n"); \
55 called_ ## func = TRUE; \
58 #define CHECK_EXPECT(func) \
60 CHECK_EXPECT2(func); \
61 expect_ ## func = FALSE; \
64 #define CHECK_CALLED(func) \
66 ok(called_ ## func, "expected " #func "\n"); \
67 expect_ ## func = called_ ## func = FALSE; \
70 #define CHECK_CALLED_BROKEN(func) \
72 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
73 expect_ ## func = called_ ## func = FALSE; \
76 #define CLEAR_CALLED(func) \
77 expect_ ## func = called_ ## func = FALSE
79 DEFINE_EXPECT(GetContainer
);
80 DEFINE_EXPECT(Site_GetWindow
);
81 DEFINE_EXPECT(ShowObject
);
82 DEFINE_EXPECT(CanInPlaceActivate
);
83 DEFINE_EXPECT(OnInPlaceActivate
);
84 DEFINE_EXPECT(OnUIActivate
);
85 DEFINE_EXPECT(GetWindowContext
);
86 DEFINE_EXPECT(Frame_GetWindow
);
87 DEFINE_EXPECT(Frame_SetActiveObject
);
88 DEFINE_EXPECT(UIWindow_SetActiveObject
);
89 DEFINE_EXPECT(SetMenu
);
90 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
91 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
92 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
93 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
94 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
95 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
96 DEFINE_EXPECT(Invoke_STATUSTEXTCHANGE
);
97 DEFINE_EXPECT(Invoke_PROPERTYCHANGE
);
98 DEFINE_EXPECT(Invoke_DOWNLOADBEGIN
);
99 DEFINE_EXPECT(Invoke_BEFORENAVIGATE2
);
100 DEFINE_EXPECT(Invoke_SETSECURELOCKICON
);
101 DEFINE_EXPECT(Invoke_FILEDOWNLOAD
);
102 DEFINE_EXPECT(Invoke_COMMANDSTATECHANGE
);
103 DEFINE_EXPECT(Invoke_DOWNLOADCOMPLETE
);
104 DEFINE_EXPECT(Invoke_ONMENUBAR
);
105 DEFINE_EXPECT(Invoke_ONADDRESSBAR
);
106 DEFINE_EXPECT(Invoke_ONSTATUSBAR
);
107 DEFINE_EXPECT(Invoke_ONTOOLBAR
);
108 DEFINE_EXPECT(Invoke_ONFULLSCREEN
);
109 DEFINE_EXPECT(Invoke_ONTHEATERMODE
);
110 DEFINE_EXPECT(Invoke_WINDOWSETRESIZABLE
);
111 DEFINE_EXPECT(Invoke_TITLECHANGE
);
112 DEFINE_EXPECT(Invoke_NAVIGATECOMPLETE2
);
113 DEFINE_EXPECT(Invoke_PROGRESSCHANGE
);
114 DEFINE_EXPECT(Invoke_DOCUMENTCOMPLETE
);
115 DEFINE_EXPECT(Invoke_282
);
116 DEFINE_EXPECT(EnableModeless_TRUE
);
117 DEFINE_EXPECT(EnableModeless_FALSE
);
118 DEFINE_EXPECT(GetHostInfo
);
119 DEFINE_EXPECT(GetOptionKeyPath
);
120 DEFINE_EXPECT(GetOverridesKeyPath
);
121 DEFINE_EXPECT(SetStatusText
);
122 DEFINE_EXPECT(UpdateUI
);
123 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
124 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
125 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
126 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
127 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
128 DEFINE_EXPECT(QueryStatus_STOP
);
129 DEFINE_EXPECT(DocHost_EnableModeless_TRUE
);
130 DEFINE_EXPECT(DocHost_EnableModeless_FALSE
);
131 DEFINE_EXPECT(GetDropTarget
);
132 DEFINE_EXPECT(TranslateUrl
);
134 static const WCHAR wszItem
[] = {'i','t','e','m',0};
135 static const WCHAR emptyW
[] = {0};
137 static VARIANT_BOOL exvb
;
138 static IWebBrowser2
*wb
;
140 static HWND container_hwnd
, shell_embedding_hwnd
;
141 static BOOL is_downloading
, is_first_load
;
142 static const char *current_url
;
144 #define DWL_EXPECT_BEFORE_NAVIGATE 0x01
145 #define DWL_FROM_PUT_HREF 0x02
147 static DWORD dwl_flags
;
149 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
152 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
153 return lstrcmpA(stra
, buf
);
156 static const char *debugstr_guid(REFIID riid
)
160 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
161 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
162 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
163 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
168 static BSTR
a2bstr(const char *str
)
173 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
174 ret
= SysAllocStringLen(NULL
, len
);
175 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
180 #define test_LocationURL(a,b) _test_LocationURL(__LINE__,a,b)
181 static void _test_LocationURL(unsigned line
, IUnknown
*unk
, const char *exurl
)
184 BSTR url
= (void*)0xdeadbeef;
187 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
188 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
192 hres
= IWebBrowser2_get_LocationURL(wb
, &url
);
193 ok_(__FILE__
,line
) (hres
== (*exurl
? S_OK
: S_FALSE
), "get_LocationURL failed: %08x\n", hres
);
194 ok_(__FILE__
,line
) (!strcmp_wa(url
, exurl
), "unexpected URL: %s\n", wine_dbgstr_w(url
));
197 IWebBrowser2_Release(wb
);
200 #define test_ready_state(ex) _test_ready_state(__LINE__,ex);
201 static void _test_ready_state(unsigned line
, READYSTATE exstate
)
206 hres
= IWebBrowser2_get_ReadyState(wb
, &state
);
207 ok_(__FILE__
,line
)(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
208 ok_(__FILE__
,line
)(state
== exstate
, "ReadyState = %d, expected %d\n", state
, exstate
);
211 static HRESULT
QueryInterface(REFIID
,void**);
213 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
214 REFIID riid
, void **ppv
)
216 ok(0, "unexpected call\n");
217 return E_NOINTERFACE
;
220 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
225 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
230 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
231 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
233 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
234 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
235 ok(!pCmdText
, "pCmdText != NULL\n");
237 switch(prgCmds
[0].cmdID
) {
239 CHECK_EXPECT2(QueryStatus_STOP
);
240 prgCmds
[0].cmdf
= OLECMDF_SUPPORTED
;
242 case OLECMDID_SETPROGRESSTEXT
:
243 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
244 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
247 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
253 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
254 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
258 case OLECMDID_SETPROGRESSMAX
:
259 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
260 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
261 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
263 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
264 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
266 case OLECMDID_SETPROGRESSPOS
:
267 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
268 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
269 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
271 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
272 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
274 case OLECMDID_SETDOWNLOADSTATE
:
276 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
|| !nCmdexecopt
,
277 "nCmdexecopts=%08x\n", nCmdexecopt
);
279 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
280 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
281 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
282 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
283 switch(V_I4(pvaIn
)) {
285 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_0
);
288 CHECK_EXPECT2(Exec_SETDOWNLOADSTATE_1
);
291 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
295 ok(0, "unexpected nsCmdID %d\n", nCmdID
);
297 }else if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
306 case 101: /* TODO (IE8) */
309 ok(0, "unexpected nCmdID %d\n", nCmdID
);
311 }else if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
314 case 140: /* TODO (Win7) */
317 ok(0, "unexpected nCmdID %d\n", nCmdID
);
319 }else if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
324 ok(0, "unexpected nCmdID %d of CGID_DocHostCmdPriv\n", nCmdID
);
327 ok(0, "unexpected pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup
));
333 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
334 OleCommandTarget_QueryInterface
,
335 OleCommandTarget_AddRef
,
336 OleCommandTarget_Release
,
337 OleCommandTarget_QueryStatus
,
338 OleCommandTarget_Exec
341 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
343 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
345 if(IsEqualGUID(&IID_ITargetContainer
, riid
))
346 return E_NOINTERFACE
; /* TODO */
348 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
)) {
349 *ppv
= &OleCommandTarget
;
353 ok(0, "unexpected call\n");
354 return E_NOINTERFACE
;
357 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
362 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
367 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
368 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
370 ok(0, "unexpected call\n");
374 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
375 IEnumUnknown
**ppenum
)
377 ok(0, "unexpected call\n");
381 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
383 ok(0, "unexpected call\n");
387 static const IOleContainerVtbl OleContainerVtbl
= {
388 OleContainer_QueryInterface
,
390 OleContainer_Release
,
391 OleContainer_ParseDisplayName
,
392 OleContainer_EnumObjects
,
393 OleContainer_LockContainer
396 static IOleContainer OleContainer
= { &OleContainerVtbl
};
398 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
400 return QueryInterface(riid
, ppv
);
403 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
408 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
413 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
415 ok(0, "unexpected call\n");
419 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
422 ok(0, "unexpected call\n");
426 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
427 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
429 ok(0, "unexpected call\n");
433 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
434 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
435 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
437 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
438 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
439 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
440 ok(V_VT(pVarResult
) == VT_EMPTY
, "V_VT(pVarResult)=%d\n", V_VT(pVarResult
));
441 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
442 ok(pDispParams
->rgvarg
== NULL
, "pDispParams->rgvarg = %p\n", pDispParams
->rgvarg
);
443 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
444 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
445 ok(pDispParams
->cArgs
== 0, "pDispParams->cArgs = %d\n", pDispParams
->cArgs
);
446 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
448 switch(dispIdMember
) {
449 case DISPID_AMBIENT_USERMODE
:
450 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
452 case DISPID_AMBIENT_DLCONTROL
:
453 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
454 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
456 case DISPID_AMBIENT_USERAGENT
:
457 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
458 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
460 case DISPID_AMBIENT_PALETTE
:
461 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
462 ok(puArgErr
!= NULL
, "puArgErr=%p\n", puArgErr
);
464 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
465 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
466 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
467 V_VT(pVarResult
) = VT_BOOL
;
468 V_BOOL(pVarResult
) = VARIANT_FALSE
;
470 case DISPID_AMBIENT_SILENT
:
471 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
472 ok(puArgErr
== NULL
, "puArgErr=%p\n", puArgErr
);
473 V_VT(pVarResult
) = VT_BOOL
;
474 V_BOOL(pVarResult
) = VARIANT_FALSE
;
478 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
482 static IDispatchVtbl DispatchVtbl
= {
483 Dispatch_QueryInterface
,
486 Dispatch_GetTypeInfoCount
,
487 Dispatch_GetTypeInfo
,
488 Dispatch_GetIDsOfNames
,
492 static IDispatch Dispatch
= { &DispatchVtbl
};
494 static HRESULT WINAPI
WebBrowserEvents2_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
498 if(IsEqualGUID(&DIID_DWebBrowserEvents2
, riid
)) {
503 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
504 return E_NOINTERFACE
;
507 #define test_invoke_bool(p,s) _test_invoke_bool(__LINE__,p,s)
508 static void _test_invoke_bool(unsigned line
, const DISPPARAMS
*params
, BOOL strict
)
510 ok_(__FILE__
,line
) (params
->rgvarg
!= NULL
, "rgvarg == NULL\n");
511 ok_(__FILE__
,line
) (params
->cArgs
== 1, "cArgs=%d, expected 1\n", params
->cArgs
);
512 ok_(__FILE__
,line
) (V_VT(params
->rgvarg
) == VT_BOOL
, "V_VT(arg)=%d\n", V_VT(params
->rgvarg
));
514 ok_(__FILE__
,line
) (V_BOOL(params
->rgvarg
) == exvb
, "V_VT(arg)=%x, expected %x\n",
515 V_BOOL(params
->rgvarg
), exvb
);
517 ok_(__FILE__
,line
) (!V_BOOL(params
->rgvarg
) == !exvb
, "V_VT(arg)=%x, expected %x\n",
518 V_BOOL(params
->rgvarg
), exvb
);
521 static void test_OnBeforeNavigate(const VARIANT
*disp
, const VARIANT
*url
, const VARIANT
*flags
,
522 const VARIANT
*frame
, const VARIANT
*post_data
, const VARIANT
*headers
, const VARIANT
*cancel
)
524 ok(V_VT(disp
) == VT_DISPATCH
, "V_VT(disp)=%d, expected VT_DISPATCH\n", V_VT(disp
));
525 ok(V_DISPATCH(disp
) != NULL
, "V_DISPATCH(disp) == NULL\n");
526 ok(V_DISPATCH(disp
) == (IDispatch
*)wb
, "V_DISPATCH(disp)=%p, wb=%p\n", V_DISPATCH(disp
), wb
);
528 ok(V_VT(url
) == (VT_BYREF
|VT_VARIANT
), "V_VT(url)=%x, expected VT_BYREF|VT_VARIANT\n", V_VT(url
));
529 ok(V_VARIANTREF(url
) != NULL
, "V_VARIANTREF(url) == NULL)\n");
530 if(V_VARIANTREF(url
)) {
531 ok(V_VT(V_VARIANTREF(url
)) == VT_BSTR
, "V_VT(V_VARIANTREF(url))=%d, expected VT_BSTR\n",
532 V_VT(V_VARIANTREF(url
)));
533 ok(V_BSTR(V_VARIANTREF(url
)) != NULL
, "V_BSTR(V_VARIANTREF(url)) == NULL\n");
534 ok(!strcmp_wa(V_BSTR(V_VARIANTREF(url
)), current_url
), "unexpected url %s, expected %s\n",
535 wine_dbgstr_w(V_BSTR(V_VARIANTREF(url
))), current_url
);
538 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
540 ok(V_VT(flags
) == (VT_BYREF
|VT_VARIANT
), "V_VT(flags)=%x, expected VT_BYREF|VT_VARIANT\n",
542 ok(V_VARIANTREF(flags
) != NULL
, "V_VARIANTREF(flags) == NULL)\n");
543 if(V_VARIANTREF(flags
)) {
544 ok(V_VT(V_VARIANTREF(flags
)) == VT_I4
, "V_VT(V_VARIANTREF(flags))=%d, expected VT_I4\n",
545 V_VT(V_VARIANTREF(flags
)));
547 ok(V_I4(V_VARIANTREF(flags
)) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0\n",
548 V_I4(V_VARIANTREF(flags
)));
550 ok((V_I4(V_VARIANTREF(flags
)) & ~0x40) == 0, "V_I4(V_VARIANTREF(flags)) = %x, expected 0x40 or 0\n",
551 V_I4(V_VARIANTREF(flags
)));
555 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
557 ok(V_VT(frame
) == (VT_BYREF
|VT_VARIANT
), "V_VT(frame)=%x, expected VT_BYREF|VT_VARIANT\n",
559 ok(V_VARIANTREF(frame
) != NULL
, "V_VARIANTREF(frame) == NULL)\n");
560 if(V_VARIANTREF(frame
)) {
561 ok(V_VT(V_VARIANTREF(frame
)) == VT_BSTR
, "V_VT(V_VARIANTREF(frame))=%d, expected VT_BSTR\n",
562 V_VT(V_VARIANTREF(frame
)));
563 ok(V_BSTR(V_VARIANTREF(frame
)) == NULL
, "V_BSTR(V_VARIANTREF(frame)) = %p, expected NULL\n",
564 V_BSTR(V_VARIANTREF(frame
)));
567 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
569 ok(V_VT(post_data
) == (VT_BYREF
|VT_VARIANT
), "V_VT(post_data)=%x, expected VT_BYREF|VT_VARIANT\n",
571 ok(V_VARIANTREF(post_data
) != NULL
, "V_VARIANTREF(post_data) == NULL)\n");
572 if(V_VARIANTREF(post_data
)) {
573 ok(V_VT(V_VARIANTREF(post_data
)) == (VT_VARIANT
|VT_BYREF
),
574 "V_VT(V_VARIANTREF(post_data))=%d, expected VT_VARIANT|VT_BYREF\n",
575 V_VT(V_VARIANTREF(post_data
)));
576 ok(V_VARIANTREF(V_VARIANTREF(post_data
)) != NULL
,
577 "V_VARIANTREF(V_VARIANTREF(post_data)) == NULL\n");
578 if(V_VARIANTREF(V_VARIANTREF(post_data
))) {
579 ok(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == VT_EMPTY
,
580 "V_VT(V_VARIANTREF(V_VARIANTREF(post_data))) = %d, expected VT_EMPTY\n",
581 V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))));
583 if(V_VT(V_VARIANTREF(V_VARIANTREF(post_data
))) == (VT_UI1
|VT_ARRAY
)) {
584 const SAFEARRAY
*sa
= V_ARRAY(V_VARIANTREF(V_VARIANTREF(post_data
)));
586 ok(sa
->cDims
== 1, "sa->cDims = %d, expected 1\n", sa
->cDims
);
587 ok(sa
->fFeatures
== 0, "sa->fFeatures = %d, expected 0\n", sa
->fFeatures
);
592 ok(V_VT(headers
) == (VT_BYREF
|VT_VARIANT
), "V_VT(headers)=%x, expected VT_BYREF|VT_VARIANT\n",
594 ok(V_VARIANTREF(headers
) != NULL
, "V_VARIANTREF(headers) == NULL)\n");
595 if(V_VARIANTREF(headers
)) {
596 ok(V_VT(V_VARIANTREF(headers
)) == VT_BSTR
, "V_VT(V_VARIANTREF(headers))=%d, expected VT_BSTR\n",
597 V_VT(V_VARIANTREF(headers
)));
598 ok(V_BSTR(V_VARIANTREF(headers
)) == NULL
, "V_BSTR(V_VARIANTREF(heders)) = %p, expected NULL\n",
599 V_BSTR(V_VARIANTREF(headers
)));
602 ok(V_VT(cancel
) == (VT_BYREF
|VT_BOOL
), "V_VT(cancel)=%x, expected VT_BYREF|VT_BOOL\n",
604 ok(V_BOOLREF(cancel
) != NULL
, "V_BOOLREF(pDispParams->rgvarg[0] == NULL)\n");
605 if(V_BOOLREF(cancel
))
606 ok(*V_BOOLREF(cancel
) == VARIANT_FALSE
, "*V_BOOLREF(calcel) = %x, expected VARIANT_FALSE\n",
610 static HRESULT WINAPI
WebBrowserEvents2_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
611 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
612 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
614 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
615 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
616 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
617 ok(pVarResult
== NULL
, "pVarResult=%p\n", pVarResult
);
618 ok(wFlags
== DISPATCH_METHOD
, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags
);
619 ok(pDispParams
->rgdispidNamedArgs
== NULL
,
620 "pDispParams->rgdispidNamedArgs = %p\n", pDispParams
->rgdispidNamedArgs
);
621 ok(pDispParams
->cNamedArgs
== 0, "pDispParams->cNamedArgs = %d\n", pDispParams
->cNamedArgs
);
623 switch(dispIdMember
) {
624 case DISPID_STATUSTEXTCHANGE
:
625 CHECK_EXPECT2(Invoke_STATUSTEXTCHANGE
);
627 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
628 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
629 ok(V_VT(pDispParams
->rgvarg
) == VT_BSTR
, "V_VT(pDispParams->rgvarg)=%d, expected VT_BSTR\n",
630 V_VT(pDispParams
->rgvarg
));
631 /* TODO: Check text */
634 case DISPID_PROPERTYCHANGE
:
635 CHECK_EXPECT2(Invoke_PROPERTYCHANGE
);
637 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
638 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
639 /* TODO: Check args */
642 case DISPID_DOWNLOADBEGIN
:
643 CHECK_EXPECT(Invoke_DOWNLOADBEGIN
);
645 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
646 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
647 test_ready_state(READYSTATE_LOADING
);
650 case DISPID_BEFORENAVIGATE2
:
651 CHECK_EXPECT(Invoke_BEFORENAVIGATE2
);
653 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
654 ok(pDispParams
->cArgs
== 7, "cArgs=%d, expected 7\n", pDispParams
->cArgs
);
655 test_OnBeforeNavigate(pDispParams
->rgvarg
+6, pDispParams
->rgvarg
+5, pDispParams
->rgvarg
+4,
656 pDispParams
->rgvarg
+3, pDispParams
->rgvarg
+2, pDispParams
->rgvarg
+1,
657 pDispParams
->rgvarg
);
658 test_ready_state((dwl_flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
661 case DISPID_SETSECURELOCKICON
:
662 CHECK_EXPECT2(Invoke_SETSECURELOCKICON
);
664 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
665 ok(pDispParams
->cArgs
== 1, "cArgs=%d, expected 1\n", pDispParams
->cArgs
);
666 /* TODO: Check args */
669 case DISPID_FILEDOWNLOAD
:
670 CHECK_EXPECT(Invoke_FILEDOWNLOAD
);
672 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
673 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
674 /* TODO: Check args */
677 case DISPID_COMMANDSTATECHANGE
:
678 CHECK_EXPECT2(Invoke_COMMANDSTATECHANGE
);
680 ok(pDispParams
->rgvarg
!= NULL
, "rgvarg == NULL\n");
681 ok(pDispParams
->cArgs
== 2, "cArgs=%d, expected 2\n", pDispParams
->cArgs
);
682 /* TODO: Check args */
685 case DISPID_DOWNLOADCOMPLETE
:
686 CHECK_EXPECT(Invoke_DOWNLOADCOMPLETE
);
688 ok(pDispParams
->rgvarg
== NULL
, "rgvarg=%p, expected NULL\n", pDispParams
->rgvarg
);
689 ok(pDispParams
->cArgs
== 0, "cArgs=%d, expected 0\n", pDispParams
->cArgs
);
690 test_ready_state(READYSTATE_LOADING
);
693 case DISPID_ONMENUBAR
:
694 CHECK_EXPECT(Invoke_ONMENUBAR
);
695 test_invoke_bool(pDispParams
, TRUE
);
698 case DISPID_ONADDRESSBAR
:
699 CHECK_EXPECT(Invoke_ONADDRESSBAR
);
700 test_invoke_bool(pDispParams
, TRUE
);
703 case DISPID_ONSTATUSBAR
:
704 CHECK_EXPECT(Invoke_ONSTATUSBAR
);
705 test_invoke_bool(pDispParams
, TRUE
);
708 case DISPID_ONTOOLBAR
:
709 CHECK_EXPECT(Invoke_ONTOOLBAR
);
710 test_invoke_bool(pDispParams
, FALSE
);
713 case DISPID_ONFULLSCREEN
:
714 CHECK_EXPECT(Invoke_ONFULLSCREEN
);
715 test_invoke_bool(pDispParams
, TRUE
);
718 case DISPID_ONTHEATERMODE
:
719 CHECK_EXPECT(Invoke_ONTHEATERMODE
);
720 test_invoke_bool(pDispParams
, TRUE
);
723 case DISPID_WINDOWSETRESIZABLE
:
724 CHECK_EXPECT(Invoke_WINDOWSETRESIZABLE
);
725 test_invoke_bool(pDispParams
, TRUE
);
728 case DISPID_TITLECHANGE
:
729 CHECK_EXPECT2(Invoke_TITLECHANGE
);
733 case DISPID_NAVIGATECOMPLETE2
:
734 CHECK_EXPECT(Invoke_NAVIGATECOMPLETE2
);
736 test_ready_state((dwl_flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
739 case DISPID_PROGRESSCHANGE
:
740 CHECK_EXPECT(Invoke_PROGRESSCHANGE
);
744 case DISPID_DOCUMENTCOMPLETE
:
745 CHECK_EXPECT(Invoke_DOCUMENTCOMPLETE
);
747 test_ready_state(READYSTATE_COMPLETE
);
750 case 282: /* FIXME */
751 CHECK_EXPECT2(Invoke_282
);
755 ok(0, "unexpected dispIdMember %d\n", dispIdMember
);
761 static IDispatchVtbl WebBrowserEvents2Vtbl
= {
762 WebBrowserEvents2_QueryInterface
,
765 Dispatch_GetTypeInfoCount
,
766 Dispatch_GetTypeInfo
,
767 Dispatch_GetIDsOfNames
,
768 WebBrowserEvents2_Invoke
771 static IDispatch WebBrowserEvents2
= { &WebBrowserEvents2Vtbl
};
773 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
775 return QueryInterface(riid
, ppv
);
778 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
783 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
788 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
790 ok(0, "unexpected call\n");
794 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
797 ok(0, "unexpected call\n");
801 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
803 CHECK_EXPECT(GetContainer
);
805 ok(ppContainer
!= NULL
, "ppContainer == NULL\n");
807 *ppContainer
= &OleContainer
;
812 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
814 CHECK_EXPECT(ShowObject
);
818 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
820 ok(0, "unexpected call\n");
824 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
826 ok(0, "unexpected call\n");
830 static const IOleClientSiteVtbl ClientSiteVtbl
= {
831 ClientSite_QueryInterface
,
834 ClientSite_SaveObject
,
835 ClientSite_GetMoniker
,
836 ClientSite_GetContainer
,
837 ClientSite_ShowObject
,
838 ClientSite_OnShowWindow
,
839 ClientSite_RequestNewObjectLayout
842 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
844 static HRESULT WINAPI
InPlaceUIWindow_QueryInterface(IOleInPlaceFrame
*iface
,
845 REFIID riid
, void **ppv
)
847 ok(0, "unexpected call\n");
848 return E_NOINTERFACE
;
851 static ULONG WINAPI
InPlaceUIWindow_AddRef(IOleInPlaceFrame
*iface
)
856 static ULONG WINAPI
InPlaceUIWindow_Release(IOleInPlaceFrame
*iface
)
861 static HRESULT WINAPI
InPlaceUIWindow_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
863 ok(0, "unexpected call\n");
867 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
869 CHECK_EXPECT(Frame_GetWindow
);
870 ok(phwnd
!= NULL
, "phwnd == NULL\n");
872 *phwnd
= container_hwnd
;
876 static HRESULT WINAPI
InPlaceUIWindow_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
878 ok(0, "unexpected call\n");
882 static HRESULT WINAPI
InPlaceUIWindow_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
884 ok(0, "unexpected call\n");
888 static HRESULT WINAPI
InPlaceUIWindow_RequestBorderSpace(IOleInPlaceFrame
*iface
,
889 LPCBORDERWIDTHS pborderwidths
)
891 ok(0, "unexpected call\n");
895 static HRESULT WINAPI
InPlaceUIWindow_SetBorderSpace(IOleInPlaceFrame
*iface
,
896 LPCBORDERWIDTHS pborderwidths
)
898 ok(0, "unexpected call\n");
902 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
903 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
905 CHECK_EXPECT(UIWindow_SetActiveObject
);
906 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
907 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
911 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
912 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
914 CHECK_EXPECT(Frame_SetActiveObject
);
915 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
916 ok(!lstrcmpW(pszObjName
, wszItem
), "unexpected pszObjName\n");
920 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
921 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
923 ok(0, "unexpected call\n");
927 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
928 HOLEMENU holemenu
, HWND hwndActiveObject
)
930 CHECK_EXPECT(SetMenu
);
931 ok(hmenuShared
== NULL
, "hmenuShared=%p\n", hmenuShared
);
932 ok(holemenu
== NULL
, "holemenu=%p\n", holemenu
);
933 ok(hwndActiveObject
== shell_embedding_hwnd
, "hwndActiveObject=%p, expected %p\n",
934 hwndActiveObject
, shell_embedding_hwnd
);
938 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
940 ok(0, "unexpected call\n");
944 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
946 CHECK_EXPECT2(SetStatusText
);
947 /* FIXME: Check pszStatusText */
951 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
954 CHECK_EXPECT2(EnableModeless_TRUE
);
956 CHECK_EXPECT2(EnableModeless_FALSE
);
960 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
962 ok(0, "unexpected call\n");
966 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
967 InPlaceUIWindow_QueryInterface
,
968 InPlaceUIWindow_AddRef
,
969 InPlaceUIWindow_Release
,
970 InPlaceUIWindow_GetWindow
,
971 InPlaceUIWindow_ContextSensitiveHelp
,
972 InPlaceUIWindow_GetBorder
,
973 InPlaceUIWindow_RequestBorderSpace
,
974 InPlaceUIWindow_SetBorderSpace
,
975 InPlaceUIWindow_SetActiveObject
,
978 static IOleInPlaceUIWindow InPlaceUIWindow
= { (IOleInPlaceUIWindowVtbl
*)&InPlaceUIWindowVtbl
};
980 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
981 InPlaceUIWindow_QueryInterface
,
982 InPlaceUIWindow_AddRef
,
983 InPlaceUIWindow_Release
,
984 InPlaceFrame_GetWindow
,
985 InPlaceUIWindow_ContextSensitiveHelp
,
986 InPlaceUIWindow_GetBorder
,
987 InPlaceUIWindow_RequestBorderSpace
,
988 InPlaceUIWindow_SetBorderSpace
,
989 InPlaceFrame_SetActiveObject
,
990 InPlaceFrame_InsertMenus
,
991 InPlaceFrame_SetMenu
,
992 InPlaceFrame_RemoveMenus
,
993 InPlaceFrame_SetStatusText
,
994 InPlaceFrame_EnableModeless
,
995 InPlaceFrame_TranslateAccelerator
998 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1000 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
1002 return QueryInterface(riid
, ppv
);
1005 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
1010 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
1015 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
1017 CHECK_EXPECT(Site_GetWindow
);
1018 ok(phwnd
!= NULL
, "phwnd == NULL\n");
1020 *phwnd
= container_hwnd
;
1024 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
1026 ok(0, "unexpected call\n");
1030 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1032 CHECK_EXPECT(CanInPlaceActivate
);
1036 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1038 CHECK_EXPECT(OnInPlaceActivate
);
1042 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
1044 CHECK_EXPECT(OnUIActivate
);
1048 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
1049 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1050 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1052 static const RECT pos_rect
= {2,1,1002,901};
1053 static const RECT clip_rect
= {10,10,990,890};
1055 CHECK_EXPECT(GetWindowContext
);
1057 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1059 *ppFrame
= &InPlaceFrame
;
1061 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1063 *ppDoc
= &InPlaceUIWindow
;
1065 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1067 memcpy(lprcPosRect
, &pos_rect
, sizeof(RECT
));
1069 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1071 memcpy(lprcClipRect
, &clip_rect
, sizeof(RECT
));
1073 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1075 lpFrameInfo
->cb
= sizeof(*lpFrameInfo
);
1076 lpFrameInfo
->fMDIApp
= FALSE
;
1077 lpFrameInfo
->hwndFrame
= container_hwnd
;
1078 lpFrameInfo
->haccel
= NULL
;
1079 lpFrameInfo
->cAccelEntries
= 0;
1085 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtant
)
1087 ok(0, "unexpected call\n");
1091 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
1093 ok(0, "unexpected call\n");
1097 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
1099 ok(0, "unexpected call\n");
1103 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
1105 ok(0, "unexpected call\n");
1109 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
1111 ok(0, "unexpected call\n");
1115 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
, LPCRECT lprcPosRect
)
1117 ok(0, "unexpected call\n");
1121 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
,
1122 BOOL
*pNoRedraw
, DWORD dwFlags
)
1124 ok(0, "unexpected call\n");
1128 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
,
1131 ok(0, "unexpected call\n");
1135 static HRESULT WINAPI
InPlaceSite_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
1137 ok(0, "unexpected call\n");
1141 static const IOleInPlaceSiteExVtbl InPlaceSiteExVtbl
= {
1142 InPlaceSite_QueryInterface
,
1144 InPlaceSite_Release
,
1145 InPlaceSite_GetWindow
,
1146 InPlaceSite_ContextSensitiveHelp
,
1147 InPlaceSite_CanInPlaceActivate
,
1148 InPlaceSite_OnInPlaceActivate
,
1149 InPlaceSite_OnUIActivate
,
1150 InPlaceSite_GetWindowContext
,
1152 InPlaceSite_OnUIDeactivate
,
1153 InPlaceSite_OnInPlaceDeactivate
,
1154 InPlaceSite_DiscardUndoState
,
1155 InPlaceSite_DeactivateAndUndo
,
1156 InPlaceSite_OnPosRectChange
,
1157 InPlaceSite_OnInPlaceActivateEx
,
1158 InPlaceSite_OnInPlaceDeactivateEx
,
1159 InPlaceSite_RequestUIActivate
1162 static IOleInPlaceSiteEx InPlaceSite
= { &InPlaceSiteExVtbl
};
1164 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
1166 return QueryInterface(riid
, ppv
);
1169 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
1174 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
1179 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
1180 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
1182 ok(0, "unexpected call %d %p %p %p\n", dwID
, ppt
, pcmdtReserved
, pdicpReserved
);
1186 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
1188 CHECK_EXPECT2(GetHostInfo
);
1189 ok(pInfo
!= NULL
, "pInfo=NULL\n");
1191 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
) || broken(!pInfo
->cbSize
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
1192 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
1193 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
1194 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
1195 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
1200 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
1201 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
1202 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
1204 ok(0, "unexpected call\n");
1208 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
1210 ok(0, "unexpected call\n");
1214 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
1216 CHECK_EXPECT(UpdateUI
);
1220 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
1223 CHECK_EXPECT(DocHost_EnableModeless_TRUE
);
1225 CHECK_EXPECT(DocHost_EnableModeless_FALSE
);
1230 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1232 ok(0, "unexpected call\n");
1236 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1238 ok(0, "unexpected call\n");
1242 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
1243 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
1245 ok(0, "unexpected call\n");
1249 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
1250 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
1252 ok(0, "unexpected call\n");
1256 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
1257 LPOLESTR
*pchKey
, DWORD dw
)
1259 CHECK_EXPECT(GetOptionKeyPath
);
1260 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1262 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1263 ok(!dw
, "dw=%x\n", dw
);
1267 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
1268 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
1270 CHECK_EXPECT(GetDropTarget
);
1274 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
1276 ok(0, "unexpected call\n");
1280 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
1281 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
1283 if(is_downloading
&& !(dwl_flags
& DWL_EXPECT_BEFORE_NAVIGATE
))
1284 todo_wine
CHECK_EXPECT(TranslateUrl
);
1286 CHECK_EXPECT(TranslateUrl
);
1290 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
1291 IDataObject
**ppPORet
)
1293 ok(0, "unexpected call\n");
1297 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
1298 LPOLESTR
*pchKey
, DWORD dw
)
1300 CHECK_EXPECT(GetOverridesKeyPath
);
1301 ok(pchKey
!= NULL
, "pchKey==NULL\n");
1303 ok(*pchKey
== NULL
, "*pchKey=%p\n", *pchKey
);
1304 ok(!dw
, "dw=%x\n", dw
);
1308 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
1309 DocHostUIHandler_QueryInterface
,
1310 DocHostUIHandler_AddRef
,
1311 DocHostUIHandler_Release
,
1312 DocHostUIHandler_ShowContextMenu
,
1313 DocHostUIHandler_GetHostInfo
,
1314 DocHostUIHandler_ShowUI
,
1315 DocHostUIHandler_HideUI
,
1316 DocHostUIHandler_UpdateUI
,
1317 DocHostUIHandler_EnableModeless
,
1318 DocHostUIHandler_OnDocWindowActivate
,
1319 DocHostUIHandler_OnFrameWindowActivate
,
1320 DocHostUIHandler_ResizeBorder
,
1321 DocHostUIHandler_TranslateAccelerator
,
1322 DocHostUIHandler_GetOptionKeyPath
,
1323 DocHostUIHandler_GetDropTarget
,
1324 DocHostUIHandler_GetExternal
,
1325 DocHostUIHandler_TranslateUrl
,
1326 DocHostUIHandler_FilterDataObject
,
1327 DocHostUIHandler_GetOverrideKeyPath
1330 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
1333 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
1335 return QueryInterface(riid
, ppv
);
1338 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
1343 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
1348 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
,
1349 REFGUID guidService
, REFIID riid
, void **ppv
)
1353 if (IsEqualGUID(&SID_STopLevelBrowser
, guidService
))
1354 trace("Service SID_STopLevelBrowser\n");
1355 else if (IsEqualGUID(&SID_SEditCommandTarget
, guidService
))
1356 trace("Service SID_SEditCommandTarget\n");
1357 else if (IsEqualGUID(&IID_ITargetFrame2
, guidService
))
1358 trace("Service IID_ITargetFrame2\n");
1359 else if (IsEqualGUID(&SID_SInternetSecurityManager
, guidService
))
1360 trace("Service SID_SInternetSecurityManager\n");
1361 else if (IsEqualGUID(&SID_SOleUndoManager
, guidService
))
1362 trace("Service SID_SOleUndoManager\n");
1363 else if (IsEqualGUID(&SID_IMimeInfo
, guidService
))
1364 trace("Service SID_IMimeInfo\n");
1365 else if (IsEqualGUID(&SID_STopWindow
, guidService
))
1366 trace("Service SID_STopWindow\n");
1368 /* 30D02401-6A81-11D0-8274-00C04FD5AE38 Explorer Bar: Search */
1369 /* D1E7AFEC-6A2E-11D0-8C78-00C04FD918B4 no info */
1370 /* A9227C3C-7F8E-11D0-8CB0-00A0C92DBFE8 no info */
1371 /* 371EA634-DC5C-11D1-BA57-00C04FC2040E one reference to IVersionHost */
1372 /* 3050F429-98B5-11CF-BB82-00AA00BDCE0B IID_IElementBehaviorFactory */
1373 /* 6D12FE80-7911-11CF-9534-0000C05BAE0B SID_DefView */
1374 /* AD7F6C62-F6BD-11D2-959B-006097C553C8 no info */
1375 /* 53A2D5B1-D2FC-11D0-84E0-006097C9987D no info */
1376 /* 3050F312-98B5-11CF-BB82-00AA00BDCE0B HTMLFrameBaseClass */
1377 /* 639447BD-B2D3-44B9-9FB0-510F23CB45E4 no info */
1378 /* 20C46561-8491-11CF-960C-0080C7F4EE85 no info */
1381 trace("Service %s not supported\n", debugstr_guid(guidService
));
1383 return E_NOINTERFACE
;
1387 static const IServiceProviderVtbl ServiceProviderVtbl
= {
1388 ServiceProvider_QueryInterface
,
1389 ServiceProvider_AddRef
,
1390 ServiceProvider_Release
,
1391 ServiceProvider_QueryService
1394 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
1397 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
1401 if(IsEqualGUID(&IID_IUnknown
, riid
)
1402 || IsEqualGUID(&IID_IOleClientSite
, riid
))
1404 else if(IsEqualGUID(&IID_IOleWindow
, riid
)
1405 || IsEqualGUID(&IID_IOleInPlaceSite
, riid
)
1406 || IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
1407 *ppv
= &InPlaceSite
;
1408 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
)
1409 || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
1410 *ppv
= &DocHostUIHandler
;
1411 else if(IsEqualGUID(&IID_IDispatch
, riid
))
1413 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
1414 *ppv
= &ServiceProvider
;
1415 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
1416 trace("interface IID_IDocHostShowUI\n");
1417 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
1418 trace("interface IID_IOleControlSite\n");
1419 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
1420 trace("interface IID_IOleCommandTarget\n");
1422 /* B6EA2050-048A-11D1-82B9-00C04FB9942E IAxWinHostWindow */
1426 /* are there more interfaces, that a host can support? */
1427 trace("%s: interface not supported\n", debugstr_guid(riid
));
1430 return (*ppv
) ? S_OK
: E_NOINTERFACE
;
1433 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1435 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
1438 static HWND
create_container_window(void)
1440 static const WCHAR wszWebBrowserContainer
[] =
1441 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1442 static WNDCLASSEXW wndclass
= {
1443 sizeof(WNDCLASSEXW
),
1446 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
1447 wszWebBrowserContainer
,
1451 RegisterClassExW(&wndclass
);
1452 return CreateWindowW(wszWebBrowserContainer
, wszWebBrowserContainer
,
1453 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
1454 CW_USEDEFAULT
, NULL
, NULL
, NULL
, NULL
);
1457 static void test_DoVerb(IUnknown
*unk
)
1460 RECT rect
= {0,0,1000,1000};
1463 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1464 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1468 SET_EXPECT(CanInPlaceActivate
);
1469 SET_EXPECT(Site_GetWindow
);
1470 SET_EXPECT(OnInPlaceActivate
);
1471 SET_EXPECT(GetWindowContext
);
1472 SET_EXPECT(ShowObject
);
1473 SET_EXPECT(GetContainer
);
1474 SET_EXPECT(Frame_GetWindow
);
1475 SET_EXPECT(OnUIActivate
);
1476 SET_EXPECT(Frame_SetActiveObject
);
1477 SET_EXPECT(UIWindow_SetActiveObject
);
1478 SET_EXPECT(SetMenu
);
1480 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1481 0, (HWND
)0xdeadbeef, &rect
);
1482 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1484 CHECK_CALLED(CanInPlaceActivate
);
1485 CHECK_CALLED(Site_GetWindow
);
1486 CHECK_CALLED(OnInPlaceActivate
);
1487 CHECK_CALLED(GetWindowContext
);
1488 CHECK_CALLED(ShowObject
);
1489 CHECK_CALLED(GetContainer
);
1490 CHECK_CALLED(Frame_GetWindow
);
1491 CHECK_CALLED(OnUIActivate
);
1492 CHECK_CALLED(Frame_SetActiveObject
);
1493 CHECK_CALLED(UIWindow_SetActiveObject
);
1494 CHECK_CALLED(SetMenu
);
1496 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1497 0, (HWND
)0xdeadbeef, &rect
);
1498 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1500 IOleObject_Release(oleobj
);
1503 static void test_GetMiscStatus(IOleObject
*oleobj
)
1508 for(i
=0; i
<10; i
++) {
1510 hres
= IOleObject_GetMiscStatus(oleobj
, i
, &st
);
1511 ok(hres
== S_OK
, "GetMiscStatus failed: %08x\n", hres
);
1512 ok(st
== (OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
1513 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
),
1514 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1515 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st
);
1519 static void test_SetHostNames(IOleObject
*oleobj
)
1523 static const WCHAR test_appW
[] = {'t','e','s','t',' ','a','p','p',0};
1525 hres
= IOleObject_SetHostNames(oleobj
, test_appW
, (void*)0xdeadbeef);
1526 ok(hres
== S_OK
, "SetHostNames failed: %08x\n", hres
);
1529 static void test_ClientSite(IUnknown
*unk
, IOleClientSite
*client
, BOOL stop_download
)
1532 IOleInPlaceObject
*inplace
;
1536 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1537 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1541 test_GetMiscStatus(oleobj
);
1542 test_SetHostNames(oleobj
);
1544 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceObject
, (void**)&inplace
);
1545 ok(hres
== S_OK
, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres
);
1547 IOleObject_Release(oleobj
);
1551 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1552 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1553 ok((hwnd
== NULL
) ^ (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1556 SET_EXPECT(GetContainer
);
1557 SET_EXPECT(Site_GetWindow
);
1558 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1559 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1560 }else if(stop_download
) {
1561 SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
1562 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
1563 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
1566 hres
= IOleObject_SetClientSite(oleobj
, client
);
1567 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1570 CHECK_CALLED(GetContainer
);
1571 CHECK_CALLED(Site_GetWindow
);
1572 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1573 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1574 }else if(stop_download
) {
1575 todo_wine
CHECK_CALLED(Invoke_DOWNLOADCOMPLETE
);
1576 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
1577 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
1580 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1581 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1582 ok((hwnd
== NULL
) == (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1584 shell_embedding_hwnd
= hwnd
;
1586 test_SetHostNames(oleobj
);
1588 IOleInPlaceObject_Release(inplace
);
1589 IOleObject_Release(oleobj
);
1592 static void test_ClassInfo(IUnknown
*unk
)
1594 IProvideClassInfo2
*class_info
;
1598 hres
= IUnknown_QueryInterface(unk
, &IID_IProvideClassInfo2
, (void**)&class_info
);
1599 ok(hres
== S_OK
, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres
);
1603 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, &guid
);
1604 ok(hres
== S_OK
, "GetGUID failed: %08x\n", hres
);
1605 ok(IsEqualGUID(&DIID_DWebBrowserEvents2
, &guid
), "wrong guid\n");
1607 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, &guid
);
1608 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1609 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1611 hres
= IProvideClassInfo2_GetGUID(class_info
, 2, &guid
);
1612 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1613 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1615 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, NULL
);
1616 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1618 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, NULL
);
1619 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1621 IProvideClassInfo2_Release(class_info
);
1624 static void test_ie_funcs(IUnknown
*unk
)
1634 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
1635 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
1642 hres
= IWebBrowser2_get_HWND(wb
, &hwnd
);
1643 ok(hres
== E_FAIL
, "get_HWND failed: %08x, expected E_FAIL\n", hres
);
1644 ok(hwnd
== 0, "unexpected hwnd %x\n", hwnd
);
1648 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1649 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1650 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1652 SET_EXPECT(Invoke_ONMENUBAR
);
1653 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= VARIANT_FALSE
));
1654 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1655 CHECK_CALLED(Invoke_ONMENUBAR
);
1657 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1658 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1659 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1661 SET_EXPECT(Invoke_ONMENUBAR
);
1662 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= 100));
1663 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1664 CHECK_CALLED(Invoke_ONMENUBAR
);
1666 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1667 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1668 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1672 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1673 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1674 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1676 SET_EXPECT(Invoke_ONADDRESSBAR
);
1677 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_FALSE
));
1678 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1679 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1681 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1682 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1683 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1685 SET_EXPECT(Invoke_ONADDRESSBAR
);
1686 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= 100));
1687 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1688 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1690 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1691 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1692 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1694 SET_EXPECT(Invoke_ONADDRESSBAR
);
1695 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_TRUE
));
1696 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1697 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1701 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1702 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1703 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1705 SET_EXPECT(Invoke_ONSTATUSBAR
);
1706 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_TRUE
));
1707 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1708 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1710 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1711 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1712 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1714 SET_EXPECT(Invoke_ONSTATUSBAR
);
1715 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_FALSE
));
1716 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1717 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1719 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1720 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1721 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1723 SET_EXPECT(Invoke_ONSTATUSBAR
);
1724 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= 100));
1725 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1726 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1728 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1729 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1730 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1734 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1735 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1738 SET_EXPECT(Invoke_ONTOOLBAR
);
1739 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_FALSE
));
1740 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1741 CHECK_CALLED(Invoke_ONTOOLBAR
);
1743 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1744 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1745 ok(i
== VARIANT_FALSE
, "b=%x\n", i
);
1747 SET_EXPECT(Invoke_ONTOOLBAR
);
1748 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= 100));
1749 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1750 CHECK_CALLED(Invoke_ONTOOLBAR
);
1752 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1753 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1756 SET_EXPECT(Invoke_ONTOOLBAR
);
1757 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_TRUE
));
1758 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1759 CHECK_CALLED(Invoke_ONTOOLBAR
);
1763 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1764 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1765 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1767 SET_EXPECT(Invoke_ONFULLSCREEN
);
1768 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_TRUE
));
1769 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1770 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1772 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1773 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1774 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1776 SET_EXPECT(Invoke_ONFULLSCREEN
);
1777 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= 100));
1778 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1779 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1781 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1782 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1783 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1785 SET_EXPECT(Invoke_ONFULLSCREEN
);
1786 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_FALSE
));
1787 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1788 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1792 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1793 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1794 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1796 SET_EXPECT(Invoke_ONTHEATERMODE
);
1797 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_TRUE
));
1798 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1799 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1801 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1802 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1803 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1805 SET_EXPECT(Invoke_ONTHEATERMODE
);
1806 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= 100));
1807 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1808 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1810 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1811 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1812 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1814 SET_EXPECT(Invoke_ONTHEATERMODE
);
1815 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_FALSE
));
1816 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1817 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1822 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
1823 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
1824 ok(b
== 0x100, "b=%x\n", b
);
1826 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
1827 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_TRUE
));
1828 ok(hres
== S_OK
|| broken(hres
== E_NOTIMPL
), "put_Resizable failed: %08x\n", hres
);
1829 CHECK_CALLED_BROKEN(Invoke_WINDOWSETRESIZABLE
);
1831 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
1832 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_FALSE
));
1833 ok(hres
== S_OK
|| broken(hres
== E_NOTIMPL
), "put_Resizable failed: %08x\n", hres
);
1834 CHECK_CALLED_BROKEN(Invoke_WINDOWSETRESIZABLE
);
1836 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
1837 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
1838 ok(b
== 0x100, "b=%x\n", b
);
1843 hres
= IWebBrowser2_get_Application(wb
, &disp
);
1844 ok(hres
== S_OK
, "get_Application failed: %08x\n", hres
);
1845 ok(disp
== (void*)wb
, "disp=%p, expected %p\n", disp
, wb
);
1847 IDispatch_Release(disp
);
1849 hres
= IWebBrowser2_get_Application(wb
, NULL
);
1850 ok(hres
== E_POINTER
, "get_Application failed: %08x, expected E_POINTER\n", hres
);
1853 hres
= IWebBrowser2_get_Name(wb
, &sName
);
1854 ok(hres
== S_OK
, "getName failed: %08x, expected S_OK\n", hres
);
1855 if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == LANG_ENGLISH
)
1856 ok(!strcmp_wa(sName
, "Microsoft Web Browser Control"), "got '%s', expected 'Microsoft Web Browser Control'\n", wine_dbgstr_w(sName
));
1857 else /* Non-English cannot be blank. */
1858 ok(sName
!=NULL
, "get_Name return a NULL string.\n");
1859 SysFreeString(sName
);
1863 hres
= IWebBrowser2_Quit(wb
);
1864 ok(hres
== E_FAIL
, "Quit failed: %08x, expected E_FAIL\n", hres
);
1866 IWebBrowser2_Release(wb
);
1869 static void test_Silent(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1875 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1876 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1877 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1879 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
1880 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1883 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1884 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1885 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1887 hres
= IWebBrowser2_put_Silent(wb
, 100);
1888 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1891 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1892 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1893 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1895 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_FALSE
);
1896 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1899 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1900 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1901 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1904 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
1905 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1907 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1910 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
1911 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1914 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1917 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1918 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1919 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1922 static void test_Offline(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1928 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1929 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1930 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1932 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
1933 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1936 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1937 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1938 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1940 hres
= IWebBrowser2_put_Offline(wb
, 100);
1941 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1944 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1945 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1946 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1948 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_FALSE
);
1949 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1952 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1953 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1954 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1957 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
1958 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1960 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1963 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
1964 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1967 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1970 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1971 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1972 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1975 static void test_ambient_unknown(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1979 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1980 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1981 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
1982 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
1983 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
1984 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
1986 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_UNKNOWN
);
1987 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1989 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1990 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
1991 CHECK_EXPECT(Invoke_AMBIENT_USERMODE
);
1992 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
1993 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
1994 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
1996 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1997 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
1998 CLEAR_CALLED(Invoke_AMBIENT_USERMODE
);
1999 CLEAR_CALLED(Invoke_AMBIENT_DLCONTROL
);
2000 CLEAR_CALLED(Invoke_AMBIENT_USERAGENT
);
2001 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
);
2004 static void test_wb_funcs(IUnknown
*unk
, BOOL is_clientsite
)
2007 IOleControl
*control
;
2010 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2011 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
2013 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2014 ok(hres
== S_OK
, "Could not get IOleControl interface: %08x\n", hres
);
2016 test_Silent(wb
, control
, is_clientsite
);
2017 test_Offline(wb
, control
, is_clientsite
);
2018 test_ambient_unknown(wb
, control
, is_clientsite
);
2020 IWebBrowser_Release(wb
);
2021 IOleControl_Release(control
);
2024 static void test_GetControlInfo(IUnknown
*unk
)
2026 IOleControl
*control
;
2030 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2031 ok(hres
== S_OK
, "Could not get IOleControl: %08x\n", hres
);
2035 hres
= IOleControl_GetControlInfo(control
, &info
);
2036 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2037 hres
= IOleControl_GetControlInfo(control
, NULL
);
2038 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2040 IOleControl_Release(control
);
2043 static void test_Extent(IUnknown
*unk
)
2046 SIZE size
, expected
;
2052 /* default aspect ratio is 96dpi / 96dpi */
2054 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
2055 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
2057 if (dpi_x
!= 96 || dpi_y
!= 96)
2058 trace("dpi: %d / %d\n", dpi_y
, dpi_y
);
2060 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
2061 ok(hres
== S_OK
, "Could not get IOleObkect: %08x\n", hres
);
2065 size
.cx
= size
.cy
= 0xdeadbeef;
2066 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2067 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2068 /* Default size is 50x20 pixels, in himetric units */
2069 expected
.cx
= MulDiv( 50, 2540, dpi_x
);
2070 expected
.cy
= MulDiv( 20, 2540, dpi_y
);
2071 ok(size
.cx
== expected
.cx
&& size
.cy
== expected
.cy
, "size = {%d %d} (expected %d %d)\n",
2072 size
.cx
, size
.cy
, expected
.cx
, expected
.cy
);
2076 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2077 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2079 size
.cx
= size
.cy
= 0xdeadbeef;
2080 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2081 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2082 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2084 size
.cx
= size
.cy
= 0xdeadbeef;
2085 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2086 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2087 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2091 hres
= IOleObject_SetExtent(oleobj
, 0, &size
);
2092 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2094 size
.cx
= size
.cy
= 0xdeadbeef;
2095 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2096 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2097 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2099 size
.cx
= size
.cy
= 0xdeadbeef;
2100 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2101 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2102 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2106 hres
= IOleObject_SetExtent(oleobj
, 0xdeadbeef, &size
);
2107 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2109 size
.cx
= size
.cy
= 0xdeadbeef;
2110 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2111 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2112 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2114 size
.cx
= size
.cy
= 0xdeadbeef;
2115 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2116 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2117 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2119 IOleObject_Release(oleobj
);
2122 static void test_ConnectionPoint(IUnknown
*unk
, BOOL init
)
2124 IConnectionPointContainer
*container
;
2125 IConnectionPoint
*point
;
2128 static DWORD dw
= 100;
2130 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2131 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2135 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &DIID_DWebBrowserEvents2
, &point
);
2136 IConnectionPointContainer_Release(container
);
2137 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2142 hres
= IConnectionPoint_Advise(point
, (IUnknown
*)&WebBrowserEvents2
, &dw
);
2143 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2144 ok(dw
== 1, "dw=%d, expected 1\n", dw
);
2146 hres
= IConnectionPoint_Unadvise(point
, dw
);
2147 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
2150 IConnectionPoint_Release(point
);
2153 static void test_Navigate2(IUnknown
*unk
)
2155 IWebBrowser2
*webbrowser
;
2159 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&webbrowser
);
2160 ok(hres
== S_OK
, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres
);
2164 test_LocationURL(unk
, is_first_load
? "" : current_url
);
2165 test_ready_state(is_first_load
? READYSTATE_UNINITIALIZED
: READYSTATE_COMPLETE
);
2167 V_VT(&url
) = VT_BSTR
;
2168 V_BSTR(&url
) = a2bstr("about:blank");
2169 current_url
= "about:blank";
2172 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2173 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2174 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2175 SET_EXPECT(Invoke_DOWNLOADBEGIN
);
2176 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2177 SET_EXPECT(EnableModeless_FALSE
);
2178 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2179 SET_EXPECT(SetStatusText
);
2180 SET_EXPECT(GetHostInfo
);
2181 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2182 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2183 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2184 SET_EXPECT(GetOptionKeyPath
);
2185 SET_EXPECT(GetOverridesKeyPath
);
2186 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2187 SET_EXPECT(Exec_SETPROGRESSMAX
);
2188 SET_EXPECT(Exec_SETPROGRESSPOS
);
2189 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2190 SET_EXPECT(Invoke_FILEDOWNLOAD
);
2191 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2192 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2193 SET_EXPECT(EnableModeless_TRUE
);
2196 hres
= IWebBrowser2_Navigate2(webbrowser
, &url
, NULL
, NULL
, NULL
, NULL
);
2197 ok(hres
== S_OK
, "Navigate2 failed: %08x\n", hres
);
2200 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
2201 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2202 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2203 todo_wine
CHECK_CALLED(Invoke_DOWNLOADBEGIN
);
2204 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2205 CHECK_CALLED(EnableModeless_FALSE
);
2206 CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2207 CHECK_CALLED(SetStatusText
);
2208 CHECK_CALLED(GetHostInfo
);
2209 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
2210 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
2211 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
2212 CHECK_CALLED(GetOptionKeyPath
);
2213 CHECK_CALLED_BROKEN(GetOverridesKeyPath
);
2214 todo_wine
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
2215 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2216 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2217 todo_wine
CHECK_CALLED_BROKEN(Invoke_SETSECURELOCKICON
);
2218 todo_wine
CHECK_CALLED_BROKEN(Invoke_FILEDOWNLOAD
);
2219 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2220 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2221 CHECK_CALLED(EnableModeless_TRUE
);
2225 IWebBrowser2_Release(webbrowser
);
2227 test_ready_state(READYSTATE_LOADING
);
2230 static void test_download(DWORD flags
)
2234 is_downloading
= TRUE
;
2237 test_ready_state((flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
2239 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2240 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2241 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2242 SET_EXPECT(TranslateUrl
);
2244 SET_EXPECT(Exec_SETPROGRESSMAX
);
2245 SET_EXPECT(Exec_SETPROGRESSPOS
);
2246 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2247 SET_EXPECT(DocHost_EnableModeless_FALSE
);
2248 SET_EXPECT(DocHost_EnableModeless_TRUE
);
2249 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2250 SET_EXPECT(Invoke_282
);
2251 SET_EXPECT(EnableModeless_FALSE
);
2252 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2253 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2254 SET_EXPECT(SetStatusText
);
2255 SET_EXPECT(EnableModeless_TRUE
);
2257 SET_EXPECT(QueryStatus_STOP
);
2259 SET_EXPECT(GetHostInfo
);
2260 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2261 SET_EXPECT(Invoke_TITLECHANGE
);
2262 SET_EXPECT(Invoke_NAVIGATECOMPLETE2
);
2264 SET_EXPECT(GetDropTarget
);
2265 SET_EXPECT(Invoke_PROGRESSCHANGE
);
2266 SET_EXPECT(Invoke_DOCUMENTCOMPLETE
);
2267 while(!called_Invoke_DOCUMENTCOMPLETE
&& GetMessage(&msg
, NULL
, 0, 0)) {
2268 TranslateMessage(&msg
);
2269 DispatchMessage(&msg
);
2272 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2273 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2274 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2275 CHECK_CALLED(TranslateUrl
);
2277 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2278 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2279 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2280 CLEAR_CALLED(DocHost_EnableModeless_FALSE
); /* IE 7 */
2281 CLEAR_CALLED(DocHost_EnableModeless_TRUE
); /* IE 7 */
2282 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2283 CLEAR_CALLED(Invoke_282
); /* IE 7 */
2285 todo_wine
CHECK_CALLED(EnableModeless_FALSE
);
2287 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2288 CLEAR_CALLED(Invoke_COMMANDSTATECHANGE
);
2289 todo_wine
CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2290 todo_wine
CHECK_CALLED(SetStatusText
);
2292 todo_wine
CHECK_CALLED(EnableModeless_TRUE
);
2294 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2296 todo_wine
CHECK_CALLED(QueryStatus_STOP
);
2298 todo_wine
CHECK_CALLED(GetHostInfo
);
2299 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2300 todo_wine
CHECK_CALLED(Invoke_TITLECHANGE
);
2301 CHECK_CALLED(Invoke_NAVIGATECOMPLETE2
);
2303 todo_wine
CHECK_CALLED(GetDropTarget
);
2304 todo_wine
CHECK_CALLED(Invoke_PROGRESSCHANGE
);
2305 CHECK_CALLED(Invoke_DOCUMENTCOMPLETE
);
2307 is_downloading
= FALSE
;
2309 test_ready_state(READYSTATE_COMPLETE
);
2312 static void test_olecmd(IUnknown
*unk
, BOOL loaded
)
2314 IOleCommandTarget
*cmdtrg
;
2318 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2319 ok(hres
== S_OK
, "Could not get IOleCommandTarget iface: %08x\n", hres
);
2323 cmds
[0].cmdID
= OLECMDID_SPELL
;
2324 cmds
[0].cmdf
= 0xdeadbeef;
2325 cmds
[1].cmdID
= OLECMDID_REFRESH
;
2326 cmds
[1].cmdf
= 0xdeadbeef;
2327 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmds
, NULL
);
2329 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2330 ok(cmds
[0].cmdf
== OLECMDF_SUPPORTED
, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2331 ok(cmds
[1].cmdf
== (OLECMDF_ENABLED
|OLECMDF_SUPPORTED
),
2332 "OLECMDID_REFRESH cmdf = %x\n", cmds
[1].cmdf
);
2334 ok(hres
== 0x80040104, "QueryStatus failed: %08x\n", hres
);
2335 ok(cmds
[0].cmdf
== 0xdeadbeef, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2336 ok(cmds
[1].cmdf
== 0xdeadbeef, "OLECMDID_REFRESH cmdf = %x\n", cmds
[0].cmdf
);
2339 IOleCommandTarget_Release(cmdtrg
);
2342 static void test_IServiceProvider(IUnknown
*unk
)
2344 IServiceProvider
*servprov
= (void*)0xdeadbeef;
2346 IUnknown
*ret
= NULL
;
2347 static const IID IID_IBrowserService2
=
2348 {0x68BD21CC,0x438B,0x11d2,{0xA5,0x60,0x00,0xA0,0xC,0x2D,0xBF,0xE8}};
2350 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&servprov
);
2351 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
2355 hres
= IServiceProvider_QueryService(servprov
, &SID_STopLevelBrowser
, &IID_IBrowserService2
, (LPVOID
*)&ret
);
2356 ok(hres
== E_FAIL
, "QueryService returned %08x, expected E_FAIL\n", hres
);
2357 ok(ret
== NULL
, "ret returned %p, expected NULL\n", ret
);
2360 IUnknown_Release(ret
);
2363 IServiceProvider_Release(servprov
);
2366 #define get_document(u) _get_document(__LINE__,u)
2367 static IDispatch
*_get_document(unsigned line
, IUnknown
*unk
)
2373 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2374 ok_(__FILE__
,line
)(hres
== S_OK
, "QueryInterface(IID_IWebBrowser2) failed: %08x\n", hres
);
2377 hres
= IWebBrowser2_get_Document(wb
, &disp
);
2378 IWebBrowser2_Release(wb
);
2379 ok_(__FILE__
,line
)(hres
== S_OK
, "get_Document failed: %08x\n", hres
);
2380 ok_(__FILE__
,line
)(disp
!= NULL
, "doc_disp == NULL\n");
2385 static void test_put_href(IUnknown
*unk
)
2387 IHTMLLocation
*location
;
2388 IHTMLDocument2
*doc
;
2389 IDispatch
*doc_disp
;
2393 doc_disp
= get_document(unk
);
2395 hres
= IDispatch_QueryInterface(doc_disp
, &IID_IHTMLDocument2
, (void**)&doc
);
2396 IDispatch_Release(doc_disp
);
2397 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2 failed: %08x\n", hres
);
2400 hres
= IHTMLDocument2_get_location(doc
, &location
);
2401 IHTMLDocument2_Release(doc
);
2402 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2403 ok(location
!= NULL
, "location == NULL\n");
2405 SET_EXPECT(TranslateUrl
);
2406 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2407 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2409 dwl_flags
= DWL_FROM_PUT_HREF
;
2411 str
= a2bstr("about:test");
2412 current_url
= "about:test";
2413 is_first_load
= FALSE
;
2414 hres
= IHTMLLocation_put_href(location
, str
);
2416 CHECK_CALLED(TranslateUrl
);
2417 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2418 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2420 IHTMLLocation_Release(location
);
2422 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
2424 test_ready_state(READYSTATE_COMPLETE
);
2427 static void test_QueryInterface(IUnknown
*unk
)
2429 IQuickActivate
*qa
= (IQuickActivate
*)0xdeadbeef;
2430 IRunnableObject
*runnable
= (IRunnableObject
*)0xdeadbeef;
2431 IPerPropertyBrowsing
*propbrowse
= (void*)0xdeadbeef;
2432 IOleInPlaceSite
*inplace
= (void*)0xdeadbeef;
2433 IOleCache
*cache
= (void*)0xdeadbeef;
2434 IObjectWithSite
*site
= (void*)0xdeadbeef;
2435 IViewObjectEx
*viewex
= (void*)0xdeadbeef;
2438 hres
= IUnknown_QueryInterface(unk
, &IID_IQuickActivate
, (void**)&qa
);
2439 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2440 ok(qa
== NULL
, "qa=%p, expected NULL\n", qa
);
2442 hres
= IUnknown_QueryInterface(unk
, &IID_IRunnableObject
, (void**)&runnable
);
2443 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2444 ok(runnable
== NULL
, "runnable=%p, expected NULL\n", runnable
);
2446 hres
= IUnknown_QueryInterface(unk
, &IID_IPerPropertyBrowsing
, (void**)&propbrowse
);
2447 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2448 ok(propbrowse
== NULL
, "propbrowse=%p, expected NULL\n", propbrowse
);
2450 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCache
, (void**)&cache
);
2451 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2452 ok(cache
== NULL
, "cache=%p, expected NULL\n", cache
);
2454 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceSite
, (void**)&inplace
);
2455 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2456 ok(inplace
== NULL
, "inplace=%p, expected NULL\n", inplace
);
2458 hres
= IUnknown_QueryInterface(unk
, &IID_IObjectWithSite
, (void**)&site
);
2459 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2460 ok(site
== NULL
, "site=%p, expected NULL\n", site
);
2462 hres
= IUnknown_QueryInterface(unk
, &IID_IViewObjectEx
, (void**)&viewex
);
2463 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2464 ok(viewex
== NULL
, "viewex=%p, expected NULL\n", viewex
);
2468 static void test_WebBrowser(BOOL do_download
)
2470 IUnknown
*unk
= NULL
;
2474 hres
= CoCreateInstance(&CLSID_WebBrowser
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2475 &IID_IUnknown
, (void**)&unk
);
2476 ok(hres
== S_OK
, "CoCreateInterface failed: %08x\n", hres
);
2480 is_downloading
= FALSE
;
2481 is_first_load
= TRUE
;
2483 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2484 ok(hres
== S_OK
, "Could not get IWebBrowser2 iface: %08x\n", hres
);
2486 test_QueryInterface(unk
);
2487 test_ready_state(READYSTATE_UNINITIALIZED
);
2488 test_ClassInfo(unk
);
2489 test_LocationURL(unk
, "");
2490 test_ConnectionPoint(unk
, TRUE
);
2491 test_ClientSite(unk
, &ClientSite
, !do_download
);
2493 test_wb_funcs(unk
, TRUE
);
2495 test_olecmd(unk
, FALSE
);
2496 test_Navigate2(unk
);
2499 IDispatch
*doc
, *doc2
;
2502 test_olecmd(unk
, TRUE
);
2503 doc
= get_document(unk
);
2506 test_download(DWL_FROM_PUT_HREF
);
2507 doc2
= get_document(unk
);
2508 ok(doc
== doc2
, "doc != doc2\n");
2509 IDispatch_Release(doc2
);
2511 test_Navigate2(unk
);
2512 test_download(DWL_EXPECT_BEFORE_NAVIGATE
);
2513 doc2
= get_document(unk
);
2514 ok(doc
== doc2
, "doc != doc2\n");
2515 IDispatch_Release(doc2
);
2516 IDispatch_Release(doc2
);
2519 test_ClientSite(unk
, NULL
, !do_download
);
2521 test_GetControlInfo(unk
);
2522 test_wb_funcs(unk
, FALSE
);
2523 test_ConnectionPoint(unk
, FALSE
);
2524 test_IServiceProvider(unk
);
2526 IWebBrowser2_Release(wb
);
2527 ref
= IUnknown_Release(unk
);
2528 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
2531 START_TEST(webbrowser
)
2533 container_hwnd
= create_container_window();
2535 OleInitialize(NULL
);
2537 trace("Testing WebBrowser (no download)...\n");
2538 test_WebBrowser(FALSE
);
2539 trace("Testing WebBrowser...\n");
2540 test_WebBrowser(TRUE
);