2 * Copyright 2005-2009 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>
32 #include "docobjectservice.h"
41 #include "shdeprecated.h"
47 #include "mshtml_test.h"
49 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
50 DEFINE_GUID(IID_IProxyManager
,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
51 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
52 DEFINE_GUID(SID_SContainerDispatch
,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
54 #define DEFINE_EXPECT(func) \
55 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
57 #define SET_EXPECT(func) \
58 expect_ ## func = TRUE
60 #define SET_CALLED(func) \
61 called_ ## func = TRUE
63 #define CHECK_EXPECT2(func) \
65 ok(expect_ ##func, "unexpected call " #func "\n"); \
66 called_ ## func = TRUE; \
69 #define CHECK_EXPECT(func) \
71 CHECK_EXPECT2(func); \
72 expect_ ## func = FALSE; \
75 #define CHECK_CALLED(func) \
77 ok(called_ ## func, "expected " #func "\n"); \
78 expect_ ## func = called_ ## func = FALSE; \
81 #define CHECK_NOT_CALLED(func) \
83 ok(!called_ ## func, "unexpected " #func "\n"); \
84 expect_ ## func = called_ ## func = FALSE; \
87 #define CHECK_CALLED_BROKEN(func) \
89 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
90 expect_ ## func = called_ ## func = FALSE; \
93 #define CLEAR_CALLED(func) \
94 expect_ ## func = called_ ## func = FALSE
97 static IOleDocumentView
*view
= NULL
;
98 static HWND container_hwnd
= NULL
, doc_hwnd
= NULL
, last_hwnd
= NULL
;
100 DEFINE_EXPECT(LockContainer
);
101 DEFINE_EXPECT(SetActiveObject
);
102 DEFINE_EXPECT(SetActiveObject_null
);
103 DEFINE_EXPECT(GetWindow
);
104 DEFINE_EXPECT(CanInPlaceActivate
);
105 DEFINE_EXPECT(OnInPlaceActivate
);
106 DEFINE_EXPECT(OnInPlaceActivateEx
);
107 DEFINE_EXPECT(OnUIActivate
);
108 DEFINE_EXPECT(GetWindowContext
);
109 DEFINE_EXPECT(OnUIDeactivate
);
110 DEFINE_EXPECT(OnInPlaceDeactivate
);
111 DEFINE_EXPECT(OnInPlaceDeactivateEx
);
112 DEFINE_EXPECT(GetContainer
);
113 DEFINE_EXPECT(ShowUI
);
114 DEFINE_EXPECT(ActivateMe
);
115 DEFINE_EXPECT(GetHostInfo
);
116 DEFINE_EXPECT(HideUI
);
117 DEFINE_EXPECT(GetOptionKeyPath
);
118 DEFINE_EXPECT(GetOverrideKeyPath
);
119 DEFINE_EXPECT(SetStatusText
);
120 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
121 DEFINE_EXPECT(QueryStatus_OPEN
);
122 DEFINE_EXPECT(QueryStatus_NEW
);
123 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
124 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
125 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE
);
126 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
127 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
128 DEFINE_EXPECT(Exec_ShellDocView_37
);
129 DEFINE_EXPECT(Exec_ShellDocView_62
);
130 DEFINE_EXPECT(Exec_ShellDocView_63
);
131 DEFINE_EXPECT(Exec_ShellDocView_67
);
132 DEFINE_EXPECT(Exec_ShellDocView_84
);
133 DEFINE_EXPECT(Exec_ShellDocView_103
);
134 DEFINE_EXPECT(Exec_ShellDocView_105
);
135 DEFINE_EXPECT(Exec_ShellDocView_138
);
136 DEFINE_EXPECT(Exec_ShellDocView_140
);
137 DEFINE_EXPECT(Exec_DocHostCommandHandler_2300
);
138 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
139 DEFINE_EXPECT(Exec_SETTITLE
);
140 DEFINE_EXPECT(Exec_HTTPEQUIV
);
141 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
142 DEFINE_EXPECT(Exec_Explorer_38
);
143 DEFINE_EXPECT(Exec_Explorer_69
);
144 DEFINE_EXPECT(Exec_DOCCANNAVIGATE
);
145 DEFINE_EXPECT(Exec_DOCCANNAVIGATE_NULL
);
146 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
147 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
148 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
149 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
150 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
151 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
152 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive
);
153 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading
);
154 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete
);
155 DEFINE_EXPECT(GetDropTarget
);
156 DEFINE_EXPECT(UpdateUI
);
157 DEFINE_EXPECT(Navigate
);
158 DEFINE_EXPECT(OnFrameWindowActivate
);
159 DEFINE_EXPECT(OnChanged_READYSTATE
);
160 DEFINE_EXPECT(OnChanged_1005
);
161 DEFINE_EXPECT(OnChanged_1012
);
162 DEFINE_EXPECT(OnChanged_1014
);
163 DEFINE_EXPECT(GetDisplayName
);
164 DEFINE_EXPECT(BindToStorage
);
165 DEFINE_EXPECT(IsSystemMoniker
);
166 DEFINE_EXPECT(GetBindResult
);
167 DEFINE_EXPECT(GetClassID
);
168 DEFINE_EXPECT(Abort
);
170 DEFINE_EXPECT(CreateInstance
);
171 DEFINE_EXPECT(Start
);
172 DEFINE_EXPECT(Terminate
);
173 DEFINE_EXPECT(Protocol_Read
);
174 DEFINE_EXPECT(LockRequest
);
175 DEFINE_EXPECT(UnlockRequest
);
176 DEFINE_EXPECT(OnFocus_TRUE
);
177 DEFINE_EXPECT(OnFocus_FALSE
);
178 DEFINE_EXPECT(RequestUIActivate
);
179 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace
);
180 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject
);
181 DEFINE_EXPECT(GetExternal
);
182 DEFINE_EXPECT(EnableModeless_TRUE
);
183 DEFINE_EXPECT(EnableModeless_FALSE
);
184 DEFINE_EXPECT(Frame_EnableModeless_TRUE
);
185 DEFINE_EXPECT(Frame_EnableModeless_FALSE
);
186 DEFINE_EXPECT(Frame_GetWindow
);
187 DEFINE_EXPECT(TranslateUrl
);
188 DEFINE_EXPECT(Advise_Close
);
189 DEFINE_EXPECT(OnViewChange
);
190 DEFINE_EXPECT(EvaluateNewWindow
);
191 DEFINE_EXPECT(GetTravelLog
);
192 DEFINE_EXPECT(UpdateBackForwardState
);
193 DEFINE_EXPECT(FireBeforeNavigate2
);
194 DEFINE_EXPECT(FireNavigateComplete2
);
195 DEFINE_EXPECT(FireDocumentComplete
);
196 DEFINE_EXPECT(GetPendingUrl
);
197 DEFINE_EXPECT(ActiveElementChanged
);
198 DEFINE_EXPECT(IsErrorUrl
);
199 DEFINE_EXPECT(get_LocationURL
);
200 DEFINE_EXPECT(CountEntries
);
201 DEFINE_EXPECT(FindConnectionPoint
);
202 DEFINE_EXPECT(EnumConnections
);
203 DEFINE_EXPECT(EnumConnections_Next
);
204 DEFINE_EXPECT(WindowClosing
);
205 DEFINE_EXPECT(NavigateWithBindCtx
);
207 static BOOL is_ie9plus
;
208 static IUnknown
*doc_unk
;
209 static IMoniker
*doc_mon
;
210 static BOOL expect_LockContainer_fLock
;
211 static BOOL expect_InPlaceUIWindow_SetActiveObject_active
= TRUE
;
212 static BOOL ipsex
, ipsw
;
213 static BOOL set_clientsite
, container_locked
;
214 static BOOL readystate_set_loading
= FALSE
, readystate_set_interactive
= FALSE
, load_from_stream
;
215 static BOOL editmode
= FALSE
, ignore_external_qi
;
216 static BOOL inplace_deactivated
, open_call
;
217 static BOOL complete
, loading_js
, loading_hash
, is_refresh
;
218 static DWORD status_code
= HTTP_STATUS_OK
;
219 static BOOL asynchronous_binding
= FALSE
;
220 static BOOL support_wbapp
, allow_new_window
, no_travellog
;
221 static BOOL report_mime
;
222 static BOOL testing_submit
;
223 static BOOL resetting_document
;
224 static int stream_read
, protocol_read
;
225 static IStream
*history_stream
;
226 static enum load_state_t
{
235 static LPCOLESTR expect_status_text
= NULL
;
236 static const char *nav_url
, *nav_serv_url
, *prev_url
;
238 static const char html_page
[] =
240 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
241 "<body><div>test</div></body>"
244 static const char css_data
[] = "body {color: red; margin: 0}";
246 static const WCHAR http_urlW
[] =
247 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t','s','/','w','i','n','e','h','q','_','s','n','a','p','s','h','o','t','/',0};
249 static const WCHAR doc_url
[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
251 #define DOCHOST_DOCCANNAVIGATE 0
252 #define WM_CONTINUE_BINDING (WM_APP+1)
254 static HRESULT
QueryInterface(REFIID riid
, void **ppv
);
255 static void test_MSHTML_QueryStatus(IHTMLDocument2
*,DWORD
);
257 #define test_readyState(u) _test_readyState(__LINE__,u)
258 static void _test_readyState(unsigned,IUnknown
*);
260 static const WCHAR wszTimesNewRoman
[] =
261 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
262 static const WCHAR wszArial
[] =
263 {'A','r','i','a','l',0};
265 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
268 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
269 return lstrcmpA(stra
, buf
);
272 static BOOL
wstr_contains(const WCHAR
*strw
, const char *stra
)
275 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
276 return strstr(buf
, stra
) != NULL
;
279 static const WCHAR
*strstrW( const WCHAR
*str
, const WCHAR
*sub
)
283 const WCHAR
*p1
= str
, *p2
= sub
;
284 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
285 if (!*p2
) return str
;
291 static BSTR
a2bstr(const char *str
)
296 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
297 ret
= SysAllocStringLen(NULL
, len
);
298 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
303 /* Returns true if the user interface is in English. Note that this does not
304 * presume of the formatting of dates, numbers, etc.
306 static BOOL
is_lang_english(void)
308 static HMODULE hkernel32
= NULL
;
309 static LANGID (WINAPI
*pGetThreadUILanguage
)(void) = NULL
;
310 static LANGID (WINAPI
*pGetUserDefaultUILanguage
)(void) = NULL
;
314 hkernel32
= GetModuleHandleA("kernel32.dll");
315 pGetThreadUILanguage
= (void*)GetProcAddress(hkernel32
, "GetThreadUILanguage");
316 pGetUserDefaultUILanguage
= (void*)GetProcAddress(hkernel32
, "GetUserDefaultUILanguage");
318 if (pGetThreadUILanguage
)
319 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH
;
320 if (pGetUserDefaultUILanguage
)
321 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH
;
323 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
326 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
328 IUnknown
*unk1
, *unk2
;
333 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
334 IUnknown_Release(unk1
);
335 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
336 IUnknown_Release(unk2
);
341 #define EXPECT_UPDATEUI 1
342 #define EXPECT_SETTITLE 2
344 static void test_timer(DWORD flags
)
346 BOOL
*b
= &called_Exec_SETTITLE
;
349 if(flags
& EXPECT_UPDATEUI
) {
350 SET_EXPECT(UpdateUI
);
351 SET_EXPECT(Exec_UPDATECOMMANDS
);
352 b
= &called_UpdateUI
;
354 if(flags
& EXPECT_SETTITLE
)
355 SET_EXPECT(Exec_SETTITLE
);
357 while(!*b
&& GetMessageA(&msg
, doc_hwnd
, 0, 0)) {
358 TranslateMessage(&msg
);
359 DispatchMessageA(&msg
);
362 if(flags
& EXPECT_UPDATEUI
) {
363 CHECK_CALLED(UpdateUI
);
364 CHECK_CALLED(Exec_UPDATECOMMANDS
);
366 if(flags
& EXPECT_SETTITLE
)
367 CHECK_CALLED(Exec_SETTITLE
);
370 static IMoniker Moniker
;
372 #define test_GetCurMoniker(u,m,v,t) _test_GetCurMoniker(__LINE__,u,m,v,t)
373 static void _test_GetCurMoniker(unsigned line
, IUnknown
*unk
, IMoniker
*exmon
, const char *exurl
, BOOL is_todo
)
376 IPersistMoniker
*permon
;
377 IMoniker
*mon
= (void*)0xdeadbeef;
378 BSTR doc_url
= (void*)0xdeadbeef;
385 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
386 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
390 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
391 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
393 hres
= IHTMLDocument2_get_URL(doc
, &doc_url
);
394 ok(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
395 for(ptr
= doc_url
; *ptr
&& *ptr
!= '#'; ptr
++);
397 hres
= IPersistMoniker_GetCurMoniker(permon
, &mon
);
398 IPersistMoniker_Release(permon
);
402 BOOL exb
= expect_GetDisplayName
;
403 BOOL clb
= called_GetDisplayName
;
405 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
406 ok_(__FILE__
,line
)(mon
== exmon
, "mon(%p) != exmon(%p)\n", mon
, exmon
);
409 SET_EXPECT(GetDisplayName
);
410 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
411 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
413 CHECK_CALLED(GetDisplayName
);
414 expect_GetDisplayName
= exb
;
415 called_GetDisplayName
= clb
;
418 ok(!lstrcmpW(url
, doc_url
), "url %s != doc_url %s\n", wine_dbgstr_w(url
), wine_dbgstr_w(doc_url
));
420 ok(!strcmp_wa(url
, nav_serv_url
), "url = %s, expected %s\n", wine_dbgstr_w(url
), nav_serv_url
);
425 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
427 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
428 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
431 todo_wine
ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "unexpected url %s\n", wine_dbgstr_w(url
));
433 ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "unexpected url %s\n", wine_dbgstr_w(url
));
435 ok_(__FILE__
,line
)(!lstrcmpW(url
, doc_url
), "url %s != doc_url %s\n", wine_dbgstr_w(url
), wine_dbgstr_w(doc_url
));
439 ok_(__FILE__
,line
)(hres
== E_UNEXPECTED
,
440 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres
);
441 ok_(__FILE__
,line
)(mon
== (IMoniker
*)0xdeadbeef, "mon=%p\n", mon
);
442 ok_(__FILE__
,line
)(!strcmp_wa(doc_url
, "about:blank"), "doc_url is not about:blank\n");
445 SysFreeString(doc_url
);
446 IHTMLDocument2_Release(doc
);
447 if(mon
&& mon
!= (void*)0xdeadbeef)
448 IMoniker_Release(mon
);
451 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
452 static void _test_current_url(unsigned line
, IUnknown
*unk
, const char *exurl
)
458 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
459 ok_(__FILE__
,line
)(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
461 hres
= IHTMLDocument2_get_URL(doc
, &url
);
462 ok_(__FILE__
,line
)(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
463 ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url
), exurl
);
466 IHTMLDocument2_Release(doc
);
469 DEFINE_GUID(IID_External_unk
,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
471 static HRESULT WINAPI
External_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
475 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
480 if(IsEqualGUID(&IID_IProxyManager
, riid
))
481 return E_NOINTERFACE
; /* TODO */
482 if(IsEqualGUID(&IID_IDispatchEx
, riid
))
483 return E_NOINTERFACE
; /* TODO */
484 if(IsEqualGUID(&IID_External_unk
, riid
))
485 return E_NOINTERFACE
; /* TODO */
487 if(!ignore_external_qi
)
488 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid
));
489 return E_NOINTERFACE
;
492 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
497 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
502 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
504 ok(0, "unexpected call\n");
508 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
511 ok(0, "unexpected call\n");
515 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
516 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
518 ok(0, "unexpected call\n");
522 static HRESULT WINAPI
External_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
523 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
524 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
526 ok(0, "unexpected call\n");
530 static const IDispatchVtbl ExternalVtbl
= {
531 External_QueryInterface
,
534 Dispatch_GetTypeInfoCount
,
535 Dispatch_GetTypeInfo
,
536 Dispatch_GetIDsOfNames
,
540 static IDispatch External
= { &ExternalVtbl
};
542 static HRESULT WINAPI
Protocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
544 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
550 return E_NOINTERFACE
;
553 static ULONG WINAPI
Protocol_AddRef(IInternetProtocol
*iface
)
558 static ULONG WINAPI
Protocol_Release(IInternetProtocol
*iface
)
563 static HRESULT WINAPI
Protocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
564 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
565 DWORD grfPI
, HANDLE_PTR dwReserved
)
571 static const WCHAR wszTextCss
[] = {'t','e','x','t','/','c','s','s',0};
572 static const WCHAR empty_str
= {0};
576 ok(pOIProtSink
!= NULL
, "pOIProtSink == NULL\n");
577 ok(pOIBindInfo
!= NULL
, "pOIBindInfo == NULL\n");
578 ok(!grfPI
, "grfPI = %x\n", grfPI
);
579 ok(!dwReserved
, "dwReserved = %lx\n", dwReserved
);
581 memset(&bindinfo
, 0, sizeof(bindinfo
));
582 bindinfo
.cbSize
= sizeof(bindinfo
);
583 hres
= IInternetBindInfo_GetBindInfo(pOIBindInfo
, &bindf
, &bindinfo
);
584 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
586 ok(bindf
== (BINDF_FROMURLMON
|BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
587 "bindf = %x\n", bindf
);
589 ok(bindf
== (BINDF_FROMURLMON
|BINDF_FORMS_SUBMIT
|BINDF_PRAGMA_NO_CACHE
|BINDF_HYPERLINK
590 |BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_GETNEWESTVERSION
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
591 "bindf = %x\n", bindf
);
593 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
594 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
595 /* TODO: test stgmedData */
596 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
597 if(!testing_submit
) {
598 ok(bindinfo
.dwBindVerb
== BINDVERB_GET
, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
599 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
600 ok(bindinfo
.stgmedData
.tymed
== TYMED_NULL
, "bindinfo.stgmedData.tymed=%d\n", bindinfo
.stgmedData
.tymed
);
602 ok(bindinfo
.dwBindVerb
== BINDVERB_POST
, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
603 ok(bindinfo
.cbstgmedData
== 8, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
604 ok(bindinfo
.stgmedData
.tymed
== TYMED_HGLOBAL
, "bindinfo.stgmedData.tymed=%d\n", bindinfo
.stgmedData
.tymed
);
605 ok(!memcmp(U(bindinfo
.stgmedData
).hGlobal
, "cmd=TEST", 8), "unexpected hGlobal\n");
607 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
608 ok(bindinfo
.dwOptions
== 0x80000 ||
609 bindinfo
.dwOptions
== 0x4080000, /* win2k3 */
610 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
611 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
612 /* TODO: test dwCodePage */
613 /* TODO: test securityAttributes */
614 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
615 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
616 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
618 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
619 BINDSTATUS_CACHEFILENAMEAVAILABLE
, &empty_str
);
620 ok(hres
== S_OK
, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres
);
623 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
624 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
, wszTextCss
);
626 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres
);
629 hres
= IInternetProtocolSink_ReportData(pOIProtSink
,
630 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
, 13, 13);
631 ok(hres
== S_OK
, "ReportData failed: %08x\n", hres
);
633 hres
= IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
634 ok(hres
== S_OK
, "ReportResult failed: %08x\n", hres
);
639 static HRESULT WINAPI
Protocol_Continue(IInternetProtocol
*iface
,
640 PROTOCOLDATA
*pProtocolData
)
642 ok(0, "unexpected call\n");
646 static HRESULT WINAPI
Protocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
649 ok(0, "unexpected call\n");
653 static HRESULT WINAPI
Protocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
655 CHECK_EXPECT(Terminate
);
659 static HRESULT WINAPI
Protocol_Suspend(IInternetProtocol
*iface
)
661 ok(0, "unexpected call\n");
665 static HRESULT WINAPI
Protocol_Resume(IInternetProtocol
*iface
)
667 ok(0, "unexpected call\n");
671 static HRESULT WINAPI
Protocol_Read(IInternetProtocol
*iface
, void *pv
,
672 ULONG cb
, ULONG
*pcbRead
)
674 CHECK_EXPECT2(Protocol_Read
);
676 ok(pv
!= NULL
, "pv == NULL\n");
677 ok(cb
> sizeof(css_data
), "cb < sizeof(css_data)\n");
678 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
679 ok(!*pcbRead
|| *pcbRead
==sizeof(css_data
)-1, "*pcbRead=%d\n", *pcbRead
);
684 protocol_read
+= *pcbRead
= sizeof(css_data
)-1;
685 memcpy(pv
, css_data
, sizeof(css_data
)-1);
690 static HRESULT WINAPI
Protocol_Seek(IInternetProtocol
*iface
,
691 LARGE_INTEGER dlibMove
, DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
693 ok(0, "unexpected call\n");
697 static HRESULT WINAPI
Protocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
699 CHECK_EXPECT(LockRequest
);
703 static HRESULT WINAPI
Protocol_UnlockRequest(IInternetProtocol
*iface
)
705 CHECK_EXPECT(UnlockRequest
);
709 static const IInternetProtocolVtbl ProtocolVtbl
= {
710 Protocol_QueryInterface
,
721 Protocol_LockRequest
,
722 Protocol_UnlockRequest
725 static IInternetProtocol Protocol
= { &ProtocolVtbl
};
727 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
729 if(!IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
730 ok(0, "unexpected call\n");
731 return E_NOINTERFACE
;
734 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
739 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
744 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
745 REFIID riid
, void **ppv
)
747 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
748 return E_NOINTERFACE
;
750 CHECK_EXPECT(CreateInstance
);
751 ok(ppv
!= NULL
, "ppv == NULL\n");
757 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
759 ok(0, "unexpected call\n");
763 static const IClassFactoryVtbl ClassFactoryVtbl
= {
764 ClassFactory_QueryInterface
,
766 ClassFactory_Release
,
767 ClassFactory_CreateInstance
,
768 ClassFactory_LockServer
771 static IClassFactory ClassFactory
= { &ClassFactoryVtbl
};
773 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
775 ok(0, "unexpected call\n");
779 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
784 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
789 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
790 IHlinkBrowseContext
*pihlbc
)
792 ok(0, "unexpected call\n");
796 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
797 IHlinkBrowseContext
**ppihlbc
)
799 ok(0, "unexpected call\n");
803 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
804 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
808 CHECK_EXPECT(Navigate
);
810 ok(grfHLNF
== 0, "grfHLNF=%d, expected 0\n", grfHLNF
);
811 ok(pbc
!= NULL
, "pbc == NULL\n");
812 ok(pibsc
!= NULL
, "pubsc == NULL\n");
813 ok(pihlNavigate
!= NULL
, "puhlNavigate == NULL\n");
816 LPWSTR frame_name
= (LPWSTR
)0xdeadbeef;
817 LPWSTR location
= (LPWSTR
)0xdeadbeef;
819 IMoniker
*mon
= NULL
;
820 DWORD site_data
= 0xdeadbeef;
822 hres
= IHlink_GetTargetFrameName(pihlNavigate
, &frame_name
);
823 ok(hres
== S_FALSE
, "GetTargetFrameName failed: %08x\n", hres
);
824 ok(frame_name
== NULL
, "frame_name = %p\n", frame_name
);
826 hres
= IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
827 ok(hres
== S_OK
, "GetMonikerReference failed: %08x\n", hres
);
828 ok(location
== NULL
, "location = %p\n", location
);
829 ok(mon
!= NULL
, "mon == NULL\n");
831 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &location
);
832 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
833 ok(!strcmp_wa(location
, nav_url
), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location
), nav_url
);
834 CoTaskMemFree(location
);
835 IMoniker_Release(mon
);
837 hres
= IHlink_GetHlinkSite(pihlNavigate
, &site
, &site_data
);
838 ok(hres
== S_OK
, "GetHlinkSite failed: %08x\n", hres
);
839 ok(site
== NULL
, "site = %p\n, expected NULL\n", site
);
840 ok(site_data
== 0xdeadbeef, "site_data = %x\n", site_data
);
846 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
847 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
849 ok(0, "unexpected call\n");
853 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
854 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
856 ok(0, "unexpected call\n");
860 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
861 HlinkFrame_QueryInterface
,
864 HlinkFrame_SetBrowseContext
,
865 HlinkFrame_GetBrowseContext
,
867 HlinkFrame_OnNavigate
,
868 HlinkFrame_UpdateHlink
871 static IHlinkFrame HlinkFrame
= { &HlinkFrameVtbl
};
873 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
875 ok(0, "unexpected call\n");
876 return E_NOINTERFACE
;
879 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
884 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
889 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
890 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
891 DWORD dwUserActionTime
)
893 CHECK_EXPECT(EvaluateNewWindow
);
895 ok(!strcmp_wa(pszUrl
, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl
));
896 ok(!strcmp_wa(pszName
, "test"), "pszName = %s\n", wine_dbgstr_w(pszName
));
897 ok(!strcmp_wa(pszUrlContext
, prev_url
), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext
));
898 ok(!pszFeatures
, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures
));
899 ok(!fReplace
, "fReplace = %x\n", fReplace
);
900 ok(dwFlags
== (allow_new_window
? 0 : NWMF_FIRST
), "dwFlags = %x\n", dwFlags
);
901 ok(!dwUserActionTime
, "dwUserActionime = %d\n", dwUserActionTime
);
903 return allow_new_window
? S_OK
: E_FAIL
;
906 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
907 NewWindowManager_QueryInterface
,
908 NewWindowManager_AddRef
,
909 NewWindowManager_Release
,
910 NewWindowManager_EvaluateNewWindow
913 static INewWindowManager NewWindowManager
= { &NewWindowManagerVtbl
};
915 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
916 REFIID riid
, void**ppv
)
918 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
923 ok(0, "unexpected call\n");
924 return E_NOINTERFACE
;
927 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
932 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
937 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
939 if(resetting_document
)
943 case DISPID_READYSTATE
:
944 CHECK_EXPECT2(OnChanged_READYSTATE
);
946 if(!readystate_set_interactive
)
947 test_MSHTML_QueryStatus(NULL
, OLECMDF_SUPPORTED
948 | (editmode
&& (load_state
== LD_INTERACTIVE
|| load_state
== LD_COMPLETE
)
949 ? OLECMDF_ENABLED
: 0));
951 if(readystate_set_loading
) {
952 readystate_set_loading
= FALSE
;
953 load_state
= LD_LOADING
;
955 if(!editmode
|| load_state
!= LD_LOADING
|| !called_Exec_Explorer_69
)
956 test_readyState(NULL
);
959 CHECK_EXPECT2(OnChanged_1005
);
961 test_readyState(NULL
);
962 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
965 CHECK_EXPECT2(OnChanged_1012
);
968 CHECK_EXPECT2(OnChanged_1014
);
985 ok(0, "unexpected id %d\n", dispID
);
989 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
991 ok(0, "unexpected call\n");
995 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
996 PropertyNotifySink_QueryInterface
,
997 PropertyNotifySink_AddRef
,
998 PropertyNotifySink_Release
,
999 PropertyNotifySink_OnChanged
,
1000 PropertyNotifySink_OnRequestEdit
1003 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
1005 static HRESULT WINAPI
Stream_QueryInterface(IStream
*iface
, REFIID riid
, void **ppv
)
1007 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_ISequentialStream
, riid
) || IsEqualGUID(&IID_IStream
, riid
)) {
1012 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
1014 return E_NOINTERFACE
;
1017 static ULONG WINAPI
Stream_AddRef(IStream
*iface
)
1022 static ULONG WINAPI
Stream_Release(IStream
*iface
)
1027 static HRESULT WINAPI
Stream_Read(IStream
*iface
, void *pv
,
1028 ULONG cb
, ULONG
*pcbRead
)
1030 CHECK_EXPECT2(Read
);
1031 ok(pv
!= NULL
, "pv == NULL\n");
1032 ok(cb
> sizeof(html_page
), "cb = %d\n", cb
);
1033 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
1034 ok(!*pcbRead
, "*pcbRead = %d\n", *pcbRead
);
1039 memcpy(pv
, html_page
, sizeof(html_page
)-1);
1040 stream_read
+= *pcbRead
= sizeof(html_page
)-1;
1044 static HRESULT WINAPI
Stream_Write(IStream
*iface
, const void *pv
,
1045 ULONG cb
, ULONG
*pcbWritten
)
1047 ok(0, "unexpected call\n");
1051 static HRESULT WINAPI
Stream_Seek(IStream
*iface
, LARGE_INTEGER dlibMove
,
1052 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
1054 ok(0, "unexpected call\n");
1058 static HRESULT WINAPI
Stream_SetSize(IStream
*iface
, ULARGE_INTEGER libNewSize
)
1060 ok(0, "unexpected call\n");
1064 static HRESULT WINAPI
Stream_CopyTo(IStream
*iface
, IStream
*pstm
,
1065 ULARGE_INTEGER cb
, ULARGE_INTEGER
*pcbRead
, ULARGE_INTEGER
*pcbWritten
)
1067 ok(0, "unexpected call\n");
1071 static HRESULT WINAPI
Stream_Commit(IStream
*iface
, DWORD grfCommitFlags
)
1073 ok(0, "unexpected call\n");
1077 static HRESULT WINAPI
Stream_Revert(IStream
*iface
)
1079 ok(0, "unexpected call\n");
1083 static HRESULT WINAPI
Stream_LockRegion(IStream
*iface
, ULARGE_INTEGER libOffset
,
1084 ULARGE_INTEGER cb
, DWORD dwLockType
)
1086 ok(0, "unexpected call\n");
1090 static HRESULT WINAPI
Stream_UnlockRegion(IStream
*iface
,
1091 ULARGE_INTEGER libOffset
, ULARGE_INTEGER cb
, DWORD dwLockType
)
1093 ok(0, "unexpected call\n");
1097 static HRESULT WINAPI
Stream_Stat(IStream
*iface
, STATSTG
*pstatstg
,
1100 ok(0, "unexpected call\n");
1104 static HRESULT WINAPI
Stream_Clone(IStream
*iface
, IStream
**ppstm
)
1106 ok(0, "unexpected call\n");
1110 static const IStreamVtbl StreamVtbl
= {
1111 Stream_QueryInterface
,
1122 Stream_UnlockRegion
,
1127 static IStream Stream
= { &StreamVtbl
};
1129 static HRESULT WINAPI
WinInetHttpInfo_QueryInterface(
1130 IWinInetHttpInfo
* This
,
1136 if(IsEqualGUID(&IID_IGetBindHandle
, riid
))
1137 return E_NOINTERFACE
;
1139 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
1140 return E_NOINTERFACE
;
1143 static ULONG WINAPI
WinInetHttpInfo_AddRef(
1144 IWinInetHttpInfo
* This
)
1149 static ULONG WINAPI
WinInetHttpInfo_Release(
1150 IWinInetHttpInfo
* This
)
1155 static HRESULT WINAPI
WinInetHttpInfo_QueryOption(
1156 IWinInetHttpInfo
* This
,
1161 return E_NOTIMPL
; /* TODO */
1164 static HRESULT WINAPI
WinInetHttpInfo_QueryInfo(
1165 IWinInetHttpInfo
* This
,
1172 ok(pdwReserved
== NULL
, "pdwReserved != NULL\n");
1174 if(dwOption
== (HTTP_QUERY_STATUS_CODE
|HTTP_QUERY_FLAG_NUMBER
)) {
1175 ok(pBuffer
!= NULL
, "pBuffer == NULL\n");
1176 ok(*pcbBuf
== sizeof(DWORD
), "*pcbBuf = %d\n", *pcbBuf
);
1177 ok(pdwFlags
== NULL
, "*pdwFlags != NULL\n");
1178 *((DWORD
*)pBuffer
) = status_code
;
1182 return E_NOTIMPL
; /* TODO */
1185 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
= {
1186 WinInetHttpInfo_QueryInterface
,
1187 WinInetHttpInfo_AddRef
,
1188 WinInetHttpInfo_Release
,
1189 WinInetHttpInfo_QueryOption
,
1190 WinInetHttpInfo_QueryInfo
1193 static IWinInetHttpInfo WinInetHttpInfo
= { &WinInetHttpInfoVtbl
};
1195 DEFINE_GUID(IID_unk_binding
, 0xf3d8f080,0xa5eb,0x476f,0x9d,0x19,0xa5,0xef,0x24,0xe5,0xc2,0xe6);
1197 static HRESULT WINAPI
Binding_QueryInterface(IBinding
*iface
, REFIID riid
, void **ppv
)
1199 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1204 if(IsEqualGUID(&IID_IWinInetInfo
, riid
) || IsEqualGUID(&IID_IWinInetHttpInfo
, riid
)) {
1205 *ppv
= &WinInetHttpInfo
;
1209 if(IsEqualGUID(&IID_unk_binding
, riid
)) {
1211 return E_NOINTERFACE
;
1214 trace("Binding::QI(%s)\n", wine_dbgstr_guid(riid
));
1216 return E_NOINTERFACE
;
1219 static ULONG WINAPI
Binding_AddRef(IBinding
*iface
)
1224 static ULONG WINAPI
Binding_Release(IBinding
*iface
)
1229 static HRESULT WINAPI
Binding_Abort(IBinding
*iface
)
1231 CHECK_EXPECT(Abort
);
1232 if(asynchronous_binding
)
1233 PeekMessageA(NULL
, container_hwnd
, WM_CONTINUE_BINDING
, WM_CONTINUE_BINDING
, PM_REMOVE
);
1237 static HRESULT WINAPI
Binding_Suspend(IBinding
*iface
)
1239 ok(0, "unexpected call\n");
1243 static HRESULT WINAPI
Binding_Resume(IBinding
*iface
)
1245 ok(0, "unexpected call\n");
1249 static HRESULT WINAPI
Binding_SetPriority(IBinding
*iface
, LONG nPriority
)
1251 ok(0, "unexpected call\n");
1255 static HRESULT WINAPI
Binding_GetPriority(IBinding
*iface
, LONG
*pnPriority
)
1257 ok(0, "unexpected call\n");
1261 static HRESULT WINAPI
Binding_GetBindResult(IBinding
*iface
, CLSID
*pclsidProtocol
,
1262 DWORD
*pdwResult
, LPOLESTR
*pszResult
, DWORD
*pdwReserved
)
1264 CHECK_EXPECT(GetBindResult
);
1268 static const IBindingVtbl BindingVtbl
= {
1269 Binding_QueryInterface
,
1275 Binding_SetPriority
,
1276 Binding_GetPriority
,
1277 Binding_GetBindResult
1280 static IBinding Binding
= { &BindingVtbl
};
1282 DEFINE_GUID(IID_IMoniker_unk
,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1283 DEFINE_GUID(IID_IMoniker_unk2
, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1285 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
1289 if(IsEqualGUID(&IID_IMoniker_unk
, riid
))
1290 return E_NOINTERFACE
; /* TODO */
1291 if(IsEqualGUID(&IID_IMoniker_unk2
, riid
))
1292 return E_NOINTERFACE
; /* TODO */
1294 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid
));
1295 return E_NOINTERFACE
;
1298 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
1303 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
1308 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
1310 CHECK_EXPECT(GetClassID
);
1311 ok(IsEqualGUID(pClassID
, &IID_NULL
), "pClassID = %s\n", wine_dbgstr_guid(pClassID
));
1315 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
1317 ok(0, "unexpected call\n");
1321 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
1323 ok(0, "unexpected call\n");
1327 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
1329 ok(0, "unexpected call\n");
1333 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
1335 ok(0, "unexpected call\n");
1339 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
1340 REFIID riidResult
, void **ppvResult
)
1342 ok(0, "unexpected call\n");
1346 static void test_binding_ui(IUnknown
*unk
)
1348 IWindowForBindingUI
*binding_ui
;
1349 IServiceProvider
*serv_prov
;
1353 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&serv_prov
);
1354 ok(hres
== S_OK
, "Could not get IServiceProvider: %08x\n", hres
);
1356 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IWindowForBindingUI
, &IID_IWindowForBindingUI
,
1357 (void**)&binding_ui
);
1358 ok(hres
== S_OK
, "Could not get IWindowForBindingUI: %08x\n", hres
);
1360 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IHttpSecurity
, &binding_hwnd
);
1361 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1363 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1365 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1367 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IAuthenticate
, &binding_hwnd
);
1368 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1370 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1372 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1374 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IWindowForBindingUI
, &binding_hwnd
);
1375 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1377 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1379 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1381 IWindowForBindingUI_Release(binding_ui
);
1382 IServiceProvider_Release(serv_prov
);
1385 static void continue_binding(IBindStatusCallback
*callback
)
1387 FORMATETC formatetc
= {0xc02d, NULL
, 1, -1, TYMED_ISTREAM
};
1388 STGMEDIUM stgmedium
;
1391 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
1393 test_binding_ui((IUnknown
*)callback
);
1396 hres
= IBindStatusCallback_OnProgress(callback
, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE
,
1398 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres
);
1401 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1402 BINDSTATUS_BEGINDOWNLOADDATA
, doc_url
);
1403 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres
);
1404 if(status_code
!= HTTP_STATUS_OK
) {
1405 CHECK_CALLED_BROKEN(IsErrorUrl
);
1406 SET_EXPECT(IsErrorUrl
);
1410 stgmedium
.tymed
= TYMED_ISTREAM
;
1411 U(stgmedium
).pstm
= &Stream
;
1412 stgmedium
.pUnkForRelease
= (IUnknown
*)&Moniker
;
1413 hres
= IBindStatusCallback_OnDataAvailable(callback
,
1414 BSCF_FIRSTDATANOTIFICATION
|BSCF_LASTDATANOTIFICATION
,
1415 sizeof(html_page
)-1, &formatetc
, &stgmedium
);
1416 ok(hres
== S_OK
, "OnDataAvailable failed: %08x\n", hres
);
1419 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1420 BINDSTATUS_ENDDOWNLOADDATA
, NULL
);
1421 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres
);
1423 SET_EXPECT(GetBindResult
);
1424 hres
= IBindStatusCallback_OnStopBinding(callback
, S_OK
, NULL
);
1425 ok(hres
== S_OK
, "OnStopBinding failed: %08x\n", hres
);
1426 CLEAR_CALLED(GetBindResult
); /* IE7 */
1428 IBindStatusCallback_Release(callback
);
1431 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1432 REFIID riid
, void **ppv
)
1434 IBindStatusCallback
*callback
= NULL
;
1439 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1441 CHECK_EXPECT(BindToStorage
);
1443 load_state
= LD_LOADING
;
1445 ok(pbc
!= NULL
, "pbc == NULL\n");
1446 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1447 ok(IsEqualGUID(&IID_IStream
, riid
), "unexpected riid\n");
1448 ok(ppv
!= NULL
, "ppv == NULL\n");
1449 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
1451 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, (IUnknown
**)&callback
);
1452 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
1453 ok(callback
!= NULL
, "callback == NULL\n");
1455 memset(&bindinfo
, 0xf0, sizeof(bindinfo
));
1456 bindinfo
.cbSize
= sizeof(bindinfo
);
1458 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
1459 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
1460 ok((bindf
& ~BINDF_HYPERLINK
/* IE9 */) == (BINDF_PULLDATA
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
), "bindf = %08x\n", bindf
);
1461 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
1462 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
1463 /* TODO: test stgmedData */
1464 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
1465 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
1466 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
1467 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
1468 ok(bindinfo
.dwOptions
== 0x80000 || bindinfo
.dwOptions
== 0x4080000,
1469 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
1470 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
1471 /* TODO: test dwCodePage */
1472 /* TODO: test securityAttributes */
1473 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
1474 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
1475 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
1477 hres
= IBindStatusCallback_OnStartBinding(callback
, 0, &Binding
);
1478 ok(hres
== S_OK
, "OnStartBinding failed: %08x\n", hres
);
1480 if(asynchronous_binding
) {
1481 PostMessageW(container_hwnd
, WM_CONTINUE_BINDING
, (WPARAM
)callback
, 0);
1482 return MK_S_ASYNCHRONOUS
;
1485 continue_binding(callback
);
1489 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
1490 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
1492 ok(0, "unexpected call\n");
1496 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
1497 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
1499 ok(0, "unexpected call\n");
1503 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
1505 ok(0, "unexpected call\n");
1509 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
1511 ok(0, "unexpected call\n");
1515 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
1517 ok(0, "unexpected call\n");
1521 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1522 IMoniker
*pmkNewlyRunning
)
1524 ok(0, "unexpected call\n");
1528 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
1529 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
1531 ok(0, "unexpected call\n");
1535 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
1537 ok(0, "unexpected call\n");
1541 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
1542 IMoniker
**ppmkPrefix
)
1544 ok(0, "unexpected call\n");
1548 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
1549 IMoniker
**pmkRelPath
)
1551 ok(0, "unexpected call\n");
1555 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1556 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
1558 CHECK_EXPECT2(GetDisplayName
);
1560 /* ok(pbc != NULL, "pbc == NULL\n"); */
1561 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1562 ok(ppszDisplayName
!= NULL
, "ppszDisplayName == NULL\n");
1564 *ppszDisplayName
= CoTaskMemAlloc(sizeof(doc_url
));
1565 memcpy(*ppszDisplayName
, doc_url
, sizeof(doc_url
));
1570 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1571 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1573 ok(0, "unexpected call\n");
1577 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
1579 CHECK_EXPECT(IsSystemMoniker
);
1583 static const IMonikerVtbl MonikerVtbl
= {
1584 Moniker_QueryInterface
,
1592 Moniker_BindToObject
,
1593 Moniker_BindToStorage
,
1595 Moniker_ComposeWith
,
1600 Moniker_GetTimeOfLastChange
,
1602 Moniker_CommonPrefixWith
,
1603 Moniker_RelativePathTo
,
1604 Moniker_GetDisplayName
,
1605 Moniker_ParseDisplayName
,
1606 Moniker_IsSystemMoniker
1609 static IMoniker Moniker
= { &MonikerVtbl
};
1611 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1613 return QueryInterface(riid
, ppv
);
1616 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1621 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1626 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
1627 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1629 ok(0, "unexpected call\n");
1633 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
1634 IEnumUnknown
**ppenum
)
1636 ok(0, "unexpected call\n");
1640 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1642 CHECK_EXPECT(LockContainer
);
1643 ok(expect_LockContainer_fLock
== fLock
, "fLock=%x, expected %x\n", fLock
, expect_LockContainer_fLock
);
1647 static const IOleContainerVtbl OleContainerVtbl
= {
1648 OleContainer_QueryInterface
,
1649 OleContainer_AddRef
,
1650 OleContainer_Release
,
1651 OleContainer_ParseDisplayName
,
1652 OleContainer_EnumObjects
,
1653 OleContainer_LockContainer
1656 static IOleContainer OleContainer
= { &OleContainerVtbl
};
1658 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1660 return QueryInterface(riid
, ppv
);
1663 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1668 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1673 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1675 ok(0, "unexpected call\n");
1679 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1682 ok(0, "unexpected call\n");
1686 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1688 CHECK_EXPECT(GetContainer
);
1689 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1690 *ppContainer
= &OleContainer
;
1694 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1696 ok(0, "unexpected call\n");
1700 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1702 ok(0, "unexpected call\n");
1706 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1708 ok(0, "unexpected call\n");
1712 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1713 ClientSite_QueryInterface
,
1716 ClientSite_SaveObject
,
1717 ClientSite_GetMoniker
,
1718 ClientSite_GetContainer
,
1719 ClientSite_ShowObject
,
1720 ClientSite_OnShowWindow
,
1721 ClientSite_RequestNewObjectLayout
1724 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1726 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1728 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1730 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1731 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
1734 return E_NOINTERFACE
;
1737 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1742 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1747 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1749 CHECK_EXPECT(Frame_GetWindow
);
1753 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1755 ok(0, "unexpected call\n");
1759 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1761 ok(0, "unexpected call\n");
1765 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1766 LPCBORDERWIDTHS pborderwidths
)
1768 ok(0, "unexpected call\n");
1772 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1773 LPCBORDERWIDTHS pborderwidths
)
1775 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1779 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1780 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1782 static const WCHAR wszHTML_Document
[] =
1783 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1785 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1787 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1788 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1789 if(pActiveObject
&& is_lang_english())
1790 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1793 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1794 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1796 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1800 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1801 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1803 static const WCHAR wszHTML_Document
[] =
1804 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1807 CHECK_EXPECT2(SetActiveObject
);
1809 if(pActiveObject
&& is_lang_english())
1810 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1812 CHECK_EXPECT(SetActiveObject_null
);
1814 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1815 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1821 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1822 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1824 ok(0, "unexpected call\n");
1828 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1829 HOLEMENU holemenu
, HWND hwndActiveObject
)
1831 ok(0, "unexpected call\n");
1835 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1837 ok(0, "unexpected call\n");
1841 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1843 if(!resetting_document
)
1844 CHECK_EXPECT2(SetStatusText
);
1845 if(!expect_status_text
)
1846 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1850 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1853 CHECK_EXPECT2(Frame_EnableModeless_TRUE
);
1855 CHECK_EXPECT2(Frame_EnableModeless_FALSE
);
1859 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1861 ok(0, "unexpected call\n");
1865 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1866 InPlaceFrame_QueryInterface
,
1867 InPlaceFrame_AddRef
,
1868 InPlaceFrame_Release
,
1869 InPlaceFrame_GetWindow
,
1870 InPlaceFrame_ContextSensitiveHelp
,
1871 InPlaceFrame_GetBorder
,
1872 InPlaceFrame_RequestBorderSpace
,
1873 InPlaceFrame_SetBorderSpace
,
1874 InPlaceFrame_SetActiveObject
,
1875 InPlaceFrame_InsertMenus
,
1876 InPlaceFrame_SetMenu
,
1877 InPlaceFrame_RemoveMenus
,
1878 InPlaceFrame_SetStatusText
,
1879 InPlaceFrame_EnableModeless
,
1880 InPlaceFrame_TranslateAccelerator
1883 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1885 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1886 InPlaceFrame_QueryInterface
,
1887 InPlaceFrame_AddRef
,
1888 InPlaceFrame_Release
,
1889 InPlaceFrame_GetWindow
,
1890 InPlaceFrame_ContextSensitiveHelp
,
1891 InPlaceFrame_GetBorder
,
1892 InPlaceFrame_RequestBorderSpace
,
1893 InPlaceFrame_SetBorderSpace
,
1894 InPlaceUIWindow_SetActiveObject
,
1897 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1899 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
1901 return QueryInterface(riid
, ppv
);
1904 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
1909 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
1914 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(
1915 IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
1917 IOleClientSite
*client_site
;
1918 IOleObject
*ole_obj
;
1921 CHECK_EXPECT2(GetWindow
);
1922 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1923 *phwnd
= container_hwnd
;
1925 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IOleObject
, (void**)&ole_obj
);
1926 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
1928 hres
= IOleObject_GetClientSite(ole_obj
, &client_site
);
1929 IOleObject_Release(ole_obj
);
1930 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
1931 ok(client_site
== &ClientSite
, "client_site != ClientSite\n");
1932 IOleClientSite_Release(client_site
);
1937 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(
1938 IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
1940 ok(0, "unexpected call\n");
1944 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(
1945 IOleInPlaceSiteWindowless
*iface
)
1947 CHECK_EXPECT(CanInPlaceActivate
);
1951 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(
1952 IOleInPlaceSiteWindowless
*iface
)
1954 CHECK_EXPECT(OnInPlaceActivate
);
1955 inplace_deactivated
= FALSE
;
1959 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(
1960 IOleInPlaceSiteWindowless
*iface
)
1962 CHECK_EXPECT(OnUIActivate
);
1966 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(
1967 IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
1968 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1969 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1971 static const RECT rect
= {0,0,500,500};
1973 CHECK_EXPECT(GetWindowContext
);
1975 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1977 *ppFrame
= &InPlaceFrame
;
1978 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1980 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1981 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1983 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1984 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1986 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1987 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1989 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
1990 lpFrameInfo
->fMDIApp
= FALSE
;
1991 lpFrameInfo
->hwndFrame
= container_hwnd
;
1992 lpFrameInfo
->haccel
= NULL
;
1993 lpFrameInfo
->cAccelEntries
= 0;
1999 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
2000 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
2002 ok(0, "unexpected call\n");
2006 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
2007 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
2009 CHECK_EXPECT(OnUIDeactivate
);
2010 ok(!fUndoable
, "fUndoable = TRUE\n");
2014 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
2015 IOleInPlaceSiteWindowless
*iface
)
2017 CHECK_EXPECT(OnInPlaceDeactivate
);
2018 inplace_deactivated
= TRUE
;
2022 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
2023 IOleInPlaceSiteWindowless
*iface
)
2025 ok(0, "unexpected call\n");
2029 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
2030 IOleInPlaceSiteWindowless
*iface
)
2032 ok(0, "unexpected call\n");
2036 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
2037 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
2039 ok(0, "unexpected call\n");
2043 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
2044 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
2046 CHECK_EXPECT(OnInPlaceActivateEx
);
2048 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
2049 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
2050 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
2055 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2056 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
2058 CHECK_EXPECT(OnInPlaceDeactivateEx
);
2060 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
2065 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
2066 IOleInPlaceSiteWindowless
*iface
)
2068 CHECK_EXPECT2(RequestUIActivate
);
2072 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
2073 IOleInPlaceSiteWindowless
*iface
)
2075 ok(0, "unexpected call\n");
2079 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
2080 IOleInPlaceSiteWindowless
*iface
)
2082 ok(0, "unexpected call\n");
2086 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
2087 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
2089 ok(0, "unexpected call\n");
2093 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
2094 IOleInPlaceSiteWindowless
*iface
)
2096 ok(0, "unexpected call\n");
2100 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
2101 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
2103 ok(0, "unexpected call\n");
2107 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
2108 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
2109 DWORD grfFlags
, HDC
*phDC
)
2111 ok(0, "unexpected call\n");
2115 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
2116 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
2118 ok(0, "unexpected call\n");
2122 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
2123 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
2125 ok(0, "unexpected call\n");
2129 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
2130 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
2132 ok(0, "unexpected call\n");
2136 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
2137 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
2138 LPCRECT pRectScroll
, LPCRECT pRectClip
)
2140 ok(0, "unexpected call\n");
2144 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
2145 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
2147 ok(0, "unexpected call\n");
2151 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
2152 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
2153 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
2155 ok(0, "unexpected call\n");
2159 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
2160 InPlaceSiteWindowless_QueryInterface
,
2161 InPlaceSiteWindowless_AddRef
,
2162 InPlaceSiteWindowless_Release
,
2163 InPlaceSiteWindowless_GetWindow
,
2164 InPlaceSiteWindowless_ContextSensitiveHelp
,
2165 InPlaceSiteWindowless_CanInPlaceActivate
,
2166 InPlaceSiteWindowless_OnInPlaceActivate
,
2167 InPlaceSiteWindowless_OnUIActivate
,
2168 InPlaceSiteWindowless_GetWindowContext
,
2169 InPlaceSiteWindowless_Scroll
,
2170 InPlaceSiteWindowless_OnUIDeactivate
,
2171 InPlaceSiteWindowless_OnInPlaceDeactivate
,
2172 InPlaceSiteWindowless_DiscardUndoState
,
2173 InPlaceSiteWindowless_DeactivateAndUndo
,
2174 InPlaceSiteWindowless_OnPosRectChange
,
2175 InPlaceSiteWindowless_OnInPlaceActivateEx
,
2176 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
2177 InPlaceSiteWindowless_RequestUIActivate
,
2178 InPlaceSiteWindowless_CanWindowlessActivate
,
2179 InPlaceSiteWindowless_GetCapture
,
2180 InPlaceSiteWindowless_SetCapture
,
2181 InPlaceSiteWindowless_GetFocus
,
2182 InPlaceSiteWindowless_SetFocus
,
2183 InPlaceSiteWindowless_GetDC
,
2184 InPlaceSiteWindowless_ReleaseDC
,
2185 InPlaceSiteWindowless_InvalidateRect
,
2186 InPlaceSiteWindowless_InvalidateRgn
,
2187 InPlaceSiteWindowless_ScrollRect
,
2188 InPlaceSiteWindowless_AdjustRect
,
2189 InPlaceSiteWindowless_OnDefWindowMessage
2192 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
2194 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
2196 return QueryInterface(riid
, ppv
);
2199 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
2204 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
2211 CallUIActivate_None
,
2212 CallUIActivate_ActivateMe
,
2213 CallUIActivate_AfterShow
,
2216 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
2217 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
2219 IOleDocument
*document
;
2222 CHECK_EXPECT(ActivateMe
);
2223 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
2225 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
2226 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
2228 if(SUCCEEDED(hres
)) {
2229 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
, NULL
, 0, &view
);
2230 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
2232 if(SUCCEEDED(hres
)) {
2233 IOleInPlaceActiveObject
*activeobj
= NULL
;
2234 IOleInPlaceSite
*inplacesite
= NULL
;
2235 HWND tmp_hwnd
= NULL
;
2236 static RECT rect
= {0,0,400,500};
2238 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2239 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2240 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2241 inplacesite
, &InPlaceSiteWindowless
);
2243 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
);
2244 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
2246 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2247 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2248 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2249 inplacesite
, &InPlaceSiteWindowless
);
2251 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
2252 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
2255 HWND hwnd
= (void*)0xdeadbeef;
2256 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2257 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
2258 ok(hwnd
== NULL
, "hwnd=%p, expected NULL\n", hwnd
);
2261 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2262 SET_EXPECT(CanInPlaceActivate
);
2263 SET_EXPECT(GetWindowContext
);
2264 SET_EXPECT(GetWindow
);
2266 SET_EXPECT(OnInPlaceActivateEx
);
2268 SET_EXPECT(OnInPlaceActivate
);
2269 SET_EXPECT(SetStatusText
);
2270 SET_EXPECT(Exec_SETPROGRESSMAX
);
2271 SET_EXPECT(Exec_SETPROGRESSPOS
);
2272 SET_EXPECT(OnUIActivate
);
2273 SET_EXPECT(SetActiveObject
);
2275 expect_status_text
= NULL
;
2277 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2278 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2280 CHECK_CALLED(CanInPlaceActivate
);
2281 CHECK_CALLED(GetWindowContext
);
2282 CHECK_CALLED(GetWindow
);
2284 CHECK_CALLED(OnInPlaceActivateEx
);
2286 CHECK_CALLED(OnInPlaceActivate
);
2287 CHECK_CALLED(SetStatusText
);
2288 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2289 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2290 CHECK_CALLED(OnUIActivate
);
2291 CHECK_CALLED(SetActiveObject
);
2292 CHECK_CALLED(ShowUI
);
2295 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &doc_hwnd
);
2296 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2297 ok(doc_hwnd
!= NULL
, "hwnd == NULL\n");
2299 ok(doc_hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2302 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2303 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2306 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
2307 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2308 ok(tmp_hwnd
== doc_hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, doc_hwnd
);
2312 hres
= IOleDocumentView_SetRect(view
, &rect
);
2313 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2315 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2316 hres
= IOleDocumentView_Show(view
, TRUE
);
2317 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2319 SET_EXPECT(CanInPlaceActivate
);
2320 SET_EXPECT(GetWindowContext
);
2321 SET_EXPECT(GetWindow
);
2323 SET_EXPECT(OnInPlaceActivateEx
);
2325 SET_EXPECT(OnInPlaceActivate
);
2326 SET_EXPECT(SetStatusText
);
2327 SET_EXPECT(Exec_SETPROGRESSMAX
);
2328 SET_EXPECT(Exec_SETPROGRESSPOS
);
2329 SET_EXPECT(OnUIActivate
);
2330 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
2332 hres
= IOleDocumentView_Show(view
, TRUE
);
2333 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2335 CHECK_CALLED(CanInPlaceActivate
);
2336 CHECK_CALLED(GetWindowContext
);
2337 CHECK_CALLED(GetWindow
);
2339 CHECK_CALLED(OnInPlaceActivateEx
);
2341 CHECK_CALLED(OnInPlaceActivate
);
2342 CHECK_CALLED(SetStatusText
);
2343 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2344 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2347 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &doc_hwnd
);
2348 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2349 ok(doc_hwnd
!= NULL
, "doc_hwnd == NULL\n");
2351 ok(doc_hwnd
== last_hwnd
, "doc_hwnd != last_hwnd\n");
2355 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
2358 IOleInPlaceActiveObject_Release(activeobj
);
2361 IOleDocument_Release(document
);
2367 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2368 DocumentSite_QueryInterface
,
2369 DocumentSite_AddRef
,
2370 DocumentSite_Release
,
2371 DocumentSite_ActivateMe
2374 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2376 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
2378 return QueryInterface(riid
, ppv
);
2381 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
2386 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
2391 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
2393 ok(0, "unexpected call\n");
2397 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
2399 ok(0, "unexpected call\n");
2403 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
2405 ok(0, "unexpected call\n");
2409 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
2410 POINTF
*pPtfContainer
, DWORD dwFlags
)
2412 ok(0, "unexpected call\n");
2416 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
2417 MSG
*pMsg
, DWORD grfModifiers
)
2419 ok(0, "unexpected call\n");
2423 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
2426 CHECK_EXPECT(OnFocus_TRUE
);
2428 CHECK_EXPECT2(OnFocus_FALSE
);
2432 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
2434 ok(0, "unexpected call\n");
2438 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
2439 OleControlSite_QueryInterface
,
2440 OleControlSite_AddRef
,
2441 OleControlSite_Release
,
2442 OleControlSite_OnControlInfoChanged
,
2443 OleControlSite_LockInPlaceActive
,
2444 OleControlSite_GetExtendedControl
,
2445 OleControlSite_TransformCoords
,
2446 OleControlSite_TranslateAccelerator
,
2447 OleControlSite_OnFocus
,
2448 OleControlSite_ShowPropertyFrame
2451 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
2453 static IDocHostUIHandler2
*expect_uihandler_iface
;
2455 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2457 return QueryInterface(riid
, ppv
);
2460 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
2465 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
2470 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
2471 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
2473 ok(0, "unexpected call\n");
2474 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2478 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
2480 if(!resetting_document
)
2481 CHECK_EXPECT(GetHostInfo
);
2482 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2483 ok(pInfo
!= NULL
, "pInfo=NULL\n");
2485 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
2486 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
2487 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2488 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2489 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
2490 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
2491 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
2492 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
2497 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
2498 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
2499 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
2501 CHECK_EXPECT(ShowUI
);
2502 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2505 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
2507 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
2508 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
2509 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
2510 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
2511 if (expect_InPlaceUIWindow_SetActiveObject_active
)
2512 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
2514 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
2519 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
2521 CHECK_EXPECT(HideUI
);
2522 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2526 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
2528 CHECK_EXPECT(UpdateUI
);
2529 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2533 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
2535 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2537 CHECK_EXPECT2(EnableModeless_TRUE
);
2539 CHECK_EXPECT2(EnableModeless_FALSE
);
2543 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2545 ok(0, "unexpected call\n");
2546 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2550 static BOOL expect_OnFrameWindowActivate_fActivate
;
2551 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2553 CHECK_EXPECT2(OnFrameWindowActivate
);
2554 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2555 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
2559 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
2560 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
2562 ok(0, "unexpected call\n");
2566 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
2567 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
2569 ok(0, "unexpected call\n");
2570 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2574 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
2575 LPOLESTR
*pchKey
, DWORD dw
)
2577 CHECK_EXPECT(GetOptionKeyPath
);
2578 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2579 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2580 ok(!dw
, "dw=%d, expected 0\n", dw
);
2582 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2586 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
2587 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
2589 CHECK_EXPECT(GetDropTarget
);
2590 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2595 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
2597 CHECK_EXPECT(GetExternal
);
2598 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2599 *ppDispatch
= &External
;
2603 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
2604 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
2606 CHECK_EXPECT(TranslateUrl
);
2607 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2608 ok(!dwTranslate
, "dwTranslate = %x\n", dwTranslate
);
2610 ok(!strcmp_wa(pchURLIn
, nav_serv_url
), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn
), nav_serv_url
);
2612 todo_wine
ok(!strcmp_wa(pchURLIn
, nav_serv_url
), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn
), nav_serv_url
);
2613 ok(ppchURLOut
!= NULL
, "ppchURLOut == NULL\n");
2614 ok(!*ppchURLOut
, "*ppchURLOut = %p\n", *ppchURLOut
);
2619 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
2620 IDataObject
**ppPORet
)
2622 ok(0, "unexpected call\n");
2623 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2627 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
2628 LPOLESTR
*pchKey
, DWORD dw
)
2630 CHECK_EXPECT(GetOverrideKeyPath
);
2631 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2632 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2634 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2635 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2639 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2640 DocHostUIHandler_QueryInterface
,
2641 DocHostUIHandler_AddRef
,
2642 DocHostUIHandler_Release
,
2643 DocHostUIHandler_ShowContextMenu
,
2644 DocHostUIHandler_GetHostInfo
,
2645 DocHostUIHandler_ShowUI
,
2646 DocHostUIHandler_HideUI
,
2647 DocHostUIHandler_UpdateUI
,
2648 DocHostUIHandler_EnableModeless
,
2649 DocHostUIHandler_OnDocWindowActivate
,
2650 DocHostUIHandler_OnFrameWindowActivate
,
2651 DocHostUIHandler_ResizeBorder
,
2652 DocHostUIHandler_TranslateAccelerator
,
2653 DocHostUIHandler_GetOptionKeyPath
,
2654 DocHostUIHandler_GetDropTarget
,
2655 DocHostUIHandler_GetExternal
,
2656 DocHostUIHandler_TranslateUrl
,
2657 DocHostUIHandler_FilterDataObject
,
2658 DocHostUIHandler_GetOverrideKeyPath
2661 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2663 static HRESULT WINAPI
CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2665 if(IsEqualGUID(&IID_IDocHostUIHandler2
, riid
)) {
2672 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2673 return E_NOINTERFACE
;
2675 if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2676 return E_NOINTERFACE
; /* TODO */
2678 trace("CustomDocHostUIHandler::QI(%s)\n", wine_dbgstr_guid(riid
));
2679 return E_NOINTERFACE
;
2682 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl
= {
2683 CustomDocHostUIHandler_QueryInterface
,
2684 DocHostUIHandler_AddRef
,
2685 DocHostUIHandler_Release
,
2686 DocHostUIHandler_ShowContextMenu
,
2687 DocHostUIHandler_GetHostInfo
,
2688 DocHostUIHandler_ShowUI
,
2689 DocHostUIHandler_HideUI
,
2690 DocHostUIHandler_UpdateUI
,
2691 DocHostUIHandler_EnableModeless
,
2692 DocHostUIHandler_OnDocWindowActivate
,
2693 DocHostUIHandler_OnFrameWindowActivate
,
2694 DocHostUIHandler_ResizeBorder
,
2695 DocHostUIHandler_TranslateAccelerator
,
2696 DocHostUIHandler_GetOptionKeyPath
,
2697 DocHostUIHandler_GetDropTarget
,
2698 DocHostUIHandler_GetExternal
,
2699 DocHostUIHandler_TranslateUrl
,
2700 DocHostUIHandler_FilterDataObject
,
2701 DocHostUIHandler_GetOverrideKeyPath
2704 static IDocHostUIHandler2 CustomDocHostUIHandler
= { &CustomDocHostUIHandlerVtbl
};
2706 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2707 REFIID riid
, void **ppv
)
2709 return QueryInterface(riid
, ppv
);
2712 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2717 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2722 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2723 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2725 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2726 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2727 ok(!pCmdText
, "pCmdText != NULL\n");
2729 switch(prgCmds
[0].cmdID
) {
2730 case OLECMDID_SETPROGRESSTEXT
:
2731 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2732 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2735 CHECK_EXPECT(QueryStatus_OPEN
);
2736 prgCmds
[0].cmdf
= 0;
2739 CHECK_EXPECT(QueryStatus_NEW
);
2740 prgCmds
[0].cmdf
= 0;
2743 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2749 static void test_save_history(IUnknown
*unk
)
2751 IPersistHistory
*per_hist
;
2756 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistHistory
, (void**)&per_hist
);
2757 ok(hres
== S_OK
, "Could not get IPersistHistory iface: %08x\n", hres
);
2759 hres
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
2760 ok(hres
== S_OK
, "CreateStreamOnHGlobal failed: %08x\n", hres
);
2762 hres
= IPersistHistory_SaveHistory(per_hist
, stream
);
2763 ok(hres
== S_OK
, "SaveHistory failed: %08x\n", hres
);
2764 IPersistHistory_Release(per_hist
);
2767 hres
= IStream_Seek(stream
, li
, STREAM_SEEK_SET
, NULL
);
2768 ok(hres
== S_OK
, "Stat failed: %08x\n", hres
);
2769 history_stream
= stream
;
2772 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2773 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2775 if(resetting_document
)
2778 if(!pguidCmdGroup
) {
2779 test_readyState(NULL
);
2782 case OLECMDID_SETPROGRESSMAX
:
2783 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2784 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2785 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2787 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2788 if(load_state
== LD_NO
)
2789 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2791 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2793 case OLECMDID_SETPROGRESSPOS
:
2794 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2795 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2796 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2798 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2799 if(load_state
== LD_NO
)
2800 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2802 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2804 case OLECMDID_HTTPEQUIV_DONE
:
2805 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2806 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2807 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2808 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2809 readystate_set_loading
= FALSE
;
2810 readystate_set_interactive
= FALSE
;
2811 load_state
= LD_COMPLETE
;
2813 case OLECMDID_SETDOWNLOADSTATE
:
2814 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2815 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2816 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2817 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2819 switch(V_I4(pvaIn
)) {
2821 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2823 load_state
= LD_INTERACTIVE
;
2826 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2827 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
2830 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2834 case OLECMDID_UPDATECOMMANDS
:
2835 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2836 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2837 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2838 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2840 case OLECMDID_SETTITLE
:
2841 CHECK_EXPECT2(Exec_SETTITLE
);
2842 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2843 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2844 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2845 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2846 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2848 case OLECMDID_HTTPEQUIV
:
2849 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2850 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2851 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2852 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2853 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2854 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) = NULL\n");
2855 test_readyState(NULL
);
2857 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
2859 return E_FAIL
; /* FIXME */
2861 ok(0, "unexpected command %d\n", nCmdID
);
2866 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2867 if(nCmdID
!= 63 && (!is_refresh
|| nCmdID
!= 37))
2868 test_readyState(NULL
);
2869 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2873 CHECK_EXPECT2(Exec_ShellDocView_37
);
2875 if(is_refresh
&& load_state
== LD_COMPLETE
) {
2876 load_state
= LD_DOLOAD
;
2877 test_readyState(NULL
);
2878 }else if(is_refresh
&& load_state
== LD_DOLOAD
) {
2879 test_readyState(NULL
);
2880 load_state
= LD_LOADING
;
2883 test_GetCurMoniker(doc_unk
, NULL
, nav_serv_url
, FALSE
);
2884 else if(load_from_stream
)
2885 test_GetCurMoniker(doc_unk
, NULL
, "about:blank", FALSE
);
2887 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
, FALSE
);
2890 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2891 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2893 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2894 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2899 CHECK_EXPECT(Exec_ShellDocView_62
);
2900 ok(!pvaIn
, "pvaIn != NULL\n");
2901 ok(!pvaOut
, "pvaOut != NULL\n");
2905 IHTMLPrivateWindow
*priv_window
;
2908 CHECK_EXPECT(Exec_ShellDocView_63
);
2909 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2910 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2911 ok(V_UNKNOWN(pvaIn
) != NULL
, "VPUNKNOWN(pvaIn) = NULL\n");
2912 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2913 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2915 hres
= IUnknown_QueryInterface(V_UNKNOWN(pvaIn
), &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
2916 ok(hres
== S_OK
, "Could not get IHTMLPrivateWindow: %08x\n", hres
);
2918 IHTMLPrivateWindow_Release(priv_window
);
2920 load_state
= loading_js
? LD_COMPLETE
: LD_LOADING
;
2921 return S_OK
; /* TODO */
2925 CHECK_EXPECT(Exec_ShellDocView_67
);
2926 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2927 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2928 ok(!strcmp_wa(V_BSTR(pvaIn
), nav_serv_url
), "V_BSTR(pvaIn) = %s, expected \"%s\"\n",
2929 wine_dbgstr_w(V_BSTR(pvaIn
)), nav_serv_url
);
2930 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2931 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2932 ok(V_BOOL(pvaOut
) == VARIANT_TRUE
, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut
));
2934 load_state
= LD_DOLOAD
;
2938 CHECK_EXPECT2(Exec_ShellDocView_84
);
2940 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2941 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2943 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2948 CHECK_EXPECT2(Exec_ShellDocView_103
);
2950 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2951 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2956 CHECK_EXPECT2(Exec_ShellDocView_105
);
2958 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2959 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2964 CHECK_EXPECT2(Exec_ShellDocView_138
);
2965 ok(!pvaIn
, "pvaIn != NULL\n");
2966 ok(!pvaOut
, "pvaOut != NULL\n");
2970 CHECK_EXPECT2(Exec_ShellDocView_140
);
2972 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2973 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2979 case 134: /* TODO */
2981 case 136: /* TODO */
2982 case 139: /* TODO */
2983 case 143: /* TODO */
2984 case 144: /* TODO */
2990 ok(0, "unexpected command %d\n", nCmdID
);
2995 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2996 test_readyState(NULL
);
2997 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
3000 case IDM_PARSECOMPLETE
:
3001 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
3002 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
3003 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
3006 ok(0, "unexpected command %d\n", nCmdID
);
3010 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
3012 case DOCHOST_DOCCANNAVIGATE
:
3014 CHECK_EXPECT(Exec_DOCCANNAVIGATE
);
3015 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) != VT_UNKNOWN\n");
3016 /* FIXME: test V_UNKNOWN(pvaIn) == window */
3018 CHECK_EXPECT(Exec_DOCCANNAVIGATE_NULL
);
3021 test_readyState(NULL
);
3022 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
3031 test_readyState(NULL
);
3033 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
3034 ok(pvaOut
!= NULL
|| broken(!pvaOut
), "pvaOut != NULL\n");
3035 ok(V_VT(pvaIn
) == VT_ARRAY
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
3037 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
3038 sa
= V_ARRAY(pvaIn
);
3040 dim
= SafeArrayGetDim(sa
);
3041 ok(dim
== 1, "dim = %d\n", dim
);
3042 hres
= SafeArrayGetLBound(sa
, 1, &ind
);
3043 ok(hres
== S_OK
, "SafeArrayGetLBound failed: %x\n", hres
);
3044 ok(ind
== 0, "Lower bound = %d\n", ind
);
3045 hres
= SafeArrayGetUBound(sa
, 1, &ind
);
3046 ok(hres
== S_OK
, "SafeArrayGetUBound failed: %x\n", hres
);
3047 ok(ind
== 7 || ind
== 8 /* IE11 */ ||broken(ind
== 5), "Upper bound = %d\n", ind
);
3050 SafeArrayGetElement(sa
, &ind
, &var
);
3051 ok(V_VT(&var
) == VT_I4
, "Incorrect data type: %d\n", V_VT(&var
));
3052 ok(V_I4(&var
) == status_code
, "Incorrect error code: %d\n", V_I4(&var
));
3055 SafeArrayGetElement(sa
, &ind
, &var
);
3056 ok(V_VT(&var
) == VT_BSTR
, "Incorrect data type: %d\n", V_VT(&var
));
3057 ok(!strcmp_wa(V_BSTR(&var
), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var
)));
3060 SafeArrayGetElement(sa
, &ind
, &var
);
3061 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
3064 SafeArrayGetElement(sa
, &ind
, &var
);
3065 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
3068 SafeArrayGetElement(sa
, &ind
, &var
);
3069 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
3070 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
3073 SafeArrayGetElement(sa
, &ind
, &var
);
3074 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
3075 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
3079 return E_FAIL
; /* TODO */
3083 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
3084 test_readyState(NULL
);
3085 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
3089 CHECK_EXPECT2(Exec_Explorer_38
);
3090 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
3091 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
3092 ok(!V_I4(pvaIn
), "V_I4(pvaIn) = %d\n", V_I4(pvaIn
));
3093 ok(!pvaOut
, "pvaOut != NULL\n");
3095 test_current_url(doc_unk
, prev_url
);
3097 test_save_history(doc_unk
);
3101 CHECK_EXPECT2(Exec_Explorer_69
);
3102 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
3103 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
3105 case 109: /* TODO */
3108 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
3113 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
3114 test_readyState(NULL
);
3117 case OLECMDID_PAGEACTIONBLOCKED
: /* win2k3 */
3118 SET_EXPECT(SetStatusText
);
3119 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
3120 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
3122 case OLECMDID_SHOWSCRIPTERROR
:
3126 CHECK_EXPECT(Exec_DocHostCommandHandler_2300
);
3129 ok(0, "unexpected command %d\n", nCmdID
);
3134 ok(0, "unexpected pguidCmdGroup: %s\n", wine_dbgstr_guid(pguidCmdGroup
));
3138 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
3139 OleCommandTarget_QueryInterface
,
3140 OleCommandTarget_AddRef
,
3141 OleCommandTarget_Release
,
3142 OleCommandTarget_QueryStatus
,
3143 OleCommandTarget_Exec
3146 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
3148 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
3150 return QueryInterface(riid
, ppv
);
3153 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
3154 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3155 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3157 if(resetting_document
)
3160 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
3161 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
3162 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
3163 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
3164 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
3165 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
3167 if(dispIdMember
!= DISPID_AMBIENT_SILENT
&& dispIdMember
!= DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
)
3168 test_readyState(NULL
);
3170 switch(dispIdMember
) {
3171 case DISPID_AMBIENT_USERMODE
:
3172 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
3173 V_VT(pVarResult
) = VT_BOOL
;
3174 V_BOOL(pVarResult
) = VARIANT_TRUE
;
3176 case DISPID_AMBIENT_DLCONTROL
:
3177 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
3179 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
3180 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3182 case DISPID_AMBIENT_SILENT
:
3183 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
3184 V_VT(pVarResult
) = VT_BOOL
;
3185 V_BOOL(pVarResult
) = VARIANT_FALSE
;
3187 case DISPID_AMBIENT_USERAGENT
:
3188 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
3190 case DISPID_AMBIENT_PALETTE
:
3191 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
3195 ok(0, "unexpected dispid %d\n", dispIdMember
);
3199 static const IDispatchVtbl DispatchVtbl
= {
3200 Dispatch_QueryInterface
,
3203 Dispatch_GetTypeInfoCount
,
3204 Dispatch_GetTypeInfo
,
3205 Dispatch_GetIDsOfNames
,
3209 static IDispatch Dispatch
= { &DispatchVtbl
};
3211 static HRESULT WINAPI
EventDispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
3213 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
3218 ok(0, "Unexpected call\n");
3219 return E_NOINTERFACE
;
3222 static HRESULT WINAPI
EventDispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
3223 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3224 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3227 IHTMLDocument2
*doc
;
3230 if(resetting_document
)
3233 ok(IsEqualGUID(&IID_NULL
, riid
), "riid = %s\n", wine_dbgstr_guid(riid
));
3234 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
3235 ok(pExcepInfo
!= NULL
, "pExcepInfo == NULL\n");
3236 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
3237 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult
));
3238 ok(wFlags
== DISPATCH_METHOD
, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags
);
3240 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IHTMLDocument2
, (void**)&doc
);
3241 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
3243 switch(dispIdMember
) {
3244 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE
:
3245 hres
= IHTMLDocument2_get_readyState(doc
, &state
);
3246 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3248 if(!strcmp_wa(state
, "interactive"))
3249 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive
);
3250 else if(!strcmp_wa(state
, "loading"))
3251 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading
);
3252 else if(!strcmp_wa(state
, "complete")) {
3253 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete
);
3256 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state
));
3258 SysFreeString(state
);
3260 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE
:
3271 break; /* FIXME: Handle these events. */
3273 ok(0, "Unexpected DISPID: %d\n", dispIdMember
);
3276 IHTMLDocument2_Release(doc
);
3280 static const IDispatchVtbl EventDispatchVtbl
= {
3281 EventDispatch_QueryInterface
,
3284 Dispatch_GetTypeInfoCount
,
3285 Dispatch_GetTypeInfo
,
3286 Dispatch_GetIDsOfNames
,
3287 EventDispatch_Invoke
3290 static IDispatch EventDispatch
= { &EventDispatchVtbl
};
3292 static HRESULT WINAPI
TravelLog_QueryInterface(ITravelLog
*iface
, REFIID riid
, void **ppv
)
3294 static const IID IID_IIETravelLog2
= {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3295 static const IID IID_unk_travellog
= {0x6afc8b7f,0xbc17,0x4a95,{0x90,0x2f,0x6f,0x5c,0xb5,0x54,0xc3,0xd8}};
3297 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_ITravelLog
, riid
)) {
3302 if(!IsEqualGUID(&IID_IIETravelLog2
, riid
) && !IsEqualGUID(&IID_unk_travellog
, riid
))
3303 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
3306 return E_NOINTERFACE
;
3309 static ULONG WINAPI
TravelLog_AddRef(ITravelLog
*iface
)
3314 static ULONG WINAPI
TravelLog_Release(ITravelLog
*iface
)
3319 static HRESULT WINAPI
TravelLog_AddEntry(ITravelLog
*iface
, IUnknown
*punk
, BOOL fIsLocalAnchor
)
3321 ok(0, "unexpected call\n");
3325 static HRESULT WINAPI
TravelLog_UpdateEntry(ITravelLog
*iface
, IUnknown
*punk
, BOOL fIsLocalAnchor
)
3327 ok(0, "unexpected call\n");
3331 static HRESULT WINAPI
TravelLog_UpdateExternal(ITravelLog
*iface
, IUnknown
*punk
, IUnknown
*punkHLBrowseContext
)
3333 ok(0, "unexpected call\n");
3337 static HRESULT WINAPI
TravelLog_Travel(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
)
3339 ok(0, "unexpected call\n");
3343 static HRESULT WINAPI
TravelLog_GetTravelEntry(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
, ITravelEntry
**ppte
)
3345 ok(0, "unexpected call\n");
3349 static HRESULT WINAPI
TravelLog_FindTravelEntry(ITravelLog
*iface
, IUnknown
*punk
, LPCITEMIDLIST pidl
, ITravelEntry
**ppte
)
3351 ok(0, "unexpected call\n");
3355 static HRESULT WINAPI
TravelLog_GetTooltipText(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
, int idsTemplate
,
3356 LPWSTR pwzText
, DWORD cchText
)
3358 ok(0, "unexpected call\n");
3362 static HRESULT WINAPI
TravelLog_InsertMenuEntries(ITravelLog
*iface
, IUnknown
*punk
, HMENU hmenu
, int nPos
,
3363 int idFirst
, int idLast
, DWORD dwFlags
)
3365 ok(0, "unexpected call\n");
3369 static HRESULT WINAPI
TravelLog_Clone(ITravelLog
*iface
, ITravelLog
**pptl
)
3371 ok(0, "unexpected call\n");
3375 static IBrowserService BrowserService
;
3376 static DWORD WINAPI
TravelLog_CountEntries(ITravelLog
*iface
, IUnknown
*punk
)
3378 CHECK_EXPECT(CountEntries
);
3380 ok(punk
== (IUnknown
*)&BrowserService
, "punk != &BrowserService (%p)\n", punk
);
3384 static HRESULT WINAPI
TravelLog_Revert(ITravelLog
*iface
)
3386 ok(0, "unexpected call\n");
3390 static const ITravelLogVtbl TravelLogVtbl
= {
3391 TravelLog_QueryInterface
,
3395 TravelLog_UpdateEntry
,
3396 TravelLog_UpdateExternal
,
3398 TravelLog_GetTravelEntry
,
3399 TravelLog_FindTravelEntry
,
3400 TravelLog_GetTooltipText
,
3401 TravelLog_InsertMenuEntries
,
3403 TravelLog_CountEntries
,
3407 static ITravelLog TravelLog
= { &TravelLogVtbl
};
3409 static HRESULT
browserservice_qi(REFIID
,void**);
3411 static HRESULT WINAPI
DocObjectService_QueryInterface(IDocObjectService
* This
, REFIID riid
, void **ppv
)
3413 return browserservice_qi(riid
, ppv
);
3416 static ULONG WINAPI
DocObjectService_AddRef(
3417 IDocObjectService
* This
)
3422 static ULONG WINAPI
DocObjectService_Release(
3423 IDocObjectService
* This
)
3428 static HRESULT WINAPI
DocObjectService_FireBeforeNavigate2(IDocObjectService
*iface
, IDispatch
*pDispatch
,
3429 LPCWSTR lpszUrl
, DWORD dwFlags
, LPCWSTR lpszFrameName
, BYTE
*pPostData
, DWORD cbPostData
,
3430 LPCWSTR lpszHeaders
, BOOL fPlayNavSound
, BOOL
*pfCancel
)
3432 CHECK_EXPECT(FireBeforeNavigate2
);
3434 ok(!pDispatch
, "pDispatch = %p\n", pDispatch
);
3435 ok(!strcmp_wa(lpszUrl
, nav_url
), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl
), nav_url
);
3436 ok(dwFlags
== 0x40 || !dwFlags
|| dwFlags
== 0x50, "dwFlags = %x\n", dwFlags
);
3437 ok(!lpszFrameName
, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName
));
3438 if(!testing_submit
) {
3439 ok(!pPostData
, "pPostData = %p\n", pPostData
);
3440 ok(!cbPostData
, "cbPostData = %d\n", cbPostData
);
3441 ok(!lpszHeaders
, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders
));
3443 ok(cbPostData
== 9, "cbPostData = %d\n", cbPostData
);
3444 ok(!memcmp(pPostData
, "cmd=TEST", cbPostData
), "pPostData = %p\n", pPostData
);
3445 ok(wstr_contains(lpszHeaders
, "Content-Type: application/x-www-form-urlencoded\r\n"),
3446 "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders
));
3449 ok(fPlayNavSound
, "fPlayNavSound = %x\n", fPlayNavSound
);
3450 ok(pfCancel
!= NULL
, "pfCancel = NULL\n");
3451 ok(!*pfCancel
, "*pfCancel = %x\n", *pfCancel
);
3456 static HRESULT WINAPI
DocObjectService_FireNavigateComplete2(
3457 IDocObjectService
* This
,
3458 IHTMLWindow2
*pHTMLWindow2
,
3461 CHECK_EXPECT(FireNavigateComplete2
);
3462 test_readyState(NULL
);
3465 ok(dwFlags
== 0x10 || broken(!dwFlags
), "dwFlags = %x, expected 0x10\n", dwFlags
);
3467 ok(!(dwFlags
&~1), "dwFlags = %x\n", dwFlags
);
3469 ok(pHTMLWindow2
!= NULL
, "pHTMLWindow2 = NULL\n");
3474 static HRESULT WINAPI
DocObjectService_FireDownloadBegin(
3475 IDocObjectService
* This
)
3477 ok(0, "unexpected call\n");
3481 static HRESULT WINAPI
DocObjectService_FireDownloadComplete(
3482 IDocObjectService
* This
)
3484 ok(0, "unexpected call\n");
3488 static HRESULT WINAPI
DocObjectService_FireDocumentComplete(
3489 IDocObjectService
* This
,
3490 IHTMLWindow2
*pHTMLWindow
,
3493 CHECK_EXPECT(FireDocumentComplete
);
3495 ok(pHTMLWindow
!= NULL
, "pHTMLWindow == NULL\n");
3496 ok(!dwFlags
, "dwFlags = %x\n", dwFlags
);
3501 static HRESULT WINAPI
DocObjectService_UpdateDesktopComponent(
3502 IDocObjectService
* This
,
3503 IHTMLWindow2
*pHTMLWindow
)
3505 ok(0, "unexpected call\n");
3509 static HRESULT WINAPI
DocObjectService_GetPendingUrl(
3510 IDocObjectService
* This
,
3511 BSTR
*pbstrPendingUrl
)
3513 if(!resetting_document
)
3514 CHECK_EXPECT(GetPendingUrl
);
3518 static HRESULT WINAPI
DocObjectService_ActiveElementChanged(
3519 IDocObjectService
* This
,
3520 IHTMLElement
*pHTMLElement
)
3522 CHECK_EXPECT2(ActiveElementChanged
);
3526 static HRESULT WINAPI
DocObjectService_GetUrlSearchComponent(
3527 IDocObjectService
* This
,
3530 ok(0, "unexpected call\n");
3534 static HRESULT WINAPI
DocObjectService_IsErrorUrl(
3535 IDocObjectService
* This
,
3539 CHECK_EXPECT(IsErrorUrl
);
3544 static IDocObjectServiceVtbl DocObjectServiceVtbl
= {
3545 DocObjectService_QueryInterface
,
3546 DocObjectService_AddRef
,
3547 DocObjectService_Release
,
3548 DocObjectService_FireBeforeNavigate2
,
3549 DocObjectService_FireNavigateComplete2
,
3550 DocObjectService_FireDownloadBegin
,
3551 DocObjectService_FireDownloadComplete
,
3552 DocObjectService_FireDocumentComplete
,
3553 DocObjectService_UpdateDesktopComponent
,
3554 DocObjectService_GetPendingUrl
,
3555 DocObjectService_ActiveElementChanged
,
3556 DocObjectService_GetUrlSearchComponent
,
3557 DocObjectService_IsErrorUrl
3560 static IDocObjectService DocObjectService
= { &DocObjectServiceVtbl
};
3562 static HRESULT WINAPI
ShellBrowser_QueryInterface(IShellBrowser
*iface
, REFIID riid
, void **ppv
)
3564 return browserservice_qi(riid
, ppv
);
3567 static ULONG WINAPI
ShellBrowser_AddRef(IShellBrowser
*iface
)
3572 static ULONG WINAPI
ShellBrowser_Release(IShellBrowser
*iface
)
3577 static HRESULT WINAPI
ShellBrowser_GetWindow(IShellBrowser
*iface
, HWND
*phwnd
)
3579 ok(0, "unexpected call\n");
3583 static HRESULT WINAPI
ShellBrowser_ContextSensitiveHelp(IShellBrowser
*iface
, BOOL fEnterMode
)
3585 ok(0, "unexpected call\n");
3589 static HRESULT WINAPI
ShellBrowser_InsertMenusSB(IShellBrowser
*iface
, HMENU hmenuShared
, LPOLEMENUGROUPWIDTHS lpMenuWidths
)
3591 ok(0, "unexpected call\n");
3595 static HRESULT WINAPI
ShellBrowser_SetMenuSB(IShellBrowser
*iface
, HMENU hmenuShared
, HOLEMENU holemenuReserved
,
3596 HWND hwndActiveObject
)
3598 ok(0, "unexpected call\n");
3602 static HRESULT WINAPI
ShellBrowser_RemoveMenusSB(IShellBrowser
*iface
, HMENU hmenuShared
)
3604 ok(0, "unexpected call\n");
3608 static HRESULT WINAPI
ShellBrowser_SetStatusTextSB(IShellBrowser
*iface
, LPCOLESTR pszStatusText
)
3610 ok(0, "unexpected call\n");
3614 static HRESULT WINAPI
ShellBrowser_EnableModelessSB(IShellBrowser
*iface
, BOOL fEnable
)
3616 ok(0, "unexpected call\n");
3620 static HRESULT WINAPI
ShellBrowser_TranslateAcceleratorSB(IShellBrowser
*iface
, MSG
*pmsg
, WORD wID
)
3622 ok(0, "unexpected call\n");
3626 static HRESULT WINAPI
ShellBrowser_BrowseObject(IShellBrowser
*iface
, LPCITEMIDLIST pidl
, UINT wFlags
)
3628 ok(0, "unexpected call\n");
3632 static HRESULT WINAPI
ShellBrowser_GetViewStateStream(IShellBrowser
*iface
, DWORD grfMode
, IStream
**ppStrm
)
3634 ok(0, "unexpected call\n");
3638 static HRESULT WINAPI
ShellBrowser_GetControlWindow(IShellBrowser
*iface
, UINT id
, HWND
*phwnd
)
3640 ok(0, "unexpected call\n");
3644 static HRESULT WINAPI
ShellBrowser_SendControlMsg(IShellBrowser
*iface
, UINT id
, UINT uMsg
, WPARAM wParam
,
3645 LPARAM lParam
, LRESULT
*pret
)
3647 ok(0, "unexpected call\n");
3651 static HRESULT WINAPI
ShellBrowser_QueryActiveShellView(IShellBrowser
*iface
, IShellView
**ppshv
)
3653 ok(0, "unexpected call\n");
3657 static HRESULT WINAPI
ShellBrowser_OnViewWindowActive(IShellBrowser
* iface
, IShellView
*pshv
)
3659 ok(0, "unexpected call\n");
3663 static HRESULT WINAPI
ShellBrowser_SetToolbarItems(IShellBrowser
*iface
, LPTBBUTTONSB lpButtons
,
3664 UINT nButtons
, UINT uFlags
)
3666 ok(0, "unexpected call\n");
3670 static const IShellBrowserVtbl ShellBrowserVtbl
= {
3671 ShellBrowser_QueryInterface
,
3672 ShellBrowser_AddRef
,
3673 ShellBrowser_Release
,
3674 ShellBrowser_GetWindow
,
3675 ShellBrowser_ContextSensitiveHelp
,
3676 ShellBrowser_InsertMenusSB
,
3677 ShellBrowser_SetMenuSB
,
3678 ShellBrowser_RemoveMenusSB
,
3679 ShellBrowser_SetStatusTextSB
,
3680 ShellBrowser_EnableModelessSB
,
3681 ShellBrowser_TranslateAcceleratorSB
,
3682 ShellBrowser_BrowseObject
,
3683 ShellBrowser_GetViewStateStream
,
3684 ShellBrowser_GetControlWindow
,
3685 ShellBrowser_SendControlMsg
,
3686 ShellBrowser_QueryActiveShellView
,
3687 ShellBrowser_OnViewWindowActive
,
3688 ShellBrowser_SetToolbarItems
3691 static IShellBrowser ShellBrowser
= { &ShellBrowserVtbl
};
3693 static HRESULT WINAPI
BrowserService_QueryInterface(IBrowserService
*iface
, REFIID riid
, void **ppv
)
3695 return browserservice_qi(riid
, ppv
);
3698 static ULONG WINAPI
BrowserService_AddRef(
3699 IBrowserService
* This
)
3704 static ULONG WINAPI
BrowserService_Release(
3705 IBrowserService
* This
)
3710 static HRESULT WINAPI
BrowserService_GetParentSite(
3711 IBrowserService
* This
,
3712 IOleInPlaceSite
**ppipsite
)
3714 ok(0, "unexpected call\n");
3718 static HRESULT WINAPI
BrowserService_SetTitle(
3719 IBrowserService
* This
,
3723 ok(0, "unexpected call\n");
3727 static HRESULT WINAPI
BrowserService_GetTitle(
3728 IBrowserService
* This
,
3733 ok(0, "unexpected call\n");
3737 static HRESULT WINAPI
BrowserService_GetOleObject(
3738 IBrowserService
* This
,
3739 IOleObject
**ppobjv
)
3741 ok(0, "unexpected call\n");
3745 static HRESULT WINAPI
BrowserService_GetTravelLog(IBrowserService
* This
, ITravelLog
**pptl
)
3747 CHECK_EXPECT(GetTravelLog
);
3749 ok(pptl
!= NULL
, "pptl = NULL\n");
3758 static HRESULT WINAPI
BrowserService_ShowControlWindow(
3759 IBrowserService
* This
,
3763 ok(0, "unexpected call\n");
3767 static HRESULT WINAPI
BrowserService_IsControlWindowShown(
3768 IBrowserService
* This
,
3772 ok(0, "unexpected call\n");
3776 static HRESULT WINAPI
BrowserService_IEGetDisplayName(
3777 IBrowserService
* This
,
3778 PCIDLIST_ABSOLUTE pidl
,
3782 ok(0, "unexpected call\n");
3786 static HRESULT WINAPI
BrowserService_IEParseDisplayName(
3787 IBrowserService
* This
,
3790 PIDLIST_ABSOLUTE
*ppidlOut
)
3792 ok(0, "unexpected call\n");
3796 static HRESULT WINAPI
BrowserService_DisplayParseError(
3797 IBrowserService
* This
,
3801 ok(0, "unexpected call\n");
3805 static HRESULT WINAPI
BrowserService_NavigateToPidl(
3806 IBrowserService
* This
,
3807 PCIDLIST_ABSOLUTE pidl
,
3810 ok(0, "unexpected call\n");
3814 static HRESULT WINAPI
BrowserService_SetNavigateState(
3815 IBrowserService
* This
,
3818 ok(0, "unexpected call\n");
3822 static HRESULT WINAPI
BrowserService_GetNavigateState(
3823 IBrowserService
* This
,
3826 ok(0, "unexpected call\n");
3830 static HRESULT WINAPI
BrowserService_NotifyRedirect(
3831 IBrowserService
* This
,
3833 PCIDLIST_ABSOLUTE pidl
,
3836 ok(0, "unexpected call\n");
3840 static HRESULT WINAPI
BrowserService_UpdateWindowList(
3841 IBrowserService
* This
)
3843 ok(0, "unexpected call\n");
3847 static HRESULT WINAPI
BrowserService_UpdateBackForwardState(
3848 IBrowserService
* This
)
3850 CHECK_EXPECT(UpdateBackForwardState
);
3854 static HRESULT WINAPI
BrowserService_SetFlags(
3855 IBrowserService
* This
,
3859 ok(0, "unexpected call\n");
3863 static HRESULT WINAPI
BrowserService_GetFlags(
3864 IBrowserService
* This
,
3867 ok(0, "unexpected call\n");
3871 static HRESULT WINAPI
BrowserService_CanNavigateNow(
3872 IBrowserService
* This
)
3874 ok(0, "unexpected call\n");
3878 static HRESULT WINAPI
BrowserService_GetPidl(
3879 IBrowserService
* This
,
3880 PIDLIST_ABSOLUTE
*ppidl
)
3882 ok(0, "unexpected call\n");
3886 static HRESULT WINAPI
BrowserService_SetReferrer(
3887 IBrowserService
* This
,
3888 PCIDLIST_ABSOLUTE pidl
)
3890 ok(0, "unexpected call\n");
3894 static DWORD WINAPI
BrowserService_GetBrowserIndex(
3895 IBrowserService
* This
)
3897 ok(0, "unexpected call\n");
3901 static HRESULT WINAPI
BrowserService_GetBrowserByIndex(
3902 IBrowserService
* This
,
3906 ok(0, "unexpected call\n");
3910 static HRESULT WINAPI
BrowserService_GetHistoryObject(
3911 IBrowserService
* This
,
3916 ok(0, "unexpected call\n");
3920 static HRESULT WINAPI
BrowserService_SetHistoryObject(
3921 IBrowserService
* This
,
3923 BOOL fIsLocalAnchor
)
3925 ok(0, "unexpected call\n");
3929 static HRESULT WINAPI
BrowserService_CacheOLEServer(
3930 IBrowserService
* This
,
3933 ok(0, "unexpected call\n");
3937 static HRESULT WINAPI
BrowserService_GetSetCodePage(
3938 IBrowserService
* This
,
3942 ok(0, "unexpected call\n");
3946 static HRESULT WINAPI
BrowserService_OnHttpEquiv(
3947 IBrowserService
* This
,
3951 VARIANT
*pvarargOut
)
3953 ok(0, "unexpected call\n");
3957 static HRESULT WINAPI
BrowserService_GetPalette(
3958 IBrowserService
* This
,
3961 ok(0, "unexpected call\n");
3965 static HRESULT WINAPI
BrowserService_RegisterWindow(
3966 IBrowserService
* This
,
3967 BOOL fForceRegister
,
3970 ok(0, "unexpected call\n");
3974 static IBrowserServiceVtbl BrowserServiceVtbl
= {
3975 BrowserService_QueryInterface
,
3976 BrowserService_AddRef
,
3977 BrowserService_Release
,
3978 BrowserService_GetParentSite
,
3979 BrowserService_SetTitle
,
3980 BrowserService_GetTitle
,
3981 BrowserService_GetOleObject
,
3982 BrowserService_GetTravelLog
,
3983 BrowserService_ShowControlWindow
,
3984 BrowserService_IsControlWindowShown
,
3985 BrowserService_IEGetDisplayName
,
3986 BrowserService_IEParseDisplayName
,
3987 BrowserService_DisplayParseError
,
3988 BrowserService_NavigateToPidl
,
3989 BrowserService_SetNavigateState
,
3990 BrowserService_GetNavigateState
,
3991 BrowserService_NotifyRedirect
,
3992 BrowserService_UpdateWindowList
,
3993 BrowserService_UpdateBackForwardState
,
3994 BrowserService_SetFlags
,
3995 BrowserService_GetFlags
,
3996 BrowserService_CanNavigateNow
,
3997 BrowserService_GetPidl
,
3998 BrowserService_SetReferrer
,
3999 BrowserService_GetBrowserIndex
,
4000 BrowserService_GetBrowserByIndex
,
4001 BrowserService_GetHistoryObject
,
4002 BrowserService_SetHistoryObject
,
4003 BrowserService_CacheOLEServer
,
4004 BrowserService_GetSetCodePage
,
4005 BrowserService_OnHttpEquiv
,
4006 BrowserService_GetPalette
,
4007 BrowserService_RegisterWindow
4010 static IBrowserService BrowserService
= { &BrowserServiceVtbl
};
4012 DEFINE_GUID(IID_ITabBrowserService
, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
4014 static HRESULT
browserservice_qi(REFIID riid
, void **ppv
)
4016 if(IsEqualGUID(&IID_IShellBrowser
, riid
)) {
4017 *ppv
= &ShellBrowser
;
4021 if(IsEqualGUID(&IID_IDocObjectService
, riid
)) {
4022 *ppv
= &DocObjectService
;
4026 if(IsEqualGUID(&IID_IBrowserService
, riid
)) {
4027 *ppv
= &BrowserService
;
4032 return E_NOINTERFACE
;
4035 static HRESULT WINAPI
WBE2Sink_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
4037 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
4043 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid
));
4044 return E_NOINTERFACE
;
4047 static HRESULT WINAPI
WBE2Sink_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
4048 LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
, VARIANT
*pVarResult
,
4049 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
4051 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
4052 ok(pdp
!= NULL
, "pDispParams == NULL\n");
4053 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
4054 ok(puArgErr
== NULL
, "puArgErr != NULL\n");
4055 ok(pVarResult
== NULL
, "pVarResult != NULL\n");
4056 ok(wFlags
== DISPATCH_METHOD
, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags
);
4057 ok(!pdp
->cNamedArgs
, "pdp->cNamedArgs = %d\n", pdp
->cNamedArgs
);
4058 ok(!pdp
->rgdispidNamedArgs
, "rgdispidNamedArgs = %p\n", pdp
->rgdispidNamedArgs
);
4060 switch(dispIdMember
) {
4061 case DISPID_WINDOWCLOSING
: {
4062 VARIANT
*is_child
= pdp
->rgvarg
+1, *cancel
= pdp
->rgvarg
;
4064 CHECK_EXPECT(WindowClosing
);
4066 ok(pdp
->cArgs
== 2, "pdp->cArgs = %d\n", pdp
->cArgs
);
4067 ok(V_VT(is_child
) == VT_BOOL
, "V_VT(is_child) = %d\n", V_VT(is_child
));
4068 ok(!V_BOOL(is_child
), "V_BOOL(is_child) = %x\n", V_BOOL(is_child
));
4069 ok(V_VT(cancel
) == (VT_BYREF
|VT_BOOL
), "V_VT(cancel) = %d\n", V_VT(cancel
));
4070 ok(!*V_BOOLREF(cancel
), "*V_BOOLREF(cancel) = %x\n", *V_BOOLREF(cancel
));
4072 *V_BOOLREF(cancel
) = VARIANT_TRUE
;
4076 ok(0, "unexpected id %d\n", dispIdMember
);
4082 static const IDispatchVtbl WBE2SinkVtbl
= {
4083 WBE2Sink_QueryInterface
,
4086 Dispatch_GetTypeInfoCount
,
4087 Dispatch_GetTypeInfo
,
4088 Dispatch_GetIDsOfNames
,
4092 static IDispatch WBE2Sink
= { &WBE2SinkVtbl
};
4094 static HRESULT WINAPI
EnumConnections_QueryInterface(IEnumConnections
*iface
, REFIID riid
, LPVOID
*ppv
)
4096 ok(0, "unexpected call\n");
4097 return E_NOINTERFACE
;
4100 static ULONG WINAPI
EnumConnections_AddRef(IEnumConnections
*iface
)
4105 static ULONG WINAPI
EnumConnections_Release(IEnumConnections
*iface
)
4110 static BOOL next_called
;
4112 static HRESULT WINAPI
EnumConnections_Next(IEnumConnections
*iface
, ULONG cConnections
, CONNECTDATA
*rgcd
, ULONG
*pcFetched
)
4114 CHECK_EXPECT2(EnumConnections_Next
);
4116 ok(cConnections
== 1, "cConnections = %d\n", cConnections
);
4117 ok(pcFetched
!= NULL
, "pcFetched == NULL\n");
4125 rgcd
->pUnk
= (IUnknown
*)&WBE2Sink
;
4126 rgcd
->dwCookie
= 0xdeadbeef;
4131 static HRESULT WINAPI
EnumConnections_Skip(IEnumConnections
*iface
, ULONG ulConnections
)
4133 ok(0, "unexpected call\n");
4134 return E_NOINTERFACE
;
4137 static HRESULT WINAPI
EnumConnections_Reset(IEnumConnections
*iface
)
4139 ok(0, "unexpected call\n");
4140 return E_NOINTERFACE
;
4143 static HRESULT WINAPI
EnumConnections_Clone(IEnumConnections
*iface
, IEnumConnections
**ppEnum
)
4145 ok(0, "unexpected call\n");
4146 return E_NOINTERFACE
;
4149 static const IEnumConnectionsVtbl EnumConnectionsVtbl
= {
4150 EnumConnections_QueryInterface
,
4151 EnumConnections_AddRef
,
4152 EnumConnections_Release
,
4153 EnumConnections_Next
,
4154 EnumConnections_Skip
,
4155 EnumConnections_Reset
,
4156 EnumConnections_Clone
4159 static IEnumConnections EnumConnections
= { &EnumConnectionsVtbl
};
4161 static HRESULT WINAPI
ConnectionPoint_QueryInterface(IConnectionPoint
*iface
, REFIID riid
, LPVOID
*ppv
)
4163 ok(0, "unexpected call\n");
4164 return E_NOINTERFACE
;
4167 static ULONG WINAPI
ConnectionPoint_AddRef(IConnectionPoint
*iface
)
4172 static ULONG WINAPI
ConnectionPoint_Release(IConnectionPoint
*iface
)
4177 static HRESULT WINAPI
ConnectionPoint_GetConnectionInterface(IConnectionPoint
*iface
, IID
*pIID
)
4179 ok(0, "unexpected call\n");
4183 static HRESULT WINAPI
ConnectionPoint_GetConnectionPointContainer(IConnectionPoint
*iface
,
4184 IConnectionPointContainer
**ppCPC
)
4186 ok(0, "unexpected call\n");
4190 static HRESULT WINAPI
ConnectionPoint_Advise(IConnectionPoint
*iface
, IUnknown
*pUnkSink
, DWORD
*pdwCookie
)
4192 ok(0, "unexpected call\n");
4196 static HRESULT WINAPI
ConnectionPoint_Unadvise(IConnectionPoint
*iface
, DWORD dwCookie
)
4198 ok(0, "unexpected call\n");
4202 static HRESULT WINAPI
ConnectionPoint_EnumConnections(IConnectionPoint
*iface
, IEnumConnections
**ppEnum
)
4204 CHECK_EXPECT(EnumConnections
);
4206 *ppEnum
= &EnumConnections
;
4207 next_called
= FALSE
;
4211 static const IConnectionPointVtbl ConnectionPointVtbl
=
4213 ConnectionPoint_QueryInterface
,
4214 ConnectionPoint_AddRef
,
4215 ConnectionPoint_Release
,
4216 ConnectionPoint_GetConnectionInterface
,
4217 ConnectionPoint_GetConnectionPointContainer
,
4218 ConnectionPoint_Advise
,
4219 ConnectionPoint_Unadvise
,
4220 ConnectionPoint_EnumConnections
4223 static IConnectionPoint ConnectionPointWBE2
= { &ConnectionPointVtbl
};
4225 static HRESULT WINAPI
ConnectionPointContainer_QueryInterface(IConnectionPointContainer
*iface
,
4226 REFIID riid
, void **ppv
)
4228 ok(0, "unexpected call\n");
4229 return E_NOINTERFACE
;
4232 static ULONG WINAPI
ConnectionPointContainer_AddRef(IConnectionPointContainer
*iface
)
4237 static ULONG WINAPI
ConnectionPointContainer_Release(IConnectionPointContainer
*iface
)
4242 static HRESULT WINAPI
ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer
*iface
,
4243 IEnumConnectionPoints
**ppEnum
)
4245 ok(0, "unexpected call\n");
4249 static HRESULT WINAPI
ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer
*iface
,
4250 REFIID riid
, IConnectionPoint
**ppCP
)
4252 CHECK_EXPECT(FindConnectionPoint
);
4254 if(IsEqualGUID(riid
, &DIID_DWebBrowserEvents2
)) {
4255 *ppCP
= &ConnectionPointWBE2
;
4259 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
4263 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl
= {
4264 ConnectionPointContainer_QueryInterface
,
4265 ConnectionPointContainer_AddRef
,
4266 ConnectionPointContainer_Release
,
4267 ConnectionPointContainer_EnumConnectionPoints
,
4268 ConnectionPointContainer_FindConnectionPoint
4271 static IConnectionPointContainer ConnectionPointContainer
= { &ConnectionPointContainerVtbl
};
4273 static void test_NavigateWithBindCtx(BSTR uri
, VARIANT
*flags
, VARIANT
*target_frame
, VARIANT
*post_data
,
4274 VARIANT
*headers
, IBindCtx
*bind_ctx
, LPOLESTR url_fragment
)
4276 ok(!strcmp_wa(uri
, nav_url
), "uri = %s\n", wine_dbgstr_w(uri
));
4277 ok(V_VT(flags
) == VT_I4
, "V_VT(flags) = %d\n", V_VT(flags
));
4278 ok(V_I4(flags
) == navHyperlink
, "V_I4(flags) = %x\n", V_I4(flags
));
4279 ok(!target_frame
, "target_frame != NULL\n");
4280 ok(!post_data
, "post_data != NULL\n");
4281 ok(!headers
, "headers != NULL\n");
4282 ok(bind_ctx
!= NULL
, "bind_ctx == NULL\n");
4283 ok(!url_fragment
, "url_dragment = %s\n", wine_dbgstr_w(url_fragment
));
4286 static HRESULT
wb_qi(REFIID riid
, void **ppv
);
4288 static HRESULT WINAPI
WebBrowserPriv_QueryInterface(IWebBrowserPriv
*iface
, REFIID riid
, void **ppv
)
4290 return wb_qi(riid
, ppv
);
4293 static ULONG WINAPI
WebBrowserPriv_AddRef(IWebBrowserPriv
*iface
)
4298 static ULONG WINAPI
WebBrowserPriv_Release(IWebBrowserPriv
*iface
)
4303 static HRESULT WINAPI
WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv
*iface
, VARIANT
*uri
, VARIANT
*flags
,
4304 VARIANT
*target_frame
, VARIANT
*post_data
, VARIANT
*headers
, IBindCtx
*bind_ctx
, LPOLESTR url_fragment
)
4306 trace("NavigateWithBindCtx\n");
4308 CHECK_EXPECT(NavigateWithBindCtx
);
4310 ok(V_VT(uri
) == VT_BSTR
, "V_VT(uri) = %d\n", V_VT(uri
));
4311 test_NavigateWithBindCtx(V_BSTR(uri
), flags
, target_frame
, post_data
, headers
, bind_ctx
, url_fragment
);
4315 static HRESULT WINAPI
WebBrowserPriv_OnClose(IWebBrowserPriv
*iface
)
4317 ok(0, "unexpected call\n");
4321 static const IWebBrowserPrivVtbl WebBrowserPrivVtbl
= {
4322 WebBrowserPriv_QueryInterface
,
4323 WebBrowserPriv_AddRef
,
4324 WebBrowserPriv_Release
,
4325 WebBrowserPriv_NavigateWithBindCtx
,
4326 WebBrowserPriv_OnClose
4329 static IWebBrowserPriv WebBrowserPriv
= { &WebBrowserPrivVtbl
};
4331 static HRESULT WINAPI
WebBrowserPriv2IE8_QueryInterface(IWebBrowserPriv2IE8
*iface
, REFIID riid
, void **ppv
)
4333 return wb_qi(riid
, ppv
);
4336 static ULONG WINAPI
WebBrowserPriv2IE8_AddRef(IWebBrowserPriv2IE8
*iface
)
4341 static ULONG WINAPI
WebBrowserPriv2IE8_Release(IWebBrowserPriv2IE8
*iface
)
4346 static HRESULT WINAPI
WebBrowserPriv2IE8_NavigateWithBindCtx2(IWebBrowserPriv2IE8
*iface
, IUri
*uri
, VARIANT
*flags
,
4347 VARIANT
*target_frame
, VARIANT
*post_data
, VARIANT
*headers
, IBindCtx
*bind_ctx
, LPOLESTR url_fragment
)
4352 trace("IE8: NavigateWithBindCtx2\n");
4354 CHECK_EXPECT(NavigateWithBindCtx
);
4356 hres
= IUri_GetDisplayUri(uri
, &str
);
4357 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
4358 test_NavigateWithBindCtx(str
, flags
, target_frame
, post_data
, headers
, bind_ctx
, url_fragment
);
4363 static HRESULT WINAPI
WebBrowserPriv2IE8_SetBrowserFrameOptions(IWebBrowserPriv2IE8
*iface
, DWORD opt1
, DWORD opt2
)
4365 ok(0, "unexpected call\n");
4369 static HRESULT WINAPI
WebBrowserPriv2IE8_DetachConnectionPoints(IWebBrowserPriv2IE8
*iface
)
4371 ok(0, "unexpected call\n");
4375 static HRESULT WINAPI
WebBrowserPriv2IE8_GetProcessId(IWebBrowserPriv2IE8
*iface
, DWORD
*pid
)
4377 ok(0, "unexpected call\n");
4381 static HRESULT WINAPI
WebBrowserPriv2IE8_CompatAttachEditEvents(IWebBrowserPriv2IE8
*iface
)
4383 ok(0, "unexpected call\n");
4387 static HRESULT WINAPI
WebBrowserPriv2IE8_HandleOpenOptions(IWebBrowserPriv2IE8
*iface
, IUnknown
*obj
, BSTR bstr
, int options
)
4389 ok(0, "unexpected call\n");
4393 static HRESULT WINAPI
WebBrowserPriv2IE8_SetSearchTerm(IWebBrowserPriv2IE8
*iface
, BSTR term
)
4395 ok(0, "unexpected call\n");
4399 static HRESULT WINAPI
WebBrowserPriv2IE8_GetSearchTerm(IWebBrowserPriv2IE8
*iface
, BSTR
*term
)
4401 ok(0, "unexpected call\n");
4405 static HRESULT WINAPI
WebBrowserPriv2IE8_GetCurrentDocument(IWebBrowserPriv2IE8
*iface
, IDispatch
**doc
)
4407 ok(0, "unexpected call\n");
4411 static const IWebBrowserPriv2IE8Vtbl WebBrowserPriv2IE8Vtbl
= {
4412 WebBrowserPriv2IE8_QueryInterface
,
4413 WebBrowserPriv2IE8_AddRef
,
4414 WebBrowserPriv2IE8_Release
,
4415 WebBrowserPriv2IE8_NavigateWithBindCtx2
,
4416 WebBrowserPriv2IE8_SetBrowserFrameOptions
,
4417 WebBrowserPriv2IE8_DetachConnectionPoints
,
4418 WebBrowserPriv2IE8_GetProcessId
,
4419 WebBrowserPriv2IE8_CompatAttachEditEvents
,
4420 WebBrowserPriv2IE8_HandleOpenOptions
,
4421 WebBrowserPriv2IE8_SetSearchTerm
,
4422 WebBrowserPriv2IE8_GetSearchTerm
,
4423 WebBrowserPriv2IE8_GetCurrentDocument
4426 static IWebBrowserPriv2IE8 WebBrowserPriv2IE8
= { &WebBrowserPriv2IE8Vtbl
};
4428 static HRESULT WINAPI
WebBrowserPriv2IE9_QueryInterface(IWebBrowserPriv2IE9
*iface
, REFIID riid
, void **ppv
)
4430 return wb_qi(riid
, ppv
);
4433 static ULONG WINAPI
WebBrowserPriv2IE9_AddRef(IWebBrowserPriv2IE9
*iface
)
4438 static ULONG WINAPI
WebBrowserPriv2IE9_Release(IWebBrowserPriv2IE9
*iface
)
4443 static HRESULT WINAPI
WebBrowserPriv2IE9_NavigateWithBindCtx2(IWebBrowserPriv2IE9
*iface
, IUri
*uri
, VARIANT
*flags
,
4444 VARIANT
*target_frame
, VARIANT
*post_data
, VARIANT
*headers
, IBindCtx
*bind_ctx
, LPOLESTR url_fragment
, DWORD unknown
)
4449 trace("IE9: NavigateWithBindCtx2\n");
4451 CHECK_EXPECT(NavigateWithBindCtx
);
4453 hres
= IUri_GetDisplayUri(uri
, &str
);
4454 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
4455 test_NavigateWithBindCtx(str
, flags
, target_frame
, post_data
, headers
, bind_ctx
, url_fragment
);
4460 static const IWebBrowserPriv2IE9Vtbl WebBrowserPriv2IE9Vtbl
= {
4461 WebBrowserPriv2IE9_QueryInterface
,
4462 WebBrowserPriv2IE9_AddRef
,
4463 WebBrowserPriv2IE9_Release
,
4464 WebBrowserPriv2IE9_NavigateWithBindCtx2
4467 static IWebBrowserPriv2IE9 WebBrowserPriv2IE9
= { &WebBrowserPriv2IE9Vtbl
};
4469 static HRESULT WINAPI
WebBrowser_QueryInterface(IWebBrowser2
*iface
, REFIID riid
, void **ppv
)
4471 return wb_qi(riid
, ppv
);
4474 static ULONG WINAPI
WebBrowser_AddRef(IWebBrowser2
*iface
)
4479 static ULONG WINAPI
WebBrowser_Release(IWebBrowser2
*iface
)
4484 static HRESULT WINAPI
WebBrowser_GetTypeInfoCount(IWebBrowser2
*iface
, UINT
*pctinfo
)
4486 ok(0, "unexpected call\n");
4490 static HRESULT WINAPI
WebBrowser_GetTypeInfo(IWebBrowser2
*iface
, UINT iTInfo
, LCID lcid
,
4491 LPTYPEINFO
*ppTInfo
)
4493 ok(0, "unexpected call\n");
4497 static HRESULT WINAPI
WebBrowser_GetIDsOfNames(IWebBrowser2
*iface
, REFIID riid
,
4498 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4500 ok(0, "unexpected call\n");
4504 static HRESULT WINAPI
WebBrowser_Invoke(IWebBrowser2
*iface
, DISPID dispIdMember
,
4505 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
4506 EXCEPINFO
*pExepInfo
, UINT
*puArgErr
)
4508 ok(0, "unexpected call\n");
4512 static HRESULT WINAPI
WebBrowser_GoBack(IWebBrowser2
*iface
)
4514 ok(0, "unexpected call\n");
4518 static HRESULT WINAPI
WebBrowser_GoForward(IWebBrowser2
*iface
)
4520 ok(0, "unexpected call\n");
4524 static HRESULT WINAPI
WebBrowser_GoHome(IWebBrowser2
*iface
)
4526 ok(0, "unexpected call\n");
4530 static HRESULT WINAPI
WebBrowser_GoSearch(IWebBrowser2
*iface
)
4532 ok(0, "unexpected call\n");
4536 static HRESULT WINAPI
WebBrowser_Navigate(IWebBrowser2
*iface
, BSTR szUrl
,
4537 VARIANT
*Flags
, VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
4539 ok(0, "unexpected call\n");
4543 static HRESULT WINAPI
WebBrowser_Refresh(IWebBrowser2
*iface
)
4545 ok(0, "unexpected call\n");
4549 static HRESULT WINAPI
WebBrowser_Refresh2(IWebBrowser2
*iface
, VARIANT
*Level
)
4551 ok(0, "unexpected call\n");
4555 static HRESULT WINAPI
WebBrowser_Stop(IWebBrowser2
*iface
)
4557 ok(0, "unexpected call\n");
4561 static HRESULT WINAPI
WebBrowser_get_Application(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4563 ok(0, "unexpected call\n");
4567 static HRESULT WINAPI
WebBrowser_get_Parent(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4569 ok(0, "unexpected call\n");
4573 static HRESULT WINAPI
WebBrowser_get_Container(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4575 ok(0, "unexpected call\n");
4579 static HRESULT WINAPI
WebBrowser_get_Document(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4581 ok(0, "unexpected call\n");
4585 static HRESULT WINAPI
WebBrowser_get_TopLevelContainer(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4587 ok(0, "unexpected call\n");
4591 static HRESULT WINAPI
WebBrowser_get_Type(IWebBrowser2
*iface
, BSTR
*Type
)
4593 ok(0, "unexpected call\n");
4597 static HRESULT WINAPI
WebBrowser_get_Left(IWebBrowser2
*iface
, LONG
*pl
)
4599 ok(0, "unexpected call\n");
4603 static HRESULT WINAPI
WebBrowser_put_Left(IWebBrowser2
*iface
, LONG Left
)
4605 ok(0, "unexpected call\n");
4609 static HRESULT WINAPI
WebBrowser_get_Top(IWebBrowser2
*iface
, LONG
*pl
)
4611 ok(0, "unexpected call\n");
4615 static HRESULT WINAPI
WebBrowser_put_Top(IWebBrowser2
*iface
, LONG Top
)
4617 ok(0, "unexpected call\n");
4621 static HRESULT WINAPI
WebBrowser_get_Width(IWebBrowser2
*iface
, LONG
*pl
)
4623 ok(0, "unexpected call\n");
4627 static HRESULT WINAPI
WebBrowser_put_Width(IWebBrowser2
*iface
, LONG Width
)
4629 ok(0, "unexpected call\n");
4633 static HRESULT WINAPI
WebBrowser_get_Height(IWebBrowser2
*iface
, LONG
*pl
)
4635 ok(0, "unexpected call\n");
4639 static HRESULT WINAPI
WebBrowser_put_Height(IWebBrowser2
*iface
, LONG Height
)
4641 ok(0, "unexpected call\n");
4645 static HRESULT WINAPI
WebBrowser_get_LocationName(IWebBrowser2
*iface
, BSTR
*LocationName
)
4647 ok(0, "unexpected call\n");
4651 static HRESULT WINAPI
WebBrowser_get_LocationURL(IWebBrowser2
*iface
, BSTR
*LocationURL
)
4653 CHECK_EXPECT(get_LocationURL
);
4657 static HRESULT WINAPI
WebBrowser_get_Busy(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4659 ok(0, "unexpected call\n");
4663 static HRESULT WINAPI
WebBrowser_Quit(IWebBrowser2
*iface
)
4665 ok(0, "unexpected call\n");
4669 static HRESULT WINAPI
WebBrowser_ClientToWindow(IWebBrowser2
*iface
, int *pcx
, int *pcy
)
4671 ok(0, "unexpected call\n");
4675 static HRESULT WINAPI
WebBrowser_PutProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT vtValue
)
4677 ok(0, "unexpected call\n");
4681 static HRESULT WINAPI
WebBrowser_GetProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT
*pvtValue
)
4683 ok(0, "unexpected call\n");
4687 static HRESULT WINAPI
WebBrowser_get_Name(IWebBrowser2
*iface
, BSTR
*Name
)
4689 ok(0, "unexpected call\n");
4693 static HRESULT WINAPI
WebBrowser_get_HWND(IWebBrowser2
*iface
, SHANDLE_PTR
*pHWND
)
4695 ok(0, "unexpected call\n");
4699 static HRESULT WINAPI
WebBrowser_get_FullName(IWebBrowser2
*iface
, BSTR
*FullName
)
4701 ok(0, "unexpected call\n");
4705 static HRESULT WINAPI
WebBrowser_get_Path(IWebBrowser2
*iface
, BSTR
*Path
)
4707 ok(0, "unexpected call\n");
4711 static HRESULT WINAPI
WebBrowser_get_Visible(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4713 ok(0, "unexpected call\n");
4717 static HRESULT WINAPI
WebBrowser_put_Visible(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4719 ok(0, "unexpected call\n");
4723 static HRESULT WINAPI
WebBrowser_get_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4725 ok(0, "unexpected call\n");
4729 static HRESULT WINAPI
WebBrowser_put_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4731 ok(0, "unexpected call\n");
4735 static HRESULT WINAPI
WebBrowser_get_StatusText(IWebBrowser2
*iface
, BSTR
*StatusText
)
4737 ok(0, "unexpected call\n");
4741 static HRESULT WINAPI
WebBrowser_put_StatusText(IWebBrowser2
*iface
, BSTR StatusText
)
4743 ok(0, "unexpected call\n");
4747 static HRESULT WINAPI
WebBrowser_get_ToolBar(IWebBrowser2
*iface
, int *Value
)
4749 ok(0, "unexpected call\n");
4753 static HRESULT WINAPI
WebBrowser_put_ToolBar(IWebBrowser2
*iface
, int Value
)
4755 ok(0, "unexpected call\n");
4759 static HRESULT WINAPI
WebBrowser_get_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4761 ok(0, "unexpected call\n");
4765 static HRESULT WINAPI
WebBrowser_put_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4767 ok(0, "unexpected call\n");
4771 static HRESULT WINAPI
WebBrowser_get_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL
*pbFullScreen
)
4773 ok(0, "unexpected call\n");
4777 static HRESULT WINAPI
WebBrowser_put_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL bFullScreen
)
4779 ok(0, "unexpected call\n");
4783 static HRESULT WINAPI
WebBrowser_Navigate2(IWebBrowser2
*iface
, VARIANT
*URL
, VARIANT
*Flags
,
4784 VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
4786 ok(0, "unexpected call\n");
4790 static HRESULT WINAPI
WebBrowser_QueryStatusWB(IWebBrowser2
*iface
, OLECMDID cmdID
, OLECMDF
*pcmdf
)
4792 ok(0, "unexpected call\n");
4796 static HRESULT WINAPI
WebBrowser_ExecWB(IWebBrowser2
*iface
, OLECMDID cmdID
,
4797 OLECMDEXECOPT cmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
4799 ok(0, "unexpected call\n");
4803 static HRESULT WINAPI
WebBrowser_ShowBrowserBar(IWebBrowser2
*iface
, VARIANT
*pvaClsid
,
4804 VARIANT
*pvarShow
, VARIANT
*pvarSize
)
4806 ok(0, "unexpected call\n");
4810 static HRESULT WINAPI
WebBrowser_get_ReadyState(IWebBrowser2
*iface
, READYSTATE
*lpReadyState
)
4812 ok(0, "unexpected call\n");
4816 static HRESULT WINAPI
WebBrowser_get_Offline(IWebBrowser2
*iface
, VARIANT_BOOL
*pbOffline
)
4818 ok(0, "unexpected call\n");
4822 static HRESULT WINAPI
WebBrowser_put_Offline(IWebBrowser2
*iface
, VARIANT_BOOL bOffline
)
4824 ok(0, "unexpected call\n");
4828 static HRESULT WINAPI
WebBrowser_get_Silent(IWebBrowser2
*iface
, VARIANT_BOOL
*pbSilent
)
4830 ok(0, "unexpected call\n");
4834 static HRESULT WINAPI
WebBrowser_put_Silent(IWebBrowser2
*iface
, VARIANT_BOOL bSilent
)
4836 ok(0, "unexpected call\n");
4840 static HRESULT WINAPI
WebBrowser_get_RegisterAsBrowser(IWebBrowser2
*iface
,
4841 VARIANT_BOOL
*pbRegister
)
4843 ok(0, "unexpected call\n");
4847 static HRESULT WINAPI
WebBrowser_put_RegisterAsBrowser(IWebBrowser2
*iface
,
4848 VARIANT_BOOL bRegister
)
4850 ok(0, "unexpected call\n");
4854 static HRESULT WINAPI
WebBrowser_get_RegisterAsDropTarget(IWebBrowser2
*iface
,
4855 VARIANT_BOOL
*pbRegister
)
4857 ok(0, "unexpected call\n");
4861 static HRESULT WINAPI
WebBrowser_put_RegisterAsDropTarget(IWebBrowser2
*iface
,
4862 VARIANT_BOOL bRegister
)
4864 ok(0, "unexpected call\n");
4868 static HRESULT WINAPI
WebBrowser_get_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL
*pbRegister
)
4870 ok(0, "unexpected call\n");
4874 static HRESULT WINAPI
WebBrowser_put_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL bRegister
)
4876 ok(0, "unexpected call\n");
4880 static HRESULT WINAPI
WebBrowser_get_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4882 trace("get_AddressBar: ignoring\n"); /* Some old IEs call it */
4886 static HRESULT WINAPI
WebBrowser_put_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4888 ok(0, "unexpected call\n");
4892 static HRESULT WINAPI
WebBrowser_get_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4894 ok(0, "unexpected call\n");
4898 static HRESULT WINAPI
WebBrowser_put_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4900 ok(0, "unexpected call\n");
4904 static const IWebBrowser2Vtbl WebBrowser2Vtbl
=
4906 WebBrowser_QueryInterface
,
4909 WebBrowser_GetTypeInfoCount
,
4910 WebBrowser_GetTypeInfo
,
4911 WebBrowser_GetIDsOfNames
,
4914 WebBrowser_GoForward
,
4916 WebBrowser_GoSearch
,
4917 WebBrowser_Navigate
,
4919 WebBrowser_Refresh2
,
4921 WebBrowser_get_Application
,
4922 WebBrowser_get_Parent
,
4923 WebBrowser_get_Container
,
4924 WebBrowser_get_Document
,
4925 WebBrowser_get_TopLevelContainer
,
4926 WebBrowser_get_Type
,
4927 WebBrowser_get_Left
,
4928 WebBrowser_put_Left
,
4931 WebBrowser_get_Width
,
4932 WebBrowser_put_Width
,
4933 WebBrowser_get_Height
,
4934 WebBrowser_put_Height
,
4935 WebBrowser_get_LocationName
,
4936 WebBrowser_get_LocationURL
,
4937 WebBrowser_get_Busy
,
4939 WebBrowser_ClientToWindow
,
4940 WebBrowser_PutProperty
,
4941 WebBrowser_GetProperty
,
4942 WebBrowser_get_Name
,
4943 WebBrowser_get_HWND
,
4944 WebBrowser_get_FullName
,
4945 WebBrowser_get_Path
,
4946 WebBrowser_get_Visible
,
4947 WebBrowser_put_Visible
,
4948 WebBrowser_get_StatusBar
,
4949 WebBrowser_put_StatusBar
,
4950 WebBrowser_get_StatusText
,
4951 WebBrowser_put_StatusText
,
4952 WebBrowser_get_ToolBar
,
4953 WebBrowser_put_ToolBar
,
4954 WebBrowser_get_MenuBar
,
4955 WebBrowser_put_MenuBar
,
4956 WebBrowser_get_FullScreen
,
4957 WebBrowser_put_FullScreen
,
4958 WebBrowser_Navigate2
,
4959 WebBrowser_QueryStatusWB
,
4961 WebBrowser_ShowBrowserBar
,
4962 WebBrowser_get_ReadyState
,
4963 WebBrowser_get_Offline
,
4964 WebBrowser_put_Offline
,
4965 WebBrowser_get_Silent
,
4966 WebBrowser_put_Silent
,
4967 WebBrowser_get_RegisterAsBrowser
,
4968 WebBrowser_put_RegisterAsBrowser
,
4969 WebBrowser_get_RegisterAsDropTarget
,
4970 WebBrowser_put_RegisterAsDropTarget
,
4971 WebBrowser_get_TheaterMode
,
4972 WebBrowser_put_TheaterMode
,
4973 WebBrowser_get_AddressBar
,
4974 WebBrowser_put_AddressBar
,
4975 WebBrowser_get_Resizable
,
4976 WebBrowser_put_Resizable
4979 static IWebBrowser2 WebBrowser2
= { &WebBrowser2Vtbl
};
4981 static HRESULT
wb_qi(REFIID riid
, void **ppv
)
4983 static const IID IID_IWebBrowserPriv2IE7
= {0x1af32b6c, 0xa3ba,0x48b9,{0xb2,0x4e,0x8a,0xa9,0xc4,0x1f,0x6e,0xcd}};
4984 static const IID IID_IWebBrowserPriv2IE8XP
= {0x486f6159,0x9f3f,0x4827,{0x82,0xd4,0x28,0x3c,0xef,0x39,0x77,0x33}};
4988 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IWebBrowser
, riid
)
4989 || IsEqualGUID(&IID_IWebBrowserApp
, riid
) || IsEqualGUID(&IID_IWebBrowser2
, riid
)) {
4990 *ppv
= &WebBrowser2
;
4994 if(IsEqualGUID(riid
, &IID_IOleObject
))
4995 return E_NOINTERFACE
; /* TODO */
4997 if(IsEqualGUID(riid
, &IID_IConnectionPointContainer
)) {
4998 *ppv
= &ConnectionPointContainer
;
5002 if(IsEqualGUID(riid
, &IID_IWebBrowserPriv
)) {
5003 *ppv
= &WebBrowserPriv
;
5007 if(IsEqualGUID(riid
, &IID_IWebBrowserPriv2IE8
)) {
5008 /* IE8 and IE9 versions use the same IID, but have different declarations. */
5009 *ppv
= is_ie9plus
? (void*)&WebBrowserPriv2IE9
: (void*)&WebBrowserPriv2IE8
;
5013 if(IsEqualGUID(riid
, &IID_IWebBrowserPriv2IE7
)) {
5014 trace("QI(IID_IWebBrowserPriv2IE7)\n");
5015 return E_NOINTERFACE
;
5018 if(IsEqualGUID(riid
, &IID_IWebBrowserPriv2IE8XP
)) {
5019 trace("QI(IID_IWebBrowserPriv2IE8XP)\n");
5020 return E_NOINTERFACE
;
5023 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid
));
5024 return E_NOINTERFACE
;
5027 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
5028 REFIID riid
, void **ppv
)
5030 return QueryInterface(riid
, ppv
);
5033 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
5038 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
5043 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
5044 REFIID riid
, void **ppv
)
5047 * Services used by HTMLDocument:
5050 * IInternetSecurityManager
5052 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
5055 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
5056 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
5057 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
5059 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
5060 * IElementBehaviorFactory
5061 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
5070 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
5071 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
5076 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
5077 ok(IsEqualGUID(&IID_INewWindowManager
, riid
), "unexpected riid\n");
5078 *ppv
= &NewWindowManager
;
5082 if(IsEqualGUID(&IID_IShellBrowser
, guidService
)) {
5083 ok(IsEqualGUID(&IID_IBrowserService
, riid
), "unexpected riid\n");
5084 *ppv
= &BrowserService
;
5088 if(support_wbapp
&& IsEqualGUID(&IID_IWebBrowserApp
, guidService
)) {
5089 if(IsEqualGUID(riid
, &IID_IWebBrowser2
)) {
5090 *ppv
= &WebBrowser2
;
5093 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
5096 return E_NOINTERFACE
;
5099 static const IServiceProviderVtbl ServiceProviderVtbl
= {
5100 ServiceProvider_QueryInterface
,
5101 ServiceProvider_AddRef
,
5102 ServiceProvider_Release
,
5103 ServiceProvider_QueryService
5106 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
5108 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
5109 REFIID riid
, void **ppv
)
5111 return QueryInterface(riid
, ppv
);
5114 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSinkEx
*iface
)
5119 static ULONG WINAPI
AdviseSink_Release(IAdviseSinkEx
*iface
)
5124 static void WINAPI
AdviseSink_OnDataChange(IAdviseSinkEx
*iface
,
5125 FORMATETC
*pFormatetc
, STGMEDIUM
*pStgmed
)
5127 ok(0, "unexpected call\n");
5130 static void WINAPI
AdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
5131 DWORD dwAspect
, LONG lindex
)
5133 ok(0, "unexpected call\n");
5136 static void WINAPI
AdviseSink_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
5138 ok(0, "unexpected call\n");
5141 static void WINAPI
AdviseSink_OnSave(IAdviseSinkEx
*iface
)
5143 ok(0, "unexpected call\n");
5146 static void WINAPI
AdviseSink_OnClose(IAdviseSinkEx
*iface
)
5148 ok(0, "unexpected call\n");
5151 static void WINAPI
AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
5153 ok(0, "unexpected call\n");
5156 static void WINAPI
ObjectAdviseSink_OnClose(IAdviseSinkEx
*iface
)
5158 CHECK_EXPECT(Advise_Close
);
5161 static const IAdviseSinkExVtbl AdviseSinkVtbl
= {
5162 AdviseSink_QueryInterface
,
5165 AdviseSink_OnDataChange
,
5166 AdviseSink_OnViewChange
,
5167 AdviseSink_OnRename
,
5169 ObjectAdviseSink_OnClose
,
5170 AdviseSinkEx_OnViewStatusChange
5173 static IAdviseSinkEx AdviseSink
= { &AdviseSinkVtbl
};
5175 static HRESULT WINAPI
ViewAdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
5176 REFIID riid
, void **ppv
)
5178 if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
5183 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
5185 return E_NOINTERFACE
;
5188 static void WINAPI
ViewAdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
5189 DWORD dwAspect
, LONG lindex
)
5191 CHECK_EXPECT2(OnViewChange
);
5193 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
5194 ok(lindex
== -1, "lindex = %d\n", lindex
);
5197 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl
= {
5198 ViewAdviseSink_QueryInterface
,
5201 AdviseSink_OnDataChange
,
5202 ViewAdviseSink_OnViewChange
,
5203 AdviseSink_OnRename
,
5206 AdviseSinkEx_OnViewStatusChange
5209 static IAdviseSinkEx ViewAdviseSink
= { &ViewAdviseSinkVtbl
};
5211 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
5212 DEFINE_GUID(IID_IThumbnailView
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
5213 DEFINE_GUID(IID_IRenMailEditor
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
5214 DEFINE_GUID(IID_unk4
, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
5215 DEFINE_GUID(IID_IDocHostUIHandlerPriv
, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
5216 DEFINE_GUID(IID_unk5
, 0x5f95accc,0xd7a1,0x4574,0xbc,0xcb,0x69,0x71,0x35,0xbc,0x41,0xde);
5218 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
5222 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
5224 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
5225 *ppv
= &DocumentSite
;
5226 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
5227 *ppv
= &DocHostUIHandler
;
5228 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
5229 *ppv
= &OleContainer
;
5230 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
5231 *ppv
= &InPlaceSiteWindowless
;
5232 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
5233 *ppv
= &OleCommandTarget
;
5234 else if(IsEqualGUID(&IID_IDispatch
, riid
))
5236 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
5237 *ppv
= &ServiceProvider
;
5238 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
5239 *ppv
= ipsex
? &InPlaceSiteWindowless
: NULL
;
5240 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
))
5241 *ppv
= ipsw
? &InPlaceSiteWindowless
: NULL
;
5242 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
5243 *ppv
= &OleControlSite
;
5244 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
5245 return E_NOINTERFACE
; /* TODO */
5246 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
5247 return E_NOINTERFACE
; /* ? */
5248 else if(IsEqualGUID(&IID_unk1
, riid
))
5249 return E_NOINTERFACE
; /* HTMLWindow2 ? */
5250 else if(IsEqualGUID(&IID_IThumbnailView
, riid
))
5251 return E_NOINTERFACE
; /* ? */
5252 else if(IsEqualGUID(&IID_IRenMailEditor
, riid
))
5253 return E_NOINTERFACE
; /* ? */
5254 else if(IsEqualGUID(&IID_unk4
, riid
))
5255 return E_NOINTERFACE
; /* ? */
5256 else if(IsEqualGUID(&IID_unk5
, riid
))
5257 return E_NOINTERFACE
; /* IE10 */
5258 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv
, riid
))
5259 return E_NOINTERFACE
; /* ? */
5261 trace("QI(%s)\n", wine_dbgstr_guid(riid
));
5265 return E_NOINTERFACE
;
5268 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
5270 if(msg
== WM_CONTINUE_BINDING
) {
5271 IBindStatusCallback
*callback
= (IBindStatusCallback
*)wParam
;
5272 continue_binding(callback
);
5275 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
5278 static void test_doscroll(IUnknown
*unk
)
5280 IHTMLDocument3
*doc
;
5281 IHTMLElement2
*elem2
;
5286 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument3
, (void**)&doc
);
5287 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
5291 hres
= IHTMLDocument3_get_documentElement(doc
, &elem
);
5292 IHTMLDocument3_Release(doc
);
5293 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
5294 switch(load_state
) {
5298 ok(!elem
, "elem != NULL\n");
5301 case LD_INTERACTIVE
:
5303 ok(elem
!= NULL
, "elem == NULL\n");
5308 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
5309 IHTMLElement_Release(elem
);
5310 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
5313 V_BSTR(&v
) = a2bstr("left");
5314 hres
= IHTMLElement2_doScroll(elem2
, v
);
5315 SysFreeString(V_BSTR(&v
));
5316 IHTMLElement2_Release(elem2
);
5318 if(inplace_deactivated
)
5319 ok(hres
== E_PENDING
, "doScroll failed: %08x\n", hres
);
5320 else if(load_state
== LD_COMPLETE
)
5321 ok(hres
== S_OK
, "doScroll failed: %08x\n", hres
);
5323 ok(hres
== E_PENDING
|| hres
== S_OK
, "doScroll failed: %08x\n", hres
);
5326 static void _test_readyState(unsigned line
, IUnknown
*unk
)
5328 IHTMLDocument2
*htmldoc
;
5329 DISPPARAMS dispparams
;
5335 static const LPCSTR expected_state
[] = {
5344 if(open_call
|| resetting_document
)
5350 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
5351 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
5355 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
5356 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
5358 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
5359 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
5361 if(!strcmp_wa(state
, "interactive") && load_state
== LD_LOADING
)
5362 load_state
= LD_INTERACTIVE
;
5365 (!strcmp_wa(state
, expected_state
[load_state
]), "unexpected state %s, expected %d\n",
5366 wine_dbgstr_w(state
), load_state
);
5367 SysFreeString(state
);
5369 hres
= IHTMLDocument2_get_body(htmldoc
, &elem
);
5370 ok_(__FILE__
,line
)(hres
== S_OK
, "get_body failed: %08x\n", hres
);
5372 IHTMLElement2
*elem2
;
5375 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
5376 IHTMLElement_Release(elem
);
5377 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
5379 hres
= IHTMLElement2_get_readyState(elem2
, &var
);
5380 IHTMLElement2_Release(elem2
);
5381 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
5382 ok(V_VT(&var
) == VT_BSTR
, "V_VT(state) = %d\n", V_VT(&var
));
5383 ok(!strcmp_wa(V_BSTR(&var
), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var
)));
5386 ok_(__FILE__
,line
)(load_state
!= LD_COMPLETE
, "body is NULL in complete state\n");
5389 dispparams
.cArgs
= 0;
5390 dispparams
.cNamedArgs
= 0;
5391 dispparams
.rgdispidNamedArgs
= NULL
;
5392 dispparams
.rgvarg
= NULL
;
5396 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
5397 &dispparams
, &out
, NULL
, NULL
);
5398 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
5400 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
5401 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
5403 test_doscroll((IUnknown
*)htmldoc
);
5405 IHTMLDocument2_Release(htmldoc
);
5408 static void test_ViewAdviseSink(IHTMLDocument2
*doc
)
5413 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IViewObject
, (void**)&view
);
5414 ok(hres
== S_OK
, "QueryInterface(IID_IViewObject) failed: %08x\n", hres
);
5416 hres
= IViewObject_SetAdvise(view
, DVASPECT_CONTENT
, ADVF_PRIMEFIRST
, (IAdviseSink
*)&ViewAdviseSink
);
5417 ok(hres
== S_OK
, "SetAdvise failed: %08x\n", hres
);
5419 IViewObject_Release(view
);
5422 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
5424 IConnectionPointContainer
*tmp_container
= NULL
;
5425 IConnectionPoint
*cp
;
5430 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
5431 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
5435 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
5436 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
5437 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
5439 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
5440 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
5442 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
5443 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
5444 ok(tmp_container
== container
, "container != tmp_container\n");
5446 IConnectionPointContainer_Release(tmp_container
);
5448 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
5449 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
5451 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
5452 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
5453 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5454 hres
= IConnectionPoint_Unadvise(cp
, cookie
);
5455 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
5456 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, NULL
);
5457 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5458 } else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
5459 IEnumConnections
*enum_conn
;
5460 CONNECTDATA conn_data
;
5463 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&EventDispatch
, &cookie
);
5464 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5466 hres
= IConnectionPoint_EnumConnections(cp
, &enum_conn
);
5467 ok(hres
== S_OK
, "EnumConnections failed: %08x\n", hres
);
5470 hres
= IEnumConnections_Next(enum_conn
, 1, &conn_data
, &fetched
);
5471 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
5472 ok(conn_data
.pUnk
== (IUnknown
*)&EventDispatch
, "conn_data.pUnk == EventDispatch\n");
5473 ok(conn_data
.dwCookie
== cookie
, "conn_data.dwCookie != cookie\n");
5474 IUnknown_Release(conn_data
.pUnk
);
5476 fetched
= 0xdeadbeef;
5477 hres
= IEnumConnections_Next(enum_conn
, 1, &conn_data
, &fetched
);
5478 ok(hres
== S_FALSE
, "Next failed: %08x\n", hres
);
5479 ok(!fetched
, "fetched = %d\n", fetched
);
5481 IEnumConnections_Release(enum_conn
);
5484 IConnectionPoint_Release(cp
);
5487 static void test_ConnectionPointContainer(IHTMLDocument2
*doc
)
5489 IConnectionPointContainer
*container
;
5492 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IConnectionPointContainer
, (void**)&container
);
5493 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
5497 test_ConnectionPoint(container
, &IID_IDispatch
);
5498 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
5499 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
5500 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
5502 IConnectionPointContainer_Release(container
);
5505 static void set_custom_uihandler(IHTMLDocument2
*doc
, IDocHostUIHandler2
*uihandler
)
5507 ICustomDoc
*custom_doc
;
5510 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ICustomDoc
, (void**)&custom_doc
);
5511 ok(hres
== S_OK
, "Could not get ICustomDoc iface: %08x\n", hres
);
5513 expect_uihandler_iface
= uihandler
;
5515 hres
= ICustomDoc_SetUIHandler(custom_doc
, (IDocHostUIHandler
*)uihandler
);
5516 ICustomDoc_Release(custom_doc
);
5517 ok(hres
== S_OK
, "SetUIHandler failed: %08x\n", hres
);
5520 static void test_Load(IPersistMoniker
*persist
, IMoniker
*mon
)
5524 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
5526 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
5528 test_readyState((IUnknown
*)persist
);
5532 CreateBindCtx(0, &bind
);
5533 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
5534 (IUnknown
*)&ClientSite
);
5537 SET_EXPECT(GetDisplayName
);
5538 if(!set_clientsite
) {
5539 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
5540 SET_EXPECT(GetHostInfo
);
5541 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
5542 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5543 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5544 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
5545 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
5546 SET_EXPECT(GetOptionKeyPath
);
5547 SET_EXPECT(GetOverrideKeyPath
);
5548 SET_EXPECT(GetWindow
);
5549 SET_EXPECT(Exec_DOCCANNAVIGATE
);
5550 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
5551 SET_EXPECT(Exec_SETPROGRESSMAX
);
5552 SET_EXPECT(Exec_SETPROGRESSPOS
);
5553 SET_EXPECT(Exec_ShellDocView_37
);
5555 if(!container_locked
) {
5556 SET_EXPECT(GetContainer
);
5557 SET_EXPECT(LockContainer
);
5559 SET_EXPECT(OnChanged_READYSTATE
);
5560 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5561 SET_EXPECT(IsSystemMoniker
);
5563 SET_EXPECT(BindToStorage
);
5564 SET_EXPECT(SetActiveObject
);
5565 if(set_clientsite
) {
5566 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5567 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5568 SET_EXPECT(Exec_ShellDocView_37
);
5569 SET_EXPECT(IsErrorUrl
);
5571 SET_EXPECT(GetTravelLog
);
5573 SET_EXPECT(Exec_ShellDocView_84
);
5574 SET_EXPECT(GetPendingUrl
);
5575 load_state
= LD_DOLOAD
;
5576 expect_LockContainer_fLock
= TRUE
;
5577 readystate_set_loading
= TRUE
;
5579 hres
= IPersistMoniker_Load(persist
, FALSE
, mon
, bind
, 0x12);
5580 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
5583 CHECK_CALLED(GetDisplayName
);
5584 if(!set_clientsite
) {
5585 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
5586 CHECK_CALLED(GetHostInfo
);
5587 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
5588 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5589 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5590 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
5591 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
5592 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
5593 CHECK_CALLED(GetOverrideKeyPath
);
5594 CHECK_CALLED(GetWindow
);
5595 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
5596 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
5597 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5598 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5599 CHECK_CALLED(Exec_ShellDocView_37
);
5601 if(!container_locked
) {
5602 CHECK_CALLED(GetContainer
);
5603 CHECK_CALLED(LockContainer
);
5604 container_locked
= TRUE
;
5606 CHECK_CALLED(OnChanged_READYSTATE
);
5607 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5608 CLEAR_CALLED(IsSystemMoniker
); /* IE7 */
5610 CHECK_CALLED(BindToStorage
);
5611 CLEAR_CALLED(SetActiveObject
); /* FIXME */
5612 if(set_clientsite
) {
5613 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5614 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5615 CHECK_CALLED(Exec_ShellDocView_37
);
5616 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
5618 CHECK_CALLED(GetTravelLog
);
5620 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5621 todo_wine
CHECK_CALLED(GetPendingUrl
);
5623 set_clientsite
= container_locked
= TRUE
;
5625 test_GetCurMoniker((IUnknown
*)persist
, mon
, NULL
, FALSE
);
5627 IBindCtx_Release(bind
);
5629 test_readyState((IUnknown
*)persist
);
5632 #define DWL_VERBDONE 0x0001
5633 #define DWL_CSS 0x0002
5634 #define DWL_TRYCSS 0x0004
5635 #define DWL_HTTP 0x0008
5636 #define DWL_EMPTY 0x0010
5637 #define DWL_JAVASCRIPT 0x0020
5638 #define DWL_ONREADY_LOADING 0x0040
5639 #define DWL_EXPECT_HISTUPDATE 0x0080
5640 #define DWL_FROM_HISTORY 0x0100
5641 #define DWL_REFRESH 0x0200
5642 #define DWL_EX_GETHOSTINFO 0x0400
5643 #define DWL_EXTERNAL 0x0800
5645 static void test_download(DWORD flags
)
5647 const BOOL is_extern
= (flags
& DWL_EXTERNAL
) != 0;
5648 const BOOL is_js
= (flags
& DWL_JAVASCRIPT
) != 0;
5654 b
= &called_Exec_SETDOWNLOADSTATE_0
;
5656 b
= &called_NavigateWithBindCtx
;
5658 b
= &called_Exec_HTTPEQUIV_DONE
;
5659 is_refresh
= (flags
& DWL_REFRESH
) != 0;
5661 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
5662 ok(hwnd
!= NULL
, "Could not find hidden window\n");
5664 test_readyState(NULL
);
5666 if(flags
& DWL_REFRESH
) {
5667 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5668 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5670 if(flags
& (DWL_VERBDONE
|DWL_HTTP
))
5671 SET_EXPECT(Exec_SETPROGRESSMAX
);
5672 if(flags
& DWL_EX_GETHOSTINFO
)
5673 SET_EXPECT(GetHostInfo
);
5674 SET_EXPECT(SetStatusText
);
5675 if(!(flags
& DWL_EMPTY
))
5676 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
5678 SET_EXPECT(GetExternal
);
5679 SET_EXPECT(OnViewChange
);
5680 SET_EXPECT(GetDropTarget
);
5681 if((flags
& DWL_TRYCSS
) && !(flags
& DWL_EMPTY
))
5682 SET_EXPECT(Exec_ShellDocView_84
);
5683 if(flags
& DWL_CSS
) {
5684 SET_EXPECT(CreateInstance
);
5686 SET_EXPECT(LockRequest
);
5687 SET_EXPECT(Terminate
);
5688 SET_EXPECT(Protocol_Read
);
5689 SET_EXPECT(UnlockRequest
);
5691 if(flags
& DWL_ONREADY_LOADING
)
5692 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5693 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
)))
5694 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
5695 if(!is_js
&& !is_extern
)
5696 SET_EXPECT(Invoke_OnReadyStateChange_Complete
);
5697 SET_EXPECT(Exec_Explorer_69
);
5698 SET_EXPECT(EnableModeless_TRUE
); /* IE7 */
5699 SET_EXPECT(Frame_EnableModeless_TRUE
); /* IE7 */
5700 SET_EXPECT(EnableModeless_FALSE
); /* IE7 */
5701 SET_EXPECT(Frame_EnableModeless_FALSE
); /* IE7 */
5702 if((nav_url
&& !is_js
&& !is_extern
) || (flags
& (DWL_CSS
|DWL_HTTP
)))
5703 SET_EXPECT(Exec_ShellDocView_37
);
5704 if(flags
& DWL_HTTP
) {
5705 if(!(flags
& DWL_FROM_HISTORY
))
5706 SET_EXPECT(OnChanged_1012
);
5707 SET_EXPECT(Exec_HTTPEQUIV
);
5708 SET_EXPECT(Exec_SETTITLE
);
5710 if(!is_js
&& !is_extern
)
5711 SET_EXPECT(OnChanged_1005
);
5712 SET_EXPECT(OnChanged_READYSTATE
);
5713 SET_EXPECT(Exec_SETPROGRESSPOS
);
5714 if(!(flags
& DWL_EMPTY
))
5715 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
5716 SET_EXPECT(Exec_ShellDocView_103
);
5717 SET_EXPECT(Exec_ShellDocView_105
);
5718 SET_EXPECT(Exec_ShellDocView_140
);
5719 if(!is_js
&& !is_extern
) {
5720 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
5721 if(support_wbapp
) /* Called on some Vista installations */
5722 SET_EXPECT(CountEntries
);
5723 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
5725 SET_EXPECT(SetStatusText
);
5726 if(nav_url
|| support_wbapp
) {
5727 SET_EXPECT(UpdateUI
);
5728 SET_EXPECT(Exec_UPDATECOMMANDS
);
5729 SET_EXPECT(Exec_SETTITLE
);
5730 if(flags
& DWL_EXPECT_HISTUPDATE
)
5731 SET_EXPECT(Exec_Explorer_38
);
5732 SET_EXPECT(UpdateBackForwardState
);
5734 if(!is_js
&& !is_extern
) {
5735 if(!editmode
&& !(flags
& DWL_REFRESH
)) {
5736 if(!(flags
& DWL_EMPTY
))
5737 SET_EXPECT(FireNavigateComplete2
);
5738 SET_EXPECT(FireDocumentComplete
);
5740 SET_EXPECT(ActiveElementChanged
);
5742 SET_EXPECT(IsErrorUrl
);
5744 SET_EXPECT(Exec_ShellDocView_62
);
5745 SET_EXPECT(Exec_DOCCANNAVIGATE_NULL
);
5746 SET_EXPECT(NavigateWithBindCtx
);
5747 SET_EXPECT(Exec_Explorer_38
); /* todo_wine */
5749 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
5751 while(!*b
&& GetMessageW(&msg
, NULL
, 0, 0)) {
5752 TranslateMessage(&msg
);
5753 DispatchMessageA(&msg
);
5756 if(flags
& DWL_REFRESH
) {
5757 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5758 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5760 if(flags
& DWL_VERBDONE
)
5761 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5762 if(flags
& DWL_HTTP
)
5763 SET_CALLED(Exec_SETPROGRESSMAX
);
5764 if(flags
& DWL_EX_GETHOSTINFO
) {
5766 todo_wine
CHECK_CALLED(GetHostInfo
);
5768 CHECK_CALLED(GetHostInfo
);
5770 CHECK_CALLED(SetStatusText
);
5771 if(!(flags
& DWL_EMPTY
))
5772 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
5774 CHECK_CALLED(GetExternal
);
5775 CHECK_CALLED(OnViewChange
);
5776 CLEAR_CALLED(GetDropTarget
);
5777 if((flags
& DWL_TRYCSS
) && !(flags
& DWL_EMPTY
))
5778 todo_wine
CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5779 if(flags
& DWL_CSS
) {
5780 CHECK_CALLED(CreateInstance
);
5781 CHECK_CALLED(Start
);
5782 CHECK_CALLED(LockRequest
);
5783 CHECK_CALLED(Terminate
);
5784 CHECK_CALLED(Protocol_Read
);
5785 CHECK_CALLED(UnlockRequest
);
5787 if(flags
& DWL_ONREADY_LOADING
)
5788 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5789 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
))) {
5791 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive
);
5793 todo_wine
CHECK_CALLED(Invoke_OnReadyStateChange_Interactive
);
5795 if(!is_js
&& !is_extern
)
5796 CHECK_CALLED(Invoke_OnReadyStateChange_Complete
);
5797 SET_CALLED(Exec_Explorer_69
);
5798 SET_CALLED(EnableModeless_TRUE
); /* IE7 */
5799 SET_CALLED(Frame_EnableModeless_TRUE
); /* IE7 */
5800 SET_CALLED(EnableModeless_FALSE
); /* IE7 */
5801 SET_CALLED(Frame_EnableModeless_FALSE
); /* IE7 */
5802 if(nav_url
&& !is_js
&& !is_extern
&& !(flags
& DWL_REFRESH
))
5803 todo_wine
CHECK_CALLED(Exec_ShellDocView_37
);
5804 else if(flags
& (DWL_CSS
|DWL_HTTP
))
5805 CLEAR_CALLED(Exec_ShellDocView_37
); /* Called by IE9 */
5806 if(flags
& DWL_HTTP
) {
5807 if(!(flags
& DWL_FROM_HISTORY
))
5808 todo_wine
CHECK_CALLED(OnChanged_1012
);
5809 todo_wine
CHECK_CALLED(Exec_HTTPEQUIV
);
5810 if(!(flags
& DWL_REFRESH
))
5811 todo_wine
CHECK_CALLED(Exec_SETTITLE
);
5813 CHECK_CALLED(Exec_SETTITLE
);
5817 CHECK_CALLED(OnChanged_1005
);
5818 CHECK_CALLED(OnChanged_READYSTATE
);
5819 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5821 CLEAR_CALLED(OnChanged_READYSTATE
); /* sometimes called */
5822 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
5824 if(!(flags
& DWL_EMPTY
)) {
5826 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
5828 todo_wine
CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
5830 CLEAR_CALLED(Exec_ShellDocView_103
);
5831 CLEAR_CALLED(Exec_ShellDocView_105
);
5832 CLEAR_CALLED(Exec_ShellDocView_140
);
5833 if(!is_js
&& !is_extern
) {
5834 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
5835 if(support_wbapp
) /* Called on some Vista installations */
5836 CLEAR_CALLED(CountEntries
);
5837 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
5839 SET_CALLED(SetStatusText
);
5840 if(nav_url
|| support_wbapp
) { /* avoiding race, FIXME: find better way */
5841 CLEAR_CALLED(UpdateUI
);
5842 CLEAR_CALLED(Exec_UPDATECOMMANDS
);
5843 CLEAR_CALLED(Exec_SETTITLE
);
5844 if(flags
& DWL_EXPECT_HISTUPDATE
) {
5845 if(flags
& DWL_FROM_HISTORY
)
5846 CHECK_CALLED_BROKEN(Exec_Explorer_38
); /* Some old IEs don't call it. */
5848 CHECK_CALLED(Exec_Explorer_38
);
5850 todo_wine
CHECK_CALLED_BROKEN(UpdateBackForwardState
);
5852 if(!is_js
&& !is_extern
) {
5853 if(!editmode
&& !(flags
& DWL_REFRESH
)) {
5854 if(!(flags
& DWL_EMPTY
)) {
5856 CHECK_CALLED(FireNavigateComplete2
);
5858 todo_wine
CHECK_CALLED(FireNavigateComplete2
);
5860 CHECK_CALLED(FireDocumentComplete
);
5862 todo_wine
CHECK_CALLED(ActiveElementChanged
);
5864 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
5866 CHECK_CALLED(Exec_ShellDocView_62
);
5867 CHECK_CALLED(Exec_DOCCANNAVIGATE_NULL
);
5868 CHECK_CALLED(NavigateWithBindCtx
);
5869 todo_wine
CHECK_NOT_CALLED(Exec_Explorer_38
);
5873 load_state
= LD_COMPLETE
;
5875 test_readyState(NULL
);
5878 static void test_Persist(IHTMLDocument2
*doc
, IMoniker
*mon
)
5880 IPersistMoniker
*persist_mon
;
5881 IPersistFile
*persist_file
;
5885 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistFile
, (void**)&persist_file
);
5886 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
5887 if(SUCCEEDED(hres
)) {
5888 hres
= IPersistFile_GetClassID(persist_file
, NULL
);
5889 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
5891 hres
= IPersistFile_GetClassID(persist_file
, &guid
);
5892 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
5893 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
5895 IPersistFile_Release(persist_file
);
5898 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&persist_mon
);
5899 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
5900 if(SUCCEEDED(hres
)) {
5901 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
5902 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
5904 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
5905 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
5906 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
5908 if(load_state
== LD_DOLOAD
)
5909 test_Load(persist_mon
, mon
);
5911 test_readyState((IUnknown
*)doc
);
5913 IPersistMoniker_Release(persist_mon
);
5917 static void test_put_href(IHTMLDocument2
*doc
, BOOL use_replace
, const char *href
, const char *new_nav_url
, BOOL is_js
,
5918 BOOL is_hash
, DWORD dwl_flags
)
5920 const char *prev_nav_url
= NULL
;
5921 IHTMLPrivateWindow
*priv_window
;
5922 IHTMLLocation
*location
;
5923 IHTMLWindow2
*window
;
5927 trace("put_href %s...\n", new_nav_url
);
5930 loading_hash
= is_hash
;
5933 hres
= IHTMLDocument2_get_location(doc
, &location
);
5934 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
5935 ok(location
!= NULL
, "location == NULL\n");
5937 prev_url
= prev_nav_url
= nav_url
;
5938 nav_url
= new_nav_url
;
5940 nav_serv_url
= new_nav_url
;
5945 SET_EXPECT(TranslateUrl
);
5947 SET_EXPECT(FireBeforeNavigate2
);
5948 SET_EXPECT(Exec_ShellDocView_67
);
5950 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5951 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5952 SET_EXPECT(Exec_ShellDocView_63
);
5953 SET_EXPECT(Exec_ShellDocView_84
);
5955 SET_EXPECT(FireNavigateComplete2
);
5956 SET_EXPECT(FireDocumentComplete
);
5959 SET_EXPECT(Navigate
);
5962 hres
= IHTMLLocation_replace(location
, str
);
5963 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
5965 hres
= IHTMLLocation_put_href(location
, str
);
5966 if(is_js
&& hres
== E_ACCESSDENIED
)
5967 win_skip("put_href: got E_ACCESSDENIED\n");
5969 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
5973 CHECK_CALLED(TranslateUrl
);
5975 CHECK_CALLED(FireBeforeNavigate2
);
5976 CHECK_CALLED(Exec_ShellDocView_67
);
5978 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5979 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5980 CHECK_CALLED(Exec_ShellDocView_63
);
5981 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5983 CHECK_CALLED(FireNavigateComplete2
);
5984 CHECK_CALLED(FireDocumentComplete
);
5987 CHECK_CALLED(Navigate
);
5990 CLEAR_CALLED(TranslateUrl
);
5992 CLEAR_CALLED(FireBeforeNavigate2
);
5993 SET_CALLED(Exec_ShellDocView_67
);
5995 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
5996 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5997 CLEAR_CALLED(Exec_ShellDocView_63
);
5998 todo_wine
CLEAR_CALLED(Exec_ShellDocView_84
);
6000 CLEAR_CALLED(FireNavigateComplete2
);
6001 CLEAR_CALLED(FireDocumentComplete
);
6004 CLEAR_CALLED(Navigate
);
6008 IHTMLLocation_Release(location
);
6010 if(is_js
&& hres
== E_ACCESSDENIED
) {
6011 nav_url
= prev_nav_url
;
6015 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
6016 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6018 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
6019 IHTMLWindow2_Release(window
);
6020 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres
);
6022 if(!support_wbapp
) {
6025 readystate_set_loading
= TRUE
;
6026 SET_EXPECT(TranslateUrl
);
6027 SET_EXPECT(Exec_ShellDocView_67
);
6028 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6029 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6030 SET_EXPECT(Exec_ShellDocView_63
);
6031 SET_EXPECT(Exec_ShellDocView_84
);
6033 str
= a2bstr(nav_url
);
6035 V_VT(&vempty
) = VT_EMPTY
;
6036 hres
= IHTMLPrivateWindow_SuperNavigate(priv_window
, str
, str2
, NULL
, NULL
, &vempty
, &vempty
, 0);
6038 SysFreeString(str2
);
6039 ok(hres
== S_OK
, "SuperNavigate failed: %08x\n", hres
);
6041 CHECK_CALLED(TranslateUrl
);
6042 CHECK_CALLED(Exec_ShellDocView_67
);
6043 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6044 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6045 CHECK_CALLED(Exec_ShellDocView_63
);
6046 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
6050 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
, FALSE
);
6055 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
6056 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
6057 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2
), prev_nav_url
);
6058 SysFreeString(str2
);
6061 ignore_external_qi
= TRUE
;
6062 dwl_flags
|= DWL_JAVASCRIPT
;
6064 if(!(dwl_flags
& DWL_EXTERNAL
))
6065 dwl_flags
|= DWL_EX_GETHOSTINFO
;
6066 dwl_flags
|= DWL_ONREADY_LOADING
;
6068 test_download(DWL_VERBDONE
| dwl_flags
);
6070 ignore_external_qi
= FALSE
;
6074 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
6075 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
6077 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
6078 else if (dwl_flags
& DWL_EXTERNAL
)
6079 todo_wine
ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
6081 ok(!strcmp_wa(str2
, nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
6082 SysFreeString(str2
);
6083 IHTMLPrivateWindow_Release(priv_window
);
6087 nav_url
= prev_nav_url
;
6090 static void test_load_history(IHTMLDocument2
*doc
)
6092 IPersistHistory
*per_hist
;
6095 trace("LoadHistory...\n");
6097 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistHistory
, (void**)&per_hist
);
6098 ok(hres
== S_OK
, "Could not get IPersistHistory iface: %08x\n", hres
);
6101 nav_url
= "http://test.winehq.org/tests/winehq_snapshot/#test";
6102 nav_serv_url
= "http://test.winehq.org/tests/winehq_snapshot/";
6104 SET_EXPECT(Exec_ShellDocView_138
);
6105 SET_EXPECT(Exec_ShellDocView_67
);
6106 SET_EXPECT(FireBeforeNavigate2
);
6107 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6108 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6110 hres
= IPersistHistory_LoadHistory(per_hist
, history_stream
, NULL
);
6111 ok(hres
== S_OK
, "LoadHistory failed: %08x\n", hres
);
6113 CHECK_CALLED_BROKEN(Exec_ShellDocView_138
);
6114 CHECK_CALLED(Exec_ShellDocView_67
);
6115 CHECK_CALLED(FireBeforeNavigate2
);
6116 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6117 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6119 load_state
= LD_LOADING
;
6120 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
6122 test_download(DWL_VERBDONE
|DWL_HTTP
|DWL_EXPECT_HISTUPDATE
|DWL_ONREADY_LOADING
|DWL_FROM_HISTORY
|DWL_EX_GETHOSTINFO
);
6124 IPersistHistory_Release(per_hist
);
6125 IStream_Release(history_stream
);
6126 history_stream
= NULL
;
6129 static void test_OmHistory(IHTMLDocument2
*doc
)
6136 hres
= IHTMLDocument2_get_parentWindow(doc
, &win
);
6137 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6139 hres
= IHTMLWindow2_get_history(win
, &hist
);
6140 ok(hres
== S_OK
, "get_history failed: %08x\n", hres
);
6141 IHTMLWindow2_Release(win
);
6143 SET_EXPECT(CountEntries
);
6144 hres
= IOmHistory_get_length(hist
, &len
);
6145 CHECK_CALLED(CountEntries
);
6146 ok(hres
== S_OK
, "get_length failed: %08x\n", hres
);
6147 ok(len
== 0, "len = %d\n", len
);
6149 IOmHistory_Release(hist
);
6152 static void test_refresh(IHTMLDocument2
*doc
)
6154 IOleCommandTarget
*cmdtrg
;
6158 trace("Refresh...\n");
6160 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6161 ok(hres
== S_OK
, "Could not get IOleCommandTarget iface: %08x\n", hres
);
6163 V_VT(&vin
) = VT_EMPTY
;
6164 V_VT(&vout
) = VT_EMPTY
;
6165 SET_EXPECT(Exec_DocHostCommandHandler_2300
);
6166 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_REFRESH
, OLECMDEXECOPT_PROMPTUSER
, &vin
, &vout
);
6167 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
6168 ok(V_VT(&vout
) == VT_EMPTY
, "V_VT(vout) = %d\n", V_VT(&vout
));
6169 CHECK_CALLED(Exec_DocHostCommandHandler_2300
);
6171 IOleCommandTarget_Release(cmdtrg
);
6173 test_download(DWL_VERBDONE
|DWL_HTTP
|DWL_ONREADY_LOADING
|DWL_REFRESH
|DWL_EX_GETHOSTINFO
);
6176 static void test_open_window(IHTMLDocument2
*doc
, BOOL do_block
)
6178 IHTMLWindow2
*window
, *new_window
;
6182 allow_new_window
= !do_block
;
6184 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
6185 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6187 url
= a2bstr(nav_serv_url
= nav_url
= "about:blank");
6188 name
= a2bstr("test");
6189 new_window
= (void*)0xdeadbeef;
6195 SET_EXPECT(get_LocationURL
);
6196 SET_EXPECT(TranslateUrl
);
6197 SET_EXPECT(EvaluateNewWindow
);
6199 hres
= IHTMLWindow2_open(window
, url
, name
, NULL
, VARIANT_FALSE
, &new_window
);
6202 SysFreeString(name
);
6205 todo_wine
CHECK_CALLED_BROKEN(get_LocationURL
);
6207 CHECK_CALLED(TranslateUrl
);
6209 if(!called_EvaluateNewWindow
) {
6210 win_skip("INewWindowManager not supported\n");
6211 if(SUCCEEDED(hres
) && new_window
)
6212 IHTMLWindow2_Release(new_window
);
6213 IHTMLWindow2_Release(window
);
6216 CHECK_CALLED(EvaluateNewWindow
);
6218 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
6221 ok(!new_window
, "new_window != NULL\n");
6223 ok(new_window
!= NULL
, "new_window == NULL\n");
6225 hres
= IHTMLWindow2_close(new_window
);
6226 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
6227 IHTMLWindow2_Release(new_window
);
6230 IHTMLWindow2_Release(window
);
6233 static void test_window_close(IHTMLDocument2
*doc
)
6235 IHTMLWindow2
*window
;
6238 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
6239 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6241 SET_EXPECT(FindConnectionPoint
);
6242 SET_EXPECT(EnumConnections
);
6243 SET_EXPECT(EnumConnections_Next
);
6244 SET_EXPECT(WindowClosing
);
6246 hres
= IHTMLWindow2_close(window
);
6247 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
6249 CHECK_CALLED(FindConnectionPoint
);
6250 CHECK_CALLED(EnumConnections
);
6251 CHECK_CALLED(EnumConnections_Next
);
6252 CHECK_CALLED(WindowClosing
);
6254 IHTMLWindow2_Release(window
);
6257 static void test_elem_from_point(IHTMLDocument2
*doc
)
6264 hres
= IHTMLDocument2_elementFromPoint(doc
, 3, 3, &elem
);
6265 ok(hres
== S_OK
, "elementFromPoint failed: %08x\n", hres
);
6266 ok(elem
!= NULL
, "elem == NULL\n");
6268 hres
= IHTMLElement_get_tagName(elem
, &tag
);
6269 IHTMLElement_Release(elem
);
6270 ok(hres
== S_OK
, "get_tagName failed: %08x\n", hres
);
6271 ok(!strcmp_wa(tag
, "DIV"), "tag = %s\n", wine_dbgstr_w(tag
));
6274 static void test_clear(IHTMLDocument2
*doc
)
6278 hres
= IHTMLDocument2_clear(doc
);
6279 ok(hres
== S_OK
, "clear failed: %08x\n", hres
);
6282 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
6284 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
6285 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
6286 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
6287 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
6288 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
6289 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
6290 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
6291 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
6292 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
6293 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
6294 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
6295 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
6296 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
6297 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
6298 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
6299 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
6300 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
6301 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
6302 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
6303 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
6305 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
6306 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
6308 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
6310 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
6312 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
6313 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
6315 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
6316 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
6318 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
6320 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
6321 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
6324 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
6325 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
6327 IOleCommandTarget
*cmdtrg
;
6328 OLECMD olecmd
= {cmdid
, 0};
6331 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6332 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
6336 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
6337 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
6339 IOleCommandTarget_Release(cmdtrg
);
6341 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
6342 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
6345 static void test_MSHTML_QueryStatus(IHTMLDocument2
*doc
, DWORD cmdf
)
6347 IUnknown
*unk
= doc
? (IUnknown
*)doc
: doc_unk
;
6349 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
6350 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
6351 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
6352 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
6353 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
6354 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
6355 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
6356 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
6357 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
6358 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
6359 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
6360 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
6361 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
6362 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
6363 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
6364 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
6367 static void test_OleCommandTarget(IHTMLDocument2
*doc
)
6369 IOleCommandTarget
*cmdtrg
;
6370 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
6374 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6375 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
6379 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
6380 cmds
[i
].cmdID
= i
+1;
6381 cmds
[i
].cmdf
= 0xf0f0;
6384 SET_EXPECT(QueryStatus_OPEN
);
6385 SET_EXPECT(QueryStatus_NEW
);
6386 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
6387 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
6388 CHECK_CALLED(QueryStatus_OPEN
);
6389 CHECK_CALLED(QueryStatus_NEW
);
6391 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
6392 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
6393 if(i
+1 == OLECMDID_FIND
)
6395 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
6396 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
6399 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
6400 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
6402 IOleCommandTarget_Release(cmdtrg
);
6405 static void test_OleCommandTarget_fail(IHTMLDocument2
*doc
)
6407 IOleCommandTarget
*cmdtrg
;
6412 {OLECMDID_OPEN
, 0xf0f0},
6413 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
6416 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6417 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
6421 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
6422 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
6424 SET_EXPECT(QueryStatus_OPEN
);
6425 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
6426 CHECK_CALLED(QueryStatus_OPEN
);
6428 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
6429 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
6430 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
6431 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
6432 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
6433 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
6434 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
6436 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
6437 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
6438 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
6440 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
6441 if(!expect_cmds
[i
]) {
6442 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
6443 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6444 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
6445 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
6449 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
6450 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6451 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
6452 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
6454 IOleCommandTarget_Release(cmdtrg
);
6457 static void test_exec_onunload(IHTMLDocument2
*doc
)
6459 IOleCommandTarget
*cmdtrg
;
6463 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6464 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
6468 memset(&var
, 0x0a, sizeof(var
));
6469 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
6470 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
6471 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
6472 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
6473 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
6475 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
6476 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6477 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
6479 IOleCommandTarget_Release(cmdtrg
);
6482 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
6484 IOleCommandTarget
*cmdtrg
;
6487 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6488 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
6495 load_state
= LD_DOLOAD
;
6498 SET_EXPECT(GetClassID
);
6499 SET_EXPECT(SetStatusText
);
6500 SET_EXPECT(Exec_ShellDocView_37
);
6501 SET_EXPECT(GetHostInfo
);
6503 SET_EXPECT(GetDisplayName
);
6504 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6505 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6506 SET_EXPECT(OnChanged_READYSTATE
);
6507 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
6508 SET_EXPECT(IsSystemMoniker
);
6509 SET_EXPECT(Exec_ShellDocView_84
);
6511 SET_EXPECT(BindToStorage
);
6512 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
6515 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
6517 expect_status_text
= NULL
;
6518 readystate_set_loading
= TRUE
;
6520 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
6521 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6522 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
6525 CHECK_CALLED(GetClassID
);
6526 CHECK_CALLED(SetStatusText
);
6527 CHECK_CALLED(Exec_ShellDocView_37
);
6528 CHECK_CALLED(GetHostInfo
);
6530 CHECK_CALLED(GetDisplayName
);
6531 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6532 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6533 CHECK_CALLED(OnChanged_READYSTATE
);
6534 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
6535 CLEAR_CALLED(IsSystemMoniker
); /* IE7 */
6536 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
6538 CHECK_CALLED(BindToStorage
);
6539 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
6540 CHECK_CALLED(HideUI
);
6541 CHECK_CALLED(ShowUI
);
6542 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
6544 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
6546 IOleCommandTarget_Release(cmdtrg
);
6548 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
6549 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6550 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
6553 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
6555 IOleCommandTarget
*cmdtrg
;
6556 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
6559 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6560 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
6567 V_BSTR(in
) = SysAllocString(name
);
6573 V_I4(out
) = 0xdeadbeef;
6576 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
6577 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
6583 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
6584 if(V_VT(out
) == VT_BSTR
) {
6586 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
6587 "unexpected fontname %s\n", wine_dbgstr_w(name
));
6589 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
6594 IOleCommandTarget_Release(cmdtrg
);
6597 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
6599 IOleCommandTarget
*cmdtrg
;
6602 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
6603 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
6607 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
6608 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
6609 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
6611 IOleCommandTarget_Release(cmdtrg
);
6614 static void test_IsDirty(IHTMLDocument2
*doc
, HRESULT exhres
)
6616 IPersistStreamInit
*perinit
;
6617 IPersistMoniker
*permon
;
6618 IPersistFile
*perfile
;
6621 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&perinit
);
6622 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
6623 if(SUCCEEDED(hres
)) {
6624 hres
= IPersistStreamInit_IsDirty(perinit
);
6625 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
6626 IPersistStreamInit_Release(perinit
);
6629 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&permon
);
6630 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
6631 if(SUCCEEDED(hres
)) {
6632 hres
= IPersistMoniker_IsDirty(permon
);
6633 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
6634 IPersistMoniker_Release(permon
);
6637 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistFile
, (void**)&perfile
);
6638 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
6639 if(SUCCEEDED(hres
)) {
6640 hres
= IPersistFile_IsDirty(perfile
);
6641 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
6642 IPersistFile_Release(perfile
);
6646 static HWND
create_container_window(void)
6648 static const WCHAR wszHTMLDocumentTest
[] =
6649 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
6650 static WNDCLASSEXW wndclass
= {
6651 sizeof(WNDCLASSEXW
),
6654 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
6655 wszHTMLDocumentTest
,
6659 RegisterClassExW(&wndclass
);
6660 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
6661 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
6662 515, 530, NULL
, NULL
, NULL
, NULL
);
6665 static void test_DoVerb(IOleObject
*oleobj
)
6667 RECT rect
= {0,0,500,500};
6670 if(!container_locked
) {
6671 SET_EXPECT(GetContainer
);
6672 SET_EXPECT(LockContainer
);
6674 SET_EXPECT(ActivateMe
);
6675 expect_LockContainer_fLock
= TRUE
;
6677 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
6678 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
6680 if(!container_locked
) {
6681 CHECK_CALLED(GetContainer
);
6682 CHECK_CALLED(LockContainer
);
6683 container_locked
= TRUE
;
6685 CHECK_CALLED(ActivateMe
);
6688 #define CLIENTSITE_EXPECTPATH 0x00000001
6689 #define CLIENTSITE_SETNULL 0x00000002
6690 #define CLIENTSITE_DONTSET 0x00000004
6692 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
6694 IOleClientSite
*clientsite
;
6697 if(flags
& CLIENTSITE_SETNULL
) {
6698 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
6699 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
6701 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
6703 ok(!clientsite
, "clientsite != NULL\n");
6705 SET_EXPECT(GetOverrideKeyPath
);
6706 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
6707 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
6708 CLEAR_CALLED(GetOverrideKeyPath
); /* IE9 sometimes calls it */
6710 set_clientsite
= FALSE
;
6713 if(flags
& CLIENTSITE_DONTSET
)
6716 if(!expect_uihandler_iface
)
6717 expect_uihandler_iface
= &DocHostUIHandler
;
6719 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
6720 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
6721 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
6722 clientsite
, set_clientsite
? &ClientSite
: NULL
);
6724 if(!set_clientsite
) {
6725 if(expect_uihandler_iface
)
6726 SET_EXPECT(GetHostInfo
);
6727 if(flags
& CLIENTSITE_EXPECTPATH
) {
6728 SET_EXPECT(GetOptionKeyPath
);
6729 SET_EXPECT(GetOverrideKeyPath
);
6731 SET_EXPECT(GetWindow
);
6732 if(flags
& CLIENTSITE_EXPECTPATH
)
6733 SET_EXPECT(Exec_DOCCANNAVIGATE
);
6734 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
6735 SET_EXPECT(Exec_SETPROGRESSMAX
);
6736 SET_EXPECT(Exec_SETPROGRESSPOS
);
6737 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
6738 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6739 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6740 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6741 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
6742 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
6743 SET_EXPECT(GetOverrideKeyPath
);
6744 SET_EXPECT(GetTravelLog
);
6745 SET_EXPECT(Exec_ShellDocView_84
);
6747 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
6748 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
6750 if(expect_uihandler_iface
)
6751 CHECK_CALLED(GetHostInfo
);
6752 if(flags
& CLIENTSITE_EXPECTPATH
) {
6753 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
6754 CHECK_CALLED(GetOverrideKeyPath
);
6756 CHECK_CALLED(GetWindow
);
6757 if(flags
& CLIENTSITE_EXPECTPATH
)
6758 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
6759 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
6760 CHECK_CALLED(Exec_SETPROGRESSMAX
);
6761 CHECK_CALLED(Exec_SETPROGRESSPOS
);
6762 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
6763 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6764 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6765 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6766 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
6767 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
6768 CLEAR_CALLED(GetOverrideKeyPath
); /* Called by IE9 */
6769 CHECK_CALLED(GetTravelLog
);
6770 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
6772 set_clientsite
= TRUE
;
6775 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
6776 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
6778 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
6779 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
6780 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
6783 static void test_OnAmbientPropertyChange(IHTMLDocument2
*doc
)
6785 IOleControl
*control
= NULL
;
6788 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
6789 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
6793 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
6794 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
6795 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6796 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
6798 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6799 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
6800 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6801 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6803 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6804 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6805 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
6806 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6807 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6808 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6810 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6811 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6812 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
6813 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6814 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6815 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6817 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
6818 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
6819 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6820 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
6822 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
6823 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
6824 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6825 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
6827 IOleControl_Release(control
);
6832 static void test_OnAmbientPropertyChange2(IHTMLDocument2
*doc
)
6834 IOleControl
*control
= NULL
;
6837 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
6838 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
6842 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
6843 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
6845 IOleControl_Release(control
);
6848 static void test_Close(IHTMLDocument2
*doc
, BOOL set_client
)
6850 IOleObject
*oleobj
= NULL
;
6853 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6854 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6858 SET_EXPECT(GetContainer
);
6859 SET_EXPECT(LockContainer
);
6860 expect_LockContainer_fLock
= FALSE
;
6861 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
6862 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
6863 CHECK_CALLED(GetContainer
);
6864 CHECK_CALLED(LockContainer
);
6865 container_locked
= FALSE
;
6868 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
6870 IOleObject_Release(oleobj
);
6873 static void test_Advise(IHTMLDocument2
*doc
)
6875 IOleObject
*oleobj
= NULL
;
6876 IEnumSTATDATA
*enum_advise
= (void*)0xdeadbeef;
6880 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6881 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6885 hres
= IOleObject_Unadvise(oleobj
, 0);
6886 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
6888 hres
= IOleObject_EnumAdvise(oleobj
, &enum_advise
);
6889 ok(hres
== S_OK
, "EnumAdvise returned: %08x\n", hres
);
6890 ok(enum_advise
== NULL
, "enum_advise != NULL\n");
6893 hres
= IOleObject_Advise(oleobj
, NULL
, &conn
);
6894 /* Old IE returns S_OK and sets conn to 1 */
6895 ok(hres
== E_INVALIDARG
|| hres
== S_OK
, "Advise returned: %08x\n", hres
);
6896 ok(conn
== 0 || conn
== 1, "conn = %d\n", conn
);
6898 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, NULL
);
6899 ok(hres
== E_INVALIDARG
, "Advise returned: %08x\n", hres
);
6901 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
6902 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
6903 ok(conn
== 1, "conn = %d\n", conn
);
6905 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
6906 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
6907 ok(conn
== 2, "conn = %d\n", conn
);
6909 hres
= IOleObject_Unadvise(oleobj
, 1);
6910 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
6912 hres
= IOleObject_Unadvise(oleobj
, 1);
6913 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
6915 hres
= IOleObject_Unadvise(oleobj
, 2);
6916 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
6918 IOleObject_Release(oleobj
);
6921 static void test_OnFrameWindowActivate(IUnknown
*unk
)
6923 IOleInPlaceActiveObject
*inplaceact
;
6926 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
6927 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
6931 if(set_clientsite
) {
6932 expect_OnFrameWindowActivate_fActivate
= TRUE
;
6933 SET_EXPECT(OnFrameWindowActivate
);
6934 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6935 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6936 CHECK_CALLED(OnFrameWindowActivate
);
6938 SET_EXPECT(OnFrameWindowActivate
);
6939 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6940 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6941 CHECK_CALLED(OnFrameWindowActivate
);
6943 expect_OnFrameWindowActivate_fActivate
= FALSE
;
6944 SET_EXPECT(OnFrameWindowActivate
);
6945 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
6946 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6947 CHECK_CALLED(OnFrameWindowActivate
);
6949 expect_OnFrameWindowActivate_fActivate
= TRUE
;
6950 SET_EXPECT(OnFrameWindowActivate
);
6951 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6952 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6953 CHECK_CALLED(OnFrameWindowActivate
);
6955 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
6956 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6958 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6959 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6962 IOleInPlaceActiveObject_Release(inplaceact
);
6965 static void test_InPlaceDeactivate(IHTMLDocument2
*doc
, BOOL expect_call
)
6967 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
6970 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleInPlaceObjectWindowless
,
6971 (void**)&windowlessobj
);
6972 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
6977 SET_EXPECT(SetStatusText
);
6978 SET_EXPECT(OnFocus_FALSE
);
6980 SET_EXPECT(OnInPlaceDeactivateEx
);
6982 SET_EXPECT(OnInPlaceDeactivate
);
6984 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
6985 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
6987 CLEAR_CALLED(SetStatusText
); /* Called by IE9 */
6988 CHECK_CALLED(OnFocus_FALSE
);
6990 CHECK_CALLED(OnInPlaceDeactivateEx
);
6992 CHECK_CALLED(OnInPlaceDeactivate
);
6995 IOleInPlaceObjectWindowless_Release(windowlessobj
);
6998 static void test_Activate(IHTMLDocument2
*doc
, DWORD flags
)
7000 IOleObject
*oleobj
= NULL
;
7001 IOleDocumentView
*docview
;
7005 last_hwnd
= doc_hwnd
;
7008 IOleDocumentView_Release(view
);
7011 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7012 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
7014 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
7015 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
7017 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
7018 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
7019 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
7021 test_OnFrameWindowActivate((IUnknown
*)doc
);
7023 test_ClientSite(oleobj
, flags
);
7024 test_InPlaceDeactivate(doc
, FALSE
);
7025 test_DoVerb(oleobj
);
7027 if(call_UIActivate
== CallUIActivate_AfterShow
) {
7028 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
7029 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
7031 SET_EXPECT(OnFocus_TRUE
);
7032 SET_EXPECT(SetActiveObject
);
7034 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
7035 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
7036 expect_status_text
= NULL
;
7038 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
7039 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
7041 CHECK_CALLED(OnFocus_TRUE
);
7042 CHECK_CALLED(SetActiveObject
);
7043 CHECK_CALLED(ShowUI
);
7044 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
7045 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
7047 IOleDocumentView_Release(docview
);
7050 IOleObject_Release(oleobj
);
7052 test_OnFrameWindowActivate((IUnknown
*)doc
);
7055 static void test_Window(IHTMLDocument2
*doc
, BOOL expect_success
)
7057 IOleInPlaceActiveObject
*activeobject
= NULL
;
7061 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
7062 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
7066 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
7068 if(expect_success
) {
7069 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
7070 ok(tmp_hwnd
== doc_hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, doc_hwnd
);
7072 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
7073 ok(IsWindow(doc_hwnd
), "hwnd is destroyed\n");
7076 IOleInPlaceActiveObject_Release(activeobject
);
7079 static void test_CloseView(void)
7081 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
7087 hres
= IOleDocumentView_Show(view
, FALSE
);
7088 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
7090 hres
= IOleDocumentView_CloseView(view
, 0);
7091 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
7093 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
7094 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
7096 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
7097 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
7098 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
7101 static void test_UIDeactivate(void)
7105 if(call_UIActivate
== CallUIActivate_AfterShow
) {
7106 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
7108 if(call_UIActivate
!= CallUIActivate_None
) {
7109 SET_EXPECT(SetActiveObject_null
);
7111 SET_EXPECT(OnUIDeactivate
);
7114 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
7115 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
7117 if(call_UIActivate
!= CallUIActivate_None
) {
7118 CHECK_CALLED(SetActiveObject_null
);
7119 CHECK_CALLED(HideUI
);
7120 CHECK_CALLED(OnUIDeactivate
);
7122 if(call_UIActivate
== CallUIActivate_AfterShow
) {
7123 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
7127 static void test_Hide(void)
7134 hres
= IOleDocumentView_Show(view
, FALSE
);
7135 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
7138 static IHTMLDocument2
*create_document(void)
7140 IHTMLDocument2
*doc
;
7143 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
7144 &IID_IHTMLDocument2
, (void**)&doc
);
7145 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
7152 static void release_document(IHTMLDocument2
*doc
)
7158 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
7159 * To workaround it, we release it via IUnknown iface */
7160 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IUnknown
, (void**)&unk
);
7161 ok(hres
== S_OK
, "Could not get IUnknown iface: %08x\n", hres
);
7163 IHTMLDocument2_Release(doc
);
7164 ref
= IUnknown_Release(unk
);
7165 ok(!ref
, "ref = %d\n", ref
);
7168 static void test_Navigate(IHTMLDocument2
*doc
)
7170 IHlinkTarget
*hlink
;
7173 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHlinkTarget
, (void**)&hlink
);
7174 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
7176 SET_EXPECT(ActivateMe
);
7177 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
7178 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
7179 CHECK_CALLED(ActivateMe
);
7181 IHlinkTarget_Release(hlink
);
7184 static void test_external(IHTMLDocument2
*doc
, BOOL initialized
)
7186 IDispatch
*external
;
7187 IHTMLWindow2
*htmlwin
;
7190 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
7191 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
7194 SET_EXPECT(GetExternal
);
7195 external
= (void*)0xdeadbeef;
7196 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
7198 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
7199 CHECK_CALLED(GetExternal
);
7200 ok(external
!= NULL
, "external == NULL\n");
7202 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
7203 ok(external
== NULL
, "external != NULL\n");
7206 IHTMLWindow2_Release(htmlwin
);
7209 static void test_enum_objects(IOleContainer
*container
)
7211 IEnumUnknown
*enum_unknown
;
7212 IUnknown
*buf
[100] = {(void*)0xdeadbeef};
7216 enum_unknown
= NULL
;
7217 hres
= IOleContainer_EnumObjects(container
, OLECONTF_EMBEDDINGS
, &enum_unknown
);
7218 ok(hres
== S_OK
, "EnumObjects failed: %08x\n", hres
);
7219 ok(enum_unknown
!= NULL
, "enum_unknown == NULL\n");
7221 fetched
= 0xdeadbeef;
7222 hres
= IEnumUnknown_Next(enum_unknown
, sizeof(buf
)/sizeof(*buf
), buf
, &fetched
);
7223 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
7224 ok(!fetched
, "fetched = %d\n", fetched
);
7225 ok(buf
[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf
[0]);
7227 fetched
= 0xdeadbeef;
7228 hres
= IEnumUnknown_Next(enum_unknown
, 1, buf
, &fetched
);
7229 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
7230 ok(!fetched
, "fetched = %d\n", fetched
);
7232 hres
= IEnumUnknown_Next(enum_unknown
, 1, buf
, NULL
);
7233 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
7235 IEnumUnknown_Release(enum_unknown
);
7238 static void test_target_container(IHTMLDocument2
*doc
)
7240 IOleContainer
*ole_container
, *doc_ole_container
;
7241 ITargetContainer
*target_container
;
7244 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ITargetContainer
, (void**)&target_container
);
7245 ok(hres
== S_OK
, "Could not get ITargetContainer iface: %08x\n", hres
);
7247 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleContainer
, (void**)&doc_ole_container
);
7248 ok(hres
== S_OK
, "Could not get ITargetContainer iface: %08x\n", hres
);
7250 ole_container
= (void*)0xdeadbeef;
7251 hres
= ITargetContainer_GetFramesContainer(target_container
, &ole_container
);
7252 ok(hres
== S_OK
, "GetFramesContainer failed: %08x\n", hres
);
7253 ok(ole_container
!= NULL
, "ole_container == NULL\n");
7254 ok(iface_cmp((IUnknown
*)ole_container
, (IUnknown
*)doc_ole_container
), "ole_container != doc_ole_container\n");
7255 test_enum_objects(ole_container
);
7256 IOleContainer_Release(ole_container
);
7258 ITargetContainer_Release(target_container
);
7259 IOleContainer_Release(doc_ole_container
);
7262 static void test_travellog(IHTMLDocument2
*doc
)
7264 ITravelLogClient
*travellog_client
;
7265 IHTMLWindow2
*window
, *top_window
;
7270 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
7271 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
7272 ok(window
!= NULL
, "window = NULL\n");
7274 hres
= IHTMLWindow2_get_top(window
, &top_window
);
7275 IHTMLWindow2_Release(window
);
7276 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
7278 hres
= IHTMLWindow2_QueryInterface(top_window
, &IID_ITravelLogClient
, (void**)&travellog_client
);
7279 IHTMLWindow2_Release(top_window
);
7280 if(hres
== E_NOINTERFACE
) {
7281 win_skip("ITravelLogClient not supported\n");
7282 no_travellog
= TRUE
;
7285 ok(hres
== S_OK
, "Could not get ITraveLogClient iface: %08x\n", hres
);
7287 unk
= (void*)0xdeadbeef;
7288 hres
= ITravelLogClient_FindWindowByIndex(travellog_client
, 0, &unk
);
7289 ok(hres
== E_FAIL
, "FindWindowByIndex failed: %08x\n", hres
);
7290 ok(!unk
, "unk != NULL\n");
7292 ITravelLogClient_Release(travellog_client
);
7295 static void test_StreamLoad(IHTMLDocument2
*doc
)
7297 IPersistStreamInit
*init
;
7300 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
7301 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
7305 SET_EXPECT(Invoke_AMBIENT_SILENT
);
7306 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7307 SET_EXPECT(Exec_ShellDocView_37
);
7308 SET_EXPECT(OnChanged_READYSTATE
);
7309 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
7311 SET_EXPECT(GetPendingUrl
);
7312 readystate_set_loading
= TRUE
;
7314 hres
= IPersistStreamInit_Load(init
, &Stream
);
7315 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
7317 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
7318 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7319 CHECK_CALLED(Exec_ShellDocView_37
);
7320 CHECK_CALLED(OnChanged_READYSTATE
);
7321 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
7323 todo_wine
CHECK_CALLED(GetPendingUrl
);
7325 test_timer(EXPECT_SETTITLE
);
7326 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank", FALSE
);
7328 IPersistStreamInit_Release(init
);
7331 static void test_StreamInitNew(IHTMLDocument2
*doc
)
7333 IPersistStreamInit
*init
;
7336 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
7337 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
7341 SET_EXPECT(Invoke_AMBIENT_SILENT
);
7342 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7343 SET_EXPECT(Exec_ShellDocView_37
);
7344 SET_EXPECT(OnChanged_READYSTATE
);
7345 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
7346 SET_EXPECT(GetPendingUrl
);
7347 readystate_set_loading
= TRUE
;
7349 hres
= IPersistStreamInit_InitNew(init
);
7350 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
7352 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
7353 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7354 CHECK_CALLED(Exec_ShellDocView_37
);
7355 CHECK_CALLED(OnChanged_READYSTATE
);
7356 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
7357 todo_wine
CHECK_CALLED(GetPendingUrl
);
7359 test_timer(EXPECT_SETTITLE
);
7360 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank", FALSE
);
7362 IPersistStreamInit_Release(init
);
7365 static void test_QueryInterface(IHTMLDocument2
*htmldoc
)
7367 IUnknown
*qi
, *doc
= (IUnknown
*)htmldoc
;
7370 static const IID IID_UndocumentedScriptIface
=
7371 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
7373 qi
= (void*)0xdeadbeef;
7374 hres
= IUnknown_QueryInterface(doc
, &IID_IRunnableObject
, (void**)&qi
);
7375 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7376 ok(qi
== NULL
, "qirunnable=%p, expected NULL\n", qi
);
7378 qi
= (void*)0xdeadbeef;
7379 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&qi
);
7380 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7381 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7383 qi
= (void*)0xdeadbeef;
7384 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode2
, (void**)&qi
);
7385 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7386 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7388 qi
= (void*)0xdeadbeef;
7389 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistPropertyBag
, (void**)&qi
);
7390 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7391 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7393 qi
= (void*)0xdeadbeef;
7394 hres
= IUnknown_QueryInterface(doc
, &IID_UndocumentedScriptIface
, (void**)&qi
);
7395 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7396 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7398 qi
= (void*)0xdeadbeef;
7399 hres
= IUnknown_QueryInterface(doc
, &IID_IMarshal
, (void**)&qi
);
7400 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7401 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7403 qi
= (void*)0xdeadbeef;
7404 hres
= IUnknown_QueryInterface(doc
, &IID_IExternalConnection
, (void**)&qi
);
7405 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7406 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7408 qi
= (void*)0xdeadbeef;
7409 hres
= IUnknown_QueryInterface(doc
, &IID_IStdMarshalInfo
, (void**)&qi
);
7410 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7411 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7413 qi
= (void*)0xdeadbeef;
7414 hres
= IUnknown_QueryInterface(doc
, &IID_ITargetFrame
, (void**)&qi
);
7415 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
7416 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
7418 hres
= IUnknown_QueryInterface(doc
, &IID_IDispatch
, (void**)&qi
);
7419 ok(hres
== S_OK
, "Could not get IDispatch interface: %08x\n", hres
);
7420 ok(qi
!= (IUnknown
*)doc
, "disp == doc\n");
7421 IUnknown_Release(qi
);
7424 static void init_test(enum load_state_t ls
) {
7426 doc_hwnd
= last_hwnd
= NULL
;
7427 set_clientsite
= FALSE
;
7428 load_from_stream
= FALSE
;
7429 call_UIActivate
= CallUIActivate_None
;
7436 inplace_deactivated
= FALSE
;
7438 testing_submit
= FALSE
;
7439 expect_uihandler_iface
= &DocHostUIHandler
;
7442 static void test_HTMLDocument(BOOL do_load
, BOOL mime
)
7444 IHTMLDocument2
*doc
;
7446 trace("Testing HTMLDocument (%s, %s)...\n", (do_load
? "load" : "no load"),
7447 (report_mime
? "mime" : "no mime"));
7449 init_test(do_load
? LD_DOLOAD
: LD_NO
);
7452 doc
= create_document();
7453 doc_unk
= (IUnknown
*)doc
;
7455 test_QueryInterface(doc
);
7457 test_IsDirty(doc
, S_FALSE
);
7458 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7459 test_external(doc
, FALSE
);
7460 test_ViewAdviseSink(doc
);
7461 test_ConnectionPointContainer(doc
);
7462 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
, FALSE
);
7463 test_Persist(doc
, &Moniker
);
7465 test_OnAmbientPropertyChange2(doc
);
7467 test_Activate(doc
, CLIENTSITE_EXPECTPATH
);
7470 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
7471 test_download(DWL_CSS
|DWL_TRYCSS
);
7472 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
, FALSE
);
7473 test_elem_from_point(doc
);
7476 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7477 test_OleCommandTarget_fail(doc
);
7478 test_OleCommandTarget(doc
);
7479 test_OnAmbientPropertyChange(doc
);
7480 test_Window(doc
, TRUE
);
7481 test_external(doc
, TRUE
);
7482 test_target_container(doc
);
7484 test_UIDeactivate();
7485 test_OleCommandTarget(doc
);
7486 test_Window(doc
, TRUE
);
7487 test_InPlaceDeactivate(doc
, TRUE
);
7489 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
7490 * MSHTML. It doesn't with Wine. */
7492 test_Window(doc
, FALSE
);
7494 test_InPlaceDeactivate(doc
, FALSE
);
7496 test_Close(doc
, FALSE
);
7498 /* Activate HTMLDocument again */
7499 test_Activate(doc
, CLIENTSITE_SETNULL
);
7500 test_Window(doc
, TRUE
);
7501 test_OleCommandTarget(doc
);
7502 test_UIDeactivate();
7503 test_InPlaceDeactivate(doc
, TRUE
);
7504 test_Close(doc
, FALSE
);
7506 /* Activate HTMLDocument again, this time without UIActivate */
7507 call_UIActivate
= CallUIActivate_None
;
7508 test_Activate(doc
, CLIENTSITE_SETNULL
);
7509 test_Window(doc
, TRUE
);
7511 test_external(doc
, TRUE
);
7512 set_custom_uihandler(doc
, NULL
);
7513 test_external(doc
, FALSE
);
7515 test_UIDeactivate();
7516 test_InPlaceDeactivate(doc
, TRUE
);
7519 test_Close(doc
, TRUE
);
7520 test_OnAmbientPropertyChange2(doc
);
7521 test_GetCurMoniker((IUnknown
*)doc
, do_load
? &Moniker
: NULL
, NULL
, FALSE
);
7524 /* Activate HTMLDocument again, calling UIActivate after showing the window */
7525 call_UIActivate
= CallUIActivate_AfterShow
;
7526 test_Activate(doc
, 0);
7527 test_Window(doc
, TRUE
);
7528 test_OleCommandTarget(doc
);
7529 test_UIDeactivate();
7530 test_InPlaceDeactivate(doc
, TRUE
);
7531 test_Close(doc
, FALSE
);
7532 call_UIActivate
= CallUIActivate_None
;
7536 IOleDocumentView_Release(view
);
7539 ok(IsWindow(doc_hwnd
), "hwnd is destroyed\n");
7540 release_document(doc
);
7541 ok(!IsWindow(doc_hwnd
), "hwnd is not destroyed\n");
7544 static void test_HTMLDocument_hlink(DWORD status
)
7546 IHTMLDocument2
*doc
;
7548 trace("Testing HTMLDocument (hlink)...\n");
7550 init_test(LD_DOLOAD
);
7553 doc
= create_document();
7554 doc_unk
= (IUnknown
*)doc
;
7556 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
7557 test_ViewAdviseSink(doc
);
7558 test_ConnectionPointContainer(doc
);
7559 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
, FALSE
);
7560 test_Persist(doc
, &Moniker
);
7563 status_code
= status
;
7564 test_download(DWL_CSS
|DWL_TRYCSS
);
7565 status_code
= HTTP_STATUS_OK
;
7567 test_IsDirty(doc
, S_FALSE
);
7568 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7570 test_exec_onunload(doc
);
7571 test_Window(doc
, TRUE
);
7572 test_InPlaceDeactivate(doc
, TRUE
);
7573 test_Close(doc
, FALSE
);
7574 test_IsDirty(doc
, S_FALSE
);
7575 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
, FALSE
);
7577 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
, FALSE
);
7580 IOleDocumentView_Release(view
);
7583 release_document(doc
);
7586 static void test_cookies(IHTMLDocument2
*doc
)
7594 hres
= IHTMLDocument2_get_cookie(doc
, &str
);
7595 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
7597 size
= sizeof(buf
)/sizeof(WCHAR
);
7598 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
7599 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
7600 ok(!lstrcmpW(buf
, str
), "cookie = %s, expected %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(buf
));
7604 str
= a2bstr("test=testval");
7605 hres
= IHTMLDocument2_put_cookie(doc
, str
);
7606 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
7609 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
7610 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
7611 ok(str2
!= NULL
, "cookie = NULL\n");
7612 size
= sizeof(buf
)/sizeof(WCHAR
);
7613 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
7614 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
7615 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
7617 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
7619 SysFreeString(str2
);
7621 str
= a2bstr("test=testval2");
7622 hres
= IHTMLDocument2_put_cookie(doc
, str
);
7623 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
7626 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
7627 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
7628 ok(str2
!= NULL
, "cookie = NULL\n");
7629 size
= sizeof(buf
)/sizeof(WCHAR
);
7630 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
7631 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
7632 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
7634 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
7636 SysFreeString(str2
);
7639 static void test_HTMLDocument_http(BOOL with_wbapp
)
7642 IHTMLDocument2
*doc
;
7646 trace("Testing HTMLDocument (http%s)...\n", with_wbapp
? " with IWebBrowserApp" : "");
7648 support_wbapp
= with_wbapp
;
7650 if(!winetest_interactive
&& is_ie_hardened()) {
7651 win_skip("IE running in Enhanced Security Configuration\n");
7655 init_test(LD_DOLOAD
);
7658 doc
= create_document();
7659 doc_unk
= (IUnknown
*)doc
;
7661 hres
= CreateURLMoniker(NULL
, http_urlW
, &http_mon
);
7662 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
7664 test_ViewAdviseSink(doc
);
7665 test_ConnectionPointContainer(doc
);
7666 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
, FALSE
);
7667 test_Persist(doc
, http_mon
);
7669 test_download(DWL_HTTP
);
7671 test_IsDirty(doc
, S_FALSE
);
7672 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7673 test_GetCurMoniker((IUnknown
*)doc
, http_mon
, NULL
, FALSE
);
7674 test_travellog(doc
);
7675 test_binding_ui((IUnknown
*)doc
);
7677 nav_url
= nav_serv_url
= "http://test.winehq.org/tests/winehq_snapshot/"; /* for valid prev nav_url */
7679 test_put_href(doc
, FALSE
, "#test", "http://test.winehq.org/tests/winehq_snapshot/#test", FALSE
, TRUE
, 0);
7680 test_travellog(doc
);
7683 test_put_href(doc
, FALSE
, NULL
, "javascript:external%20&&undefined", TRUE
, FALSE
, 0);
7684 test_put_href(doc
, FALSE
, NULL
, "about:blank", FALSE
, FALSE
, support_wbapp
? DWL_EXPECT_HISTUPDATE
: 0);
7685 test_put_href(doc
, TRUE
, NULL
, "about:replace", FALSE
, FALSE
, 0);
7687 test_load_history(doc
);
7688 test_OmHistory(doc
);
7689 test_put_href(doc
, FALSE
, NULL
, "about:blank", FALSE
, FALSE
, support_wbapp
? DWL_EXPECT_HISTUPDATE
: 0);
7692 prev_url
= nav_serv_url
;
7693 test_open_window(doc
, TRUE
);
7694 if(!support_wbapp
) /* FIXME */
7695 test_open_window(doc
, FALSE
);
7697 test_put_href(doc
, FALSE
, NULL
, "http://test.winehq.org/tests/file.winetest", FALSE
, FALSE
, DWL_EXTERNAL
);
7698 test_window_close(doc
);
7701 test_InPlaceDeactivate(doc
, TRUE
);
7702 test_Close(doc
, FALSE
);
7703 test_IsDirty(doc
, S_FALSE
);
7704 test_GetCurMoniker((IUnknown
*)doc
, NULL
, prev_url
, support_wbapp
);
7707 IOleDocumentView_Release(view
);
7710 release_document(doc
);
7712 ref
= IMoniker_Release(http_mon
);
7713 ok(!ref
, "ref=%d, expected 0\n", ref
);
7716 static void put_inner_html(IHTMLElement
*elem
, const char *html
)
7718 BSTR str
= a2bstr(html
);
7721 hres
= IHTMLElement_put_innerHTML(elem
, str
);
7722 ok(hres
== S_OK
, "put_innerHTML failed: %08x\n", hres
);
7727 static IHTMLElement
*get_elem_by_id(IHTMLDocument2
*doc
, const char *id
)
7729 IHTMLDocument3
*doc3
;
7730 BSTR str
= a2bstr(id
);
7734 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3
);
7735 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
7737 hres
= IHTMLDocument3_getElementById(doc3
, str
, &ret
);
7738 ok(hres
== S_OK
, "getElementById failed: %08x\n", hres
);
7740 IHTMLDocument3_Release(doc3
);
7744 static void reset_document(IHTMLDocument2
*doc
)
7746 IPersistStreamInit
*init
;
7749 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
7750 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
7754 resetting_document
= TRUE
;
7756 hres
= IPersistStreamInit_InitNew(init
);
7757 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
7759 resetting_document
= FALSE
;
7761 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank", FALSE
);
7763 IPersistStreamInit_Release(init
);
7766 static void test_submit(void)
7768 IHTMLElement
*body
, *form_elem
;
7769 IHTMLFormElement
*form
;
7770 IHTMLDocument2
*doc
;
7776 trace("Testing submit...\n");
7778 support_wbapp
= TRUE
;
7780 if(!winetest_interactive
&& is_ie_hardened()) {
7781 win_skip("IE running in Enhanced Security Configuration\n");
7785 init_test(LD_DOLOAD
);
7788 doc
= create_document();
7789 doc_unk
= (IUnknown
*)doc
;
7791 test_ConnectionPointContainer(doc
);
7792 test_ViewAdviseSink(doc
);
7793 test_Persist(doc
, &Moniker
);
7795 test_download(DWL_CSS
|DWL_TRYCSS
);
7797 hres
= IHTMLDocument2_get_body(doc
, &body
);
7798 ok(hres
== S_OK
, "get_body failed: %08x\n", hres
);
7799 ok(body
!= NULL
, "body = NULL\n");
7801 put_inner_html(body
, "<form action='test_submit' method='post' id='fid'><input type='hidden' name='cmd' value='TEST'></form>");
7802 IHTMLElement_Release(body
);
7804 form_elem
= get_elem_by_id(doc
, "fid");
7805 ok(form_elem
!= NULL
, "form = NULL\n");
7807 hres
= IHTMLElement_QueryInterface(form_elem
, &IID_IHTMLFormElement
, (void**)&form
);
7808 ok(hres
== S_OK
, "Could not get IHTMLFormElement: %08x\n", hres
);
7809 IHTMLElement_Release(form_elem
);
7811 nav_url
= nav_serv_url
= "winetest:test_submit";
7812 testing_submit
= TRUE
;
7814 SET_EXPECT(TranslateUrl
);
7815 SET_EXPECT(FireBeforeNavigate2
);
7816 SET_EXPECT(Exec_ShellDocView_67
);
7817 SET_EXPECT(Invoke_AMBIENT_SILENT
);
7818 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7819 SET_EXPECT(Exec_ShellDocView_63
);
7820 SET_EXPECT(Exec_ShellDocView_84
);
7821 SET_EXPECT(CreateInstance
);
7823 SET_EXPECT(Protocol_Read
);
7824 SET_EXPECT(LockRequest
);
7825 SET_EXPECT(GetClassID
);
7826 SET_EXPECT(Exec_ShellDocView_138
);
7827 SET_EXPECT(OnViewChange
);
7829 SET_EXPECT(UnlockRequest
);
7830 SET_EXPECT(Terminate
);
7832 hres
= IHTMLFormElement_submit(form
);
7833 ok(hres
== S_OK
, "submit failed: %08x\n", hres
);
7835 CHECK_CALLED(TranslateUrl
);
7836 CHECK_CALLED(FireBeforeNavigate2
);
7837 CHECK_CALLED(Exec_ShellDocView_67
);
7838 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
7839 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7840 CHECK_CALLED(Exec_ShellDocView_63
);
7841 todo_wine
CHECK_CALLED(Exec_ShellDocView_84
);
7842 CHECK_CALLED(CreateInstance
);
7843 CHECK_CALLED(Start
);
7844 CHECK_CALLED(Protocol_Read
);
7845 CHECK_CALLED(LockRequest
);
7846 todo_wine
CHECK_CALLED(GetClassID
);
7847 CLEAR_CALLED(Exec_ShellDocView_138
); /* called only by some versions */
7848 CLEAR_CALLED(OnViewChange
); /* called only by some versions */
7850 todo_wine
CHECK_NOT_CALLED(UnlockRequest
);
7851 todo_wine
CHECK_NOT_CALLED(Terminate
);
7853 IHTMLFormElement_Release(form
);
7855 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
, FALSE
);
7857 SET_EXPECT(UnlockRequest
);
7858 reset_document(doc
);
7859 todo_wine
CHECK_CALLED(UnlockRequest
);
7861 test_InPlaceDeactivate(doc
, TRUE
);
7862 test_Close(doc
, FALSE
);
7865 IOleDocumentView_Release(view
);
7868 release_document(doc
);
7871 static void test_QueryService(IHTMLDocument2
*doc
, BOOL success
)
7873 IHTMLWindow2
*window
, *sp_window
;
7874 IServiceProvider
*sp
;
7878 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&sp
);
7879 ok(hres
== S_OK
, "QueryService returned %08x\n", hres
);
7881 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
7883 ok(hres
== E_NOINTERFACE
, "QueryService returned %08x, expected E_NOINTERFACE\n", hres
);
7884 IServiceProvider_Release(sp
);
7888 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
7889 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
7890 IHlinkFrame_Release(hf
);
7892 IServiceProvider_Release(sp
);
7894 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
7895 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
7897 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IServiceProvider
, (void**)&sp
);
7898 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
7900 hres
= IServiceProvider_QueryService(sp
, &IID_IHTMLWindow2
, &IID_IHTMLWindow2
, (void**)&sp_window
);
7901 ok(hres
== S_OK
, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres
);
7902 /* FIXME: test returned window */
7903 IHTMLWindow2_Release(sp_window
);
7905 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
7906 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
7907 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
7908 IHlinkFrame_Release(hf
);
7910 IServiceProvider_Release(sp
);
7911 IHTMLWindow2_Release(window
);
7914 static void test_HTMLDocument_StreamLoad(void)
7916 IHTMLDocument2
*doc
;
7921 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
7923 init_test(LD_DOLOAD
);
7924 load_from_stream
= TRUE
;
7926 doc
= create_document();
7927 doc_unk
= (IUnknown
*)doc
;
7929 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7930 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
7932 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
7933 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
7935 test_readyState((IUnknown
*)doc
);
7936 test_IsDirty(doc
, S_FALSE
);
7937 test_ViewAdviseSink(doc
);
7938 test_ConnectionPointContainer(doc
);
7939 test_QueryService(doc
, FALSE
);
7940 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
7941 test_QueryService(doc
, TRUE
);
7942 test_DoVerb(oleobj
);
7943 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7945 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
, FALSE
);
7946 test_StreamLoad(doc
);
7947 test_download(DWL_VERBDONE
|DWL_TRYCSS
);
7948 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7950 test_UIDeactivate();
7951 test_InPlaceDeactivate(doc
, TRUE
);
7952 SET_EXPECT(Advise_Close
);
7953 test_Close(doc
, TRUE
);
7954 CHECK_CALLED(Advise_Close
);
7955 test_external(doc
, FALSE
);
7956 test_IsDirty(doc
, S_FALSE
);
7958 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
7959 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
);
7960 test_external(doc
, TRUE
);
7961 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
7962 test_external(doc
, TRUE
);
7963 set_custom_uihandler(doc
, NULL
);
7964 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
7966 IOleObject_Release(oleobj
);
7968 IOleDocumentView_Release(view
);
7972 release_document(doc
);
7975 static void test_HTMLDocument_StreamInitNew(void)
7977 IHTMLDocument2
*doc
;
7982 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
7984 init_test(LD_DOLOAD
);
7985 load_from_stream
= TRUE
;
7987 doc
= create_document();
7988 doc_unk
= (IUnknown
*)doc
;
7990 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7991 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
7993 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
7994 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
7996 test_readyState((IUnknown
*)doc
);
7997 test_IsDirty(doc
, S_FALSE
);
7998 test_ViewAdviseSink(doc
);
7999 test_ConnectionPointContainer(doc
);
8000 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
8001 test_DoVerb(oleobj
);
8002 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
8004 IOleObject_Release(oleobj
);
8006 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
, FALSE
);
8007 test_StreamInitNew(doc
);
8009 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
8010 test_download(DWL_VERBDONE
|DWL_TRYCSS
|DWL_EMPTY
);
8011 todo_wine
CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive
);
8013 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
8015 test_UIDeactivate();
8016 test_InPlaceDeactivate(doc
, TRUE
);
8017 SET_EXPECT(Advise_Close
);
8018 test_Close(doc
, FALSE
);
8019 CHECK_CALLED(Advise_Close
);
8020 test_IsDirty(doc
, S_FALSE
);
8023 IOleDocumentView_Release(view
);
8027 release_document(doc
);
8030 static void test_edit_uiactivate(IOleObject
*oleobj
)
8032 IOleDocumentView
*docview
;
8035 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
8036 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
8038 SET_EXPECT(OnFocus_TRUE
);
8039 SET_EXPECT(SetActiveObject
);
8041 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
8042 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
8043 expect_status_text
= NULL
;
8045 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
8046 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
8048 CHECK_CALLED(OnFocus_TRUE
);
8049 CHECK_CALLED(SetActiveObject
);
8050 CHECK_CALLED(ShowUI
);
8051 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
8052 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
8054 IOleDocumentView_Release(docview
);
8057 static void test_editing_mode(BOOL do_load
, BOOL use_design_mode
)
8059 IHTMLDocument2
*doc
;
8065 trace("Testing HTMLDocument (edit%s%s)...\n", do_load
? " load" : "", use_design_mode
? " using designMode" : "");
8067 init_test(do_load
? LD_DOLOAD
: LD_NO
);
8068 call_UIActivate
= CallUIActivate_AfterShow
;
8070 doc
= create_document();
8071 unk
= doc_unk
= (IUnknown
*)doc
;
8073 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
8074 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
8076 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
8077 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
8079 test_readyState((IUnknown
*)doc
);
8080 test_ViewAdviseSink(doc
);
8081 test_ConnectionPointContainer(doc
);
8082 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
8083 test_DoVerb(oleobj
);
8084 test_edit_uiactivate(oleobj
);
8086 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
8088 test_Persist(doc
, &Moniker
);
8089 stream_read
= protocol_read
= 0;
8091 if(!use_design_mode
) {
8092 test_exec_editmode(unk
, do_load
);
8093 test_UIDeactivate();
8094 call_UIActivate
= CallUIActivate_None
;
8098 SET_EXPECT(Exec_SETTITLE
);
8099 test_download(DWL_VERBDONE
|DWL_CSS
|DWL_TRYCSS
);
8100 CLEAR_CALLED(Exec_SETTITLE
);
8103 load_state
= LD_DOLOAD
;
8104 readystate_set_loading
= TRUE
;
8106 SET_EXPECT(OnChanged_1005
);
8107 SET_EXPECT(ActiveElementChanged
);
8108 SET_EXPECT(GetClassID
);
8109 SET_EXPECT(SetStatusText
);
8110 SET_EXPECT(Exec_ShellDocView_37
);
8111 SET_EXPECT(GetHostInfo
);
8112 SET_EXPECT(GetDisplayName
);
8113 SET_EXPECT(Invoke_AMBIENT_SILENT
);
8114 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
8115 SET_EXPECT(OnChanged_READYSTATE
);
8116 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
8117 SET_EXPECT(IsSystemMoniker
);
8118 SET_EXPECT(Exec_ShellDocView_84
);
8119 SET_EXPECT(BindToStorage
);
8120 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
8123 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
8124 SET_EXPECT(OnChanged_1014
);
8127 hres
= IHTMLDocument2_put_designMode(doc
, on
);
8129 ok(hres
== S_OK
, "put_designMode failed: %08x\n", hres
);
8131 todo_wine
CHECK_CALLED(OnChanged_1005
);
8132 todo_wine
CHECK_CALLED(ActiveElementChanged
);
8133 CHECK_CALLED(GetClassID
);
8134 CHECK_CALLED(SetStatusText
);
8135 CHECK_CALLED(Exec_ShellDocView_37
);
8136 CHECK_CALLED(GetHostInfo
);
8137 CHECK_CALLED(GetDisplayName
);
8138 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
8139 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
8140 CHECK_CALLED(OnChanged_READYSTATE
);
8141 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
8142 CLEAR_CALLED(IsSystemMoniker
); /* IE7 */
8143 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
8144 CHECK_CALLED(BindToStorage
);
8145 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
8146 CHECK_CALLED(HideUI
);
8147 CHECK_CALLED(ShowUI
);
8148 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
8149 CHECK_CALLED(OnChanged_1014
);
8151 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
8154 IOleObject_Release(oleobj
);
8156 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
8157 test_download(DWL_VERBDONE
| DWL_EX_GETHOSTINFO
| (do_load
? DWL_CSS
|DWL_TRYCSS
: 0));
8159 SET_EXPECT(SetStatusText
); /* ignore race in native mshtml */
8160 test_timer(EXPECT_UPDATEUI
);
8161 CLEAR_CALLED(SetStatusText
);
8163 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
8166 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
8167 test_timer(EXPECT_UPDATEUI
);
8168 test_exec_fontname(unk
, NULL
, wszArial
);
8170 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
8171 test_timer(EXPECT_UPDATEUI
);
8172 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
8173 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
8175 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
8176 test_timer(EXPECT_UPDATEUI
);
8177 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
8178 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
8179 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
8180 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
8182 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
8183 test_timer(EXPECT_UPDATEUI
);
8184 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
8185 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
8188 test_UIDeactivate();
8189 test_InPlaceDeactivate(doc
, TRUE
);
8190 SET_EXPECT(Advise_Close
);
8191 test_Close(doc
, FALSE
);
8192 CHECK_CALLED(Advise_Close
);
8195 IOleDocumentView_Release(view
);
8199 release_document(doc
);
8202 static void test_UIActivate(BOOL do_load
, BOOL use_ipsex
, BOOL use_ipsw
)
8204 IHTMLDocument2
*doc
;
8206 IOleInPlaceSite
*inplacesite
;
8209 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load
, use_ipsex
, use_ipsw
);
8211 init_test(do_load
? LD_DOLOAD
: LD_NO
);
8213 doc
= create_document();
8214 doc_unk
= (IUnknown
*)doc
;
8219 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
8220 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
8222 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&view
);
8223 ok(hres
== S_OK
, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres
);
8225 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
8226 SET_EXPECT(GetHostInfo
);
8227 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
8228 SET_EXPECT(Invoke_AMBIENT_SILENT
);
8229 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
8230 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
8231 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
8232 SET_EXPECT(GetOptionKeyPath
);
8233 SET_EXPECT(GetOverrideKeyPath
);
8234 SET_EXPECT(GetWindow
);
8235 SET_EXPECT(Exec_DOCCANNAVIGATE
);
8236 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
8237 SET_EXPECT(Exec_SETPROGRESSMAX
);
8238 SET_EXPECT(Exec_SETPROGRESSPOS
);
8239 SET_EXPECT(GetTravelLog
);
8240 SET_EXPECT(Exec_ShellDocView_84
);
8242 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
8243 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
8244 set_clientsite
= TRUE
;
8246 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
8247 CHECK_CALLED(GetHostInfo
);
8248 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
8249 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
8250 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
8251 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
8252 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
8253 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
8254 CHECK_CALLED(GetOverrideKeyPath
);
8255 CHECK_CALLED(GetWindow
);
8256 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
8257 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
8258 CHECK_CALLED(Exec_SETPROGRESSMAX
);
8259 CHECK_CALLED(Exec_SETPROGRESSPOS
);
8260 CHECK_CALLED(GetTravelLog
);
8261 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
8263 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
8264 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
8265 ok(inplacesite
== NULL
, "inplacesite = %p, expected NULL\n", inplacesite
);
8267 SET_EXPECT(GetContainer
);
8268 SET_EXPECT(LockContainer
);
8269 SET_EXPECT(CanInPlaceActivate
);
8270 SET_EXPECT(GetWindowContext
);
8271 SET_EXPECT(GetWindow
);
8273 SET_EXPECT(OnInPlaceActivateEx
);
8274 SET_EXPECT(RequestUIActivate
);
8277 SET_EXPECT(OnInPlaceActivate
);
8278 SET_EXPECT(OnUIActivate
);
8279 SET_EXPECT(SetStatusText
);
8280 SET_EXPECT(Exec_SETPROGRESSMAX
);
8281 SET_EXPECT(Exec_SETPROGRESSPOS
);
8283 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
8284 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
8285 SET_EXPECT(OnFocus_TRUE
);
8286 SET_EXPECT(SetActiveObject
);
8287 expect_LockContainer_fLock
= TRUE
;
8289 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
8290 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
8292 CHECK_CALLED(GetContainer
);
8293 CHECK_CALLED(LockContainer
);
8294 CHECK_CALLED(CanInPlaceActivate
);
8295 CHECK_CALLED(GetWindowContext
);
8296 CHECK_CALLED(GetWindow
);
8298 CHECK_CALLED(OnInPlaceActivateEx
);
8299 SET_EXPECT(RequestUIActivate
);
8302 CHECK_CALLED(OnInPlaceActivate
);
8303 CHECK_CALLED(OnUIActivate
);
8304 CHECK_CALLED(SetStatusText
);
8305 CHECK_CALLED(Exec_SETPROGRESSMAX
);
8306 CHECK_CALLED(Exec_SETPROGRESSPOS
);
8307 CHECK_CALLED(ShowUI
);
8308 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
8309 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
8310 CHECK_CALLED(OnFocus_TRUE
);
8311 CHECK_CALLED(SetActiveObject
);
8312 container_locked
= TRUE
;
8314 SET_EXPECT(SetActiveObject_null
);
8315 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
8317 SET_EXPECT(OnUIDeactivate
);
8319 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
8320 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
8322 CHECK_CALLED(SetActiveObject_null
);
8323 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
8324 CHECK_CALLED(HideUI
);
8325 CHECK_CALLED(OnUIDeactivate
);
8327 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
8328 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
8329 ok(inplacesite
!= NULL
, "inplacesite = NULL\n");
8330 IOleInPlaceSite_Release(inplacesite
);
8332 SET_EXPECT(SetStatusText
);
8333 SET_EXPECT(OnFocus_FALSE
);
8335 SET_EXPECT(OnInPlaceDeactivateEx
);
8337 SET_EXPECT(OnInPlaceDeactivate
);
8341 CLEAR_CALLED(SetStatusText
); /* Called by IE9 */
8342 CHECK_CALLED(OnFocus_FALSE
);
8344 CHECK_CALLED(OnInPlaceDeactivateEx
);
8346 CHECK_CALLED(OnInPlaceDeactivate
);
8348 test_Close(doc
, TRUE
);
8350 IOleObject_Release(oleobj
);
8351 IOleDocumentView_Release(view
);
8354 release_document(doc
);
8357 static void register_protocol(void)
8359 IInternetSession
*session
;
8362 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
8364 hres
= CoInternetGetSession(0, &session
, 0);
8365 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
8367 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
8368 wsz_winetest
, 0, NULL
, 0);
8369 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
8371 IInternetSession_Release(session
);
8374 static void test_HTMLDoc_ISupportErrorInfo(void)
8376 IHTMLDocument2
*doc
;
8378 ISupportErrorInfo
*sinfo
;
8380 doc
= create_document();
8382 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ISupportErrorInfo
, (void**)&sinfo
);
8383 ok(hres
== S_OK
, "got %x\n", hres
);
8384 ok(sinfo
!= NULL
, "got %p\n", sinfo
);
8387 hres
= ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo
, &IID_IErrorInfo
);
8388 ok(hres
== S_FALSE
, "Expected S_OK, got %x\n", hres
);
8389 ISupportErrorInfo_Release(sinfo
);
8392 release_document(doc
);
8395 static BOOL
check_ie(void)
8397 IHTMLDocument2
*doc
;
8398 IHTMLDocument5
*doc5
;
8399 IHTMLDocument7
*doc7
;
8402 doc
= create_document();
8406 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument7
, (void**)&doc7
);
8407 if(SUCCEEDED(hres
)) {
8409 IHTMLDocument7_Release(doc7
);
8412 trace("is_ie9plus %x\n", is_ie9plus
);
8414 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
8416 IHTMLDocument5_Release(doc5
);
8418 release_document(doc
);
8419 return SUCCEEDED(hres
);
8422 static void test_ServiceProvider(void)
8424 IHTMLDocument3
*doc3
, *doc3_2
;
8425 IServiceProvider
*provider
;
8426 IHTMLDocument2
*doc
, *doc2
;
8430 doc
= create_document();
8434 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&provider
);
8435 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
8437 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IHTMLDocument2
, (void**)&doc2
);
8438 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
8439 ok(iface_cmp((IUnknown
*)doc2
, (IUnknown
*)doc
), "got wrong pointer\n");
8440 IHTMLDocument2_Release(doc2
);
8442 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IHTMLDocument3
, (void**)&doc3
);
8443 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
8444 ok(iface_cmp((IUnknown
*)doc3
, (IUnknown
*)doc
), "got wrong pointer\n");
8446 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3_2
);
8447 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
8448 ok(iface_cmp((IUnknown
*)doc3_2
, (IUnknown
*)doc
), "got wrong pointer\n");
8449 ok(iface_cmp((IUnknown
*)doc3_2
, (IUnknown
*)doc3
), "got wrong pointer\n");
8450 IHTMLDocument3_Release(doc3
);
8451 IHTMLDocument3_Release(doc3_2
);
8453 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IUnknown
, (void**)&unk
);
8454 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
8455 ok(iface_cmp((IUnknown
*)doc
, unk
), "got wrong pointer\n");
8457 IUnknown_Release(unk
);
8458 IServiceProvider_Release(provider
);
8459 release_document(doc
);
8468 win_skip("Too old IE\n");
8472 container_hwnd
= create_container_window();
8473 register_protocol();
8475 asynchronous_binding
= TRUE
;
8476 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND
);
8478 asynchronous_binding
= FALSE
;
8479 test_HTMLDocument_hlink(HTTP_STATUS_OK
);
8480 test_HTMLDocument(FALSE
, TRUE
);
8481 test_HTMLDocument(TRUE
, FALSE
);
8482 test_HTMLDocument(TRUE
, TRUE
);
8483 test_HTMLDocument_StreamLoad();
8484 test_HTMLDocument_StreamInitNew();
8485 test_editing_mode(FALSE
, FALSE
);
8486 test_editing_mode(TRUE
, FALSE
);
8487 test_editing_mode(TRUE
, TRUE
);
8488 test_HTMLDocument_http(FALSE
);
8489 test_HTMLDocument_http(TRUE
);
8491 test_UIActivate(FALSE
, FALSE
, FALSE
);
8492 test_UIActivate(FALSE
, TRUE
, FALSE
);
8493 test_UIActivate(FALSE
, TRUE
, TRUE
);
8494 test_UIActivate(TRUE
, FALSE
, FALSE
);
8495 test_UIActivate(TRUE
, TRUE
, FALSE
);
8496 test_UIActivate(TRUE
, TRUE
, TRUE
);
8497 test_HTMLDoc_ISupportErrorInfo();
8498 test_ServiceProvider();
8500 DestroyWindow(container_hwnd
);