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(!winetest_interactive
)
1354 return E_NOINTERFACE
;
1356 if (IsEqualGUID(&SID_STopLevelBrowser
, guidService
))
1357 trace("Service SID_STopLevelBrowser\n");
1358 else if (IsEqualGUID(&SID_SEditCommandTarget
, guidService
))
1359 trace("Service SID_SEditCommandTarget\n");
1360 else if (IsEqualGUID(&IID_ITargetFrame2
, guidService
))
1361 trace("Service IID_ITargetFrame2\n");
1362 else if (IsEqualGUID(&SID_SInternetSecurityManager
, guidService
))
1363 trace("Service SID_SInternetSecurityManager\n");
1364 else if (IsEqualGUID(&SID_SOleUndoManager
, guidService
))
1365 trace("Service SID_SOleUndoManager\n");
1366 else if (IsEqualGUID(&SID_IMimeInfo
, guidService
))
1367 trace("Service SID_IMimeInfo\n");
1368 else if (IsEqualGUID(&SID_STopWindow
, guidService
))
1369 trace("Service SID_STopWindow\n");
1371 /* 30D02401-6A81-11D0-8274-00C04FD5AE38 Explorer Bar: Search */
1372 /* D1E7AFEC-6A2E-11D0-8C78-00C04FD918B4 no info */
1373 /* A9227C3C-7F8E-11D0-8CB0-00A0C92DBFE8 no info */
1374 /* 371EA634-DC5C-11D1-BA57-00C04FC2040E one reference to IVersionHost */
1375 /* 3050F429-98B5-11CF-BB82-00AA00BDCE0B IID_IElementBehaviorFactory */
1376 /* 6D12FE80-7911-11CF-9534-0000C05BAE0B SID_DefView */
1377 /* AD7F6C62-F6BD-11D2-959B-006097C553C8 no info */
1378 /* 53A2D5B1-D2FC-11D0-84E0-006097C9987D no info */
1379 /* 3050F312-98B5-11CF-BB82-00AA00BDCE0B HTMLFrameBaseClass */
1380 /* 639447BD-B2D3-44B9-9FB0-510F23CB45E4 no info */
1381 /* 20C46561-8491-11CF-960C-0080C7F4EE85 no info */
1384 trace("Service %s not supported\n", debugstr_guid(guidService
));
1386 return E_NOINTERFACE
;
1390 static const IServiceProviderVtbl ServiceProviderVtbl
= {
1391 ServiceProvider_QueryInterface
,
1392 ServiceProvider_AddRef
,
1393 ServiceProvider_Release
,
1394 ServiceProvider_QueryService
1397 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
1400 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
1404 if(IsEqualGUID(&IID_IUnknown
, riid
)
1405 || IsEqualGUID(&IID_IOleClientSite
, riid
))
1407 else if(IsEqualGUID(&IID_IOleWindow
, riid
)
1408 || IsEqualGUID(&IID_IOleInPlaceSite
, riid
)
1409 || IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
1410 *ppv
= &InPlaceSite
;
1411 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
)
1412 || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
1413 *ppv
= &DocHostUIHandler
;
1414 else if(IsEqualGUID(&IID_IDispatch
, riid
))
1416 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
1417 *ppv
= &ServiceProvider
;
1418 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
1419 trace("interface IID_IDocHostShowUI\n");
1420 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
1421 trace("interface IID_IOleControlSite\n");
1422 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
1423 trace("interface IID_IOleCommandTarget\n");
1425 /* B6EA2050-048A-11D1-82B9-00C04FB9942E IAxWinHostWindow */
1429 /* are there more interfaces, that a host can support? */
1430 trace("%s: interface not supported\n", debugstr_guid(riid
));
1433 return (*ppv
) ? S_OK
: E_NOINTERFACE
;
1436 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1438 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
1441 static HWND
create_container_window(void)
1443 static const WCHAR wszWebBrowserContainer
[] =
1444 {'W','e','b','B','r','o','w','s','e','r','C','o','n','t','a','i','n','e','r',0};
1445 static WNDCLASSEXW wndclass
= {
1446 sizeof(WNDCLASSEXW
),
1449 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
1450 wszWebBrowserContainer
,
1454 RegisterClassExW(&wndclass
);
1455 return CreateWindowW(wszWebBrowserContainer
, wszWebBrowserContainer
,
1456 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
, CW_USEDEFAULT
,
1457 CW_USEDEFAULT
, NULL
, NULL
, NULL
, NULL
);
1460 static void test_DoVerb(IUnknown
*unk
)
1463 RECT rect
= {0,0,1000,1000};
1466 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1467 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1471 SET_EXPECT(CanInPlaceActivate
);
1472 SET_EXPECT(Site_GetWindow
);
1473 SET_EXPECT(OnInPlaceActivate
);
1474 SET_EXPECT(GetWindowContext
);
1475 SET_EXPECT(ShowObject
);
1476 SET_EXPECT(GetContainer
);
1477 SET_EXPECT(Frame_GetWindow
);
1478 SET_EXPECT(OnUIActivate
);
1479 SET_EXPECT(Frame_SetActiveObject
);
1480 SET_EXPECT(UIWindow_SetActiveObject
);
1481 SET_EXPECT(SetMenu
);
1483 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1484 0, (HWND
)0xdeadbeef, &rect
);
1485 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1487 CHECK_CALLED(CanInPlaceActivate
);
1488 CHECK_CALLED(Site_GetWindow
);
1489 CHECK_CALLED(OnInPlaceActivate
);
1490 CHECK_CALLED(GetWindowContext
);
1491 CHECK_CALLED(ShowObject
);
1492 CHECK_CALLED(GetContainer
);
1493 CHECK_CALLED(Frame_GetWindow
);
1494 CHECK_CALLED(OnUIActivate
);
1495 CHECK_CALLED(Frame_SetActiveObject
);
1496 CHECK_CALLED(UIWindow_SetActiveObject
);
1497 CHECK_CALLED(SetMenu
);
1499 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
,
1500 0, (HWND
)0xdeadbeef, &rect
);
1501 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1503 IOleObject_Release(oleobj
);
1506 static void test_GetMiscStatus(IOleObject
*oleobj
)
1511 for(i
=0; i
<10; i
++) {
1513 hres
= IOleObject_GetMiscStatus(oleobj
, i
, &st
);
1514 ok(hres
== S_OK
, "GetMiscStatus failed: %08x\n", hres
);
1515 ok(st
== (OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
1516 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
),
1517 "st=%08x, expected OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|"
1518 "OLEMISC_INSIDEOUT|OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE)\n", st
);
1522 static void test_SetHostNames(IOleObject
*oleobj
)
1526 static const WCHAR test_appW
[] = {'t','e','s','t',' ','a','p','p',0};
1528 hres
= IOleObject_SetHostNames(oleobj
, test_appW
, (void*)0xdeadbeef);
1529 ok(hres
== S_OK
, "SetHostNames failed: %08x\n", hres
);
1532 static void test_ClientSite(IUnknown
*unk
, IOleClientSite
*client
, BOOL stop_download
)
1535 IOleInPlaceObject
*inplace
;
1539 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
1540 ok(hres
== S_OK
, "QueryInterface(IID_OleObject) failed: %08x\n", hres
);
1544 test_GetMiscStatus(oleobj
);
1545 test_SetHostNames(oleobj
);
1547 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceObject
, (void**)&inplace
);
1548 ok(hres
== S_OK
, "QueryInterface(IID_OleInPlaceObject) failed: %08x\n", hres
);
1550 IOleObject_Release(oleobj
);
1554 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1555 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1556 ok((hwnd
== NULL
) ^ (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1559 SET_EXPECT(GetContainer
);
1560 SET_EXPECT(Site_GetWindow
);
1561 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1562 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1563 }else if(stop_download
) {
1564 SET_EXPECT(Invoke_DOWNLOADCOMPLETE
);
1565 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
1566 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
1569 hres
= IOleObject_SetClientSite(oleobj
, client
);
1570 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1573 CHECK_CALLED(GetContainer
);
1574 CHECK_CALLED(Site_GetWindow
);
1575 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1576 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1577 }else if(stop_download
) {
1578 todo_wine
CHECK_CALLED(Invoke_DOWNLOADCOMPLETE
);
1579 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
1580 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
1583 hres
= IOleInPlaceObject_GetWindow(inplace
, &hwnd
);
1584 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1585 ok((hwnd
== NULL
) == (client
== NULL
), "unexpected hwnd %p\n", hwnd
);
1587 shell_embedding_hwnd
= hwnd
;
1589 test_SetHostNames(oleobj
);
1591 IOleInPlaceObject_Release(inplace
);
1592 IOleObject_Release(oleobj
);
1595 static void test_ClassInfo(IUnknown
*unk
)
1597 IProvideClassInfo2
*class_info
;
1601 hres
= IUnknown_QueryInterface(unk
, &IID_IProvideClassInfo2
, (void**)&class_info
);
1602 ok(hres
== S_OK
, "QueryInterface(IID_IProvideClassInfo) failed: %08x\n", hres
);
1606 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, &guid
);
1607 ok(hres
== S_OK
, "GetGUID failed: %08x\n", hres
);
1608 ok(IsEqualGUID(&DIID_DWebBrowserEvents2
, &guid
), "wrong guid\n");
1610 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, &guid
);
1611 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1612 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1614 hres
= IProvideClassInfo2_GetGUID(class_info
, 2, &guid
);
1615 ok(hres
== E_FAIL
, "GetGUID failed: %08x, expected E_FAIL\n", hres
);
1616 ok(IsEqualGUID(&IID_NULL
, &guid
), "wrong guid\n");
1618 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, NULL
);
1619 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1621 hres
= IProvideClassInfo2_GetGUID(class_info
, 0, NULL
);
1622 ok(hres
== E_POINTER
, "GetGUID failed: %08x, expected E_POINTER\n", hres
);
1624 IProvideClassInfo2_Release(class_info
);
1627 static void test_ie_funcs(IUnknown
*unk
)
1637 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
1638 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
1645 hres
= IWebBrowser2_get_HWND(wb
, &hwnd
);
1646 ok(hres
== E_FAIL
, "get_HWND failed: %08x, expected E_FAIL\n", hres
);
1647 ok(hwnd
== 0, "unexpected hwnd %x\n", hwnd
);
1651 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1652 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1653 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1655 SET_EXPECT(Invoke_ONMENUBAR
);
1656 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= VARIANT_FALSE
));
1657 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1658 CHECK_CALLED(Invoke_ONMENUBAR
);
1660 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1661 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1662 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1664 SET_EXPECT(Invoke_ONMENUBAR
);
1665 hres
= IWebBrowser2_put_MenuBar(wb
, (exvb
= 100));
1666 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1667 CHECK_CALLED(Invoke_ONMENUBAR
);
1669 hres
= IWebBrowser2_get_MenuBar(wb
, &b
);
1670 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1671 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1675 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1676 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1677 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1679 SET_EXPECT(Invoke_ONADDRESSBAR
);
1680 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_FALSE
));
1681 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1682 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1684 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1685 ok(hres
== S_OK
, "get_MenuBar failed: %08x\n", hres
);
1686 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1688 SET_EXPECT(Invoke_ONADDRESSBAR
);
1689 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= 100));
1690 ok(hres
== S_OK
, "put_AddressBar failed: %08x\n", hres
);
1691 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1693 hres
= IWebBrowser2_get_AddressBar(wb
, &b
);
1694 ok(hres
== S_OK
, "get_AddressBar failed: %08x\n", hres
);
1695 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1697 SET_EXPECT(Invoke_ONADDRESSBAR
);
1698 hres
= IWebBrowser2_put_AddressBar(wb
, (exvb
= VARIANT_TRUE
));
1699 ok(hres
== S_OK
, "put_MenuBar failed: %08x\n", hres
);
1700 CHECK_CALLED(Invoke_ONADDRESSBAR
);
1704 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1705 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1706 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1708 SET_EXPECT(Invoke_ONSTATUSBAR
);
1709 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_TRUE
));
1710 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1711 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1713 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1714 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1715 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1717 SET_EXPECT(Invoke_ONSTATUSBAR
);
1718 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= VARIANT_FALSE
));
1719 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1720 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1722 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1723 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1724 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1726 SET_EXPECT(Invoke_ONSTATUSBAR
);
1727 hres
= IWebBrowser2_put_StatusBar(wb
, (exvb
= 100));
1728 ok(hres
== S_OK
, "put_StatusBar failed: %08x\n", hres
);
1729 CHECK_CALLED(Invoke_ONSTATUSBAR
);
1731 hres
= IWebBrowser2_get_StatusBar(wb
, &b
);
1732 ok(hres
== S_OK
, "get_StatusBar failed: %08x\n", hres
);
1733 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1737 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1738 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1741 SET_EXPECT(Invoke_ONTOOLBAR
);
1742 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_FALSE
));
1743 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1744 CHECK_CALLED(Invoke_ONTOOLBAR
);
1746 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1747 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1748 ok(i
== VARIANT_FALSE
, "b=%x\n", i
);
1750 SET_EXPECT(Invoke_ONTOOLBAR
);
1751 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= 100));
1752 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1753 CHECK_CALLED(Invoke_ONTOOLBAR
);
1755 hres
= IWebBrowser2_get_ToolBar(wb
, &i
);
1756 ok(hres
== S_OK
, "get_ToolBar failed: %08x\n", hres
);
1759 SET_EXPECT(Invoke_ONTOOLBAR
);
1760 hres
= IWebBrowser2_put_ToolBar(wb
, (exvb
= VARIANT_TRUE
));
1761 ok(hres
== S_OK
, "put_ToolBar failed: %08x\n", hres
);
1762 CHECK_CALLED(Invoke_ONTOOLBAR
);
1766 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1767 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1768 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1770 SET_EXPECT(Invoke_ONFULLSCREEN
);
1771 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_TRUE
));
1772 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1773 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1775 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1776 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1777 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1779 SET_EXPECT(Invoke_ONFULLSCREEN
);
1780 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= 100));
1781 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1782 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1784 hres
= IWebBrowser2_get_FullScreen(wb
, &b
);
1785 ok(hres
== S_OK
, "get_FullScreen failed: %08x\n", hres
);
1786 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1788 SET_EXPECT(Invoke_ONFULLSCREEN
);
1789 hres
= IWebBrowser2_put_FullScreen(wb
, (exvb
= VARIANT_FALSE
));
1790 ok(hres
== S_OK
, "put_FullScreen failed: %08x\n", hres
);
1791 CHECK_CALLED(Invoke_ONFULLSCREEN
);
1795 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1796 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1797 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1799 SET_EXPECT(Invoke_ONTHEATERMODE
);
1800 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_TRUE
));
1801 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1802 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1804 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1805 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1806 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1808 SET_EXPECT(Invoke_ONTHEATERMODE
);
1809 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= 100));
1810 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1811 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1813 hres
= IWebBrowser2_get_TheaterMode(wb
, &b
);
1814 ok(hres
== S_OK
, "get_TheaterMode failed: %08x\n", hres
);
1815 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1817 SET_EXPECT(Invoke_ONTHEATERMODE
);
1818 hres
= IWebBrowser2_put_TheaterMode(wb
, (exvb
= VARIANT_FALSE
));
1819 ok(hres
== S_OK
, "put_TheaterMode failed: %08x\n", hres
);
1820 CHECK_CALLED(Invoke_ONTHEATERMODE
);
1825 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
1826 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
1827 ok(b
== 0x100, "b=%x\n", b
);
1829 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
1830 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_TRUE
));
1831 ok(hres
== S_OK
|| broken(hres
== E_NOTIMPL
), "put_Resizable failed: %08x\n", hres
);
1832 CHECK_CALLED_BROKEN(Invoke_WINDOWSETRESIZABLE
);
1834 SET_EXPECT(Invoke_WINDOWSETRESIZABLE
);
1835 hres
= IWebBrowser2_put_Resizable(wb
, (exvb
= VARIANT_FALSE
));
1836 ok(hres
== S_OK
|| broken(hres
== E_NOTIMPL
), "put_Resizable failed: %08x\n", hres
);
1837 CHECK_CALLED_BROKEN(Invoke_WINDOWSETRESIZABLE
);
1839 hres
= IWebBrowser2_get_Resizable(wb
, &b
);
1840 ok(hres
== E_NOTIMPL
, "get_Resizable failed: %08x\n", hres
);
1841 ok(b
== 0x100, "b=%x\n", b
);
1846 hres
= IWebBrowser2_get_Application(wb
, &disp
);
1847 ok(hres
== S_OK
, "get_Application failed: %08x\n", hres
);
1848 ok(disp
== (void*)wb
, "disp=%p, expected %p\n", disp
, wb
);
1850 IDispatch_Release(disp
);
1852 hres
= IWebBrowser2_get_Application(wb
, NULL
);
1853 ok(hres
== E_POINTER
, "get_Application failed: %08x, expected E_POINTER\n", hres
);
1856 hres
= IWebBrowser2_get_Name(wb
, &sName
);
1857 ok(hres
== S_OK
, "getName failed: %08x, expected S_OK\n", hres
);
1858 if (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) == LANG_ENGLISH
)
1859 ok(!strcmp_wa(sName
, "Microsoft Web Browser Control"), "got '%s', expected 'Microsoft Web Browser Control'\n", wine_dbgstr_w(sName
));
1860 else /* Non-English cannot be blank. */
1861 ok(sName
!=NULL
, "get_Name return a NULL string.\n");
1862 SysFreeString(sName
);
1866 hres
= IWebBrowser2_Quit(wb
);
1867 ok(hres
== E_FAIL
, "Quit failed: %08x, expected E_FAIL\n", hres
);
1869 IWebBrowser2_Release(wb
);
1872 static void test_Silent(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1878 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1879 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1880 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1882 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
1883 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1886 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1887 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1888 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1890 hres
= IWebBrowser2_put_Silent(wb
, 100);
1891 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1894 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1895 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1896 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1898 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_FALSE
);
1899 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1902 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1903 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1904 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1907 hres
= IWebBrowser2_put_Silent(wb
, VARIANT_TRUE
);
1908 ok(hres
== S_OK
, "set_Silent failed: %08x\n", hres
);
1910 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1913 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
1914 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1917 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
1920 hres
= IWebBrowser2_get_Silent(wb
, &b
);
1921 ok(hres
== S_OK
, "get_Silent failed: %08x\n", hres
);
1922 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1925 static void test_Offline(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1931 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1932 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1933 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1935 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
1936 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1939 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1940 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1941 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1943 hres
= IWebBrowser2_put_Offline(wb
, 100);
1944 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1947 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1948 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1949 ok(b
== VARIANT_TRUE
, "b=%x\n", b
);
1951 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_FALSE
);
1952 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1955 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1956 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1957 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1960 hres
= IWebBrowser2_put_Offline(wb
, VARIANT_TRUE
);
1961 ok(hres
== S_OK
, "set_Offline failed: %08x\n", hres
);
1963 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1966 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
1967 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1970 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1973 hres
= IWebBrowser2_get_Offline(wb
, &b
);
1974 ok(hres
== S_OK
, "get_Offline failed: %08x\n", hres
);
1975 ok(b
== VARIANT_FALSE
, "b=%x\n", b
);
1978 static void test_ambient_unknown(IWebBrowser2
*wb
, IOleControl
*control
, BOOL is_clientsite
)
1982 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1983 SET_EXPECT(Invoke_AMBIENT_SILENT
);
1984 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
1985 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
1986 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
1987 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
1989 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_UNKNOWN
);
1990 ok(hres
== S_OK
, "OnAmbientPropertyChange failed %08x\n", hres
);
1992 CHECK_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
1993 CHECK_EXPECT(Invoke_AMBIENT_SILENT
);
1994 CHECK_EXPECT(Invoke_AMBIENT_USERMODE
);
1995 CHECK_EXPECT(Invoke_AMBIENT_DLCONTROL
);
1996 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
1997 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
1999 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2000 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
2001 CLEAR_CALLED(Invoke_AMBIENT_USERMODE
);
2002 CLEAR_CALLED(Invoke_AMBIENT_DLCONTROL
);
2003 CLEAR_CALLED(Invoke_AMBIENT_USERAGENT
);
2004 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
);
2007 static void test_wb_funcs(IUnknown
*unk
, BOOL is_clientsite
)
2010 IOleControl
*control
;
2013 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2014 ok(hres
== S_OK
, "Could not get IWebBrowser2 interface: %08x\n", hres
);
2016 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2017 ok(hres
== S_OK
, "Could not get IOleControl interface: %08x\n", hres
);
2019 test_Silent(wb
, control
, is_clientsite
);
2020 test_Offline(wb
, control
, is_clientsite
);
2021 test_ambient_unknown(wb
, control
, is_clientsite
);
2023 IWebBrowser_Release(wb
);
2024 IOleControl_Release(control
);
2027 static void test_GetControlInfo(IUnknown
*unk
)
2029 IOleControl
*control
;
2033 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
2034 ok(hres
== S_OK
, "Could not get IOleControl: %08x\n", hres
);
2038 hres
= IOleControl_GetControlInfo(control
, &info
);
2039 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2040 hres
= IOleControl_GetControlInfo(control
, NULL
);
2041 ok(hres
== E_NOTIMPL
, "GetControlInfo failed: %08x, exxpected E_NOTIMPL\n", hres
);
2043 IOleControl_Release(control
);
2046 static void test_Extent(IUnknown
*unk
)
2049 SIZE size
, expected
;
2055 /* default aspect ratio is 96dpi / 96dpi */
2057 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
2058 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
2060 if (dpi_x
!= 96 || dpi_y
!= 96)
2061 trace("dpi: %d / %d\n", dpi_y
, dpi_y
);
2063 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
2064 ok(hres
== S_OK
, "Could not get IOleObkect: %08x\n", hres
);
2068 size
.cx
= size
.cy
= 0xdeadbeef;
2069 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2070 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2071 /* Default size is 50x20 pixels, in himetric units */
2072 expected
.cx
= MulDiv( 50, 2540, dpi_x
);
2073 expected
.cy
= MulDiv( 20, 2540, dpi_y
);
2074 ok(size
.cx
== expected
.cx
&& size
.cy
== expected
.cy
, "size = {%d %d} (expected %d %d)\n",
2075 size
.cx
, size
.cy
, expected
.cx
, expected
.cy
);
2079 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2080 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2082 size
.cx
= size
.cy
= 0xdeadbeef;
2083 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2084 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2085 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2087 size
.cx
= size
.cy
= 0xdeadbeef;
2088 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2089 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2090 ok(size
.cx
== 800 && size
.cy
== 700, "size = {%d %d}\n", size
.cx
, size
.cy
);
2094 hres
= IOleObject_SetExtent(oleobj
, 0, &size
);
2095 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2097 size
.cx
= size
.cy
= 0xdeadbeef;
2098 hres
= IOleObject_GetExtent(oleobj
, 0, &size
);
2099 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2100 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2102 size
.cx
= size
.cy
= 0xdeadbeef;
2103 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2104 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2105 ok(size
.cx
== 900 && size
.cy
== 800, "size = {%d %d}\n", size
.cx
, size
.cy
);
2109 hres
= IOleObject_SetExtent(oleobj
, 0xdeadbeef, &size
);
2110 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
2112 size
.cx
= size
.cy
= 0xdeadbeef;
2113 hres
= IOleObject_GetExtent(oleobj
, 0xdeadbeef, &size
);
2114 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2115 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2117 size
.cx
= size
.cy
= 0xdeadbeef;
2118 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &size
);
2119 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
2120 ok(size
.cx
== 1000 && size
.cy
== 900, "size = {%d %d}\n", size
.cx
, size
.cy
);
2122 IOleObject_Release(oleobj
);
2125 static void test_ConnectionPoint(IUnknown
*unk
, BOOL init
)
2127 IConnectionPointContainer
*container
;
2128 IConnectionPoint
*point
;
2131 static DWORD dw
= 100;
2133 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2134 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2138 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &DIID_DWebBrowserEvents2
, &point
);
2139 IConnectionPointContainer_Release(container
);
2140 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2145 hres
= IConnectionPoint_Advise(point
, (IUnknown
*)&WebBrowserEvents2
, &dw
);
2146 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2147 ok(dw
== 1, "dw=%d, expected 1\n", dw
);
2149 hres
= IConnectionPoint_Unadvise(point
, dw
);
2150 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
2153 IConnectionPoint_Release(point
);
2156 static void test_Navigate2(IUnknown
*unk
)
2158 IWebBrowser2
*webbrowser
;
2162 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&webbrowser
);
2163 ok(hres
== S_OK
, "QueryInterface(IID_IWebBrowser) failed: %08x\n", hres
);
2167 test_LocationURL(unk
, is_first_load
? "" : current_url
);
2168 test_ready_state(is_first_load
? READYSTATE_UNINITIALIZED
: READYSTATE_COMPLETE
);
2170 V_VT(&url
) = VT_BSTR
;
2171 V_BSTR(&url
) = a2bstr("about:blank");
2172 current_url
= "about:blank";
2175 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2176 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2177 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2178 SET_EXPECT(Invoke_DOWNLOADBEGIN
);
2179 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2180 SET_EXPECT(EnableModeless_FALSE
);
2181 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2182 SET_EXPECT(SetStatusText
);
2183 SET_EXPECT(GetHostInfo
);
2184 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2185 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2186 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2187 SET_EXPECT(GetOptionKeyPath
);
2188 SET_EXPECT(GetOverridesKeyPath
);
2189 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2190 SET_EXPECT(Exec_SETPROGRESSMAX
);
2191 SET_EXPECT(Exec_SETPROGRESSPOS
);
2192 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2193 SET_EXPECT(Invoke_FILEDOWNLOAD
);
2194 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2195 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2196 SET_EXPECT(EnableModeless_TRUE
);
2199 hres
= IWebBrowser2_Navigate2(webbrowser
, &url
, NULL
, NULL
, NULL
, NULL
);
2200 ok(hres
== S_OK
, "Navigate2 failed: %08x\n", hres
);
2203 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
2204 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2205 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2206 todo_wine
CHECK_CALLED(Invoke_DOWNLOADBEGIN
);
2207 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2208 CHECK_CALLED(EnableModeless_FALSE
);
2209 CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2210 CHECK_CALLED(SetStatusText
);
2211 CHECK_CALLED(GetHostInfo
);
2212 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
2213 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
2214 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
2215 CHECK_CALLED(GetOptionKeyPath
);
2216 CHECK_CALLED_BROKEN(GetOverridesKeyPath
);
2217 todo_wine
CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
2218 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2219 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2220 todo_wine
CHECK_CALLED_BROKEN(Invoke_SETSECURELOCKICON
);
2221 todo_wine
CHECK_CALLED_BROKEN(Invoke_FILEDOWNLOAD
);
2222 todo_wine
CHECK_CALLED(Invoke_COMMANDSTATECHANGE
);
2223 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2224 CHECK_CALLED(EnableModeless_TRUE
);
2228 IWebBrowser2_Release(webbrowser
);
2230 test_ready_state(READYSTATE_LOADING
);
2233 static void test_download(DWORD flags
)
2237 is_downloading
= TRUE
;
2240 test_ready_state((flags
& DWL_FROM_PUT_HREF
) ? READYSTATE_COMPLETE
: READYSTATE_LOADING
);
2242 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2243 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2244 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2245 SET_EXPECT(TranslateUrl
);
2247 SET_EXPECT(Exec_SETPROGRESSMAX
);
2248 SET_EXPECT(Exec_SETPROGRESSPOS
);
2249 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2250 SET_EXPECT(DocHost_EnableModeless_FALSE
);
2251 SET_EXPECT(DocHost_EnableModeless_TRUE
);
2252 SET_EXPECT(Invoke_SETSECURELOCKICON
);
2253 SET_EXPECT(Invoke_282
);
2254 SET_EXPECT(EnableModeless_FALSE
);
2255 SET_EXPECT(Invoke_COMMANDSTATECHANGE
);
2256 SET_EXPECT(Invoke_STATUSTEXTCHANGE
);
2257 SET_EXPECT(SetStatusText
);
2258 SET_EXPECT(EnableModeless_TRUE
);
2260 SET_EXPECT(QueryStatus_STOP
);
2262 SET_EXPECT(GetHostInfo
);
2263 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2264 SET_EXPECT(Invoke_TITLECHANGE
);
2265 SET_EXPECT(Invoke_NAVIGATECOMPLETE2
);
2267 SET_EXPECT(GetDropTarget
);
2268 SET_EXPECT(Invoke_PROGRESSCHANGE
);
2269 SET_EXPECT(Invoke_DOCUMENTCOMPLETE
);
2270 while(!called_Invoke_DOCUMENTCOMPLETE
&& GetMessage(&msg
, NULL
, 0, 0)) {
2271 TranslateMessage(&msg
);
2272 DispatchMessage(&msg
);
2275 if(flags
& DWL_EXPECT_BEFORE_NAVIGATE
) {
2276 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2277 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2278 CHECK_CALLED(TranslateUrl
);
2280 todo_wine
CHECK_CALLED(Exec_SETPROGRESSMAX
);
2281 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
2282 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2283 CLEAR_CALLED(DocHost_EnableModeless_FALSE
); /* IE 7 */
2284 CLEAR_CALLED(DocHost_EnableModeless_TRUE
); /* IE 7 */
2285 todo_wine
CHECK_CALLED(Invoke_SETSECURELOCKICON
);
2286 CLEAR_CALLED(Invoke_282
); /* IE 7 */
2288 todo_wine
CHECK_CALLED(EnableModeless_FALSE
);
2290 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2291 CLEAR_CALLED(Invoke_COMMANDSTATECHANGE
);
2292 todo_wine
CHECK_CALLED(Invoke_STATUSTEXTCHANGE
);
2293 todo_wine
CHECK_CALLED(SetStatusText
);
2295 todo_wine
CHECK_CALLED(EnableModeless_TRUE
);
2297 CLEAR_CALLED(EnableModeless_FALSE
); /* IE 8 */
2299 todo_wine
CHECK_CALLED(QueryStatus_STOP
);
2301 todo_wine
CHECK_CALLED(GetHostInfo
);
2302 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2303 todo_wine
CHECK_CALLED(Invoke_TITLECHANGE
);
2304 CHECK_CALLED(Invoke_NAVIGATECOMPLETE2
);
2306 todo_wine
CHECK_CALLED(GetDropTarget
);
2307 todo_wine
CHECK_CALLED(Invoke_PROGRESSCHANGE
);
2308 CHECK_CALLED(Invoke_DOCUMENTCOMPLETE
);
2310 is_downloading
= FALSE
;
2312 test_ready_state(READYSTATE_COMPLETE
);
2315 static void test_olecmd(IUnknown
*unk
, BOOL loaded
)
2317 IOleCommandTarget
*cmdtrg
;
2321 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2322 ok(hres
== S_OK
, "Could not get IOleCommandTarget iface: %08x\n", hres
);
2326 cmds
[0].cmdID
= OLECMDID_SPELL
;
2327 cmds
[0].cmdf
= 0xdeadbeef;
2328 cmds
[1].cmdID
= OLECMDID_REFRESH
;
2329 cmds
[1].cmdf
= 0xdeadbeef;
2330 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmds
, NULL
);
2332 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2333 ok(cmds
[0].cmdf
== OLECMDF_SUPPORTED
, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2334 ok(cmds
[1].cmdf
== (OLECMDF_ENABLED
|OLECMDF_SUPPORTED
),
2335 "OLECMDID_REFRESH cmdf = %x\n", cmds
[1].cmdf
);
2337 ok(hres
== 0x80040104, "QueryStatus failed: %08x\n", hres
);
2338 ok(cmds
[0].cmdf
== 0xdeadbeef, "OLECMDID_SPELL cmdf = %x\n", cmds
[0].cmdf
);
2339 ok(cmds
[1].cmdf
== 0xdeadbeef, "OLECMDID_REFRESH cmdf = %x\n", cmds
[0].cmdf
);
2342 IOleCommandTarget_Release(cmdtrg
);
2345 static void test_IServiceProvider(IUnknown
*unk
)
2347 IServiceProvider
*servprov
= (void*)0xdeadbeef;
2349 IUnknown
*ret
= NULL
;
2350 static const IID IID_IBrowserService2
=
2351 {0x68BD21CC,0x438B,0x11d2,{0xA5,0x60,0x00,0xA0,0xC,0x2D,0xBF,0xE8}};
2353 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&servprov
);
2354 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
2358 hres
= IServiceProvider_QueryService(servprov
, &SID_STopLevelBrowser
, &IID_IBrowserService2
, (LPVOID
*)&ret
);
2359 ok(hres
== E_FAIL
, "QueryService returned %08x, expected E_FAIL\n", hres
);
2360 ok(ret
== NULL
, "ret returned %p, expected NULL\n", ret
);
2363 IUnknown_Release(ret
);
2366 IServiceProvider_Release(servprov
);
2369 #define get_document(u) _get_document(__LINE__,u)
2370 static IDispatch
*_get_document(unsigned line
, IUnknown
*unk
)
2372 IHTMLDocument2
*html_doc
;
2377 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2378 ok_(__FILE__
,line
)(hres
== S_OK
, "QueryInterface(IID_IWebBrowser2) failed: %08x\n", hres
);
2381 hres
= IWebBrowser2_get_Document(wb
, &disp
);
2382 IWebBrowser2_Release(wb
);
2383 ok_(__FILE__
,line
)(hres
== S_OK
, "get_Document failed: %08x\n", hres
);
2384 ok_(__FILE__
,line
)(disp
!= NULL
, "doc_disp == NULL\n");
2386 hres
= IDispatch_QueryInterface(disp
, &IID_IHTMLDocument2
, (void**)&html_doc
);
2387 ok_(__FILE__
,line
)(hres
== S_OK
, "Could not get IHTMLDocument iface: %08x\n", hres
);
2388 ok(disp
== (IDispatch
*)html_doc
, "disp != html_doc\n");
2389 IHTMLDocument_Release(html_doc
);
2394 static void test_put_href(IUnknown
*unk
)
2396 IHTMLLocation
*location
;
2397 IHTMLDocument2
*doc
;
2398 IDispatch
*doc_disp
;
2402 doc_disp
= get_document(unk
);
2404 hres
= IDispatch_QueryInterface(doc_disp
, &IID_IHTMLDocument2
, (void**)&doc
);
2405 IDispatch_Release(doc_disp
);
2406 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2 failed: %08x\n", hres
);
2409 hres
= IHTMLDocument2_get_location(doc
, &location
);
2410 IHTMLDocument2_Release(doc
);
2411 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
2412 ok(location
!= NULL
, "location == NULL\n");
2414 SET_EXPECT(TranslateUrl
);
2415 SET_EXPECT(Invoke_BEFORENAVIGATE2
);
2416 SET_EXPECT(Invoke_PROPERTYCHANGE
);
2418 dwl_flags
= DWL_FROM_PUT_HREF
;
2420 str
= a2bstr("about:test");
2421 current_url
= "about:test";
2422 is_first_load
= FALSE
;
2423 hres
= IHTMLLocation_put_href(location
, str
);
2425 CHECK_CALLED(TranslateUrl
);
2426 CHECK_CALLED(Invoke_BEFORENAVIGATE2
);
2427 todo_wine
CHECK_CALLED(Invoke_PROPERTYCHANGE
);
2429 IHTMLLocation_Release(location
);
2431 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
2433 test_ready_state(READYSTATE_COMPLETE
);
2436 static void test_QueryInterface(IUnknown
*unk
)
2438 IQuickActivate
*qa
= (IQuickActivate
*)0xdeadbeef;
2439 IRunnableObject
*runnable
= (IRunnableObject
*)0xdeadbeef;
2440 IPerPropertyBrowsing
*propbrowse
= (void*)0xdeadbeef;
2441 IOleInPlaceSite
*inplace
= (void*)0xdeadbeef;
2442 IOleCache
*cache
= (void*)0xdeadbeef;
2443 IObjectWithSite
*site
= (void*)0xdeadbeef;
2444 IViewObjectEx
*viewex
= (void*)0xdeadbeef;
2447 hres
= IUnknown_QueryInterface(unk
, &IID_IQuickActivate
, (void**)&qa
);
2448 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2449 ok(qa
== NULL
, "qa=%p, expected NULL\n", qa
);
2451 hres
= IUnknown_QueryInterface(unk
, &IID_IRunnableObject
, (void**)&runnable
);
2452 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2453 ok(runnable
== NULL
, "runnable=%p, expected NULL\n", runnable
);
2455 hres
= IUnknown_QueryInterface(unk
, &IID_IPerPropertyBrowsing
, (void**)&propbrowse
);
2456 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2457 ok(propbrowse
== NULL
, "propbrowse=%p, expected NULL\n", propbrowse
);
2459 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCache
, (void**)&cache
);
2460 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2461 ok(cache
== NULL
, "cache=%p, expected NULL\n", cache
);
2463 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceSite
, (void**)&inplace
);
2464 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2465 ok(inplace
== NULL
, "inplace=%p, expected NULL\n", inplace
);
2467 hres
= IUnknown_QueryInterface(unk
, &IID_IObjectWithSite
, (void**)&site
);
2468 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2469 ok(site
== NULL
, "site=%p, expected NULL\n", site
);
2471 hres
= IUnknown_QueryInterface(unk
, &IID_IViewObjectEx
, (void**)&viewex
);
2472 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
2473 ok(viewex
== NULL
, "viewex=%p, expected NULL\n", viewex
);
2477 static void test_WebBrowser(BOOL do_download
)
2479 IUnknown
*unk
= NULL
;
2483 hres
= CoCreateInstance(&CLSID_WebBrowser
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
2484 &IID_IUnknown
, (void**)&unk
);
2485 ok(hres
== S_OK
, "CoCreateInterface failed: %08x\n", hres
);
2489 is_downloading
= FALSE
;
2490 is_first_load
= TRUE
;
2492 hres
= IUnknown_QueryInterface(unk
, &IID_IWebBrowser2
, (void**)&wb
);
2493 ok(hres
== S_OK
, "Could not get IWebBrowser2 iface: %08x\n", hres
);
2495 test_QueryInterface(unk
);
2496 test_ready_state(READYSTATE_UNINITIALIZED
);
2497 test_ClassInfo(unk
);
2498 test_LocationURL(unk
, "");
2499 test_ConnectionPoint(unk
, TRUE
);
2500 test_ClientSite(unk
, &ClientSite
, !do_download
);
2502 test_wb_funcs(unk
, TRUE
);
2504 test_olecmd(unk
, FALSE
);
2505 test_Navigate2(unk
);
2508 IDispatch
*doc
, *doc2
;
2511 test_olecmd(unk
, TRUE
);
2512 doc
= get_document(unk
);
2515 test_download(DWL_FROM_PUT_HREF
);
2516 doc2
= get_document(unk
);
2517 ok(doc
== doc2
, "doc != doc2\n");
2518 IDispatch_Release(doc2
);
2520 test_Navigate2(unk
);
2521 test_download(DWL_EXPECT_BEFORE_NAVIGATE
);
2522 doc2
= get_document(unk
);
2523 ok(doc
== doc2
, "doc != doc2\n");
2524 IDispatch_Release(doc2
);
2525 IDispatch_Release(doc2
);
2528 test_ClientSite(unk
, NULL
, !do_download
);
2530 test_GetControlInfo(unk
);
2531 test_wb_funcs(unk
, FALSE
);
2532 test_ConnectionPoint(unk
, FALSE
);
2533 test_IServiceProvider(unk
);
2535 IWebBrowser2_Release(wb
);
2536 ref
= IUnknown_Release(unk
);
2537 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
2540 START_TEST(webbrowser
)
2542 container_hwnd
= create_container_window();
2544 OleInitialize(NULL
);
2546 trace("Testing WebBrowser (no download)...\n");
2547 test_WebBrowser(FALSE
);
2548 trace("Testing WebBrowser...\n");
2549 test_WebBrowser(TRUE
);