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"
46 #include "mshtml_test.h"
48 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
49 DEFINE_GUID(IID_IProxyManager
,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
50 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
51 DEFINE_GUID(SID_SContainerDispatch
,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
53 #define DEFINE_EXPECT(func) \
54 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
56 #define SET_EXPECT(func) \
57 expect_ ## func = TRUE
59 #define SET_CALLED(func) \
60 called_ ## func = TRUE
62 #define CHECK_EXPECT2(func) \
64 ok(expect_ ##func, "unexpected call " #func "\n"); \
65 called_ ## func = TRUE; \
68 #define CHECK_EXPECT(func) \
70 CHECK_EXPECT2(func); \
71 expect_ ## func = FALSE; \
74 #define CHECK_CALLED(func) \
76 ok(called_ ## func, "expected " #func "\n"); \
77 expect_ ## func = called_ ## func = FALSE; \
80 #define CHECK_NOT_CALLED(func) \
82 ok(!called_ ## func, "unexpected " #func "\n"); \
83 expect_ ## func = called_ ## func = FALSE; \
86 #define CHECK_CALLED_BROKEN(func) \
88 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
89 expect_ ## func = called_ ## func = FALSE; \
92 #define CLEAR_CALLED(func) \
93 expect_ ## func = called_ ## func = FALSE
96 static IOleDocumentView
*view
= NULL
;
97 static HWND container_hwnd
= NULL
, doc_hwnd
= NULL
, last_hwnd
= NULL
;
99 DEFINE_EXPECT(LockContainer
);
100 DEFINE_EXPECT(SetActiveObject
);
101 DEFINE_EXPECT(SetActiveObject_null
);
102 DEFINE_EXPECT(GetWindow
);
103 DEFINE_EXPECT(CanInPlaceActivate
);
104 DEFINE_EXPECT(OnInPlaceActivate
);
105 DEFINE_EXPECT(OnInPlaceActivateEx
);
106 DEFINE_EXPECT(OnUIActivate
);
107 DEFINE_EXPECT(GetWindowContext
);
108 DEFINE_EXPECT(OnUIDeactivate
);
109 DEFINE_EXPECT(OnInPlaceDeactivate
);
110 DEFINE_EXPECT(OnInPlaceDeactivateEx
);
111 DEFINE_EXPECT(GetContainer
);
112 DEFINE_EXPECT(ShowUI
);
113 DEFINE_EXPECT(ActivateMe
);
114 DEFINE_EXPECT(GetHostInfo
);
115 DEFINE_EXPECT(HideUI
);
116 DEFINE_EXPECT(GetOptionKeyPath
);
117 DEFINE_EXPECT(GetOverrideKeyPath
);
118 DEFINE_EXPECT(SetStatusText
);
119 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
120 DEFINE_EXPECT(QueryStatus_OPEN
);
121 DEFINE_EXPECT(QueryStatus_NEW
);
122 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
123 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
124 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE
);
125 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
126 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
127 DEFINE_EXPECT(Exec_ShellDocView_37
);
128 DEFINE_EXPECT(Exec_ShellDocView_63
);
129 DEFINE_EXPECT(Exec_ShellDocView_67
);
130 DEFINE_EXPECT(Exec_ShellDocView_84
);
131 DEFINE_EXPECT(Exec_ShellDocView_103
);
132 DEFINE_EXPECT(Exec_ShellDocView_105
);
133 DEFINE_EXPECT(Exec_ShellDocView_140
);
134 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
135 DEFINE_EXPECT(Exec_SETTITLE
);
136 DEFINE_EXPECT(Exec_HTTPEQUIV
);
137 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
138 DEFINE_EXPECT(Exec_Explorer_38
);
139 DEFINE_EXPECT(Exec_Explorer_69
);
140 DEFINE_EXPECT(Exec_DOCCANNAVIGATE
);
141 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
142 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
143 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
144 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
145 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
146 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
147 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive
);
148 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading
);
149 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete
);
150 DEFINE_EXPECT(GetDropTarget
);
151 DEFINE_EXPECT(UpdateUI
);
152 DEFINE_EXPECT(Navigate
);
153 DEFINE_EXPECT(OnFrameWindowActivate
);
154 DEFINE_EXPECT(OnChanged_READYSTATE
);
155 DEFINE_EXPECT(OnChanged_1005
);
156 DEFINE_EXPECT(OnChanged_1012
);
157 DEFINE_EXPECT(GetDisplayName
);
158 DEFINE_EXPECT(BindToStorage
);
159 DEFINE_EXPECT(IsSystemMoniker
);
160 DEFINE_EXPECT(GetBindResult
);
161 DEFINE_EXPECT(GetClassID
);
162 DEFINE_EXPECT(Abort
);
164 DEFINE_EXPECT(CreateInstance
);
165 DEFINE_EXPECT(Start
);
166 DEFINE_EXPECT(Terminate
);
167 DEFINE_EXPECT(Protocol_Read
);
168 DEFINE_EXPECT(LockRequest
);
169 DEFINE_EXPECT(UnlockRequest
);
170 DEFINE_EXPECT(OnFocus_TRUE
);
171 DEFINE_EXPECT(OnFocus_FALSE
);
172 DEFINE_EXPECT(RequestUIActivate
);
173 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace
);
174 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject
);
175 DEFINE_EXPECT(GetExternal
);
176 DEFINE_EXPECT(EnableModeless_TRUE
);
177 DEFINE_EXPECT(EnableModeless_FALSE
);
178 DEFINE_EXPECT(Frame_EnableModeless_TRUE
);
179 DEFINE_EXPECT(Frame_EnableModeless_FALSE
);
180 DEFINE_EXPECT(Frame_GetWindow
);
181 DEFINE_EXPECT(TranslateUrl
);
182 DEFINE_EXPECT(Advise_Close
);
183 DEFINE_EXPECT(OnViewChange
);
184 DEFINE_EXPECT(EvaluateNewWindow
);
185 DEFINE_EXPECT(GetTravelLog
);
186 DEFINE_EXPECT(UpdateBackForwardState
);
187 DEFINE_EXPECT(FireBeforeNavigate2
);
188 DEFINE_EXPECT(FireNavigateComplete2
);
189 DEFINE_EXPECT(FireDocumentComplete
);
190 DEFINE_EXPECT(GetPendingUrl
);
191 DEFINE_EXPECT(ActiveElementChanged
);
192 DEFINE_EXPECT(IsErrorUrl
);
193 DEFINE_EXPECT(get_LocationURL
);
194 DEFINE_EXPECT(CountEntries
);
196 static IUnknown
*doc_unk
;
197 static IMoniker
*doc_mon
;
198 static BOOL expect_LockContainer_fLock
;
199 static BOOL expect_InPlaceUIWindow_SetActiveObject_active
= TRUE
;
200 static BOOL ipsex
, ipsw
;
201 static BOOL set_clientsite
, container_locked
;
202 static BOOL readystate_set_loading
= FALSE
, readystate_set_interactive
= FALSE
, load_from_stream
;
203 static BOOL editmode
= FALSE
, ignore_external_qi
;
204 static BOOL inplace_deactivated
, open_call
;
205 static BOOL complete
, loading_js
, loading_hash
;
206 static DWORD status_code
= HTTP_STATUS_OK
;
207 static BOOL asynchronous_binding
= FALSE
;
208 static BOOL support_wbapp
, allow_new_window
;
209 static BOOL report_mime
;
210 static int stream_read
, protocol_read
;
211 static enum load_state_t
{
220 static LPCOLESTR expect_status_text
= NULL
;
221 static const char *nav_url
, *nav_serv_url
, *prev_url
;
223 static const char html_page
[] =
225 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
226 "<body><div>test</div></body>"
229 static const char css_data
[] = "body {color: red; margin: 0}";
231 static const WCHAR http_urlW
[] =
232 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
234 static const WCHAR doc_url
[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
236 #define DOCHOST_DOCCANNAVIGATE 0
237 #define WM_CONTINUE_BINDING (WM_APP+1)
239 static HRESULT
QueryInterface(REFIID riid
, void **ppv
);
240 static void test_MSHTML_QueryStatus(IHTMLDocument2
*,DWORD
);
242 #define test_readyState(u) _test_readyState(__LINE__,u)
243 static void _test_readyState(unsigned,IUnknown
*);
245 static const WCHAR wszTimesNewRoman
[] =
246 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
247 static const WCHAR wszArial
[] =
248 {'A','r','i','a','l',0};
250 static const char *debugstr_guid(REFIID riid
)
257 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
258 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
259 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
260 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
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 const WCHAR
*strstrW( const WCHAR
*str
, const WCHAR
*sub
)
276 const WCHAR
*p1
= str
, *p2
= sub
;
277 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
278 if (!*p2
) return str
;
284 static BSTR
a2bstr(const char *str
)
289 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
290 ret
= SysAllocStringLen(NULL
, len
);
291 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
296 /* Returns true if the user interface is in English. Note that this does not
297 * presume of the formatting of dates, numbers, etc.
299 static BOOL
is_lang_english(void)
301 static HMODULE hkernel32
= NULL
;
302 static LANGID (WINAPI
*pGetThreadUILanguage
)(void) = NULL
;
303 static LANGID (WINAPI
*pGetUserDefaultUILanguage
)(void) = NULL
;
307 hkernel32
= GetModuleHandleA("kernel32.dll");
308 pGetThreadUILanguage
= (void*)GetProcAddress(hkernel32
, "GetThreadUILanguage");
309 pGetUserDefaultUILanguage
= (void*)GetProcAddress(hkernel32
, "GetUserDefaultUILanguage");
311 if (pGetThreadUILanguage
)
312 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH
;
313 if (pGetUserDefaultUILanguage
)
314 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH
;
316 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
319 static BOOL
iface_cmp(IUnknown
*iface1
, IUnknown
*iface2
)
321 IUnknown
*unk1
, *unk2
;
326 IUnknown_QueryInterface(iface1
, &IID_IUnknown
, (void**)&unk1
);
327 IUnknown_Release(unk1
);
328 IUnknown_QueryInterface(iface2
, &IID_IUnknown
, (void**)&unk2
);
329 IUnknown_Release(unk2
);
334 #define EXPECT_UPDATEUI 1
335 #define EXPECT_SETTITLE 2
337 static void test_timer(DWORD flags
)
339 BOOL
*b
= &called_Exec_SETTITLE
;
342 if(flags
& EXPECT_UPDATEUI
) {
343 SET_EXPECT(UpdateUI
);
344 SET_EXPECT(Exec_UPDATECOMMANDS
);
345 b
= &called_UpdateUI
;
347 if(flags
& EXPECT_SETTITLE
)
348 SET_EXPECT(Exec_SETTITLE
);
350 while(!*b
&& GetMessage(&msg
, doc_hwnd
, 0, 0)) {
351 TranslateMessage(&msg
);
352 DispatchMessage(&msg
);
355 if(flags
& EXPECT_UPDATEUI
) {
356 CHECK_CALLED(UpdateUI
);
357 CHECK_CALLED(Exec_UPDATECOMMANDS
);
359 if(flags
& EXPECT_SETTITLE
)
360 CHECK_CALLED(Exec_SETTITLE
);
363 static IMoniker Moniker
;
365 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
366 static void _test_GetCurMoniker(unsigned line
, IUnknown
*unk
, IMoniker
*exmon
, const char *exurl
)
369 IPersistMoniker
*permon
;
370 IMoniker
*mon
= (void*)0xdeadbeef;
371 BSTR doc_url
= (void*)0xdeadbeef;
377 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
378 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
382 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
383 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
385 hres
= IHTMLDocument2_get_URL(doc
, &doc_url
);
386 ok(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
388 hres
= IPersistMoniker_GetCurMoniker(permon
, &mon
);
389 IPersistMoniker_Release(permon
);
393 BOOL exb
= expect_GetDisplayName
;
394 BOOL clb
= called_GetDisplayName
;
396 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
397 ok_(__FILE__
,line
)(mon
== exmon
, "mon(%p) != exmon(%p)\n", mon
, exmon
);
400 SET_EXPECT(GetDisplayName
);
401 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
402 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
404 CHECK_CALLED(GetDisplayName
);
405 expect_GetDisplayName
= exb
;
406 called_GetDisplayName
= clb
;
409 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
411 ok(!strcmp_wa(url
, nav_serv_url
), "url = %s, expected %s\n", wine_dbgstr_w(url
), nav_serv_url
);
416 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
418 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
419 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
421 ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "unexpected url %s\n", wine_dbgstr_w(url
));
422 ok_(__FILE__
,line
)(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
426 ok_(__FILE__
,line
)(hres
== E_UNEXPECTED
,
427 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres
);
428 ok_(__FILE__
,line
)(mon
== (IMoniker
*)0xdeadbeef, "mon=%p\n", mon
);
429 ok_(__FILE__
,line
)(!strcmp_wa(doc_url
, "about:blank"), "doc_url is not about:blank\n");
432 SysFreeString(doc_url
);
433 IHTMLDocument2_Release(doc
);
434 if(mon
&& mon
!= (void*)0xdeadbeef)
435 IMoniker_Release(mon
);
438 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
439 static void _test_current_url(unsigned line
, IUnknown
*unk
, const char *exurl
)
445 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
446 ok_(__FILE__
,line
)(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
448 hres
= IHTMLDocument2_get_URL(doc
, &url
);
449 ok_(__FILE__
,line
)(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
450 ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url
), exurl
);
453 IHTMLDocument2_Release(doc
);
456 DEFINE_GUID(IID_External_unk
,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
458 static HRESULT WINAPI
External_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
462 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
467 if(IsEqualGUID(&IID_IProxyManager
, riid
))
468 return E_NOINTERFACE
; /* TODO */
469 if(IsEqualGUID(&IID_IDispatchEx
, riid
))
470 return E_NOINTERFACE
; /* TODO */
471 if(IsEqualGUID(&IID_External_unk
, riid
))
472 return E_NOINTERFACE
; /* TODO */
474 if(!ignore_external_qi
)
475 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
476 return E_NOINTERFACE
;
479 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
484 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
489 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
491 ok(0, "unexpected call\n");
495 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
498 ok(0, "unexpected call\n");
502 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
503 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
505 ok(0, "unexpected call\n");
509 static HRESULT WINAPI
External_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
510 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
511 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
513 ok(0, "unexpected call\n");
517 static const IDispatchVtbl ExternalVtbl
= {
518 External_QueryInterface
,
521 Dispatch_GetTypeInfoCount
,
522 Dispatch_GetTypeInfo
,
523 Dispatch_GetIDsOfNames
,
527 static IDispatch External
= { &ExternalVtbl
};
529 static HRESULT WINAPI
Protocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
531 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
537 return E_NOINTERFACE
;
540 static ULONG WINAPI
Protocol_AddRef(IInternetProtocol
*iface
)
545 static ULONG WINAPI
Protocol_Release(IInternetProtocol
*iface
)
550 static HRESULT WINAPI
Protocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
551 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
552 DWORD grfPI
, HANDLE_PTR dwReserved
)
558 static const WCHAR wszTextCss
[] = {'t','e','x','t','/','c','s','s',0};
559 static const WCHAR empty_str
= {0};
563 ok(pOIProtSink
!= NULL
, "pOIProtSink == NULL\n");
564 ok(pOIBindInfo
!= NULL
, "pOIBindInfo == NULL\n");
565 ok(!grfPI
, "grfPI = %x\n", grfPI
);
566 ok(!dwReserved
, "dwReserved = %lx\n", dwReserved
);
568 memset(&bindinfo
, 0, sizeof(bindinfo
));
569 bindinfo
.cbSize
= sizeof(bindinfo
);
570 hres
= IInternetBindInfo_GetBindInfo(pOIBindInfo
, &bindf
, &bindinfo
);
571 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
572 ok(bindf
== (BINDF_FROMURLMON
|BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
573 "bindf = %x\n", bindf
);
575 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
576 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
577 /* TODO: test stgmedData */
578 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
579 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
580 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
581 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
582 ok(bindinfo
.dwOptions
== 0x80000 ||
583 bindinfo
.dwOptions
== 0x4080000, /* win2k3 */
584 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
585 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
586 /* TODO: test dwCodePage */
587 /* TODO: test securityAttributes */
588 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
589 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
590 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
592 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
593 BINDSTATUS_CACHEFILENAMEAVAILABLE
, &empty_str
);
594 ok(hres
== S_OK
, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres
);
597 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
598 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
, wszTextCss
);
600 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres
);
603 hres
= IInternetProtocolSink_ReportData(pOIProtSink
,
604 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
, 13, 13);
605 ok(hres
== S_OK
, "ReportData failed: %08x\n", hres
);
607 hres
= IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
608 ok(hres
== S_OK
, "ReportResult failed: %08x\n", hres
);
613 static HRESULT WINAPI
Protocol_Continue(IInternetProtocol
*iface
,
614 PROTOCOLDATA
*pProtocolData
)
616 ok(0, "unexpected call\n");
620 static HRESULT WINAPI
Protocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
623 ok(0, "unexpected call\n");
627 static HRESULT WINAPI
Protocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
629 CHECK_EXPECT(Terminate
);
633 static HRESULT WINAPI
Protocol_Suspend(IInternetProtocol
*iface
)
635 ok(0, "unexpected call\n");
639 static HRESULT WINAPI
Protocol_Resume(IInternetProtocol
*iface
)
641 ok(0, "unexpected call\n");
645 static HRESULT WINAPI
Protocol_Read(IInternetProtocol
*iface
, void *pv
,
646 ULONG cb
, ULONG
*pcbRead
)
648 CHECK_EXPECT2(Protocol_Read
);
650 ok(pv
!= NULL
, "pv == NULL\n");
651 ok(cb
> sizeof(css_data
), "cb < sizeof(css_data)\n");
652 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
653 ok(!*pcbRead
|| *pcbRead
==sizeof(css_data
)-1, "*pcbRead=%d\n", *pcbRead
);
658 protocol_read
+= *pcbRead
= sizeof(css_data
)-1;
659 memcpy(pv
, css_data
, sizeof(css_data
)-1);
663 static HRESULT WINAPI
Protocol_Seek(IInternetProtocol
*iface
,
664 LARGE_INTEGER dlibMove
, DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
666 ok(0, "unexpected call\n");
670 static HRESULT WINAPI
Protocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
672 CHECK_EXPECT(LockRequest
);
676 static HRESULT WINAPI
Protocol_UnlockRequest(IInternetProtocol
*iface
)
678 CHECK_EXPECT(UnlockRequest
);
682 static const IInternetProtocolVtbl ProtocolVtbl
= {
683 Protocol_QueryInterface
,
694 Protocol_LockRequest
,
695 Protocol_UnlockRequest
698 static IInternetProtocol Protocol
= { &ProtocolVtbl
};
700 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
702 if(!IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
703 ok(0, "unexpected call\n");
704 return E_NOINTERFACE
;
707 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
712 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
717 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
718 REFIID riid
, void **ppv
)
720 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
721 return E_NOINTERFACE
;
723 CHECK_EXPECT(CreateInstance
);
724 ok(ppv
!= NULL
, "ppv == NULL\n");
730 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
732 ok(0, "unexpected call\n");
736 static const IClassFactoryVtbl ClassFactoryVtbl
= {
737 ClassFactory_QueryInterface
,
739 ClassFactory_Release
,
740 ClassFactory_CreateInstance
,
741 ClassFactory_LockServer
744 static IClassFactory ClassFactory
= { &ClassFactoryVtbl
};
746 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
748 ok(0, "unexpected call\n");
752 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
757 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
762 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
763 IHlinkBrowseContext
*pihlbc
)
765 ok(0, "unexpected call\n");
769 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
770 IHlinkBrowseContext
**ppihlbc
)
772 ok(0, "unexpected call\n");
776 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
777 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
781 CHECK_EXPECT(Navigate
);
783 ok(grfHLNF
== 0, "grfHLNF=%d, expected 0\n", grfHLNF
);
784 ok(pbc
!= NULL
, "pbc == NULL\n");
785 ok(pibsc
!= NULL
, "pubsc == NULL\n");
786 ok(pihlNavigate
!= NULL
, "puhlNavigate == NULL\n");
789 LPWSTR frame_name
= (LPWSTR
)0xdeadbeef;
790 LPWSTR location
= (LPWSTR
)0xdeadbeef;
792 IMoniker
*mon
= NULL
;
793 DWORD site_data
= 0xdeadbeef;
795 hres
= IHlink_GetTargetFrameName(pihlNavigate
, &frame_name
);
796 ok(hres
== S_FALSE
, "GetTargetFrameName failed: %08x\n", hres
);
797 ok(frame_name
== NULL
, "frame_name = %p\n", frame_name
);
799 hres
= IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
800 ok(hres
== S_OK
, "GetMonikerReference failed: %08x\n", hres
);
801 ok(location
== NULL
, "location = %p\n", location
);
802 ok(mon
!= NULL
, "mon == NULL\n");
804 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &location
);
805 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
806 ok(!strcmp_wa(location
, nav_url
), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location
), nav_url
);
807 CoTaskMemFree(location
);
808 IMoniker_Release(mon
);
810 hres
= IHlink_GetHlinkSite(pihlNavigate
, &site
, &site_data
);
811 ok(hres
== S_OK
, "GetHlinkSite failed: %08x\n", hres
);
812 ok(site
== NULL
, "site = %p\n, expected NULL\n", site
);
813 ok(site_data
== 0xdeadbeef, "site_data = %x\n", site_data
);
819 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
820 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
822 ok(0, "unexpected call\n");
826 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
827 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
829 ok(0, "unexpected call\n");
833 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
834 HlinkFrame_QueryInterface
,
837 HlinkFrame_SetBrowseContext
,
838 HlinkFrame_GetBrowseContext
,
840 HlinkFrame_OnNavigate
,
841 HlinkFrame_UpdateHlink
844 static IHlinkFrame HlinkFrame
= { &HlinkFrameVtbl
};
846 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
848 ok(0, "unexpected call\n");
849 return E_NOINTERFACE
;
852 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
857 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
862 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
863 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
864 DWORD dwUserActionTime
)
866 CHECK_EXPECT(EvaluateNewWindow
);
868 ok(!strcmp_wa(pszUrl
, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl
));
869 ok(!strcmp_wa(pszName
, "test"), "pszName = %s\n", wine_dbgstr_w(pszName
));
870 ok(!strcmp_wa(pszUrlContext
, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext
));
871 ok(!pszFeatures
, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures
));
872 ok(!fReplace
, "fReplace = %x\n", fReplace
);
873 ok(dwFlags
== (allow_new_window
? 0 : NWMF_FIRST
), "dwFlags = %x\n", dwFlags
);
874 ok(!dwUserActionTime
, "dwUserActionime = %d\n", dwUserActionTime
);
876 return allow_new_window
? S_OK
: E_FAIL
;
879 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
880 NewWindowManager_QueryInterface
,
881 NewWindowManager_AddRef
,
882 NewWindowManager_Release
,
883 NewWindowManager_EvaluateNewWindow
886 static INewWindowManager NewWindowManager
= { &NewWindowManagerVtbl
};
888 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
889 REFIID riid
, void**ppv
)
891 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
896 ok(0, "unexpected call\n");
897 return E_NOINTERFACE
;
900 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
905 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
910 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
913 case DISPID_READYSTATE
:
914 CHECK_EXPECT2(OnChanged_READYSTATE
);
916 if(!readystate_set_interactive
)
917 test_MSHTML_QueryStatus(NULL
, OLECMDF_SUPPORTED
918 | (editmode
&& (load_state
== LD_INTERACTIVE
|| load_state
== LD_COMPLETE
)
919 ? OLECMDF_ENABLED
: 0));
921 if(readystate_set_loading
) {
922 readystate_set_loading
= FALSE
;
923 load_state
= LD_LOADING
;
925 if(!editmode
|| load_state
!= LD_LOADING
|| !called_Exec_Explorer_69
)
926 test_readyState(NULL
);
929 CHECK_EXPECT(OnChanged_1005
);
931 test_readyState(NULL
);
932 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
935 CHECK_EXPECT(OnChanged_1012
);
952 ok(0, "unexpected id %d\n", dispID
);
956 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
958 ok(0, "unexpected call\n");
962 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
963 PropertyNotifySink_QueryInterface
,
964 PropertyNotifySink_AddRef
,
965 PropertyNotifySink_Release
,
966 PropertyNotifySink_OnChanged
,
967 PropertyNotifySink_OnRequestEdit
970 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
972 static HRESULT WINAPI
Stream_QueryInterface(IStream
*iface
, REFIID riid
, void **ppv
)
974 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_ISequentialStream
, riid
) || IsEqualGUID(&IID_IStream
, riid
)) {
979 ok(0, "unexpected call %s\n", debugstr_guid(riid
));
981 return E_NOINTERFACE
;
984 static ULONG WINAPI
Stream_AddRef(IStream
*iface
)
989 static ULONG WINAPI
Stream_Release(IStream
*iface
)
994 static HRESULT WINAPI
Stream_Read(IStream
*iface
, void *pv
,
995 ULONG cb
, ULONG
*pcbRead
)
998 ok(pv
!= NULL
, "pv == NULL\n");
999 ok(cb
> sizeof(html_page
), "cb = %d\n", cb
);
1000 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
1001 ok(!*pcbRead
, "*pcbRead = %d\n", *pcbRead
);
1006 memcpy(pv
, html_page
, sizeof(html_page
)-1);
1007 stream_read
+= *pcbRead
= sizeof(html_page
)-1;
1011 static HRESULT WINAPI
Stream_Write(IStream
*iface
, const void *pv
,
1012 ULONG cb
, ULONG
*pcbWritten
)
1014 ok(0, "unexpected call\n");
1018 static HRESULT WINAPI
Stream_Seek(IStream
*iface
, LARGE_INTEGER dlibMove
,
1019 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
1021 ok(0, "unexpected call\n");
1025 static HRESULT WINAPI
Stream_SetSize(IStream
*iface
, ULARGE_INTEGER libNewSize
)
1027 ok(0, "unexpected call\n");
1031 static HRESULT WINAPI
Stream_CopyTo(IStream
*iface
, IStream
*pstm
,
1032 ULARGE_INTEGER cb
, ULARGE_INTEGER
*pcbRead
, ULARGE_INTEGER
*pcbWritten
)
1034 ok(0, "unexpected call\n");
1038 static HRESULT WINAPI
Stream_Commit(IStream
*iface
, DWORD grfCommitFlags
)
1040 ok(0, "unexpected call\n");
1044 static HRESULT WINAPI
Stream_Revert(IStream
*iface
)
1046 ok(0, "unexpected call\n");
1050 static HRESULT WINAPI
Stream_LockRegion(IStream
*iface
, ULARGE_INTEGER libOffset
,
1051 ULARGE_INTEGER cb
, DWORD dwLockType
)
1053 ok(0, "unexpected call\n");
1057 static HRESULT WINAPI
Stream_UnlockRegion(IStream
*iface
,
1058 ULARGE_INTEGER libOffset
, ULARGE_INTEGER cb
, DWORD dwLockType
)
1060 ok(0, "unexpected call\n");
1064 static HRESULT WINAPI
Stream_Stat(IStream
*iface
, STATSTG
*pstatstg
,
1067 ok(0, "unexpected call\n");
1071 static HRESULT WINAPI
Stream_Clone(IStream
*iface
, IStream
**ppstm
)
1073 ok(0, "unexpected call\n");
1077 static const IStreamVtbl StreamVtbl
= {
1078 Stream_QueryInterface
,
1089 Stream_UnlockRegion
,
1094 static IStream Stream
= { &StreamVtbl
};
1096 static HRESULT WINAPI
WinInetHttpInfo_QueryInterface(
1097 IWinInetHttpInfo
* This
,
1101 ok(0, "unexpected call\n");
1102 return E_NOINTERFACE
;
1105 static ULONG WINAPI
WinInetHttpInfo_AddRef(
1106 IWinInetHttpInfo
* This
)
1111 static ULONG WINAPI
WinInetHttpInfo_Release(
1112 IWinInetHttpInfo
* This
)
1117 static HRESULT WINAPI
WinInetHttpInfo_QueryOption(
1118 IWinInetHttpInfo
* This
,
1123 return E_NOTIMPL
; /* TODO */
1126 static HRESULT WINAPI
WinInetHttpInfo_QueryInfo(
1127 IWinInetHttpInfo
* This
,
1134 ok(pdwReserved
== NULL
, "pdwReserved != NULL\n");
1136 if(dwOption
== (HTTP_QUERY_STATUS_CODE
|HTTP_QUERY_FLAG_NUMBER
)) {
1137 ok(pBuffer
!= NULL
, "pBuffer == NULL\n");
1138 ok(*pcbBuf
== sizeof(DWORD
), "*pcbBuf = %d\n", *pcbBuf
);
1139 ok(pdwFlags
== NULL
, "*pdwFlags != NULL\n");
1140 *((DWORD
*)pBuffer
) = status_code
;
1144 return E_NOTIMPL
; /* TODO */
1147 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
= {
1148 WinInetHttpInfo_QueryInterface
,
1149 WinInetHttpInfo_AddRef
,
1150 WinInetHttpInfo_Release
,
1151 WinInetHttpInfo_QueryOption
,
1152 WinInetHttpInfo_QueryInfo
1155 static IWinInetHttpInfo WinInetHttpInfo
= { &WinInetHttpInfoVtbl
};
1157 static HRESULT WINAPI
Binding_QueryInterface(IBinding
*iface
, REFIID riid
, void **ppv
)
1159 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1164 if(IsEqualGUID(&IID_IWinInetInfo
, riid
) || IsEqualGUID(&IID_IWinInetHttpInfo
, riid
)) {
1165 *ppv
= &WinInetHttpInfo
;
1169 ok(0, "unexpected call\n");
1170 return E_NOINTERFACE
;
1173 static ULONG WINAPI
Binding_AddRef(IBinding
*iface
)
1178 static ULONG WINAPI
Binding_Release(IBinding
*iface
)
1183 static HRESULT WINAPI
Binding_Abort(IBinding
*iface
)
1185 CHECK_EXPECT(Abort
);
1186 if(asynchronous_binding
)
1187 PeekMessage(NULL
, container_hwnd
, WM_CONTINUE_BINDING
, WM_CONTINUE_BINDING
, PM_REMOVE
);
1191 static HRESULT WINAPI
Binding_Suspend(IBinding
*iface
)
1193 ok(0, "unexpected call\n");
1197 static HRESULT WINAPI
Binding_Resume(IBinding
*iface
)
1199 ok(0, "unexpected call\n");
1203 static HRESULT WINAPI
Binding_SetPriority(IBinding
*iface
, LONG nPriority
)
1205 ok(0, "unexpected call\n");
1209 static HRESULT WINAPI
Binding_GetPriority(IBinding
*iface
, LONG
*pnPriority
)
1211 ok(0, "unexpected call\n");
1215 static HRESULT WINAPI
Binding_GetBindResult(IBinding
*iface
, CLSID
*pclsidProtocol
,
1216 DWORD
*pdwResult
, LPOLESTR
*pszResult
, DWORD
*pdwReserved
)
1218 CHECK_EXPECT(GetBindResult
);
1222 static const IBindingVtbl BindingVtbl
= {
1223 Binding_QueryInterface
,
1229 Binding_SetPriority
,
1230 Binding_GetPriority
,
1231 Binding_GetBindResult
1234 static IBinding Binding
= { &BindingVtbl
};
1236 DEFINE_GUID(IID_IMoniker_unk
,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1237 DEFINE_GUID(IID_IMoniker_unk2
, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1239 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
1243 if(IsEqualGUID(&IID_IMoniker_unk
, riid
))
1244 return E_NOINTERFACE
; /* TODO */
1245 if(IsEqualGUID(&IID_IMoniker_unk2
, riid
))
1246 return E_NOINTERFACE
; /* TODO */
1248 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
1249 return E_NOINTERFACE
;
1252 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
1257 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
1262 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
1264 CHECK_EXPECT(GetClassID
);
1265 ok(IsEqualGUID(pClassID
, &IID_NULL
), "pClassID = %s\n", debugstr_guid(pClassID
));
1269 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
1271 ok(0, "unexpected call\n");
1275 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
1277 ok(0, "unexpected call\n");
1281 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
1283 ok(0, "unexpected call\n");
1287 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
1289 ok(0, "unexpected call\n");
1293 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
1294 REFIID riidResult
, void **ppvResult
)
1296 ok(0, "unexpected call\n");
1300 static void test_binding_ui(IUnknown
*unk
)
1302 IWindowForBindingUI
*binding_ui
;
1303 IServiceProvider
*serv_prov
;
1307 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&serv_prov
);
1308 ok(hres
== S_OK
, "Could not get IServiceProvider: %08x\n", hres
);
1310 hres
= IServiceProvider_QueryService(serv_prov
, &IID_IWindowForBindingUI
, &IID_IWindowForBindingUI
,
1311 (void**)&binding_ui
);
1312 ok(hres
== S_OK
, "Could not get IWindowForBindingUI: %08x\n", hres
);
1314 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IHttpSecurity
, &binding_hwnd
);
1315 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1317 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1319 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1321 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IAuthenticate
, &binding_hwnd
);
1322 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1324 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1326 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1328 hres
= IWindowForBindingUI_GetWindow(binding_ui
, &IID_IWindowForBindingUI
, &binding_hwnd
);
1329 ok(hres
== S_OK
, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres
);
1331 ok(binding_hwnd
== doc_hwnd
, "binding_hwnd != doc_hwnd\n");
1333 todo_wine
ok(binding_hwnd
!= NULL
, "binding_hwnd == NULL\n");
1335 IWindowForBindingUI_Release(binding_ui
);
1336 IServiceProvider_Release(serv_prov
);
1339 static void continue_binding(IBindStatusCallback
*callback
)
1341 FORMATETC formatetc
= {0xc02d, NULL
, 1, -1, TYMED_ISTREAM
};
1342 STGMEDIUM stgmedium
;
1345 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
1347 test_binding_ui((IUnknown
*)callback
);
1350 hres
= IBindStatusCallback_OnProgress(callback
, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE
,
1352 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres
);
1355 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1356 BINDSTATUS_BEGINDOWNLOADDATA
, doc_url
);
1357 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres
);
1358 if(status_code
!= HTTP_STATUS_OK
) {
1359 CHECK_CALLED_BROKEN(IsErrorUrl
);
1360 SET_EXPECT(IsErrorUrl
);
1364 stgmedium
.tymed
= TYMED_ISTREAM
;
1365 U(stgmedium
).pstm
= &Stream
;
1366 stgmedium
.pUnkForRelease
= (IUnknown
*)&Moniker
;
1367 hres
= IBindStatusCallback_OnDataAvailable(callback
,
1368 BSCF_FIRSTDATANOTIFICATION
|BSCF_LASTDATANOTIFICATION
,
1369 sizeof(html_page
)-1, &formatetc
, &stgmedium
);
1370 ok(hres
== S_OK
, "OnDataAvailable failed: %08x\n", hres
);
1373 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1374 BINDSTATUS_ENDDOWNLOADDATA
, NULL
);
1375 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres
);
1377 SET_EXPECT(GetBindResult
);
1378 hres
= IBindStatusCallback_OnStopBinding(callback
, S_OK
, NULL
);
1379 ok(hres
== S_OK
, "OnStopBinding failed: %08x\n", hres
);
1380 CLEAR_CALLED(GetBindResult
); /* IE7 */
1382 IBindStatusCallback_Release(callback
);
1385 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1386 REFIID riid
, void **ppv
)
1388 IBindStatusCallback
*callback
= NULL
;
1393 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1395 CHECK_EXPECT(BindToStorage
);
1397 load_state
= LD_LOADING
;
1399 ok(pbc
!= NULL
, "pbc == NULL\n");
1400 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1401 ok(IsEqualGUID(&IID_IStream
, riid
), "unexpected riid\n");
1402 ok(ppv
!= NULL
, "ppv == NULL\n");
1403 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
1405 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, (IUnknown
**)&callback
);
1406 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
1407 ok(callback
!= NULL
, "callback == NULL\n");
1409 memset(&bindinfo
, 0xf0, sizeof(bindinfo
));
1410 bindinfo
.cbSize
= sizeof(bindinfo
);
1412 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
1413 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
1414 ok((bindf
& ~BINDF_HYPERLINK
/* IE9 */) == (BINDF_PULLDATA
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
), "bindf = %08x\n", bindf
);
1415 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
1416 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
1417 /* TODO: test stgmedData */
1418 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
1419 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
1420 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
1421 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
1422 ok(bindinfo
.dwOptions
== 0x80000 || bindinfo
.dwOptions
== 0x4080000,
1423 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
1424 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
1425 /* TODO: test dwCodePage */
1426 /* TODO: test securityAttributes */
1427 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
1428 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
1429 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
1431 hres
= IBindStatusCallback_OnStartBinding(callback
, 0, &Binding
);
1432 ok(hres
== S_OK
, "OnStartBinding failed: %08x\n", hres
);
1434 if(asynchronous_binding
) {
1435 PostMessageW(container_hwnd
, WM_CONTINUE_BINDING
, (WPARAM
)callback
, 0);
1436 return MK_S_ASYNCHRONOUS
;
1439 continue_binding(callback
);
1443 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
1444 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
1446 ok(0, "unexpected call\n");
1450 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
1451 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
1453 ok(0, "unexpected call\n");
1457 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
1459 ok(0, "unexpected call\n");
1463 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
1465 ok(0, "unexpected call\n");
1469 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
1471 ok(0, "unexpected call\n");
1475 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1476 IMoniker
*pmkNewlyRunning
)
1478 ok(0, "unexpected call\n");
1482 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
1483 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
1485 ok(0, "unexpected call\n");
1489 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
1491 ok(0, "unexpected call\n");
1495 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
1496 IMoniker
**ppmkPrefix
)
1498 ok(0, "unexpected call\n");
1502 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
1503 IMoniker
**pmkRelPath
)
1505 ok(0, "unexpected call\n");
1509 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1510 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
1512 CHECK_EXPECT2(GetDisplayName
);
1514 /* ok(pbc != NULL, "pbc == NULL\n"); */
1515 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1516 ok(ppszDisplayName
!= NULL
, "ppszDisplayName == NULL\n");
1518 *ppszDisplayName
= CoTaskMemAlloc(sizeof(doc_url
));
1519 memcpy(*ppszDisplayName
, doc_url
, sizeof(doc_url
));
1524 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1525 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1527 ok(0, "unexpected call\n");
1531 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
1533 CHECK_EXPECT(IsSystemMoniker
);
1537 static const IMonikerVtbl MonikerVtbl
= {
1538 Moniker_QueryInterface
,
1546 Moniker_BindToObject
,
1547 Moniker_BindToStorage
,
1549 Moniker_ComposeWith
,
1554 Moniker_GetTimeOfLastChange
,
1556 Moniker_CommonPrefixWith
,
1557 Moniker_RelativePathTo
,
1558 Moniker_GetDisplayName
,
1559 Moniker_ParseDisplayName
,
1560 Moniker_IsSystemMoniker
1563 static IMoniker Moniker
= { &MonikerVtbl
};
1565 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1567 return QueryInterface(riid
, ppv
);
1570 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1575 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1580 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
1581 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1583 ok(0, "unexpected call\n");
1587 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
1588 IEnumUnknown
**ppenum
)
1590 ok(0, "unexpected call\n");
1594 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1596 CHECK_EXPECT(LockContainer
);
1597 ok(expect_LockContainer_fLock
== fLock
, "fLock=%x, expected %x\n", fLock
, expect_LockContainer_fLock
);
1601 static const IOleContainerVtbl OleContainerVtbl
= {
1602 OleContainer_QueryInterface
,
1603 OleContainer_AddRef
,
1604 OleContainer_Release
,
1605 OleContainer_ParseDisplayName
,
1606 OleContainer_EnumObjects
,
1607 OleContainer_LockContainer
1610 static IOleContainer OleContainer
= { &OleContainerVtbl
};
1612 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1614 return QueryInterface(riid
, ppv
);
1617 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1622 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1627 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1629 ok(0, "unexpected call\n");
1633 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1636 ok(0, "unexpected call\n");
1640 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1642 CHECK_EXPECT(GetContainer
);
1643 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1644 *ppContainer
= &OleContainer
;
1648 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1650 ok(0, "unexpected call\n");
1654 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1656 ok(0, "unexpected call\n");
1660 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1662 ok(0, "unexpected call\n");
1666 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1667 ClientSite_QueryInterface
,
1670 ClientSite_SaveObject
,
1671 ClientSite_GetMoniker
,
1672 ClientSite_GetContainer
,
1673 ClientSite_ShowObject
,
1674 ClientSite_OnShowWindow
,
1675 ClientSite_RequestNewObjectLayout
1678 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1680 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1682 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1684 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1685 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
1688 return E_NOINTERFACE
;
1691 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1696 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1701 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1703 CHECK_EXPECT(Frame_GetWindow
);
1707 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1709 ok(0, "unexpected call\n");
1713 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1715 ok(0, "unexpected call\n");
1719 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1720 LPCBORDERWIDTHS pborderwidths
)
1722 ok(0, "unexpected call\n");
1726 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1727 LPCBORDERWIDTHS pborderwidths
)
1729 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1733 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1734 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1736 static const WCHAR wszHTML_Document
[] =
1737 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1739 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1741 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1742 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1743 if(pActiveObject
&& is_lang_english())
1744 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1747 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1748 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1750 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1754 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1755 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1757 static const WCHAR wszHTML_Document
[] =
1758 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1761 CHECK_EXPECT2(SetActiveObject
);
1763 if(pActiveObject
&& is_lang_english())
1764 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1766 CHECK_EXPECT(SetActiveObject_null
);
1768 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1769 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1775 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1776 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1778 ok(0, "unexpected call\n");
1782 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1783 HOLEMENU holemenu
, HWND hwndActiveObject
)
1785 ok(0, "unexpected call\n");
1789 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1791 ok(0, "unexpected call\n");
1795 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1797 CHECK_EXPECT2(SetStatusText
);
1798 if(!expect_status_text
)
1799 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1803 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1806 CHECK_EXPECT2(Frame_EnableModeless_TRUE
);
1808 CHECK_EXPECT2(Frame_EnableModeless_FALSE
);
1812 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1814 ok(0, "unexpected call\n");
1818 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1819 InPlaceFrame_QueryInterface
,
1820 InPlaceFrame_AddRef
,
1821 InPlaceFrame_Release
,
1822 InPlaceFrame_GetWindow
,
1823 InPlaceFrame_ContextSensitiveHelp
,
1824 InPlaceFrame_GetBorder
,
1825 InPlaceFrame_RequestBorderSpace
,
1826 InPlaceFrame_SetBorderSpace
,
1827 InPlaceFrame_SetActiveObject
,
1828 InPlaceFrame_InsertMenus
,
1829 InPlaceFrame_SetMenu
,
1830 InPlaceFrame_RemoveMenus
,
1831 InPlaceFrame_SetStatusText
,
1832 InPlaceFrame_EnableModeless
,
1833 InPlaceFrame_TranslateAccelerator
1836 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1838 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1839 InPlaceFrame_QueryInterface
,
1840 InPlaceFrame_AddRef
,
1841 InPlaceFrame_Release
,
1842 InPlaceFrame_GetWindow
,
1843 InPlaceFrame_ContextSensitiveHelp
,
1844 InPlaceFrame_GetBorder
,
1845 InPlaceFrame_RequestBorderSpace
,
1846 InPlaceFrame_SetBorderSpace
,
1847 InPlaceUIWindow_SetActiveObject
,
1850 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1852 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
1854 return QueryInterface(riid
, ppv
);
1857 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
1862 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
1867 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(
1868 IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
1870 IOleClientSite
*client_site
;
1871 IOleObject
*ole_obj
;
1874 CHECK_EXPECT2(GetWindow
);
1875 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1876 *phwnd
= container_hwnd
;
1878 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IOleObject
, (void**)&ole_obj
);
1879 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
1881 hres
= IOleObject_GetClientSite(ole_obj
, &client_site
);
1882 IOleObject_Release(ole_obj
);
1883 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
1884 ok(client_site
== &ClientSite
, "client_site != ClientSite\n");
1885 IOleClientSite_Release(client_site
);
1890 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(
1891 IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
1893 ok(0, "unexpected call\n");
1897 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(
1898 IOleInPlaceSiteWindowless
*iface
)
1900 CHECK_EXPECT(CanInPlaceActivate
);
1904 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(
1905 IOleInPlaceSiteWindowless
*iface
)
1907 CHECK_EXPECT(OnInPlaceActivate
);
1908 inplace_deactivated
= FALSE
;
1912 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(
1913 IOleInPlaceSiteWindowless
*iface
)
1915 CHECK_EXPECT(OnUIActivate
);
1919 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(
1920 IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
1921 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1922 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1924 static const RECT rect
= {0,0,500,500};
1926 CHECK_EXPECT(GetWindowContext
);
1928 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1930 *ppFrame
= &InPlaceFrame
;
1931 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1933 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1934 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1936 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1937 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1939 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1940 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1942 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
1943 lpFrameInfo
->fMDIApp
= FALSE
;
1944 lpFrameInfo
->hwndFrame
= container_hwnd
;
1945 lpFrameInfo
->haccel
= NULL
;
1946 lpFrameInfo
->cAccelEntries
= 0;
1952 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
1953 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
1955 ok(0, "unexpected call\n");
1959 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
1960 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
1962 CHECK_EXPECT(OnUIDeactivate
);
1963 ok(!fUndoable
, "fUndoable = TRUE\n");
1967 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
1968 IOleInPlaceSiteWindowless
*iface
)
1970 CHECK_EXPECT(OnInPlaceDeactivate
);
1971 inplace_deactivated
= TRUE
;
1975 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
1976 IOleInPlaceSiteWindowless
*iface
)
1978 ok(0, "unexpected call\n");
1982 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
1983 IOleInPlaceSiteWindowless
*iface
)
1985 ok(0, "unexpected call\n");
1989 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
1990 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
1992 ok(0, "unexpected call\n");
1996 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
1997 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
1999 CHECK_EXPECT(OnInPlaceActivateEx
);
2001 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
2002 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
2003 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
2008 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2009 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
2011 CHECK_EXPECT(OnInPlaceDeactivateEx
);
2013 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
2018 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
2019 IOleInPlaceSiteWindowless
*iface
)
2021 CHECK_EXPECT2(RequestUIActivate
);
2025 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
2026 IOleInPlaceSiteWindowless
*iface
)
2028 ok(0, "unexpected call\n");
2032 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
2033 IOleInPlaceSiteWindowless
*iface
)
2035 ok(0, "unexpected call\n");
2039 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
2040 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
2042 ok(0, "unexpected call\n");
2046 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
2047 IOleInPlaceSiteWindowless
*iface
)
2049 ok(0, "unexpected call\n");
2053 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
2054 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
2056 ok(0, "unexpected call\n");
2060 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
2061 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
2062 DWORD grfFlags
, HDC
*phDC
)
2064 ok(0, "unexpected call\n");
2068 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
2069 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
2071 ok(0, "unexpected call\n");
2075 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
2076 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
2078 ok(0, "unexpected call\n");
2082 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
2083 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
2085 ok(0, "unexpected call\n");
2089 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
2090 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
2091 LPCRECT pRectScroll
, LPCRECT pRectClip
)
2093 ok(0, "unexpected call\n");
2097 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
2098 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
2100 ok(0, "unexpected call\n");
2104 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
2105 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
2106 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
2108 ok(0, "unexpected call\n");
2112 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
2113 InPlaceSiteWindowless_QueryInterface
,
2114 InPlaceSiteWindowless_AddRef
,
2115 InPlaceSiteWindowless_Release
,
2116 InPlaceSiteWindowless_GetWindow
,
2117 InPlaceSiteWindowless_ContextSensitiveHelp
,
2118 InPlaceSiteWindowless_CanInPlaceActivate
,
2119 InPlaceSiteWindowless_OnInPlaceActivate
,
2120 InPlaceSiteWindowless_OnUIActivate
,
2121 InPlaceSiteWindowless_GetWindowContext
,
2122 InPlaceSiteWindowless_Scroll
,
2123 InPlaceSiteWindowless_OnUIDeactivate
,
2124 InPlaceSiteWindowless_OnInPlaceDeactivate
,
2125 InPlaceSiteWindowless_DiscardUndoState
,
2126 InPlaceSiteWindowless_DeactivateAndUndo
,
2127 InPlaceSiteWindowless_OnPosRectChange
,
2128 InPlaceSiteWindowless_OnInPlaceActivateEx
,
2129 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
2130 InPlaceSiteWindowless_RequestUIActivate
,
2131 InPlaceSiteWindowless_CanWindowlessActivate
,
2132 InPlaceSiteWindowless_GetCapture
,
2133 InPlaceSiteWindowless_SetCapture
,
2134 InPlaceSiteWindowless_GetFocus
,
2135 InPlaceSiteWindowless_SetFocus
,
2136 InPlaceSiteWindowless_GetDC
,
2137 InPlaceSiteWindowless_ReleaseDC
,
2138 InPlaceSiteWindowless_InvalidateRect
,
2139 InPlaceSiteWindowless_InvalidateRgn
,
2140 InPlaceSiteWindowless_ScrollRect
,
2141 InPlaceSiteWindowless_AdjustRect
,
2142 InPlaceSiteWindowless_OnDefWindowMessage
2145 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
2147 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
2149 return QueryInterface(riid
, ppv
);
2152 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
2157 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
2164 CallUIActivate_None
,
2165 CallUIActivate_ActivateMe
,
2166 CallUIActivate_AfterShow
,
2169 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
2170 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
2172 IOleDocument
*document
;
2175 CHECK_EXPECT(ActivateMe
);
2176 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
2178 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
2179 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
2181 if(SUCCEEDED(hres
)) {
2182 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
, NULL
, 0, &view
);
2183 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
2185 if(SUCCEEDED(hres
)) {
2186 IOleInPlaceActiveObject
*activeobj
= NULL
;
2187 IOleInPlaceSite
*inplacesite
= NULL
;
2188 HWND tmp_hwnd
= NULL
;
2189 static RECT rect
= {0,0,400,500};
2191 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2192 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2193 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2194 inplacesite
, &InPlaceSiteWindowless
);
2196 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
);
2197 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
2199 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2200 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2201 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2202 inplacesite
, &InPlaceSiteWindowless
);
2204 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
2205 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
2208 HWND hwnd
= (void*)0xdeadbeef;
2209 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2210 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
2211 ok(hwnd
== NULL
, "hwnd=%p, expected NULL\n", hwnd
);
2214 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2215 SET_EXPECT(CanInPlaceActivate
);
2216 SET_EXPECT(GetWindowContext
);
2217 SET_EXPECT(GetWindow
);
2219 SET_EXPECT(OnInPlaceActivateEx
);
2221 SET_EXPECT(OnInPlaceActivate
);
2222 SET_EXPECT(SetStatusText
);
2223 SET_EXPECT(Exec_SETPROGRESSMAX
);
2224 SET_EXPECT(Exec_SETPROGRESSPOS
);
2225 SET_EXPECT(OnUIActivate
);
2226 SET_EXPECT(SetActiveObject
);
2228 expect_status_text
= NULL
;
2230 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2231 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2233 CHECK_CALLED(CanInPlaceActivate
);
2234 CHECK_CALLED(GetWindowContext
);
2235 CHECK_CALLED(GetWindow
);
2237 CHECK_CALLED(OnInPlaceActivateEx
);
2239 CHECK_CALLED(OnInPlaceActivate
);
2240 CHECK_CALLED(SetStatusText
);
2241 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2242 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2243 CHECK_CALLED(OnUIActivate
);
2244 CHECK_CALLED(SetActiveObject
);
2245 CHECK_CALLED(ShowUI
);
2248 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &doc_hwnd
);
2249 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2250 ok(doc_hwnd
!= NULL
, "hwnd == NULL\n");
2252 ok(doc_hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2255 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2256 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2259 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
2260 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2261 ok(tmp_hwnd
== doc_hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, doc_hwnd
);
2265 hres
= IOleDocumentView_SetRect(view
, &rect
);
2266 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2268 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2269 hres
= IOleDocumentView_Show(view
, TRUE
);
2270 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2272 SET_EXPECT(CanInPlaceActivate
);
2273 SET_EXPECT(GetWindowContext
);
2274 SET_EXPECT(GetWindow
);
2276 SET_EXPECT(OnInPlaceActivateEx
);
2278 SET_EXPECT(OnInPlaceActivate
);
2279 SET_EXPECT(SetStatusText
);
2280 SET_EXPECT(Exec_SETPROGRESSMAX
);
2281 SET_EXPECT(Exec_SETPROGRESSPOS
);
2282 SET_EXPECT(OnUIActivate
);
2283 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
2285 hres
= IOleDocumentView_Show(view
, TRUE
);
2286 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2288 CHECK_CALLED(CanInPlaceActivate
);
2289 CHECK_CALLED(GetWindowContext
);
2290 CHECK_CALLED(GetWindow
);
2292 CHECK_CALLED(OnInPlaceActivateEx
);
2294 CHECK_CALLED(OnInPlaceActivate
);
2295 CHECK_CALLED(SetStatusText
);
2296 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2297 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2300 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &doc_hwnd
);
2301 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2302 ok(doc_hwnd
!= NULL
, "doc_hwnd == NULL\n");
2304 ok(doc_hwnd
== last_hwnd
, "doc_hwnd != last_hwnd\n");
2308 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
2311 IOleInPlaceActiveObject_Release(activeobj
);
2314 IOleDocument_Release(document
);
2320 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2321 DocumentSite_QueryInterface
,
2322 DocumentSite_AddRef
,
2323 DocumentSite_Release
,
2324 DocumentSite_ActivateMe
2327 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2329 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
2331 return QueryInterface(riid
, ppv
);
2334 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
2339 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
2344 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
2346 ok(0, "unexpected call\n");
2350 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
2352 ok(0, "unexpected call\n");
2356 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
2358 ok(0, "unexpected call\n");
2362 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
2363 POINTF
*pPtfContainer
, DWORD dwFlags
)
2365 ok(0, "unexpected call\n");
2369 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
2370 MSG
*pMsg
, DWORD grfModifiers
)
2372 ok(0, "unexpected call\n");
2376 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
2379 CHECK_EXPECT(OnFocus_TRUE
);
2381 CHECK_EXPECT2(OnFocus_FALSE
);
2385 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
2387 ok(0, "unexpected call\n");
2391 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
2392 OleControlSite_QueryInterface
,
2393 OleControlSite_AddRef
,
2394 OleControlSite_Release
,
2395 OleControlSite_OnControlInfoChanged
,
2396 OleControlSite_LockInPlaceActive
,
2397 OleControlSite_GetExtendedControl
,
2398 OleControlSite_TransformCoords
,
2399 OleControlSite_TranslateAccelerator
,
2400 OleControlSite_OnFocus
,
2401 OleControlSite_ShowPropertyFrame
2404 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
2406 static IDocHostUIHandler2
*expect_uihandler_iface
;
2408 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2410 return QueryInterface(riid
, ppv
);
2413 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
2418 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
2423 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
2424 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
2426 ok(0, "unexpected call\n");
2427 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2431 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
2433 CHECK_EXPECT(GetHostInfo
);
2434 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2435 ok(pInfo
!= NULL
, "pInfo=NULL\n");
2437 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
2438 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
2439 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2440 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2441 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
2442 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
2443 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
2444 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
2449 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
2450 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
2451 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
2453 CHECK_EXPECT(ShowUI
);
2454 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2457 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
2459 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
2460 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
2461 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
2462 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
2463 if (expect_InPlaceUIWindow_SetActiveObject_active
)
2464 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
2466 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
2471 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
2473 CHECK_EXPECT(HideUI
);
2474 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2478 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
2480 CHECK_EXPECT(UpdateUI
);
2481 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2485 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
2487 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2489 CHECK_EXPECT2(EnableModeless_TRUE
);
2491 CHECK_EXPECT2(EnableModeless_FALSE
);
2495 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2497 ok(0, "unexpected call\n");
2498 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2502 static BOOL expect_OnFrameWindowActivate_fActivate
;
2503 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2505 CHECK_EXPECT2(OnFrameWindowActivate
);
2506 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2507 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
2511 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
2512 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
2514 ok(0, "unexpected call\n");
2518 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
2519 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
2521 ok(0, "unexpected call\n");
2522 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2526 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
2527 LPOLESTR
*pchKey
, DWORD dw
)
2529 CHECK_EXPECT(GetOptionKeyPath
);
2530 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2531 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2532 ok(!dw
, "dw=%d, expected 0\n", dw
);
2534 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2538 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
2539 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
2541 CHECK_EXPECT(GetDropTarget
);
2542 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2547 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
2549 CHECK_EXPECT(GetExternal
);
2550 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2551 *ppDispatch
= &External
;
2555 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
2556 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
2558 CHECK_EXPECT(TranslateUrl
);
2559 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2560 ok(!dwTranslate
, "dwTranslate = %x\n", dwTranslate
);
2562 ok(!strcmp_wa(pchURLIn
, nav_serv_url
), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn
), nav_serv_url
);
2564 todo_wine
ok(!strcmp_wa(pchURLIn
, nav_serv_url
), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn
), nav_serv_url
);
2565 ok(ppchURLOut
!= NULL
, "ppchURLOut == NULL\n");
2566 ok(!*ppchURLOut
, "*ppchURLOut = %p\n", *ppchURLOut
);
2571 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
2572 IDataObject
**ppPORet
)
2574 ok(0, "unexpected call\n");
2575 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2579 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
2580 LPOLESTR
*pchKey
, DWORD dw
)
2582 CHECK_EXPECT(GetOverrideKeyPath
);
2583 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2584 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2586 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2587 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2591 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2592 DocHostUIHandler_QueryInterface
,
2593 DocHostUIHandler_AddRef
,
2594 DocHostUIHandler_Release
,
2595 DocHostUIHandler_ShowContextMenu
,
2596 DocHostUIHandler_GetHostInfo
,
2597 DocHostUIHandler_ShowUI
,
2598 DocHostUIHandler_HideUI
,
2599 DocHostUIHandler_UpdateUI
,
2600 DocHostUIHandler_EnableModeless
,
2601 DocHostUIHandler_OnDocWindowActivate
,
2602 DocHostUIHandler_OnFrameWindowActivate
,
2603 DocHostUIHandler_ResizeBorder
,
2604 DocHostUIHandler_TranslateAccelerator
,
2605 DocHostUIHandler_GetOptionKeyPath
,
2606 DocHostUIHandler_GetDropTarget
,
2607 DocHostUIHandler_GetExternal
,
2608 DocHostUIHandler_TranslateUrl
,
2609 DocHostUIHandler_FilterDataObject
,
2610 DocHostUIHandler_GetOverrideKeyPath
2613 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2615 static HRESULT WINAPI
CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2617 if(IsEqualGUID(&IID_IDocHostUIHandler2
, riid
)) {
2622 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2623 return E_NOINTERFACE
;
2625 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2626 return E_NOINTERFACE
; /* TODO */
2628 ok(0, "unexpected call %s\n", debugstr_guid(riid
));
2629 return E_NOINTERFACE
;
2632 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl
= {
2633 CustomDocHostUIHandler_QueryInterface
,
2634 DocHostUIHandler_AddRef
,
2635 DocHostUIHandler_Release
,
2636 DocHostUIHandler_ShowContextMenu
,
2637 DocHostUIHandler_GetHostInfo
,
2638 DocHostUIHandler_ShowUI
,
2639 DocHostUIHandler_HideUI
,
2640 DocHostUIHandler_UpdateUI
,
2641 DocHostUIHandler_EnableModeless
,
2642 DocHostUIHandler_OnDocWindowActivate
,
2643 DocHostUIHandler_OnFrameWindowActivate
,
2644 DocHostUIHandler_ResizeBorder
,
2645 DocHostUIHandler_TranslateAccelerator
,
2646 DocHostUIHandler_GetOptionKeyPath
,
2647 DocHostUIHandler_GetDropTarget
,
2648 DocHostUIHandler_GetExternal
,
2649 DocHostUIHandler_TranslateUrl
,
2650 DocHostUIHandler_FilterDataObject
,
2651 DocHostUIHandler_GetOverrideKeyPath
2654 static IDocHostUIHandler2 CustomDocHostUIHandler
= { &CustomDocHostUIHandlerVtbl
};
2656 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2657 REFIID riid
, void **ppv
)
2659 return QueryInterface(riid
, ppv
);
2662 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2667 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2672 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2673 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2675 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2676 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2677 ok(!pCmdText
, "pCmdText != NULL\n");
2679 switch(prgCmds
[0].cmdID
) {
2680 case OLECMDID_SETPROGRESSTEXT
:
2681 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2682 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2685 CHECK_EXPECT(QueryStatus_OPEN
);
2686 prgCmds
[0].cmdf
= 0;
2689 CHECK_EXPECT(QueryStatus_NEW
);
2690 prgCmds
[0].cmdf
= 0;
2693 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2699 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2700 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2702 if((!pguidCmdGroup
|| !IsEqualGUID(pguidCmdGroup
, &CGID_Explorer
))
2703 && (!pguidCmdGroup
|| !IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
) || nCmdID
!= 63))
2704 test_readyState(NULL
);
2706 if(!pguidCmdGroup
) {
2708 case OLECMDID_SETPROGRESSMAX
:
2709 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2710 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2711 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2713 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2714 if(load_state
== LD_NO
)
2715 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2717 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2719 case OLECMDID_SETPROGRESSPOS
:
2720 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2721 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2722 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2724 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2725 if(load_state
== LD_NO
)
2726 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2728 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2730 case OLECMDID_HTTPEQUIV_DONE
:
2731 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2732 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2733 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2734 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2735 readystate_set_loading
= FALSE
;
2736 readystate_set_interactive
= FALSE
;
2737 load_state
= LD_COMPLETE
;
2739 case OLECMDID_SETDOWNLOADSTATE
:
2740 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2741 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2742 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2743 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2745 switch(V_I4(pvaIn
)) {
2747 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2749 load_state
= LD_INTERACTIVE
;
2752 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2753 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
2756 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2760 case OLECMDID_UPDATECOMMANDS
:
2761 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2762 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2763 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2764 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2766 case OLECMDID_SETTITLE
:
2767 CHECK_EXPECT2(Exec_SETTITLE
);
2768 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2769 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2770 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2771 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2772 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2774 case OLECMDID_HTTPEQUIV
:
2775 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2776 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2777 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2778 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2779 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2780 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) = NULL\n");
2781 test_readyState(NULL
);
2783 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
2785 return E_FAIL
; /* FIXME */
2787 ok(0, "unexpected command %d\n", nCmdID
);
2792 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2793 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2797 CHECK_EXPECT2(Exec_ShellDocView_37
);
2800 test_GetCurMoniker(doc_unk
, NULL
, nav_url
);
2801 else if(load_from_stream
)
2802 test_GetCurMoniker(doc_unk
, NULL
, "about:blank");
2804 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
2806 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2807 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2809 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2810 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2815 IHTMLPrivateWindow
*priv_window
;
2818 CHECK_EXPECT(Exec_ShellDocView_63
);
2819 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2820 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2821 ok(V_UNKNOWN(pvaIn
) != NULL
, "VPUNKNOWN(pvaIn) = NULL\n");
2822 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2823 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2825 hres
= IUnknown_QueryInterface(V_UNKNOWN(pvaIn
), &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
2826 ok(hres
== S_OK
, "Could not get IHTMLPrivateWindow: %08x\n", hres
);
2828 IHTMLPrivateWindow_Release(priv_window
);
2830 load_state
= loading_js
? LD_COMPLETE
: LD_LOADING
;
2831 return S_OK
; /* TODO */
2835 CHECK_EXPECT(Exec_ShellDocView_67
);
2836 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2837 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2839 ok(!strcmp_wa(V_BSTR(pvaIn
), nav_serv_url
), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn
)), nav_serv_url
);
2841 todo_wine
ok(!strcmp_wa(V_BSTR(pvaIn
), nav_serv_url
), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn
)), nav_serv_url
);
2842 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2843 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2844 ok(V_BOOL(pvaOut
) == VARIANT_TRUE
, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut
));
2846 load_state
= LD_DOLOAD
;
2850 CHECK_EXPECT2(Exec_ShellDocView_84
);
2852 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2853 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2855 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2860 CHECK_EXPECT2(Exec_ShellDocView_103
);
2862 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2863 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2868 CHECK_EXPECT2(Exec_ShellDocView_105
);
2870 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2871 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2876 CHECK_EXPECT2(Exec_ShellDocView_140
);
2878 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2879 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2883 case 143: /* TODO */
2884 case 144: /* TODO */
2888 ok(0, "unexpected command %d\n", nCmdID
);
2893 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2894 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2897 case IDM_PARSECOMPLETE
:
2898 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2899 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2900 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2903 ok(0, "unexpected command %d\n", nCmdID
);
2907 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
2909 case DOCHOST_DOCCANNAVIGATE
:
2910 CHECK_EXPECT(Exec_DOCCANNAVIGATE
);
2911 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2912 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2913 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) != VT_UNKNOWN\n");
2914 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2923 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2924 ok(pvaOut
!= NULL
|| broken(!pvaOut
), "pvaOut != NULL\n");
2925 ok(V_VT(pvaIn
) == VT_ARRAY
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2927 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2928 sa
= V_ARRAY(pvaIn
);
2930 dim
= SafeArrayGetDim(sa
);
2931 ok(dim
== 1, "dim = %d\n", dim
);
2932 hres
= SafeArrayGetLBound(sa
, 1, &ind
);
2933 ok(hres
== S_OK
, "SafeArrayGetLBound failed: %x\n", hres
);
2934 ok(ind
== 0, "Lower bound = %d\n", ind
);
2935 hres
= SafeArrayGetUBound(sa
, 1, &ind
);
2936 ok(hres
== S_OK
, "SafeArrayGetUBound failed: %x\n", hres
);
2937 ok(ind
== 7 || broken(ind
== 5), "Upper bound = %d\n", ind
);
2940 SafeArrayGetElement(sa
, &ind
, &var
);
2941 ok(V_VT(&var
) == VT_I4
, "Incorrect data type: %d\n", V_VT(&var
));
2942 ok(V_I4(&var
) == status_code
, "Incorrect error code: %d\n", V_I4(&var
));
2945 SafeArrayGetElement(sa
, &ind
, &var
);
2946 ok(V_VT(&var
) == VT_BSTR
, "Incorrect data type: %d\n", V_VT(&var
));
2947 ok(!strcmp_wa(V_BSTR(&var
), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var
)));
2950 SafeArrayGetElement(sa
, &ind
, &var
);
2951 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
2954 SafeArrayGetElement(sa
, &ind
, &var
);
2955 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
2958 SafeArrayGetElement(sa
, &ind
, &var
);
2959 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
2960 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
2963 SafeArrayGetElement(sa
, &ind
, &var
);
2964 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
2965 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
2969 return E_FAIL
; /* TODO */
2973 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
2974 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2978 CHECK_EXPECT2(Exec_Explorer_38
);
2979 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2980 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2981 ok(!V_I4(pvaIn
), "V_I4(pvaIn) = %d\n", V_I4(pvaIn
));
2982 ok(!pvaOut
, "pvaOut != NULL\n");
2984 test_current_url(doc_unk
, prev_url
);
2988 CHECK_EXPECT2(Exec_Explorer_69
);
2989 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2990 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2992 case 109: /* TODO */
2995 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
3000 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
3002 case OLECMDID_PAGEACTIONBLOCKED
: /* win2k3 */
3003 SET_EXPECT(SetStatusText
);
3004 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
3005 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
3007 case OLECMDID_SHOWSCRIPTERROR
:
3011 ok(0, "unexpected command %d\n", nCmdID
);
3016 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup
));
3020 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
3021 OleCommandTarget_QueryInterface
,
3022 OleCommandTarget_AddRef
,
3023 OleCommandTarget_Release
,
3024 OleCommandTarget_QueryStatus
,
3025 OleCommandTarget_Exec
3028 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
3030 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
3032 return QueryInterface(riid
, ppv
);
3035 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
3036 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3037 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3039 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
3040 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
3041 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
3042 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
3043 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
3044 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
3045 test_readyState(NULL
);
3047 switch(dispIdMember
) {
3048 case DISPID_AMBIENT_USERMODE
:
3049 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
3050 V_VT(pVarResult
) = VT_BOOL
;
3051 V_BOOL(pVarResult
) = VARIANT_TRUE
;
3053 case DISPID_AMBIENT_DLCONTROL
:
3054 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
3056 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
3057 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3059 case DISPID_AMBIENT_SILENT
:
3060 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
3061 V_VT(pVarResult
) = VT_BOOL
;
3062 V_BOOL(pVarResult
) = VARIANT_FALSE
;
3064 case DISPID_AMBIENT_USERAGENT
:
3065 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
3067 case DISPID_AMBIENT_PALETTE
:
3068 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
3072 ok(0, "unexpected dispid %d\n", dispIdMember
);
3076 static const IDispatchVtbl DispatchVtbl
= {
3077 Dispatch_QueryInterface
,
3080 Dispatch_GetTypeInfoCount
,
3081 Dispatch_GetTypeInfo
,
3082 Dispatch_GetIDsOfNames
,
3086 static IDispatch Dispatch
= { &DispatchVtbl
};
3088 static HRESULT WINAPI
EventDispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
3090 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
3095 ok(0, "Unexpected call\n");
3096 return E_NOINTERFACE
;
3099 static HRESULT WINAPI
EventDispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
3100 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3101 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3104 IHTMLDocument2
*doc
;
3107 ok(IsEqualGUID(&IID_NULL
, riid
), "riid = %s\n", debugstr_guid(riid
));
3108 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
3109 ok(pExcepInfo
!= NULL
, "pExcepInfo == NULL\n");
3110 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
3111 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult
));
3112 ok(wFlags
== DISPATCH_METHOD
, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags
);
3114 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IHTMLDocument2
, (void**)&doc
);
3115 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
3117 switch(dispIdMember
) {
3118 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE
:
3119 hres
= IHTMLDocument2_get_readyState(doc
, &state
);
3120 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3122 if(!strcmp_wa(state
, "interactive"))
3123 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive
);
3124 else if(!strcmp_wa(state
, "loading"))
3125 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading
);
3126 else if(!strcmp_wa(state
, "complete")) {
3127 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete
);
3130 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state
));
3132 SysFreeString(state
);
3134 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE
:
3145 break; /* FIXME: Handle these events. */
3147 ok(0, "Unexpected DISPID: %d\n", dispIdMember
);
3150 IHTMLDocument2_Release(doc
);
3154 static const IDispatchVtbl EventDispatchVtbl
= {
3155 EventDispatch_QueryInterface
,
3158 Dispatch_GetTypeInfoCount
,
3159 Dispatch_GetTypeInfo
,
3160 Dispatch_GetIDsOfNames
,
3161 EventDispatch_Invoke
3164 static IDispatch EventDispatch
= { &EventDispatchVtbl
};
3166 static HRESULT WINAPI
TravelLog_QueryInterface(ITravelLog
*iface
, REFIID riid
, void **ppv
)
3168 static const IID IID_IIETravelLog2
= {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3170 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_ITravelLog
, riid
)) {
3175 if(!IsEqualGUID(&IID_IIETravelLog2
, riid
))
3176 ok(0, "unexpected call %s\n", debugstr_guid(riid
));
3179 return E_NOINTERFACE
;
3182 static ULONG WINAPI
TravelLog_AddRef(ITravelLog
*iface
)
3187 static ULONG WINAPI
TravelLog_Release(ITravelLog
*iface
)
3192 static HRESULT WINAPI
TravelLog_AddEntry(ITravelLog
*iface
, IUnknown
*punk
, BOOL fIsLocalAnchor
)
3194 ok(0, "unexpected call\n");
3198 static HRESULT WINAPI
TravelLog_UpdateEntry(ITravelLog
*iface
, IUnknown
*punk
, BOOL fIsLocalAnchor
)
3200 ok(0, "unexpected call\n");
3204 static HRESULT WINAPI
TravelLog_UpdateExternal(ITravelLog
*iface
, IUnknown
*punk
, IUnknown
*punkHLBrowseContext
)
3206 ok(0, "unexpected call\n");
3210 static HRESULT WINAPI
TravelLog_Travel(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
)
3212 ok(0, "unexpected call\n");
3216 static HRESULT WINAPI
TravelLog_GetTravelEntry(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
, ITravelEntry
**ppte
)
3218 ok(0, "unexpected call\n");
3222 static HRESULT WINAPI
TravelLog_FindTravelEntry(ITravelLog
*iface
, IUnknown
*punk
, LPCITEMIDLIST pidl
, ITravelEntry
**ppte
)
3224 ok(0, "unexpected call\n");
3228 static HRESULT WINAPI
TravelLog_GetTooltipText(ITravelLog
*iface
, IUnknown
*punk
, int iOffset
, int idsTemplate
,
3229 LPWSTR pwzText
, DWORD cchText
)
3231 ok(0, "unexpected call\n");
3235 static HRESULT WINAPI
TravelLog_InsertMenuEntries(ITravelLog
*iface
, IUnknown
*punk
, HMENU hmenu
, int nPos
,
3236 int idFirst
, int idLast
, DWORD dwFlags
)
3238 ok(0, "unexpected call\n");
3242 static HRESULT WINAPI
TravelLog_Clone(ITravelLog
*iface
, ITravelLog
**pptl
)
3244 ok(0, "unexpected call\n");
3248 static DWORD WINAPI
TravelLog_CountEntries(ITravelLog
*iface
, IUnknown
*punk
)
3250 CHECK_EXPECT(CountEntries
);
3254 static HRESULT WINAPI
TravelLog_Revert(ITravelLog
*iface
)
3256 ok(0, "unexpected call\n");
3260 static const ITravelLogVtbl TravelLogVtbl
= {
3261 TravelLog_QueryInterface
,
3265 TravelLog_UpdateEntry
,
3266 TravelLog_UpdateExternal
,
3268 TravelLog_GetTravelEntry
,
3269 TravelLog_FindTravelEntry
,
3270 TravelLog_GetTooltipText
,
3271 TravelLog_InsertMenuEntries
,
3273 TravelLog_CountEntries
,
3277 static ITravelLog TravelLog
= { &TravelLogVtbl
};
3279 static HRESULT
browserservice_qi(REFIID
,void**);
3281 static HRESULT WINAPI
DocObjectService_QueryInterface(IDocObjectService
* This
, REFIID riid
, void **ppv
)
3283 return browserservice_qi(riid
, ppv
);
3286 static ULONG WINAPI
DocObjectService_AddRef(
3287 IDocObjectService
* This
)
3292 static ULONG WINAPI
DocObjectService_Release(
3293 IDocObjectService
* This
)
3298 static HRESULT WINAPI
DocObjectService_FireBeforeNavigate2(IDocObjectService
*iface
, IDispatch
*pDispatch
,
3299 LPCWSTR lpszUrl
, DWORD dwFlags
, LPCWSTR lpszFrameName
, BYTE
*pPostData
, DWORD cbPostData
,
3300 LPCWSTR lpszHeaders
, BOOL fPlayNavSound
, BOOL
*pfCancel
)
3302 CHECK_EXPECT(FireBeforeNavigate2
);
3304 ok(!pDispatch
, "pDispatch = %p\n", pDispatch
);
3305 ok(!strcmp_wa(lpszUrl
, nav_url
), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl
), nav_url
);
3306 ok(dwFlags
== 0x40 || !dwFlags
, "dwFlags = %x\n", dwFlags
);
3307 ok(!lpszFrameName
, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName
));
3308 ok(!pPostData
, "pPostData = %p\n", pPostData
);
3309 ok(!cbPostData
, "cbPostData = %d\n", cbPostData
);
3310 ok(!lpszHeaders
, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders
));
3311 ok(fPlayNavSound
, "fPlayNavSound = %x\n", fPlayNavSound
);
3312 ok(pfCancel
!= NULL
, "pfCancel = NULL\n");
3313 ok(!*pfCancel
, "*pfCancel = %x\n", *pfCancel
);
3318 static HRESULT WINAPI
DocObjectService_FireNavigateComplete2(
3319 IDocObjectService
* This
,
3320 IHTMLWindow2
*pHTMLWindow2
,
3323 CHECK_EXPECT(FireNavigateComplete2
);
3324 test_readyState(NULL
);
3327 ok(dwFlags
== 0x10 || broken(!dwFlags
), "dwFlags = %x, expected 0x10\n", dwFlags
);
3329 ok(!(dwFlags
&~1), "dwFlags = %x\n", dwFlags
);
3331 ok(pHTMLWindow2
!= NULL
, "pHTMLWindow2 = NULL\n");
3336 static HRESULT WINAPI
DocObjectService_FireDownloadBegin(
3337 IDocObjectService
* This
)
3339 ok(0, "unexpected call\n");
3343 static HRESULT WINAPI
DocObjectService_FireDownloadComplete(
3344 IDocObjectService
* This
)
3346 ok(0, "unexpected call\n");
3350 static HRESULT WINAPI
DocObjectService_FireDocumentComplete(
3351 IDocObjectService
* This
,
3352 IHTMLWindow2
*pHTMLWindow
,
3355 CHECK_EXPECT(FireDocumentComplete
);
3357 ok(pHTMLWindow
!= NULL
, "pHTMLWindow == NULL\n");
3358 ok(!dwFlags
, "dwFlags = %x\n", dwFlags
);
3363 static HRESULT WINAPI
DocObjectService_UpdateDesktopComponent(
3364 IDocObjectService
* This
,
3365 IHTMLWindow2
*pHTMLWindow
)
3367 ok(0, "unexpected call\n");
3371 static HRESULT WINAPI
DocObjectService_GetPendingUrl(
3372 IDocObjectService
* This
,
3373 BSTR
*pbstrPendingUrl
)
3375 CHECK_EXPECT(GetPendingUrl
);
3379 static HRESULT WINAPI
DocObjectService_ActiveElementChanged(
3380 IDocObjectService
* This
,
3381 IHTMLElement
*pHTMLElement
)
3383 CHECK_EXPECT(ActiveElementChanged
);
3387 static HRESULT WINAPI
DocObjectService_GetUrlSearchComponent(
3388 IDocObjectService
* This
,
3391 ok(0, "unexpected call\n");
3395 static HRESULT WINAPI
DocObjectService_IsErrorUrl(
3396 IDocObjectService
* This
,
3400 CHECK_EXPECT(IsErrorUrl
);
3405 static IDocObjectServiceVtbl DocObjectServiceVtbl
= {
3406 DocObjectService_QueryInterface
,
3407 DocObjectService_AddRef
,
3408 DocObjectService_Release
,
3409 DocObjectService_FireBeforeNavigate2
,
3410 DocObjectService_FireNavigateComplete2
,
3411 DocObjectService_FireDownloadBegin
,
3412 DocObjectService_FireDownloadComplete
,
3413 DocObjectService_FireDocumentComplete
,
3414 DocObjectService_UpdateDesktopComponent
,
3415 DocObjectService_GetPendingUrl
,
3416 DocObjectService_ActiveElementChanged
,
3417 DocObjectService_GetUrlSearchComponent
,
3418 DocObjectService_IsErrorUrl
3421 static IDocObjectService DocObjectService
= { &DocObjectServiceVtbl
};
3423 static HRESULT WINAPI
ShellBrowser_QueryInterface(IShellBrowser
*iface
, REFIID riid
, void **ppv
)
3425 return browserservice_qi(riid
, ppv
);
3428 static ULONG WINAPI
ShellBrowser_AddRef(IShellBrowser
*iface
)
3433 static ULONG WINAPI
ShellBrowser_Release(IShellBrowser
*iface
)
3438 static HRESULT WINAPI
ShellBrowser_GetWindow(IShellBrowser
*iface
, HWND
*phwnd
)
3440 ok(0, "unexpected call\n");
3444 static HRESULT WINAPI
ShellBrowser_ContextSensitiveHelp(IShellBrowser
*iface
, BOOL fEnterMode
)
3446 ok(0, "unexpected call\n");
3450 static HRESULT WINAPI
ShellBrowser_InsertMenusSB(IShellBrowser
*iface
, HMENU hmenuShared
, LPOLEMENUGROUPWIDTHS lpMenuWidths
)
3452 ok(0, "unexpected call\n");
3456 static HRESULT WINAPI
ShellBrowser_SetMenuSB(IShellBrowser
*iface
, HMENU hmenuShared
, HOLEMENU holemenuReserved
,
3457 HWND hwndActiveObject
)
3459 ok(0, "unexpected call\n");
3463 static HRESULT WINAPI
ShellBrowser_RemoveMenusSB(IShellBrowser
*iface
, HMENU hmenuShared
)
3465 ok(0, "unexpected call\n");
3469 static HRESULT WINAPI
ShellBrowser_SetStatusTextSB(IShellBrowser
*iface
, LPCOLESTR pszStatusText
)
3471 ok(0, "unexpected call\n");
3475 static HRESULT WINAPI
ShellBrowser_EnableModelessSB(IShellBrowser
*iface
, BOOL fEnable
)
3477 ok(0, "unexpected call\n");
3481 static HRESULT WINAPI
ShellBrowser_TranslateAcceleratorSB(IShellBrowser
*iface
, MSG
*pmsg
, WORD wID
)
3483 ok(0, "unexpected call\n");
3487 static HRESULT WINAPI
ShellBrowser_BrowseObject(IShellBrowser
*iface
, LPCITEMIDLIST pidl
, UINT wFlags
)
3489 ok(0, "unexpected call\n");
3493 static HRESULT WINAPI
ShellBrowser_GetViewStateStream(IShellBrowser
*iface
, DWORD grfMode
, IStream
**ppStrm
)
3495 ok(0, "unexpected call\n");
3499 static HRESULT WINAPI
ShellBrowser_GetControlWindow(IShellBrowser
*iface
, UINT id
, HWND
*phwnd
)
3501 ok(0, "unexpected call\n");
3505 static HRESULT WINAPI
ShellBrowser_SendControlMsg(IShellBrowser
*iface
, UINT id
, UINT uMsg
, WPARAM wParam
,
3506 LPARAM lParam
, LRESULT
*pret
)
3508 ok(0, "unexpected call\n");
3512 static HRESULT WINAPI
ShellBrowser_QueryActiveShellView(IShellBrowser
*iface
, IShellView
**ppshv
)
3514 ok(0, "unexpected call\n");
3518 static HRESULT WINAPI
ShellBrowser_OnViewWindowActive(IShellBrowser
* iface
, IShellView
*pshv
)
3520 ok(0, "unexpected call\n");
3524 static HRESULT WINAPI
ShellBrowser_SetToolbarItems(IShellBrowser
*iface
, LPTBBUTTONSB lpButtons
,
3525 UINT nButtons
, UINT uFlags
)
3527 ok(0, "unexpected call\n");
3531 static const IShellBrowserVtbl ShellBrowserVtbl
= {
3532 ShellBrowser_QueryInterface
,
3533 ShellBrowser_AddRef
,
3534 ShellBrowser_Release
,
3535 ShellBrowser_GetWindow
,
3536 ShellBrowser_ContextSensitiveHelp
,
3537 ShellBrowser_InsertMenusSB
,
3538 ShellBrowser_SetMenuSB
,
3539 ShellBrowser_RemoveMenusSB
,
3540 ShellBrowser_SetStatusTextSB
,
3541 ShellBrowser_EnableModelessSB
,
3542 ShellBrowser_TranslateAcceleratorSB
,
3543 ShellBrowser_BrowseObject
,
3544 ShellBrowser_GetViewStateStream
,
3545 ShellBrowser_GetControlWindow
,
3546 ShellBrowser_SendControlMsg
,
3547 ShellBrowser_QueryActiveShellView
,
3548 ShellBrowser_OnViewWindowActive
,
3549 ShellBrowser_SetToolbarItems
3552 static IShellBrowser ShellBrowser
= { &ShellBrowserVtbl
};
3554 static HRESULT WINAPI
BrowserService_QueryInterface(IBrowserService
*iface
, REFIID riid
, void **ppv
)
3556 return browserservice_qi(riid
, ppv
);
3559 static ULONG WINAPI
BrowserService_AddRef(
3560 IBrowserService
* This
)
3565 static ULONG WINAPI
BrowserService_Release(
3566 IBrowserService
* This
)
3571 static HRESULT WINAPI
BrowserService_GetParentSite(
3572 IBrowserService
* This
,
3573 IOleInPlaceSite
**ppipsite
)
3575 ok(0, "unexpected call\n");
3579 static HRESULT WINAPI
BrowserService_SetTitle(
3580 IBrowserService
* This
,
3584 ok(0, "unexpected call\n");
3588 static HRESULT WINAPI
BrowserService_GetTitle(
3589 IBrowserService
* This
,
3594 ok(0, "unexpected call\n");
3598 static HRESULT WINAPI
BrowserService_GetOleObject(
3599 IBrowserService
* This
,
3600 IOleObject
**ppobjv
)
3602 ok(0, "unexpected call\n");
3606 static HRESULT WINAPI
BrowserService_GetTravelLog(IBrowserService
* This
, ITravelLog
**pptl
)
3608 CHECK_EXPECT(GetTravelLog
);
3610 ok(pptl
!= NULL
, "pptl = NULL\n");
3619 static HRESULT WINAPI
BrowserService_ShowControlWindow(
3620 IBrowserService
* This
,
3624 ok(0, "unexpected call\n");
3628 static HRESULT WINAPI
BrowserService_IsControlWindowShown(
3629 IBrowserService
* This
,
3633 ok(0, "unexpected call\n");
3637 static HRESULT WINAPI
BrowserService_IEGetDisplayName(
3638 IBrowserService
* This
,
3639 PCIDLIST_ABSOLUTE pidl
,
3643 ok(0, "unexpected call\n");
3647 static HRESULT WINAPI
BrowserService_IEParseDisplayName(
3648 IBrowserService
* This
,
3651 PIDLIST_ABSOLUTE
*ppidlOut
)
3653 ok(0, "unexpected call\n");
3657 static HRESULT WINAPI
BrowserService_DisplayParseError(
3658 IBrowserService
* This
,
3662 ok(0, "unexpected call\n");
3666 static HRESULT WINAPI
BrowserService_NavigateToPidl(
3667 IBrowserService
* This
,
3668 PCIDLIST_ABSOLUTE pidl
,
3671 ok(0, "unexpected call\n");
3675 static HRESULT WINAPI
BrowserService_SetNavigateState(
3676 IBrowserService
* This
,
3679 ok(0, "unexpected call\n");
3683 static HRESULT WINAPI
BrowserService_GetNavigateState(
3684 IBrowserService
* This
,
3687 ok(0, "unexpected call\n");
3691 static HRESULT WINAPI
BrowserService_NotifyRedirect(
3692 IBrowserService
* This
,
3694 PCIDLIST_ABSOLUTE pidl
,
3697 ok(0, "unexpected call\n");
3701 static HRESULT WINAPI
BrowserService_UpdateWindowList(
3702 IBrowserService
* This
)
3704 ok(0, "unexpected call\n");
3708 static HRESULT WINAPI
BrowserService_UpdateBackForwardState(
3709 IBrowserService
* This
)
3711 CHECK_EXPECT(UpdateBackForwardState
);
3715 static HRESULT WINAPI
BrowserService_SetFlags(
3716 IBrowserService
* This
,
3720 ok(0, "unexpected call\n");
3724 static HRESULT WINAPI
BrowserService_GetFlags(
3725 IBrowserService
* This
,
3728 ok(0, "unexpected call\n");
3732 static HRESULT WINAPI
BrowserService_CanNavigateNow(
3733 IBrowserService
* This
)
3735 ok(0, "unexpected call\n");
3739 static HRESULT WINAPI
BrowserService_GetPidl(
3740 IBrowserService
* This
,
3741 PIDLIST_ABSOLUTE
*ppidl
)
3743 ok(0, "unexpected call\n");
3747 static HRESULT WINAPI
BrowserService_SetReferrer(
3748 IBrowserService
* This
,
3749 PCIDLIST_ABSOLUTE pidl
)
3751 ok(0, "unexpected call\n");
3755 static DWORD WINAPI
BrowserService_GetBrowserIndex(
3756 IBrowserService
* This
)
3758 ok(0, "unexpected call\n");
3762 static HRESULT WINAPI
BrowserService_GetBrowserByIndex(
3763 IBrowserService
* This
,
3767 ok(0, "unexpected call\n");
3771 static HRESULT WINAPI
BrowserService_GetHistoryObject(
3772 IBrowserService
* This
,
3777 ok(0, "unexpected call\n");
3781 static HRESULT WINAPI
BrowserService_SetHistoryObject(
3782 IBrowserService
* This
,
3784 BOOL fIsLocalAnchor
)
3786 ok(0, "unexpected call\n");
3790 static HRESULT WINAPI
BrowserService_CacheOLEServer(
3791 IBrowserService
* This
,
3794 ok(0, "unexpected call\n");
3798 static HRESULT WINAPI
BrowserService_GetSetCodePage(
3799 IBrowserService
* This
,
3803 ok(0, "unexpected call\n");
3807 static HRESULT WINAPI
BrowserService_OnHttpEquiv(
3808 IBrowserService
* This
,
3812 VARIANT
*pvarargOut
)
3814 ok(0, "unexpected call\n");
3818 static HRESULT WINAPI
BrowserService_GetPalette(
3819 IBrowserService
* This
,
3822 ok(0, "unexpected call\n");
3826 static HRESULT WINAPI
BrowserService_RegisterWindow(
3827 IBrowserService
* This
,
3828 BOOL fForceRegister
,
3831 ok(0, "unexpected call\n");
3835 static IBrowserServiceVtbl BrowserServiceVtbl
= {
3836 BrowserService_QueryInterface
,
3837 BrowserService_AddRef
,
3838 BrowserService_Release
,
3839 BrowserService_GetParentSite
,
3840 BrowserService_SetTitle
,
3841 BrowserService_GetTitle
,
3842 BrowserService_GetOleObject
,
3843 BrowserService_GetTravelLog
,
3844 BrowserService_ShowControlWindow
,
3845 BrowserService_IsControlWindowShown
,
3846 BrowserService_IEGetDisplayName
,
3847 BrowserService_IEParseDisplayName
,
3848 BrowserService_DisplayParseError
,
3849 BrowserService_NavigateToPidl
,
3850 BrowserService_SetNavigateState
,
3851 BrowserService_GetNavigateState
,
3852 BrowserService_NotifyRedirect
,
3853 BrowserService_UpdateWindowList
,
3854 BrowserService_UpdateBackForwardState
,
3855 BrowserService_SetFlags
,
3856 BrowserService_GetFlags
,
3857 BrowserService_CanNavigateNow
,
3858 BrowserService_GetPidl
,
3859 BrowserService_SetReferrer
,
3860 BrowserService_GetBrowserIndex
,
3861 BrowserService_GetBrowserByIndex
,
3862 BrowserService_GetHistoryObject
,
3863 BrowserService_SetHistoryObject
,
3864 BrowserService_CacheOLEServer
,
3865 BrowserService_GetSetCodePage
,
3866 BrowserService_OnHttpEquiv
,
3867 BrowserService_GetPalette
,
3868 BrowserService_RegisterWindow
3871 static IBrowserService BrowserService
= { &BrowserServiceVtbl
};
3873 DEFINE_GUID(IID_ITabBrowserService
, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3875 static HRESULT
browserservice_qi(REFIID riid
, void **ppv
)
3877 if(IsEqualGUID(&IID_IShellBrowser
, riid
)) {
3878 *ppv
= &ShellBrowser
;
3882 if(IsEqualGUID(&IID_IDocObjectService
, riid
)) {
3883 *ppv
= &DocObjectService
;
3887 if(IsEqualGUID(&IID_IBrowserService
, riid
)) {
3888 *ppv
= &BrowserService
;
3893 return E_NOINTERFACE
;
3896 static HRESULT WINAPI
WebBrowser_QueryInterface(IWebBrowser2
*iface
, REFIID riid
, void **ppv
)
3900 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IWebBrowser
, riid
)
3901 || IsEqualGUID(&IID_IWebBrowserApp
, riid
) || IsEqualGUID(&IID_IWebBrowser2
, riid
)) {
3906 if(IsEqualGUID(riid
, &IID_IOleObject
))
3907 return E_NOINTERFACE
; /* TODO */
3909 ok(0, "unexpected call %s\n", debugstr_guid(riid
));
3910 return E_NOINTERFACE
;
3913 static ULONG WINAPI
WebBrowser_AddRef(IWebBrowser2
*iface
)
3918 static ULONG WINAPI
WebBrowser_Release(IWebBrowser2
*iface
)
3923 static HRESULT WINAPI
WebBrowser_GetTypeInfoCount(IWebBrowser2
*iface
, UINT
*pctinfo
)
3925 ok(0, "unexpected call\n");
3929 static HRESULT WINAPI
WebBrowser_GetTypeInfo(IWebBrowser2
*iface
, UINT iTInfo
, LCID lcid
,
3930 LPTYPEINFO
*ppTInfo
)
3932 ok(0, "unexpected call\n");
3936 static HRESULT WINAPI
WebBrowser_GetIDsOfNames(IWebBrowser2
*iface
, REFIID riid
,
3937 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3939 ok(0, "unexpected call\n");
3943 static HRESULT WINAPI
WebBrowser_Invoke(IWebBrowser2
*iface
, DISPID dispIdMember
,
3944 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3945 EXCEPINFO
*pExepInfo
, UINT
*puArgErr
)
3947 ok(0, "unexpected call\n");
3951 static HRESULT WINAPI
WebBrowser_GoBack(IWebBrowser2
*iface
)
3953 ok(0, "unexpected call\n");
3957 static HRESULT WINAPI
WebBrowser_GoForward(IWebBrowser2
*iface
)
3959 ok(0, "unexpected call\n");
3963 static HRESULT WINAPI
WebBrowser_GoHome(IWebBrowser2
*iface
)
3965 ok(0, "unexpected call\n");
3969 static HRESULT WINAPI
WebBrowser_GoSearch(IWebBrowser2
*iface
)
3971 ok(0, "unexpected call\n");
3975 static HRESULT WINAPI
WebBrowser_Navigate(IWebBrowser2
*iface
, BSTR szUrl
,
3976 VARIANT
*Flags
, VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
3978 ok(0, "unexpected call\n");
3982 static HRESULT WINAPI
WebBrowser_Refresh(IWebBrowser2
*iface
)
3984 ok(0, "unexpected call\n");
3988 static HRESULT WINAPI
WebBrowser_Refresh2(IWebBrowser2
*iface
, VARIANT
*Level
)
3990 ok(0, "unexpected call\n");
3994 static HRESULT WINAPI
WebBrowser_Stop(IWebBrowser2
*iface
)
3996 ok(0, "unexpected call\n");
4000 static HRESULT WINAPI
WebBrowser_get_Application(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4002 ok(0, "unexpected call\n");
4006 static HRESULT WINAPI
WebBrowser_get_Parent(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4008 ok(0, "unexpected call\n");
4012 static HRESULT WINAPI
WebBrowser_get_Container(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4014 ok(0, "unexpected call\n");
4018 static HRESULT WINAPI
WebBrowser_get_Document(IWebBrowser2
*iface
, IDispatch
**ppDisp
)
4020 ok(0, "unexpected call\n");
4024 static HRESULT WINAPI
WebBrowser_get_TopLevelContainer(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4026 ok(0, "unexpected call\n");
4030 static HRESULT WINAPI
WebBrowser_get_Type(IWebBrowser2
*iface
, BSTR
*Type
)
4032 ok(0, "unexpected call\n");
4036 static HRESULT WINAPI
WebBrowser_get_Left(IWebBrowser2
*iface
, LONG
*pl
)
4038 ok(0, "unexpected call\n");
4042 static HRESULT WINAPI
WebBrowser_put_Left(IWebBrowser2
*iface
, LONG Left
)
4044 ok(0, "unexpected call\n");
4048 static HRESULT WINAPI
WebBrowser_get_Top(IWebBrowser2
*iface
, LONG
*pl
)
4050 ok(0, "unexpected call\n");
4054 static HRESULT WINAPI
WebBrowser_put_Top(IWebBrowser2
*iface
, LONG Top
)
4056 ok(0, "unexpected call\n");
4060 static HRESULT WINAPI
WebBrowser_get_Width(IWebBrowser2
*iface
, LONG
*pl
)
4062 ok(0, "unexpected call\n");
4066 static HRESULT WINAPI
WebBrowser_put_Width(IWebBrowser2
*iface
, LONG Width
)
4068 ok(0, "unexpected call\n");
4072 static HRESULT WINAPI
WebBrowser_get_Height(IWebBrowser2
*iface
, LONG
*pl
)
4074 ok(0, "unexpected call\n");
4078 static HRESULT WINAPI
WebBrowser_put_Height(IWebBrowser2
*iface
, LONG Height
)
4080 ok(0, "unexpected call\n");
4084 static HRESULT WINAPI
WebBrowser_get_LocationName(IWebBrowser2
*iface
, BSTR
*LocationName
)
4086 ok(0, "unexpected call\n");
4090 static HRESULT WINAPI
WebBrowser_get_LocationURL(IWebBrowser2
*iface
, BSTR
*LocationURL
)
4092 CHECK_EXPECT(get_LocationURL
);
4096 static HRESULT WINAPI
WebBrowser_get_Busy(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4098 ok(0, "unexpected call\n");
4102 static HRESULT WINAPI
WebBrowser_Quit(IWebBrowser2
*iface
)
4104 ok(0, "unexpected call\n");
4108 static HRESULT WINAPI
WebBrowser_ClientToWindow(IWebBrowser2
*iface
, int *pcx
, int *pcy
)
4110 ok(0, "unexpected call\n");
4114 static HRESULT WINAPI
WebBrowser_PutProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT vtValue
)
4116 ok(0, "unexpected call\n");
4120 static HRESULT WINAPI
WebBrowser_GetProperty(IWebBrowser2
*iface
, BSTR szProperty
, VARIANT
*pvtValue
)
4122 ok(0, "unexpected call\n");
4126 static HRESULT WINAPI
WebBrowser_get_Name(IWebBrowser2
*iface
, BSTR
*Name
)
4128 ok(0, "unexpected call\n");
4132 static HRESULT WINAPI
WebBrowser_get_HWND(IWebBrowser2
*iface
, LONG
*pHWND
)
4134 ok(0, "unexpected call\n");
4138 static HRESULT WINAPI
WebBrowser_get_FullName(IWebBrowser2
*iface
, BSTR
*FullName
)
4140 ok(0, "unexpected call\n");
4144 static HRESULT WINAPI
WebBrowser_get_Path(IWebBrowser2
*iface
, BSTR
*Path
)
4146 ok(0, "unexpected call\n");
4150 static HRESULT WINAPI
WebBrowser_get_Visible(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4152 ok(0, "unexpected call\n");
4156 static HRESULT WINAPI
WebBrowser_put_Visible(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4158 ok(0, "unexpected call\n");
4162 static HRESULT WINAPI
WebBrowser_get_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL
*pBool
)
4164 ok(0, "unexpected call\n");
4168 static HRESULT WINAPI
WebBrowser_put_StatusBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4170 ok(0, "unexpected call\n");
4174 static HRESULT WINAPI
WebBrowser_get_StatusText(IWebBrowser2
*iface
, BSTR
*StatusText
)
4176 ok(0, "unexpected call\n");
4180 static HRESULT WINAPI
WebBrowser_put_StatusText(IWebBrowser2
*iface
, BSTR StatusText
)
4182 ok(0, "unexpected call\n");
4186 static HRESULT WINAPI
WebBrowser_get_ToolBar(IWebBrowser2
*iface
, int *Value
)
4188 ok(0, "unexpected call\n");
4192 static HRESULT WINAPI
WebBrowser_put_ToolBar(IWebBrowser2
*iface
, int Value
)
4194 ok(0, "unexpected call\n");
4198 static HRESULT WINAPI
WebBrowser_get_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4200 ok(0, "unexpected call\n");
4204 static HRESULT WINAPI
WebBrowser_put_MenuBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4206 ok(0, "unexpected call\n");
4210 static HRESULT WINAPI
WebBrowser_get_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL
*pbFullScreen
)
4212 ok(0, "unexpected call\n");
4216 static HRESULT WINAPI
WebBrowser_put_FullScreen(IWebBrowser2
*iface
, VARIANT_BOOL bFullScreen
)
4218 ok(0, "unexpected call\n");
4222 static HRESULT WINAPI
WebBrowser_Navigate2(IWebBrowser2
*iface
, VARIANT
*URL
, VARIANT
*Flags
,
4223 VARIANT
*TargetFrameName
, VARIANT
*PostData
, VARIANT
*Headers
)
4225 ok(0, "unexpected call\n");
4229 static HRESULT WINAPI
WebBrowser_QueryStatusWB(IWebBrowser2
*iface
, OLECMDID cmdID
, OLECMDF
*pcmdf
)
4231 ok(0, "unexpected call\n");
4235 static HRESULT WINAPI
WebBrowser_ExecWB(IWebBrowser2
*iface
, OLECMDID cmdID
,
4236 OLECMDEXECOPT cmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
4238 ok(0, "unexpected call\n");
4242 static HRESULT WINAPI
WebBrowser_ShowBrowserBar(IWebBrowser2
*iface
, VARIANT
*pvaClsid
,
4243 VARIANT
*pvarShow
, VARIANT
*pvarSize
)
4245 ok(0, "unexpected call\n");
4249 static HRESULT WINAPI
WebBrowser_get_ReadyState(IWebBrowser2
*iface
, READYSTATE
*lpReadyState
)
4251 ok(0, "unexpected call\n");
4255 static HRESULT WINAPI
WebBrowser_get_Offline(IWebBrowser2
*iface
, VARIANT_BOOL
*pbOffline
)
4257 ok(0, "unexpected call\n");
4261 static HRESULT WINAPI
WebBrowser_put_Offline(IWebBrowser2
*iface
, VARIANT_BOOL bOffline
)
4263 ok(0, "unexpected call\n");
4267 static HRESULT WINAPI
WebBrowser_get_Silent(IWebBrowser2
*iface
, VARIANT_BOOL
*pbSilent
)
4269 ok(0, "unexpected call\n");
4273 static HRESULT WINAPI
WebBrowser_put_Silent(IWebBrowser2
*iface
, VARIANT_BOOL bSilent
)
4275 ok(0, "unexpected call\n");
4279 static HRESULT WINAPI
WebBrowser_get_RegisterAsBrowser(IWebBrowser2
*iface
,
4280 VARIANT_BOOL
*pbRegister
)
4282 ok(0, "unexpected call\n");
4286 static HRESULT WINAPI
WebBrowser_put_RegisterAsBrowser(IWebBrowser2
*iface
,
4287 VARIANT_BOOL bRegister
)
4289 ok(0, "unexpected call\n");
4293 static HRESULT WINAPI
WebBrowser_get_RegisterAsDropTarget(IWebBrowser2
*iface
,
4294 VARIANT_BOOL
*pbRegister
)
4296 ok(0, "unexpected call\n");
4300 static HRESULT WINAPI
WebBrowser_put_RegisterAsDropTarget(IWebBrowser2
*iface
,
4301 VARIANT_BOOL bRegister
)
4303 ok(0, "unexpected call\n");
4307 static HRESULT WINAPI
WebBrowser_get_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL
*pbRegister
)
4309 ok(0, "unexpected call\n");
4313 static HRESULT WINAPI
WebBrowser_put_TheaterMode(IWebBrowser2
*iface
, VARIANT_BOOL bRegister
)
4315 ok(0, "unexpected call\n");
4319 static HRESULT WINAPI
WebBrowser_get_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4321 ok(0, "unexpected call\n");
4325 static HRESULT WINAPI
WebBrowser_put_AddressBar(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4327 ok(0, "unexpected call\n");
4331 static HRESULT WINAPI
WebBrowser_get_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL
*Value
)
4333 ok(0, "unexpected call\n");
4337 static HRESULT WINAPI
WebBrowser_put_Resizable(IWebBrowser2
*iface
, VARIANT_BOOL Value
)
4339 ok(0, "unexpected call\n");
4343 static const IWebBrowser2Vtbl WebBrowser2Vtbl
=
4345 WebBrowser_QueryInterface
,
4348 WebBrowser_GetTypeInfoCount
,
4349 WebBrowser_GetTypeInfo
,
4350 WebBrowser_GetIDsOfNames
,
4353 WebBrowser_GoForward
,
4355 WebBrowser_GoSearch
,
4356 WebBrowser_Navigate
,
4358 WebBrowser_Refresh2
,
4360 WebBrowser_get_Application
,
4361 WebBrowser_get_Parent
,
4362 WebBrowser_get_Container
,
4363 WebBrowser_get_Document
,
4364 WebBrowser_get_TopLevelContainer
,
4365 WebBrowser_get_Type
,
4366 WebBrowser_get_Left
,
4367 WebBrowser_put_Left
,
4370 WebBrowser_get_Width
,
4371 WebBrowser_put_Width
,
4372 WebBrowser_get_Height
,
4373 WebBrowser_put_Height
,
4374 WebBrowser_get_LocationName
,
4375 WebBrowser_get_LocationURL
,
4376 WebBrowser_get_Busy
,
4378 WebBrowser_ClientToWindow
,
4379 WebBrowser_PutProperty
,
4380 WebBrowser_GetProperty
,
4381 WebBrowser_get_Name
,
4382 WebBrowser_get_HWND
,
4383 WebBrowser_get_FullName
,
4384 WebBrowser_get_Path
,
4385 WebBrowser_get_Visible
,
4386 WebBrowser_put_Visible
,
4387 WebBrowser_get_StatusBar
,
4388 WebBrowser_put_StatusBar
,
4389 WebBrowser_get_StatusText
,
4390 WebBrowser_put_StatusText
,
4391 WebBrowser_get_ToolBar
,
4392 WebBrowser_put_ToolBar
,
4393 WebBrowser_get_MenuBar
,
4394 WebBrowser_put_MenuBar
,
4395 WebBrowser_get_FullScreen
,
4396 WebBrowser_put_FullScreen
,
4397 WebBrowser_Navigate2
,
4398 WebBrowser_QueryStatusWB
,
4400 WebBrowser_ShowBrowserBar
,
4401 WebBrowser_get_ReadyState
,
4402 WebBrowser_get_Offline
,
4403 WebBrowser_put_Offline
,
4404 WebBrowser_get_Silent
,
4405 WebBrowser_put_Silent
,
4406 WebBrowser_get_RegisterAsBrowser
,
4407 WebBrowser_put_RegisterAsBrowser
,
4408 WebBrowser_get_RegisterAsDropTarget
,
4409 WebBrowser_put_RegisterAsDropTarget
,
4410 WebBrowser_get_TheaterMode
,
4411 WebBrowser_put_TheaterMode
,
4412 WebBrowser_get_AddressBar
,
4413 WebBrowser_put_AddressBar
,
4414 WebBrowser_get_Resizable
,
4415 WebBrowser_put_Resizable
4418 static IWebBrowser2 WebBrowser2
= { &WebBrowser2Vtbl
};
4420 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
4421 REFIID riid
, void **ppv
)
4423 return QueryInterface(riid
, ppv
);
4426 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
4431 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
4436 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
4437 REFIID riid
, void **ppv
)
4440 * Services used by HTMLDocument:
4443 * IInternetSecurityManager
4445 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
4448 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
4449 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
4450 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
4452 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
4453 * IElementBehaviorFactory
4454 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
4463 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
4464 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
4469 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
4470 ok(IsEqualGUID(&IID_INewWindowManager
, riid
), "unexpected riid\n");
4471 *ppv
= &NewWindowManager
;
4475 if(IsEqualGUID(&IID_IShellBrowser
, guidService
)) {
4476 ok(IsEqualGUID(&IID_IBrowserService
, riid
), "unexpected riid\n");
4477 *ppv
= &BrowserService
;
4481 if(support_wbapp
&& IsEqualGUID(&IID_IWebBrowserApp
, guidService
)) {
4482 if(IsEqualGUID(riid
, &IID_IWebBrowser2
)) {
4483 *ppv
= &WebBrowser2
;
4486 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
4489 return E_NOINTERFACE
;
4492 static const IServiceProviderVtbl ServiceProviderVtbl
= {
4493 ServiceProvider_QueryInterface
,
4494 ServiceProvider_AddRef
,
4495 ServiceProvider_Release
,
4496 ServiceProvider_QueryService
4499 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
4501 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
4502 REFIID riid
, void **ppv
)
4504 return QueryInterface(riid
, ppv
);
4507 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSinkEx
*iface
)
4512 static ULONG WINAPI
AdviseSink_Release(IAdviseSinkEx
*iface
)
4517 static void WINAPI
AdviseSink_OnDataChange(IAdviseSinkEx
*iface
,
4518 FORMATETC
*pFormatetc
, STGMEDIUM
*pStgmed
)
4520 ok(0, "unexpected call\n");
4523 static void WINAPI
AdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
4524 DWORD dwAspect
, LONG lindex
)
4526 ok(0, "unexpected call\n");
4529 static void WINAPI
AdviseSink_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
4531 ok(0, "unexpected call\n");
4534 static void WINAPI
AdviseSink_OnSave(IAdviseSinkEx
*iface
)
4536 ok(0, "unexpected call\n");
4539 static void WINAPI
AdviseSink_OnClose(IAdviseSinkEx
*iface
)
4541 ok(0, "unexpected call\n");
4544 static void WINAPI
AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
4546 ok(0, "unexpected call\n");
4549 static void WINAPI
ObjectAdviseSink_OnClose(IAdviseSinkEx
*iface
)
4551 CHECK_EXPECT(Advise_Close
);
4554 static const IAdviseSinkExVtbl AdviseSinkVtbl
= {
4555 AdviseSink_QueryInterface
,
4558 AdviseSink_OnDataChange
,
4559 AdviseSink_OnViewChange
,
4560 AdviseSink_OnRename
,
4562 ObjectAdviseSink_OnClose
,
4563 AdviseSinkEx_OnViewStatusChange
4566 static IAdviseSinkEx AdviseSink
= { &AdviseSinkVtbl
};
4568 static HRESULT WINAPI
ViewAdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
4569 REFIID riid
, void **ppv
)
4571 if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
4576 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
4578 return E_NOINTERFACE
;
4581 static void WINAPI
ViewAdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
4582 DWORD dwAspect
, LONG lindex
)
4584 CHECK_EXPECT2(OnViewChange
);
4586 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
4587 ok(lindex
== -1, "lindex = %d\n", lindex
);
4590 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl
= {
4591 ViewAdviseSink_QueryInterface
,
4594 AdviseSink_OnDataChange
,
4595 ViewAdviseSink_OnViewChange
,
4596 AdviseSink_OnRename
,
4599 AdviseSinkEx_OnViewStatusChange
4602 static IAdviseSinkEx ViewAdviseSink
= { &ViewAdviseSinkVtbl
};
4604 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
4605 DEFINE_GUID(IID_IThumbnailView
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
4606 DEFINE_GUID(IID_IRenMailEditor
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
4607 DEFINE_GUID(IID_unk4
, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
4608 DEFINE_GUID(IID_IDocHostUIHandlerPriv
, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
4610 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
4614 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
4616 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
4617 *ppv
= &DocumentSite
;
4618 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
4619 *ppv
= &DocHostUIHandler
;
4620 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
4621 *ppv
= &OleContainer
;
4622 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
4623 *ppv
= &InPlaceSiteWindowless
;
4624 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
4625 *ppv
= &OleCommandTarget
;
4626 else if(IsEqualGUID(&IID_IDispatch
, riid
))
4628 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
4629 *ppv
= &ServiceProvider
;
4630 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
4631 *ppv
= ipsex
? &InPlaceSiteWindowless
: NULL
;
4632 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
))
4633 *ppv
= ipsw
? &InPlaceSiteWindowless
: NULL
;
4634 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
4635 *ppv
= &OleControlSite
;
4636 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
4637 return E_NOINTERFACE
; /* TODO */
4638 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
4639 return E_NOINTERFACE
; /* ? */
4640 else if(IsEqualGUID(&IID_unk1
, riid
))
4641 return E_NOINTERFACE
; /* HTMLWindow2 ? */
4642 else if(IsEqualGUID(&IID_IThumbnailView
, riid
))
4643 return E_NOINTERFACE
; /* ? */
4644 else if(IsEqualGUID(&IID_IRenMailEditor
, riid
))
4645 return E_NOINTERFACE
; /* ? */
4646 else if(IsEqualGUID(&IID_unk4
, riid
))
4647 return E_NOINTERFACE
; /* ? */
4648 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv
, riid
))
4649 return E_NOINTERFACE
; /* ? */
4651 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
4655 return E_NOINTERFACE
;
4658 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
4660 if(msg
== WM_CONTINUE_BINDING
) {
4661 IBindStatusCallback
*callback
= (IBindStatusCallback
*)wParam
;
4662 continue_binding(callback
);
4665 return DefWindowProc(hwnd
, msg
, wParam
, lParam
);
4668 static void test_doscroll(IUnknown
*unk
)
4670 IHTMLDocument3
*doc
;
4671 IHTMLElement2
*elem2
;
4676 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument3
, (void**)&doc
);
4677 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
4681 hres
= IHTMLDocument3_get_documentElement(doc
, &elem
);
4682 IHTMLDocument3_Release(doc
);
4683 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
4684 switch(load_state
) {
4688 ok(!elem
, "elem != NULL\n");
4691 case LD_INTERACTIVE
:
4693 ok(elem
!= NULL
, "elem == NULL\n");
4698 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
4699 IHTMLElement_Release(elem
);
4700 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
4703 V_BSTR(&v
) = a2bstr("left");
4704 hres
= IHTMLElement2_doScroll(elem2
, v
);
4705 SysFreeString(V_BSTR(&v
));
4706 IHTMLElement2_Release(elem2
);
4708 if(inplace_deactivated
)
4709 ok(hres
== E_PENDING
, "doScroll failed: %08x\n", hres
);
4710 else if(load_state
== LD_COMPLETE
)
4711 ok(hres
== S_OK
, "doScroll failed: %08x\n", hres
);
4713 ok(hres
== E_PENDING
|| hres
== S_OK
, "doScroll failed: %08x\n", hres
);
4716 static void _test_readyState(unsigned line
, IUnknown
*unk
)
4718 IHTMLDocument2
*htmldoc
;
4719 DISPPARAMS dispparams
;
4725 static const LPCSTR expected_state
[] = {
4740 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
4741 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
4745 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
4746 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
4748 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
4749 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
4751 if(!strcmp_wa(state
, "interactive") && load_state
== LD_LOADING
)
4752 load_state
= LD_INTERACTIVE
;
4755 (!strcmp_wa(state
, expected_state
[load_state
]), "unexpected state %s, expected %d\n",
4756 wine_dbgstr_w(state
), load_state
);
4757 SysFreeString(state
);
4759 hres
= IHTMLDocument2_get_body(htmldoc
, &elem
);
4760 ok_(__FILE__
,line
)(hres
== S_OK
, "get_body failed: %08x\n", hres
);
4762 IHTMLElement2
*elem2
;
4765 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
4766 IHTMLElement_Release(elem
);
4767 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
4769 hres
= IHTMLElement2_get_readyState(elem2
, &var
);
4770 IHTMLElement2_Release(elem2
);
4771 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
4772 ok(V_VT(&var
) == VT_BSTR
, "V_VT(state) = %d\n", V_VT(&var
));
4773 ok(!strcmp_wa(V_BSTR(&var
), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var
)));
4776 ok_(__FILE__
,line
)(load_state
!= LD_COMPLETE
, "body is NULL in complete state\n");
4779 dispparams
.cArgs
= 0;
4780 dispparams
.cNamedArgs
= 0;
4781 dispparams
.rgdispidNamedArgs
= NULL
;
4782 dispparams
.rgvarg
= NULL
;
4786 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
4787 &dispparams
, &out
, NULL
, NULL
);
4788 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
4790 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
4791 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
4793 test_doscroll((IUnknown
*)htmldoc
);
4795 IHTMLDocument2_Release(htmldoc
);
4798 static void test_ViewAdviseSink(IHTMLDocument2
*doc
)
4803 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IViewObject
, (void**)&view
);
4804 ok(hres
== S_OK
, "QueryInterface(IID_IViewObject) failed: %08x\n", hres
);
4806 hres
= IViewObject_SetAdvise(view
, DVASPECT_CONTENT
, ADVF_PRIMEFIRST
, (IAdviseSink
*)&ViewAdviseSink
);
4807 ok(hres
== S_OK
, "SetAdvise failed: %08x\n", hres
);
4809 IViewObject_Release(view
);
4812 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
4814 IConnectionPointContainer
*tmp_container
= NULL
;
4815 IConnectionPoint
*cp
;
4820 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
4821 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
4825 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
4826 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
4827 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
4829 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
4830 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
4832 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
4833 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
4834 ok(tmp_container
== container
, "container != tmp_container\n");
4836 IConnectionPointContainer_Release(tmp_container
);
4838 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
4839 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
4841 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
4842 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
4843 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4844 hres
= IConnectionPoint_Unadvise(cp
, cookie
);
4845 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
4846 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, NULL
);
4847 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4848 } else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
4849 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&EventDispatch
, &cookie
);
4850 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4853 IConnectionPoint_Release(cp
);
4856 static void test_ConnectionPointContainer(IHTMLDocument2
*doc
)
4858 IConnectionPointContainer
*container
;
4861 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IConnectionPointContainer
, (void**)&container
);
4862 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
4866 test_ConnectionPoint(container
, &IID_IDispatch
);
4867 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
4868 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
4869 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
4871 IConnectionPointContainer_Release(container
);
4874 static void set_custom_uihandler(IHTMLDocument2
*doc
, IDocHostUIHandler2
*uihandler
)
4876 ICustomDoc
*custom_doc
;
4879 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ICustomDoc
, (void**)&custom_doc
);
4880 ok(hres
== S_OK
, "Could not get ICustomDoc iface: %08x\n", hres
);
4882 expect_uihandler_iface
= uihandler
;
4884 hres
= ICustomDoc_SetUIHandler(custom_doc
, (IDocHostUIHandler
*)uihandler
);
4885 ICustomDoc_Release(custom_doc
);
4886 ok(hres
== S_OK
, "SetUIHandler failed: %08x\n", hres
);
4889 static void test_Load(IPersistMoniker
*persist
, IMoniker
*mon
)
4893 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
4895 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
4897 test_readyState((IUnknown
*)persist
);
4901 CreateBindCtx(0, &bind
);
4902 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
4903 (IUnknown
*)&ClientSite
);
4906 SET_EXPECT(GetDisplayName
);
4907 if(!set_clientsite
) {
4908 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
4909 SET_EXPECT(GetHostInfo
);
4910 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4911 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4912 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4913 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
4914 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
4915 SET_EXPECT(GetOptionKeyPath
);
4916 SET_EXPECT(GetOverrideKeyPath
);
4917 SET_EXPECT(GetWindow
);
4918 SET_EXPECT(Exec_DOCCANNAVIGATE
);
4919 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
4920 SET_EXPECT(Exec_SETPROGRESSMAX
);
4921 SET_EXPECT(Exec_SETPROGRESSPOS
);
4922 SET_EXPECT(Exec_ShellDocView_37
);
4924 if(!container_locked
) {
4925 SET_EXPECT(GetContainer
);
4926 SET_EXPECT(LockContainer
);
4928 SET_EXPECT(OnChanged_READYSTATE
);
4929 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
4930 SET_EXPECT(IsSystemMoniker
);
4932 SET_EXPECT(BindToStorage
);
4933 SET_EXPECT(SetActiveObject
);
4934 if(set_clientsite
) {
4935 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4936 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4937 SET_EXPECT(Exec_ShellDocView_37
);
4938 SET_EXPECT(IsErrorUrl
);
4940 SET_EXPECT(GetTravelLog
);
4942 SET_EXPECT(Exec_ShellDocView_84
);
4943 SET_EXPECT(GetPendingUrl
);
4944 load_state
= LD_DOLOAD
;
4945 expect_LockContainer_fLock
= TRUE
;
4946 readystate_set_loading
= TRUE
;
4948 hres
= IPersistMoniker_Load(persist
, FALSE
, mon
, bind
, 0x12);
4949 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4952 CHECK_CALLED(GetDisplayName
);
4953 if(!set_clientsite
) {
4954 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4955 CHECK_CALLED(GetHostInfo
);
4956 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4957 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4958 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4959 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4960 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
4961 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
4962 CHECK_CALLED(GetOverrideKeyPath
);
4963 CHECK_CALLED(GetWindow
);
4964 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
4965 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
4966 CHECK_CALLED(Exec_SETPROGRESSMAX
);
4967 CHECK_CALLED(Exec_SETPROGRESSPOS
);
4968 CHECK_CALLED(Exec_ShellDocView_37
);
4970 if(!container_locked
) {
4971 CHECK_CALLED(GetContainer
);
4972 CHECK_CALLED(LockContainer
);
4973 container_locked
= TRUE
;
4975 CHECK_CALLED(OnChanged_READYSTATE
);
4976 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
4977 CLEAR_CALLED(IsSystemMoniker
); /* IE7 */
4979 CHECK_CALLED(BindToStorage
);
4980 CLEAR_CALLED(SetActiveObject
); /* FIXME */
4981 if(set_clientsite
) {
4982 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4983 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4984 CHECK_CALLED(Exec_ShellDocView_37
);
4985 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
4987 todo_wine
CHECK_CALLED(GetTravelLog
);
4989 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
4990 todo_wine
CHECK_CALLED(GetPendingUrl
);
4992 set_clientsite
= container_locked
= TRUE
;
4994 test_GetCurMoniker((IUnknown
*)persist
, mon
, NULL
);
4996 IBindCtx_Release(bind
);
4998 test_readyState((IUnknown
*)persist
);
5001 #define DWL_VERBDONE 0x0001
5002 #define DWL_CSS 0x0002
5003 #define DWL_TRYCSS 0x0004
5004 #define DWL_HTTP 0x0008
5005 #define DWL_EMPTY 0x0010
5006 #define DWL_JAVASCRIPT 0x0020
5007 #define DWL_ONREADY_LOADING 0x0040
5008 #define DWL_EXPECT_HISTUPDATE 0x0080
5010 static void test_download(DWORD flags
)
5012 const BOOL is_js
= (flags
& DWL_JAVASCRIPT
) != 0;
5017 b
= is_js
? &called_Exec_SETDOWNLOADSTATE_0
: &called_Exec_HTTPEQUIV_DONE
;
5019 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
5020 ok(hwnd
!= NULL
, "Could not find hidden window\n");
5022 test_readyState(NULL
);
5024 if(flags
& (DWL_VERBDONE
|DWL_HTTP
))
5025 SET_EXPECT(Exec_SETPROGRESSMAX
);
5026 if((flags
& DWL_VERBDONE
) && !load_from_stream
&& !is_js
)
5027 SET_EXPECT(GetHostInfo
);
5028 SET_EXPECT(SetStatusText
);
5029 if(!(flags
& DWL_EMPTY
))
5030 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
5032 SET_EXPECT(GetExternal
);
5033 SET_EXPECT(OnViewChange
);
5034 SET_EXPECT(GetDropTarget
);
5035 if((flags
& DWL_TRYCSS
) && !(flags
& DWL_EMPTY
))
5036 SET_EXPECT(Exec_ShellDocView_84
);
5037 if(flags
& DWL_CSS
) {
5038 SET_EXPECT(CreateInstance
);
5040 SET_EXPECT(LockRequest
);
5041 SET_EXPECT(Terminate
);
5042 SET_EXPECT(Protocol_Read
);
5043 SET_EXPECT(UnlockRequest
);
5045 if(flags
& DWL_ONREADY_LOADING
)
5046 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5047 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
)))
5048 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
5050 SET_EXPECT(Invoke_OnReadyStateChange_Complete
);
5051 SET_EXPECT(Exec_Explorer_69
);
5052 SET_EXPECT(EnableModeless_TRUE
); /* IE7 */
5053 SET_EXPECT(Frame_EnableModeless_TRUE
); /* IE7 */
5054 SET_EXPECT(EnableModeless_FALSE
); /* IE7 */
5055 SET_EXPECT(Frame_EnableModeless_FALSE
); /* IE7 */
5056 if((nav_url
&& !is_js
) || (flags
& (DWL_CSS
|DWL_HTTP
)))
5057 SET_EXPECT(Exec_ShellDocView_37
);
5058 if(flags
& DWL_HTTP
) {
5059 SET_EXPECT(OnChanged_1012
);
5060 SET_EXPECT(Exec_HTTPEQUIV
);
5061 SET_EXPECT(Exec_SETTITLE
);
5064 SET_EXPECT(OnChanged_1005
);
5065 SET_EXPECT(OnChanged_READYSTATE
);
5066 SET_EXPECT(Exec_SETPROGRESSPOS
);
5067 if(!(flags
& DWL_EMPTY
))
5068 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
5069 SET_EXPECT(Exec_ShellDocView_103
);
5070 SET_EXPECT(Exec_ShellDocView_105
);
5071 SET_EXPECT(Exec_ShellDocView_140
);
5073 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
5074 if(support_wbapp
) /* Called on some Vista installations */
5075 SET_EXPECT(CountEntries
);
5076 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
5078 SET_EXPECT(SetStatusText
);
5079 if(nav_url
|| support_wbapp
) {
5080 SET_EXPECT(UpdateUI
);
5081 SET_EXPECT(Exec_UPDATECOMMANDS
);
5082 SET_EXPECT(Exec_SETTITLE
);
5083 if(flags
& DWL_EXPECT_HISTUPDATE
)
5084 SET_EXPECT(Exec_Explorer_38
);
5085 SET_EXPECT(UpdateBackForwardState
);
5089 if(!(flags
& DWL_EMPTY
))
5090 SET_EXPECT(FireNavigateComplete2
);
5091 SET_EXPECT(FireDocumentComplete
);
5093 SET_EXPECT(ActiveElementChanged
);
5095 SET_EXPECT(IsErrorUrl
);
5096 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
5098 while(!*b
&& GetMessage(&msg
, NULL
, 0, 0)) {
5099 TranslateMessage(&msg
);
5100 DispatchMessage(&msg
);
5103 if(flags
& DWL_VERBDONE
)
5104 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5105 if(flags
& DWL_HTTP
)
5106 SET_CALLED(Exec_SETPROGRESSMAX
);
5107 if((flags
& DWL_VERBDONE
) && !load_from_stream
&& !is_js
) {
5109 todo_wine
CHECK_CALLED(GetHostInfo
);
5111 CHECK_CALLED(GetHostInfo
);
5113 CHECK_CALLED(SetStatusText
);
5114 if(!(flags
& DWL_EMPTY
))
5115 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
5117 CHECK_CALLED(GetExternal
);
5118 CHECK_CALLED(OnViewChange
);
5119 CLEAR_CALLED(GetDropTarget
);
5120 if((flags
& DWL_TRYCSS
) && !(flags
& DWL_EMPTY
))
5121 todo_wine
CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5122 if(flags
& DWL_CSS
) {
5123 CHECK_CALLED(CreateInstance
);
5124 CHECK_CALLED(Start
);
5125 CHECK_CALLED(LockRequest
);
5126 CHECK_CALLED(Terminate
);
5127 CHECK_CALLED(Protocol_Read
);
5128 CHECK_CALLED(UnlockRequest
);
5130 if(flags
& DWL_ONREADY_LOADING
)
5131 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5132 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
)))
5133 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive
);
5135 CHECK_CALLED(Invoke_OnReadyStateChange_Complete
);
5136 SET_CALLED(Exec_Explorer_69
);
5137 SET_CALLED(EnableModeless_TRUE
); /* IE7 */
5138 SET_CALLED(Frame_EnableModeless_TRUE
); /* IE7 */
5139 SET_CALLED(EnableModeless_FALSE
); /* IE7 */
5140 SET_CALLED(Frame_EnableModeless_FALSE
); /* IE7 */
5141 if(nav_url
&& !is_js
)
5142 todo_wine
CHECK_CALLED(Exec_ShellDocView_37
);
5143 else if(flags
& (DWL_CSS
|DWL_HTTP
))
5144 CLEAR_CALLED(Exec_ShellDocView_37
); /* Called by IE9 */
5145 if(flags
& DWL_HTTP
) {
5146 todo_wine
CHECK_CALLED(OnChanged_1012
);
5147 todo_wine
CHECK_CALLED(Exec_HTTPEQUIV
);
5148 todo_wine
CHECK_CALLED(Exec_SETTITLE
);
5151 CHECK_CALLED(OnChanged_1005
);
5152 CHECK_CALLED(OnChanged_READYSTATE
);
5153 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5155 CLEAR_CALLED(OnChanged_READYSTATE
); /* sometimes called */
5156 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
5158 if(!(flags
& DWL_EMPTY
))
5159 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
5160 CLEAR_CALLED(Exec_ShellDocView_103
);
5161 CLEAR_CALLED(Exec_ShellDocView_105
);
5162 CLEAR_CALLED(Exec_ShellDocView_140
);
5164 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
5165 if(support_wbapp
) /* Called on some Vista installations */
5166 CLEAR_CALLED(CountEntries
);
5167 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
5169 SET_CALLED(SetStatusText
);
5170 if(nav_url
|| support_wbapp
) { /* avoiding race, FIXME: find better way */
5171 CLEAR_CALLED(UpdateUI
);
5172 CLEAR_CALLED(Exec_UPDATECOMMANDS
);
5173 CLEAR_CALLED(Exec_SETTITLE
);
5174 if(flags
& DWL_EXPECT_HISTUPDATE
)
5175 CHECK_CALLED(Exec_Explorer_38
);
5176 todo_wine
CHECK_CALLED_BROKEN(UpdateBackForwardState
);
5180 if(!(flags
& DWL_EMPTY
)) {
5182 CHECK_CALLED(FireNavigateComplete2
);
5184 todo_wine
CHECK_CALLED(FireNavigateComplete2
);
5186 CHECK_CALLED(FireDocumentComplete
);
5188 todo_wine
CHECK_CALLED(ActiveElementChanged
);
5190 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
5192 load_state
= LD_COMPLETE
;
5194 test_readyState(NULL
);
5197 static void test_Persist(IHTMLDocument2
*doc
, IMoniker
*mon
)
5199 IPersistMoniker
*persist_mon
;
5200 IPersistFile
*persist_file
;
5204 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistFile
, (void**)&persist_file
);
5205 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
5206 if(SUCCEEDED(hres
)) {
5207 hres
= IPersistFile_GetClassID(persist_file
, NULL
);
5208 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
5210 hres
= IPersistFile_GetClassID(persist_file
, &guid
);
5211 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
5212 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
5214 IPersistFile_Release(persist_file
);
5217 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&persist_mon
);
5218 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
5219 if(SUCCEEDED(hres
)) {
5220 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
5221 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
5223 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
5224 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
5225 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
5227 if(load_state
== LD_DOLOAD
)
5228 test_Load(persist_mon
, mon
);
5230 test_readyState((IUnknown
*)doc
);
5232 IPersistMoniker_Release(persist_mon
);
5236 static void test_put_href(IHTMLDocument2
*doc
, BOOL use_replace
, const char *href
, const char *new_nav_url
, BOOL is_js
,
5237 BOOL is_hash
, DWORD dwl_flags
)
5239 const char *prev_nav_url
= NULL
;
5240 IHTMLPrivateWindow
*priv_window
;
5241 IHTMLLocation
*location
;
5242 IHTMLWindow2
*window
;
5246 trace("put_href %s...\n", new_nav_url
);
5249 loading_hash
= is_hash
;
5252 hres
= IHTMLDocument2_get_location(doc
, &location
);
5253 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
5254 ok(location
!= NULL
, "location == NULL\n");
5256 prev_url
= prev_nav_url
= nav_url
;
5257 nav_url
= new_nav_url
;
5259 nav_serv_url
= new_nav_url
;
5264 SET_EXPECT(TranslateUrl
);
5266 SET_EXPECT(FireBeforeNavigate2
);
5267 SET_EXPECT(Exec_ShellDocView_67
);
5269 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5270 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5271 SET_EXPECT(Exec_ShellDocView_63
);
5272 SET_EXPECT(Exec_ShellDocView_84
);
5274 SET_EXPECT(FireNavigateComplete2
);
5275 SET_EXPECT(FireDocumentComplete
);
5278 SET_EXPECT(Navigate
);
5281 hres
= IHTMLLocation_replace(location
, str
);
5282 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
5284 hres
= IHTMLLocation_put_href(location
, str
);
5285 if(is_js
&& hres
== E_ACCESSDENIED
)
5286 win_skip("put_href: got E_ACCESSDENIED\n");
5288 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
5292 CHECK_CALLED(TranslateUrl
);
5294 CHECK_CALLED(FireBeforeNavigate2
);
5295 CHECK_CALLED(Exec_ShellDocView_67
);
5297 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5298 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5299 CHECK_CALLED(Exec_ShellDocView_63
);
5300 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5302 CHECK_CALLED(FireNavigateComplete2
);
5303 CHECK_CALLED(FireDocumentComplete
);
5306 CHECK_CALLED(Navigate
);
5309 CLEAR_CALLED(TranslateUrl
);
5311 CLEAR_CALLED(FireBeforeNavigate2
);
5312 SET_CALLED(Exec_ShellDocView_67
);
5314 CLEAR_CALLED(Invoke_AMBIENT_SILENT
);
5315 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5316 CLEAR_CALLED(Exec_ShellDocView_63
);
5317 todo_wine
CLEAR_CALLED(Exec_ShellDocView_84
);
5319 CLEAR_CALLED(FireNavigateComplete2
);
5320 CLEAR_CALLED(FireDocumentComplete
);
5323 CLEAR_CALLED(Navigate
);
5327 IHTMLLocation_Release(location
);
5329 if(is_js
&& hres
== E_ACCESSDENIED
) {
5330 nav_url
= prev_nav_url
;
5334 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
5335 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
5337 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
5338 IHTMLWindow2_Release(window
);
5339 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres
);
5341 if(!support_wbapp
) {
5344 readystate_set_loading
= TRUE
;
5345 SET_EXPECT(TranslateUrl
);
5346 SET_EXPECT(Exec_ShellDocView_67
);
5347 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5348 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5349 SET_EXPECT(Exec_ShellDocView_63
);
5350 SET_EXPECT(Exec_ShellDocView_84
);
5352 str
= a2bstr(nav_url
);
5354 V_VT(&vempty
) = VT_EMPTY
;
5355 hres
= IHTMLPrivateWindow_SuperNavigate(priv_window
, str
, str2
, NULL
, NULL
, &vempty
, &vempty
, 0);
5357 SysFreeString(str2
);
5358 ok(hres
== S_OK
, "SuperNavigate failed: %08x\n", hres
);
5360 CHECK_CALLED(TranslateUrl
);
5361 CHECK_CALLED(Exec_ShellDocView_67
);
5362 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5363 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5364 CHECK_CALLED(Exec_ShellDocView_63
);
5365 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5369 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
5374 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
5375 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
5376 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2
), prev_nav_url
);
5377 SysFreeString(str2
);
5380 ignore_external_qi
= TRUE
;
5381 test_download(DWL_VERBDONE
| (is_js
? DWL_JAVASCRIPT
: DWL_ONREADY_LOADING
) | dwl_flags
);
5383 ignore_external_qi
= FALSE
;
5387 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
5388 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
5390 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
5392 ok(!strcmp_wa(str2
, nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
5393 SysFreeString(str2
);
5394 IHTMLPrivateWindow_Release(priv_window
);
5398 nav_url
= prev_nav_url
;
5401 static void test_open_window(IHTMLDocument2
*doc
, BOOL do_block
)
5403 IHTMLWindow2
*window
, *new_window
;
5407 allow_new_window
= !do_block
;
5409 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
5410 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
5412 url
= a2bstr(nav_serv_url
= nav_url
= "about:blank");
5413 name
= a2bstr("test");
5414 new_window
= (void*)0xdeadbeef;
5420 SET_EXPECT(get_LocationURL
);
5421 SET_EXPECT(TranslateUrl
);
5422 SET_EXPECT(EvaluateNewWindow
);
5424 hres
= IHTMLWindow2_open(window
, url
, name
, NULL
, VARIANT_FALSE
, &new_window
);
5427 SysFreeString(name
);
5430 todo_wine
CHECK_CALLED_BROKEN(get_LocationURL
);
5432 CHECK_CALLED(TranslateUrl
);
5434 if(!called_EvaluateNewWindow
) {
5435 win_skip("INewWindowManager not supported\n");
5436 if(SUCCEEDED(hres
) && new_window
)
5437 IHTMLWindow2_Release(new_window
);
5438 IHTMLWindow2_Release(window
);
5441 CHECK_CALLED(EvaluateNewWindow
);
5443 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
5446 ok(!new_window
, "new_window != NULL\n");
5448 ok(new_window
!= NULL
, "new_window == NULL\n");
5450 hres
= IHTMLWindow2_close(new_window
);
5451 ok(hres
== S_OK
, "close failed: %08x\n", hres
);
5454 IHTMLWindow2_Release(window
);
5457 static void test_elem_from_point(IHTMLDocument2
*doc
)
5464 hres
= IHTMLDocument2_elementFromPoint(doc
, 3, 3, &elem
);
5465 ok(hres
== S_OK
, "elementFromPoint failed: %08x\n", hres
);
5466 ok(elem
!= NULL
, "elem == NULL\n");
5468 hres
= IHTMLElement_get_tagName(elem
, &tag
);
5469 IHTMLElement_Release(elem
);
5470 ok(hres
== S_OK
, "get_tagName failed: %08x\n", hres
);
5471 ok(!strcmp_wa(tag
, "DIV"), "tag = %s\n", wine_dbgstr_w(tag
));
5474 static void test_clear(IHTMLDocument2
*doc
)
5478 hres
= IHTMLDocument2_clear(doc
);
5479 ok(hres
== S_OK
, "clear failed: %08x\n", hres
);
5482 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
5484 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
5485 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
5486 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
5487 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
5488 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
5489 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
5490 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
5491 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
5492 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
5493 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
5494 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
5495 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
5496 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
5497 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
5498 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
5499 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
5500 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
5501 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
5502 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
5503 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
5505 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
5506 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
5508 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
5510 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
5512 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
5513 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
5515 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
5516 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
5518 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
5520 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
5521 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
5524 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
5525 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
5527 IOleCommandTarget
*cmdtrg
;
5528 OLECMD olecmd
= {cmdid
, 0};
5531 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5532 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
5536 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
5537 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
5539 IOleCommandTarget_Release(cmdtrg
);
5541 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
5542 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
5545 static void test_MSHTML_QueryStatus(IHTMLDocument2
*doc
, DWORD cmdf
)
5547 IUnknown
*unk
= doc
? (IUnknown
*)doc
: doc_unk
;
5549 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
5550 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
5551 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
5552 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
5553 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
5554 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
5555 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
5556 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
5557 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
5558 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
5559 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
5560 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
5561 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
5562 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
5563 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
5564 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
5567 static void test_OleCommandTarget(IHTMLDocument2
*doc
)
5569 IOleCommandTarget
*cmdtrg
;
5570 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
5574 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5575 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
5579 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
5580 cmds
[i
].cmdID
= i
+1;
5581 cmds
[i
].cmdf
= 0xf0f0;
5584 SET_EXPECT(QueryStatus_OPEN
);
5585 SET_EXPECT(QueryStatus_NEW
);
5586 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
5587 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
5588 CHECK_CALLED(QueryStatus_OPEN
);
5589 CHECK_CALLED(QueryStatus_NEW
);
5591 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
5592 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
5593 if(i
+1 == OLECMDID_FIND
)
5595 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
5596 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
5599 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
5600 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
5602 IOleCommandTarget_Release(cmdtrg
);
5605 static void test_OleCommandTarget_fail(IHTMLDocument2
*doc
)
5607 IOleCommandTarget
*cmdtrg
;
5612 {OLECMDID_OPEN
, 0xf0f0},
5613 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
5616 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5617 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
5621 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
5622 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
5624 SET_EXPECT(QueryStatus_OPEN
);
5625 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
5626 CHECK_CALLED(QueryStatus_OPEN
);
5628 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
5629 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
5630 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
5631 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
5632 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
5633 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
5634 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
5636 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
5637 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
5638 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
5640 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
5641 if(!expect_cmds
[i
]) {
5642 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
5643 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5644 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
5645 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
5649 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
5650 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5651 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
5652 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
5654 IOleCommandTarget_Release(cmdtrg
);
5657 static void test_exec_onunload(IHTMLDocument2
*doc
)
5659 IOleCommandTarget
*cmdtrg
;
5663 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5664 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
5668 memset(&var
, 0x0a, sizeof(var
));
5669 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
5670 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
5671 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
5672 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
5673 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
5675 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
5676 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5677 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
5679 IOleCommandTarget_Release(cmdtrg
);
5682 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
5684 IOleCommandTarget
*cmdtrg
;
5687 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5688 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
5695 load_state
= LD_DOLOAD
;
5698 SET_EXPECT(GetClassID
);
5699 SET_EXPECT(SetStatusText
);
5700 SET_EXPECT(Exec_ShellDocView_37
);
5701 SET_EXPECT(GetHostInfo
);
5703 SET_EXPECT(GetDisplayName
);
5704 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5705 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5706 SET_EXPECT(OnChanged_READYSTATE
);
5707 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5708 SET_EXPECT(IsSystemMoniker
);
5709 SET_EXPECT(Exec_ShellDocView_84
);
5711 SET_EXPECT(BindToStorage
);
5712 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5715 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
5717 expect_status_text
= NULL
;
5718 readystate_set_loading
= TRUE
;
5720 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
5721 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5722 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
5725 CHECK_CALLED(GetClassID
);
5726 CHECK_CALLED(SetStatusText
);
5727 CHECK_CALLED(Exec_ShellDocView_37
);
5728 CHECK_CALLED(GetHostInfo
);
5730 CHECK_CALLED(GetDisplayName
);
5731 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5732 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5733 CHECK_CALLED(OnChanged_READYSTATE
);
5734 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5735 CLEAR_CALLED(IsSystemMoniker
); /* IE7 */
5736 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5738 CHECK_CALLED(BindToStorage
);
5739 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5740 CHECK_CALLED(HideUI
);
5741 CHECK_CALLED(ShowUI
);
5742 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
5744 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
5746 IOleCommandTarget_Release(cmdtrg
);
5748 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
5749 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5750 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
5753 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
5755 IOleCommandTarget
*cmdtrg
;
5756 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
5759 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5760 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
5767 V_BSTR(in
) = SysAllocString(name
);
5773 V_I4(out
) = 0xdeadbeef;
5776 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
5777 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
5783 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
5784 if(V_VT(out
) == VT_BSTR
) {
5786 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
5787 "unexpected fontname %s\n", wine_dbgstr_w(name
));
5789 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
5794 IOleCommandTarget_Release(cmdtrg
);
5797 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
5799 IOleCommandTarget
*cmdtrg
;
5802 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
5803 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
5807 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
5808 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
5809 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
5811 IOleCommandTarget_Release(cmdtrg
);
5814 static void test_IsDirty(IHTMLDocument2
*doc
, HRESULT exhres
)
5816 IPersistStreamInit
*perinit
;
5817 IPersistMoniker
*permon
;
5818 IPersistFile
*perfile
;
5821 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&perinit
);
5822 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
5823 if(SUCCEEDED(hres
)) {
5824 hres
= IPersistStreamInit_IsDirty(perinit
);
5825 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
5826 IPersistStreamInit_Release(perinit
);
5829 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&permon
);
5830 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
5831 if(SUCCEEDED(hres
)) {
5832 hres
= IPersistMoniker_IsDirty(permon
);
5833 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
5834 IPersistMoniker_Release(permon
);
5837 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistFile
, (void**)&perfile
);
5838 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
5839 if(SUCCEEDED(hres
)) {
5840 hres
= IPersistFile_IsDirty(perfile
);
5841 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
5842 IPersistFile_Release(perfile
);
5846 static HWND
create_container_window(void)
5848 static const WCHAR wszHTMLDocumentTest
[] =
5849 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
5850 static WNDCLASSEXW wndclass
= {
5851 sizeof(WNDCLASSEXW
),
5854 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
5855 wszHTMLDocumentTest
,
5859 RegisterClassExW(&wndclass
);
5860 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
5861 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
5862 515, 530, NULL
, NULL
, NULL
, NULL
);
5865 static void test_DoVerb(IOleObject
*oleobj
)
5867 RECT rect
= {0,0,500,500};
5870 if(!container_locked
) {
5871 SET_EXPECT(GetContainer
);
5872 SET_EXPECT(LockContainer
);
5874 SET_EXPECT(ActivateMe
);
5875 expect_LockContainer_fLock
= TRUE
;
5877 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
5878 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
5880 if(!container_locked
) {
5881 CHECK_CALLED(GetContainer
);
5882 CHECK_CALLED(LockContainer
);
5883 container_locked
= TRUE
;
5885 CHECK_CALLED(ActivateMe
);
5888 #define CLIENTSITE_EXPECTPATH 0x00000001
5889 #define CLIENTSITE_SETNULL 0x00000002
5890 #define CLIENTSITE_DONTSET 0x00000004
5892 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
5894 IOleClientSite
*clientsite
;
5897 if(flags
& CLIENTSITE_SETNULL
) {
5898 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
5899 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5901 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
5903 ok(!clientsite
, "clientsite != NULL\n");
5905 SET_EXPECT(GetOverrideKeyPath
);
5906 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
5907 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5908 CLEAR_CALLED(GetOverrideKeyPath
); /* IE9 sometimes calls it */
5910 set_clientsite
= FALSE
;
5913 if(flags
& CLIENTSITE_DONTSET
)
5916 if(!expect_uihandler_iface
)
5917 expect_uihandler_iface
= &DocHostUIHandler
;
5919 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
5920 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
5921 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
5922 clientsite
, set_clientsite
? &ClientSite
: NULL
);
5924 if(!set_clientsite
) {
5925 if(expect_uihandler_iface
)
5926 SET_EXPECT(GetHostInfo
);
5927 if(flags
& CLIENTSITE_EXPECTPATH
) {
5928 SET_EXPECT(GetOptionKeyPath
);
5929 SET_EXPECT(GetOverrideKeyPath
);
5931 SET_EXPECT(GetWindow
);
5932 if(flags
& CLIENTSITE_EXPECTPATH
)
5933 SET_EXPECT(Exec_DOCCANNAVIGATE
);
5934 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
5935 SET_EXPECT(Exec_SETPROGRESSMAX
);
5936 SET_EXPECT(Exec_SETPROGRESSPOS
);
5937 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
5938 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
5939 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5940 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5941 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
5942 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
5943 SET_EXPECT(GetOverrideKeyPath
);
5944 SET_EXPECT(GetTravelLog
);
5945 SET_EXPECT(Exec_ShellDocView_84
);
5947 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
5948 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5950 if(expect_uihandler_iface
)
5951 CHECK_CALLED(GetHostInfo
);
5952 if(flags
& CLIENTSITE_EXPECTPATH
) {
5953 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
5954 CHECK_CALLED(GetOverrideKeyPath
);
5956 CHECK_CALLED(GetWindow
);
5957 if(flags
& CLIENTSITE_EXPECTPATH
)
5958 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
5959 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
5960 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5961 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5962 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
5963 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
5964 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5965 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5966 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
5967 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
5968 CLEAR_CALLED(GetOverrideKeyPath
); /* Called by IE9 */
5969 todo_wine
CHECK_CALLED(GetTravelLog
);
5970 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
5972 set_clientsite
= TRUE
;
5975 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
5976 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5978 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
5979 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
5980 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
5983 static void test_OnAmbientPropertyChange(IHTMLDocument2
*doc
)
5985 IOleControl
*control
= NULL
;
5988 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
5989 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
5993 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
5994 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
5995 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
5996 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
5998 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
5999 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
6000 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6001 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6003 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6004 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6005 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
6006 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6007 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6008 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6010 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6011 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6012 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
6013 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6014 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6015 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6017 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
6018 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
6019 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6020 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
6022 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
6023 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
6024 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
6025 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
6027 IOleControl_Release(control
);
6032 static void test_OnAmbientPropertyChange2(IHTMLDocument2
*doc
)
6034 IOleControl
*control
= NULL
;
6037 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
6038 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
6042 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
6043 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
6045 IOleControl_Release(control
);
6048 static void test_Close(IHTMLDocument2
*doc
, BOOL set_client
)
6050 IOleObject
*oleobj
= NULL
;
6053 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6054 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6058 SET_EXPECT(GetContainer
);
6059 SET_EXPECT(LockContainer
);
6060 expect_LockContainer_fLock
= FALSE
;
6061 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
6062 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
6063 CHECK_CALLED(GetContainer
);
6064 CHECK_CALLED(LockContainer
);
6065 container_locked
= FALSE
;
6068 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
6070 IOleObject_Release(oleobj
);
6073 static void test_Advise(IHTMLDocument2
*doc
)
6075 IOleObject
*oleobj
= NULL
;
6076 IEnumSTATDATA
*enum_advise
= (void*)0xdeadbeef;
6080 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6081 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6085 hres
= IOleObject_Unadvise(oleobj
, 0);
6086 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
6088 hres
= IOleObject_EnumAdvise(oleobj
, &enum_advise
);
6089 ok(hres
== S_OK
, "EnumAdvise returned: %08x\n", hres
);
6090 ok(enum_advise
== NULL
, "enum_advise != NULL\n");
6093 hres
= IOleObject_Advise(oleobj
, NULL
, &conn
);
6094 /* Old IE returns S_OK and sets conn to 1 */
6095 ok(hres
== E_INVALIDARG
|| hres
== S_OK
, "Advise returned: %08x\n", hres
);
6096 ok(conn
== 0 || conn
== 1, "conn = %d\n", conn
);
6098 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, NULL
);
6099 ok(hres
== E_INVALIDARG
, "Advise returned: %08x\n", hres
);
6101 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
6102 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
6103 ok(conn
== 1, "conn = %d\n", conn
);
6105 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
6106 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
6107 ok(conn
== 2, "conn = %d\n", conn
);
6109 hres
= IOleObject_Unadvise(oleobj
, 1);
6110 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
6112 hres
= IOleObject_Unadvise(oleobj
, 1);
6113 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
6115 hres
= IOleObject_Unadvise(oleobj
, 2);
6116 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
6118 IOleObject_Release(oleobj
);
6121 static void test_OnFrameWindowActivate(IUnknown
*unk
)
6123 IOleInPlaceActiveObject
*inplaceact
;
6126 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
6127 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
6131 if(set_clientsite
) {
6132 expect_OnFrameWindowActivate_fActivate
= TRUE
;
6133 SET_EXPECT(OnFrameWindowActivate
);
6134 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6135 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6136 CHECK_CALLED(OnFrameWindowActivate
);
6138 SET_EXPECT(OnFrameWindowActivate
);
6139 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6140 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6141 CHECK_CALLED(OnFrameWindowActivate
);
6143 expect_OnFrameWindowActivate_fActivate
= FALSE
;
6144 SET_EXPECT(OnFrameWindowActivate
);
6145 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
6146 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6147 CHECK_CALLED(OnFrameWindowActivate
);
6149 expect_OnFrameWindowActivate_fActivate
= TRUE
;
6150 SET_EXPECT(OnFrameWindowActivate
);
6151 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6152 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6153 CHECK_CALLED(OnFrameWindowActivate
);
6155 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
6156 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6158 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
6159 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
6162 IOleInPlaceActiveObject_Release(inplaceact
);
6165 static void test_InPlaceDeactivate(IHTMLDocument2
*doc
, BOOL expect_call
)
6167 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
6170 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleInPlaceObjectWindowless
,
6171 (void**)&windowlessobj
);
6172 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
6177 SET_EXPECT(SetStatusText
);
6178 SET_EXPECT(OnFocus_FALSE
);
6180 SET_EXPECT(OnInPlaceDeactivateEx
);
6182 SET_EXPECT(OnInPlaceDeactivate
);
6184 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
6185 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
6187 CLEAR_CALLED(SetStatusText
); /* Called by IE9 */
6188 CHECK_CALLED(OnFocus_FALSE
);
6190 CHECK_CALLED(OnInPlaceDeactivateEx
);
6192 CHECK_CALLED(OnInPlaceDeactivate
);
6195 IOleInPlaceObjectWindowless_Release(windowlessobj
);
6198 static void test_Activate(IHTMLDocument2
*doc
, DWORD flags
)
6200 IOleObject
*oleobj
= NULL
;
6201 IOleDocumentView
*docview
;
6205 last_hwnd
= doc_hwnd
;
6208 IOleDocumentView_Release(view
);
6211 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6212 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6214 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
6215 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
6217 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
6218 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
6219 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
6221 test_OnFrameWindowActivate((IUnknown
*)doc
);
6223 test_ClientSite(oleobj
, flags
);
6224 test_InPlaceDeactivate(doc
, FALSE
);
6225 test_DoVerb(oleobj
);
6227 if(call_UIActivate
== CallUIActivate_AfterShow
) {
6228 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
6229 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
6231 SET_EXPECT(OnFocus_TRUE
);
6232 SET_EXPECT(SetActiveObject
);
6234 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
6235 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
6236 expect_status_text
= NULL
;
6238 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
6239 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
6241 CHECK_CALLED(OnFocus_TRUE
);
6242 CHECK_CALLED(SetActiveObject
);
6243 CHECK_CALLED(ShowUI
);
6244 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
6245 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
6247 IOleDocumentView_Release(docview
);
6250 IOleObject_Release(oleobj
);
6252 test_OnFrameWindowActivate((IUnknown
*)doc
);
6255 static void test_Window(IHTMLDocument2
*doc
, BOOL expect_success
)
6257 IOleInPlaceActiveObject
*activeobject
= NULL
;
6261 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
6262 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
6266 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
6268 if(expect_success
) {
6269 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
6270 ok(tmp_hwnd
== doc_hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, doc_hwnd
);
6272 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
6273 ok(IsWindow(doc_hwnd
), "hwnd is destroyed\n");
6276 IOleInPlaceActiveObject_Release(activeobject
);
6279 static void test_CloseView(void)
6281 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
6287 hres
= IOleDocumentView_Show(view
, FALSE
);
6288 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
6290 hres
= IOleDocumentView_CloseView(view
, 0);
6291 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
6293 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
6294 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
6296 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
6297 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
6298 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
6301 static void test_UIDeactivate(void)
6305 if(call_UIActivate
== CallUIActivate_AfterShow
) {
6306 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
6308 if(call_UIActivate
!= CallUIActivate_None
) {
6309 SET_EXPECT(SetActiveObject_null
);
6311 SET_EXPECT(OnUIDeactivate
);
6314 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
6315 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
6317 if(call_UIActivate
!= CallUIActivate_None
) {
6318 CHECK_CALLED(SetActiveObject_null
);
6319 CHECK_CALLED(HideUI
);
6320 CHECK_CALLED(OnUIDeactivate
);
6322 if(call_UIActivate
== CallUIActivate_AfterShow
) {
6323 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
6327 static void test_Hide(void)
6334 hres
= IOleDocumentView_Show(view
, FALSE
);
6335 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
6338 static IHTMLDocument2
*create_document(void)
6340 IHTMLDocument2
*doc
;
6343 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
6344 &IID_IHTMLDocument2
, (void**)&doc
);
6345 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
6352 static void release_document(IHTMLDocument2
*doc
)
6358 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
6359 * To workaround it, we release it via IUnknown iface */
6360 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IUnknown
, (void**)&unk
);
6361 ok(hres
== S_OK
, "Could not get IUnknown iface: %08x\n", hres
);
6363 IHTMLDocument2_Release(doc
);
6364 ref
= IUnknown_Release(unk
);
6365 ok(!ref
, "ref = %d\n", ref
);
6368 static void test_Navigate(IHTMLDocument2
*doc
)
6370 IHlinkTarget
*hlink
;
6373 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHlinkTarget
, (void**)&hlink
);
6374 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
6376 SET_EXPECT(ActivateMe
);
6377 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
6378 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
6379 CHECK_CALLED(ActivateMe
);
6381 IHlinkTarget_Release(hlink
);
6384 static void test_external(IHTMLDocument2
*doc
, BOOL initialized
)
6386 IDispatch
*external
;
6387 IHTMLWindow2
*htmlwin
;
6390 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
6391 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6394 SET_EXPECT(GetExternal
);
6395 external
= (void*)0xdeadbeef;
6396 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
6398 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
6399 CHECK_CALLED(GetExternal
);
6400 ok(external
!= NULL
, "external == NULL\n");
6402 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
6403 ok(external
== NULL
, "external != NULL\n");
6406 IHTMLWindow2_Release(htmlwin
);
6409 static void test_enum_objects(IOleContainer
*container
)
6411 IEnumUnknown
*enum_unknown
;
6412 IUnknown
*buf
[100] = {(void*)0xdeadbeef};
6416 enum_unknown
= NULL
;
6417 hres
= IOleContainer_EnumObjects(container
, OLECONTF_EMBEDDINGS
, &enum_unknown
);
6418 ok(hres
== S_OK
, "EnumObjects failed: %08x\n", hres
);
6419 ok(enum_unknown
!= NULL
, "enum_unknown == NULL\n");
6421 fetched
= 0xdeadbeef;
6422 hres
= IEnumUnknown_Next(enum_unknown
, sizeof(buf
)/sizeof(*buf
), buf
, &fetched
);
6423 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
6424 ok(!fetched
, "fetched = %d\n", fetched
);
6425 ok(buf
[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf
[0]);
6427 fetched
= 0xdeadbeef;
6428 hres
= IEnumUnknown_Next(enum_unknown
, 1, buf
, &fetched
);
6429 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
6430 ok(!fetched
, "fetched = %d\n", fetched
);
6432 hres
= IEnumUnknown_Next(enum_unknown
, 1, buf
, NULL
);
6433 ok(hres
== S_FALSE
, "Next returned %08x\n", hres
);
6435 IEnumUnknown_Release(enum_unknown
);
6438 static void test_target_container(IHTMLDocument2
*doc
)
6440 IOleContainer
*ole_container
, *doc_ole_container
;
6441 ITargetContainer
*target_container
;
6444 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ITargetContainer
, (void**)&target_container
);
6445 ok(hres
== S_OK
, "Could not get ITargetContainer iface: %08x\n", hres
);
6447 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleContainer
, (void**)&doc_ole_container
);
6448 ok(hres
== S_OK
, "Could not get ITargetContainer iface: %08x\n", hres
);
6450 ole_container
= (void*)0xdeadbeef;
6451 hres
= ITargetContainer_GetFramesContainer(target_container
, &ole_container
);
6452 ok(hres
== S_OK
, "GetFramesContainer failed: %08x\n", hres
);
6453 ok(ole_container
!= NULL
, "ole_container == NULL\n");
6454 ok(iface_cmp((IUnknown
*)ole_container
, (IUnknown
*)doc_ole_container
), "ole_container != doc_ole_container\n");
6455 test_enum_objects(ole_container
);
6456 IOleContainer_Release(ole_container
);
6458 ITargetContainer_Release(target_container
);
6459 IOleContainer_Release(doc_ole_container
);
6462 static void test_travellog(IHTMLDocument2
*doc
)
6464 ITravelLogClient
*travellog_client
;
6465 IHTMLWindow2
*window
, *top_window
;
6470 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
6471 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6472 ok(window
!= NULL
, "window = NULL\n");
6474 hres
= IHTMLWindow2_get_top(window
, &top_window
);
6475 IHTMLWindow2_Release(window
);
6476 ok(hres
== S_OK
, "get_top failed: %08x\n", hres
);
6478 hres
= IHTMLWindow2_QueryInterface(top_window
, &IID_ITravelLogClient
, (void**)&travellog_client
);
6479 IHTMLWindow2_Release(top_window
);
6480 if(hres
== E_NOINTERFACE
) {
6481 win_skip("ITravelLogClient not supported\n");
6484 ok(hres
== S_OK
, "Could not get ITraveLogClient iface: %08x\n", hres
);
6486 unk
= (void*)0xdeadbeef;
6487 hres
= ITravelLogClient_FindWindowByIndex(travellog_client
, 0, &unk
);
6488 ok(hres
== E_FAIL
, "FindWindowByIndex failed: %08x\n", hres
);
6489 ok(!unk
, "unk != NULL\n");
6491 ITravelLogClient_Release(travellog_client
);
6494 static void test_StreamLoad(IHTMLDocument2
*doc
)
6496 IPersistStreamInit
*init
;
6499 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
6500 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
6504 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6505 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6506 SET_EXPECT(Exec_ShellDocView_37
);
6507 SET_EXPECT(OnChanged_READYSTATE
);
6508 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
6510 SET_EXPECT(GetPendingUrl
);
6511 readystate_set_loading
= TRUE
;
6513 hres
= IPersistStreamInit_Load(init
, &Stream
);
6514 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
6516 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6517 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6518 CHECK_CALLED(Exec_ShellDocView_37
);
6519 CHECK_CALLED(OnChanged_READYSTATE
);
6520 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
6522 todo_wine
CHECK_CALLED(GetPendingUrl
);
6524 test_timer(EXPECT_SETTITLE
);
6525 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank");
6527 IPersistStreamInit_Release(init
);
6530 static void test_StreamInitNew(IHTMLDocument2
*doc
)
6532 IPersistStreamInit
*init
;
6535 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
6536 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
6540 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6541 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6542 SET_EXPECT(Exec_ShellDocView_37
);
6543 SET_EXPECT(OnChanged_READYSTATE
);
6544 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
6545 SET_EXPECT(GetPendingUrl
);
6546 readystate_set_loading
= TRUE
;
6548 hres
= IPersistStreamInit_InitNew(init
);
6549 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
6551 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6552 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6553 CHECK_CALLED(Exec_ShellDocView_37
);
6554 CHECK_CALLED(OnChanged_READYSTATE
);
6555 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
6556 todo_wine
CHECK_CALLED(GetPendingUrl
);
6558 test_timer(EXPECT_SETTITLE
);
6559 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank");
6561 IPersistStreamInit_Release(init
);
6564 static void test_QueryInterface(IHTMLDocument2
*htmldoc
)
6566 IUnknown
*qi
, *doc
= (IUnknown
*)htmldoc
;
6569 static const IID IID_UndocumentedScriptIface
=
6570 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
6572 qi
= (void*)0xdeadbeef;
6573 hres
= IUnknown_QueryInterface(doc
, &IID_IRunnableObject
, (void**)&qi
);
6574 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6575 ok(qi
== NULL
, "qirunnable=%p, expected NULL\n", qi
);
6577 qi
= (void*)0xdeadbeef;
6578 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&qi
);
6579 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6580 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6582 qi
= (void*)0xdeadbeef;
6583 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode2
, (void**)&qi
);
6584 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6585 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6587 qi
= (void*)0xdeadbeef;
6588 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistPropertyBag
, (void**)&qi
);
6589 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6590 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6592 qi
= (void*)0xdeadbeef;
6593 hres
= IUnknown_QueryInterface(doc
, &IID_UndocumentedScriptIface
, (void**)&qi
);
6594 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6595 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6597 qi
= (void*)0xdeadbeef;
6598 hres
= IUnknown_QueryInterface(doc
, &IID_IMarshal
, (void**)&qi
);
6599 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6600 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6602 qi
= (void*)0xdeadbeef;
6603 hres
= IUnknown_QueryInterface(doc
, &IID_IExternalConnection
, (void**)&qi
);
6604 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6605 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6607 qi
= (void*)0xdeadbeef;
6608 hres
= IUnknown_QueryInterface(doc
, &IID_IStdMarshalInfo
, (void**)&qi
);
6609 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6610 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6612 qi
= (void*)0xdeadbeef;
6613 hres
= IUnknown_QueryInterface(doc
, &IID_ITargetFrame
, (void**)&qi
);
6614 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
6615 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
6617 hres
= IUnknown_QueryInterface(doc
, &IID_IDispatch
, (void**)&qi
);
6618 ok(hres
== S_OK
, "Could not get IDispatch interface: %08x\n", hres
);
6619 ok(qi
!= (IUnknown
*)doc
, "disp == doc\n");
6620 IUnknown_Release(qi
);
6623 static void init_test(enum load_state_t ls
) {
6625 doc_hwnd
= last_hwnd
= NULL
;
6626 set_clientsite
= FALSE
;
6627 load_from_stream
= FALSE
;
6628 call_UIActivate
= CallUIActivate_None
;
6635 inplace_deactivated
= FALSE
;
6637 expect_uihandler_iface
= &DocHostUIHandler
;
6640 static void test_HTMLDocument(BOOL do_load
, BOOL mime
)
6642 IHTMLDocument2
*doc
;
6644 trace("Testing HTMLDocument (%s, %s)...\n", (do_load
? "load" : "no load"),
6645 (report_mime
? "mime" : "no mime"));
6647 init_test(do_load
? LD_DOLOAD
: LD_NO
);
6650 doc
= create_document();
6651 doc_unk
= (IUnknown
*)doc
;
6653 test_QueryInterface(doc
);
6655 test_IsDirty(doc
, S_FALSE
);
6656 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6657 test_external(doc
, FALSE
);
6658 test_ViewAdviseSink(doc
);
6659 test_ConnectionPointContainer(doc
);
6660 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
6661 test_Persist(doc
, &Moniker
);
6663 test_OnAmbientPropertyChange2(doc
);
6665 test_Activate(doc
, CLIENTSITE_EXPECTPATH
);
6668 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
6669 test_download(DWL_CSS
|DWL_TRYCSS
);
6670 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
6671 test_elem_from_point(doc
);
6674 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6675 test_OleCommandTarget_fail(doc
);
6676 test_OleCommandTarget(doc
);
6677 test_OnAmbientPropertyChange(doc
);
6678 test_Window(doc
, TRUE
);
6679 test_external(doc
, TRUE
);
6680 test_target_container(doc
);
6682 test_UIDeactivate();
6683 test_OleCommandTarget(doc
);
6684 test_Window(doc
, TRUE
);
6685 test_InPlaceDeactivate(doc
, TRUE
);
6687 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
6688 * MSHTML. It doesn't with Wine. */
6690 test_Window(doc
, FALSE
);
6692 test_InPlaceDeactivate(doc
, FALSE
);
6694 test_Close(doc
, FALSE
);
6696 /* Activate HTMLDocument again */
6697 test_Activate(doc
, CLIENTSITE_SETNULL
);
6698 test_Window(doc
, TRUE
);
6699 test_OleCommandTarget(doc
);
6700 test_UIDeactivate();
6701 test_InPlaceDeactivate(doc
, TRUE
);
6702 test_Close(doc
, FALSE
);
6704 /* Activate HTMLDocument again, this time without UIActivate */
6705 call_UIActivate
= CallUIActivate_None
;
6706 test_Activate(doc
, CLIENTSITE_SETNULL
);
6707 test_Window(doc
, TRUE
);
6709 test_external(doc
, TRUE
);
6710 set_custom_uihandler(doc
, NULL
);
6711 test_external(doc
, FALSE
);
6713 test_UIDeactivate();
6714 test_InPlaceDeactivate(doc
, TRUE
);
6717 test_Close(doc
, TRUE
);
6718 test_OnAmbientPropertyChange2(doc
);
6719 test_GetCurMoniker((IUnknown
*)doc
, do_load
? &Moniker
: NULL
, NULL
);
6722 /* Activate HTMLDocument again, calling UIActivate after showing the window */
6723 call_UIActivate
= CallUIActivate_AfterShow
;
6724 test_Activate(doc
, 0);
6725 test_Window(doc
, TRUE
);
6726 test_OleCommandTarget(doc
);
6727 test_UIDeactivate();
6728 test_InPlaceDeactivate(doc
, TRUE
);
6729 test_Close(doc
, FALSE
);
6730 call_UIActivate
= CallUIActivate_None
;
6734 IOleDocumentView_Release(view
);
6737 ok(IsWindow(doc_hwnd
), "hwnd is destroyed\n");
6738 release_document(doc
);
6739 ok(!IsWindow(doc_hwnd
), "hwnd is not destroyed\n");
6742 static void test_HTMLDocument_hlink(DWORD status
)
6744 IHTMLDocument2
*doc
;
6746 trace("Testing HTMLDocument (hlink)...\n");
6748 init_test(LD_DOLOAD
);
6751 doc
= create_document();
6752 doc_unk
= (IUnknown
*)doc
;
6754 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
6755 test_ViewAdviseSink(doc
);
6756 test_ConnectionPointContainer(doc
);
6757 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
6758 test_Persist(doc
, &Moniker
);
6761 status_code
= status
;
6762 test_download(DWL_CSS
|DWL_TRYCSS
);
6763 status_code
= HTTP_STATUS_OK
;
6765 test_IsDirty(doc
, S_FALSE
);
6766 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6768 test_exec_onunload(doc
);
6769 test_Window(doc
, TRUE
);
6770 test_InPlaceDeactivate(doc
, TRUE
);
6771 test_Close(doc
, FALSE
);
6772 test_IsDirty(doc
, S_FALSE
);
6773 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
6775 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
6778 IOleDocumentView_Release(view
);
6781 release_document(doc
);
6784 static void test_cookies(IHTMLDocument2
*doc
)
6792 hres
= IHTMLDocument2_get_cookie(doc
, &str
);
6793 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
6795 size
= sizeof(buf
)/sizeof(WCHAR
);
6796 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
6797 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
6798 ok(!lstrcmpW(buf
, str
), "cookie = %s, expected %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(buf
));
6802 str
= a2bstr("test=testval");
6803 hres
= IHTMLDocument2_put_cookie(doc
, str
);
6804 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
6807 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
6808 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
6809 ok(str2
!= NULL
, "cookie = NULL\n");
6810 size
= sizeof(buf
)/sizeof(WCHAR
);
6811 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
6812 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
6813 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
6814 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
6816 SysFreeString(str2
);
6818 str
= a2bstr("test=testval2");
6819 hres
= IHTMLDocument2_put_cookie(doc
, str
);
6820 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
6823 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
6824 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
6825 ok(str2
!= NULL
, "cookie = NULL\n");
6826 size
= sizeof(buf
)/sizeof(WCHAR
);
6827 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
6828 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
6829 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
6830 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
6832 SysFreeString(str2
);
6835 static void test_HTMLDocument_http(BOOL with_wbapp
)
6838 IHTMLDocument2
*doc
;
6842 trace("Testing HTMLDocument (http%s)...\n", with_wbapp
? " with IWebBrowserApp" : "");
6844 support_wbapp
= with_wbapp
;
6846 if(!winetest_interactive
&& is_ie_hardened()) {
6847 win_skip("IE running in Enhanced Security Configuration\n");
6851 init_test(LD_DOLOAD
);
6854 doc
= create_document();
6855 doc_unk
= (IUnknown
*)doc
;
6857 hres
= CreateURLMoniker(NULL
, http_urlW
, &http_mon
);
6858 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
6860 test_ViewAdviseSink(doc
);
6861 test_ConnectionPointContainer(doc
);
6862 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
6863 test_Persist(doc
, http_mon
);
6865 test_download(DWL_HTTP
);
6867 test_IsDirty(doc
, S_FALSE
);
6868 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6869 test_GetCurMoniker((IUnknown
*)doc
, http_mon
, NULL
);
6870 test_travellog(doc
);
6871 test_binding_ui((IUnknown
*)doc
);
6873 nav_url
= nav_serv_url
= "http://www.winehq.org/"; /* for valid prev nav_url */
6875 test_put_href(doc
, FALSE
, "#test", "http://www.winehq.org/#test", FALSE
, TRUE
, 0);
6876 test_travellog(doc
);
6878 test_put_href(doc
, FALSE
, NULL
, "javascript:external%20&&undefined", TRUE
, FALSE
, 0);
6879 test_put_href(doc
, FALSE
, NULL
, "about:blank", FALSE
, FALSE
, support_wbapp
? DWL_EXPECT_HISTUPDATE
: 0);
6880 test_put_href(doc
, TRUE
, NULL
, "about:replace", FALSE
, FALSE
, 0);
6882 test_open_window(doc
, TRUE
);
6883 if(!support_wbapp
) /* FIXME */
6884 test_open_window(doc
, FALSE
);
6886 test_InPlaceDeactivate(doc
, TRUE
);
6887 test_Close(doc
, FALSE
);
6888 test_IsDirty(doc
, S_FALSE
);
6889 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:replace");
6892 IOleDocumentView_Release(view
);
6895 release_document(doc
);
6897 ref
= IMoniker_Release(http_mon
);
6898 ok(!ref
, "ref=%d, expected 0\n", ref
);
6901 static void test_QueryService(IHTMLDocument2
*doc
, BOOL success
)
6903 IHTMLWindow2
*window
, *sp_window
;
6904 IServiceProvider
*sp
;
6908 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&sp
);
6909 ok(hres
== S_OK
, "QueryService returned %08x\n", hres
);
6911 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
6913 ok(hres
== E_NOINTERFACE
, "QueryService returned %08x, expected E_NOINTERFACE\n", hres
);
6914 IServiceProvider_Release(sp
);
6918 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
6919 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
6920 IHlinkFrame_Release(hf
);
6922 IServiceProvider_Release(sp
);
6924 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
6925 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
6927 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IServiceProvider
, (void**)&sp
);
6928 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
6930 hres
= IServiceProvider_QueryService(sp
, &IID_IHTMLWindow2
, &IID_IHTMLWindow2
, (void**)&sp_window
);
6931 ok(hres
== S_OK
, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres
);
6932 /* FIXME: test returned window */
6933 IHTMLWindow2_Release(sp_window
);
6935 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
6936 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
6937 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
6938 IHlinkFrame_Release(hf
);
6940 IServiceProvider_Release(sp
);
6941 IHTMLWindow2_Release(window
);
6944 static void test_HTMLDocument_StreamLoad(void)
6946 IHTMLDocument2
*doc
;
6951 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
6953 init_test(LD_DOLOAD
);
6954 load_from_stream
= TRUE
;
6956 doc
= create_document();
6957 doc_unk
= (IUnknown
*)doc
;
6959 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6960 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
6962 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
6963 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
6965 test_readyState((IUnknown
*)doc
);
6966 test_IsDirty(doc
, S_FALSE
);
6967 test_ViewAdviseSink(doc
);
6968 test_ConnectionPointContainer(doc
);
6969 test_QueryService(doc
, FALSE
);
6970 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
6971 test_QueryService(doc
, TRUE
);
6972 test_DoVerb(oleobj
);
6973 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6975 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
6976 test_StreamLoad(doc
);
6977 test_download(DWL_VERBDONE
|DWL_TRYCSS
);
6978 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
6980 test_UIDeactivate();
6981 test_InPlaceDeactivate(doc
, TRUE
);
6982 SET_EXPECT(Advise_Close
);
6983 test_Close(doc
, TRUE
);
6984 CHECK_CALLED(Advise_Close
);
6985 test_external(doc
, FALSE
);
6986 test_IsDirty(doc
, S_FALSE
);
6988 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
6989 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
);
6990 test_external(doc
, TRUE
);
6991 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
6992 test_external(doc
, TRUE
);
6993 set_custom_uihandler(doc
, NULL
);
6994 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
6996 IOleObject_Release(oleobj
);
6998 IOleDocumentView_Release(view
);
7002 release_document(doc
);
7005 static void test_HTMLDocument_StreamInitNew(void)
7007 IHTMLDocument2
*doc
;
7012 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
7014 init_test(LD_DOLOAD
);
7015 load_from_stream
= TRUE
;
7017 doc
= create_document();
7018 doc_unk
= (IUnknown
*)doc
;
7020 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7021 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
7023 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
7024 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
7026 test_readyState((IUnknown
*)doc
);
7027 test_IsDirty(doc
, S_FALSE
);
7028 test_ViewAdviseSink(doc
);
7029 test_ConnectionPointContainer(doc
);
7030 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
7031 test_DoVerb(oleobj
);
7032 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7034 IOleObject_Release(oleobj
);
7036 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
7037 test_StreamInitNew(doc
);
7039 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
7040 test_download(DWL_VERBDONE
|DWL_TRYCSS
|DWL_EMPTY
);
7041 todo_wine
CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive
);
7043 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7045 test_UIDeactivate();
7046 test_InPlaceDeactivate(doc
, TRUE
);
7047 SET_EXPECT(Advise_Close
);
7048 test_Close(doc
, FALSE
);
7049 CHECK_CALLED(Advise_Close
);
7050 test_IsDirty(doc
, S_FALSE
);
7053 IOleDocumentView_Release(view
);
7057 release_document(doc
);
7060 static void test_edit_uiactivate(IOleObject
*oleobj
)
7062 IOleDocumentView
*docview
;
7065 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
7066 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
7068 SET_EXPECT(OnFocus_TRUE
);
7069 SET_EXPECT(SetActiveObject
);
7071 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
7072 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
7073 expect_status_text
= NULL
;
7075 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
7076 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
7078 CHECK_CALLED(OnFocus_TRUE
);
7079 CHECK_CALLED(SetActiveObject
);
7080 CHECK_CALLED(ShowUI
);
7081 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
7082 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
7084 IOleDocumentView_Release(docview
);
7087 static void test_editing_mode(BOOL do_load
)
7089 IHTMLDocument2
*doc
;
7095 trace("Testing HTMLDocument (edit%s)...\n", do_load
? " load" : "");
7097 init_test(do_load
? LD_DOLOAD
: LD_NO
);
7098 call_UIActivate
= CallUIActivate_AfterShow
;
7100 doc
= create_document();
7101 unk
= doc_unk
= (IUnknown
*)doc
;
7103 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7104 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
7106 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
7107 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
7109 test_readyState((IUnknown
*)doc
);
7110 test_ViewAdviseSink(doc
);
7111 test_ConnectionPointContainer(doc
);
7112 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
7113 test_DoVerb(oleobj
);
7114 test_edit_uiactivate(oleobj
);
7116 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7118 test_Persist(doc
, &Moniker
);
7119 stream_read
= protocol_read
= 0;
7120 test_exec_editmode(unk
, do_load
);
7121 test_UIDeactivate();
7122 call_UIActivate
= CallUIActivate_None
;
7123 IOleObject_Release(oleobj
);
7125 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
7126 test_download(DWL_VERBDONE
| (do_load
? DWL_CSS
|DWL_TRYCSS
: 0));
7128 SET_EXPECT(SetStatusText
); /* ignore race in native mshtml */
7129 test_timer(EXPECT_UPDATEUI
);
7130 CLEAR_CALLED(SetStatusText
);
7132 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
7135 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
7136 test_timer(EXPECT_UPDATEUI
);
7137 test_exec_fontname(unk
, NULL
, wszArial
);
7139 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
7140 test_timer(EXPECT_UPDATEUI
);
7141 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
7142 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
7144 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
7145 test_timer(EXPECT_UPDATEUI
);
7146 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
7147 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
7148 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
7149 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
7151 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
7152 test_timer(EXPECT_UPDATEUI
);
7153 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
7154 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
7157 test_UIDeactivate();
7158 test_InPlaceDeactivate(doc
, TRUE
);
7159 SET_EXPECT(Advise_Close
);
7160 test_Close(doc
, FALSE
);
7161 CHECK_CALLED(Advise_Close
);
7164 IOleDocumentView_Release(view
);
7168 release_document(doc
);
7171 static void test_UIActivate(BOOL do_load
, BOOL use_ipsex
, BOOL use_ipsw
)
7173 IHTMLDocument2
*doc
;
7175 IOleInPlaceSite
*inplacesite
;
7178 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load
, use_ipsex
, use_ipsw
);
7180 init_test(do_load
? LD_DOLOAD
: LD_NO
);
7182 doc
= create_document();
7183 doc_unk
= (IUnknown
*)doc
;
7188 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
7189 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
7191 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&view
);
7192 ok(hres
== S_OK
, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres
);
7194 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
7195 SET_EXPECT(GetHostInfo
);
7196 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
7197 SET_EXPECT(Invoke_AMBIENT_SILENT
);
7198 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7199 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
7200 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
7201 SET_EXPECT(GetOptionKeyPath
);
7202 SET_EXPECT(GetOverrideKeyPath
);
7203 SET_EXPECT(GetWindow
);
7204 SET_EXPECT(Exec_DOCCANNAVIGATE
);
7205 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
7206 SET_EXPECT(Exec_SETPROGRESSMAX
);
7207 SET_EXPECT(Exec_SETPROGRESSPOS
);
7208 SET_EXPECT(GetTravelLog
);
7209 SET_EXPECT(Exec_ShellDocView_84
);
7211 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
7212 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
7213 set_clientsite
= TRUE
;
7215 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
7216 CHECK_CALLED(GetHostInfo
);
7217 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
7218 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
7219 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
7220 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
7221 CLEAR_CALLED(Invoke_AMBIENT_PALETTE
); /* not called on IE9 */
7222 CLEAR_CALLED(GetOptionKeyPath
); /* not called on some IE9 */
7223 CHECK_CALLED(GetOverrideKeyPath
);
7224 CHECK_CALLED(GetWindow
);
7225 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
7226 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
7227 CHECK_CALLED(Exec_SETPROGRESSMAX
);
7228 CHECK_CALLED(Exec_SETPROGRESSPOS
);
7229 todo_wine
CHECK_CALLED(GetTravelLog
);
7230 CHECK_CALLED_BROKEN(Exec_ShellDocView_84
);
7232 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
7233 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
7234 ok(inplacesite
== NULL
, "inplacesite = %p, expected NULL\n", inplacesite
);
7236 SET_EXPECT(GetContainer
);
7237 SET_EXPECT(LockContainer
);
7238 SET_EXPECT(CanInPlaceActivate
);
7239 SET_EXPECT(GetWindowContext
);
7240 SET_EXPECT(GetWindow
);
7242 SET_EXPECT(OnInPlaceActivateEx
);
7243 SET_EXPECT(RequestUIActivate
);
7246 SET_EXPECT(OnInPlaceActivate
);
7247 SET_EXPECT(OnUIActivate
);
7248 SET_EXPECT(SetStatusText
);
7249 SET_EXPECT(Exec_SETPROGRESSMAX
);
7250 SET_EXPECT(Exec_SETPROGRESSPOS
);
7252 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
7253 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
7254 SET_EXPECT(OnFocus_TRUE
);
7255 SET_EXPECT(SetActiveObject
);
7256 expect_LockContainer_fLock
= TRUE
;
7258 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
7259 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
7261 CHECK_CALLED(GetContainer
);
7262 CHECK_CALLED(LockContainer
);
7263 CHECK_CALLED(CanInPlaceActivate
);
7264 CHECK_CALLED(GetWindowContext
);
7265 CHECK_CALLED(GetWindow
);
7267 CHECK_CALLED(OnInPlaceActivateEx
);
7268 SET_EXPECT(RequestUIActivate
);
7271 CHECK_CALLED(OnInPlaceActivate
);
7272 CHECK_CALLED(OnUIActivate
);
7273 CHECK_CALLED(SetStatusText
);
7274 CHECK_CALLED(Exec_SETPROGRESSMAX
);
7275 CHECK_CALLED(Exec_SETPROGRESSPOS
);
7276 CHECK_CALLED(ShowUI
);
7277 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
7278 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
7279 CHECK_CALLED(OnFocus_TRUE
);
7280 CHECK_CALLED(SetActiveObject
);
7281 container_locked
= TRUE
;
7283 SET_EXPECT(SetActiveObject_null
);
7284 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
7286 SET_EXPECT(OnUIDeactivate
);
7288 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
7289 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
7291 CHECK_CALLED(SetActiveObject_null
);
7292 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
7293 CHECK_CALLED(HideUI
);
7294 CHECK_CALLED(OnUIDeactivate
);
7296 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
7297 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
7298 ok(inplacesite
!= NULL
, "inplacesite = NULL\n");
7299 IOleInPlaceSite_Release(inplacesite
);
7301 SET_EXPECT(SetStatusText
);
7302 SET_EXPECT(OnFocus_FALSE
);
7304 SET_EXPECT(OnInPlaceDeactivateEx
);
7306 SET_EXPECT(OnInPlaceDeactivate
);
7310 CLEAR_CALLED(SetStatusText
); /* Called by IE9 */
7311 CHECK_CALLED(OnFocus_FALSE
);
7313 CHECK_CALLED(OnInPlaceDeactivateEx
);
7315 CHECK_CALLED(OnInPlaceDeactivate
);
7317 test_Close(doc
, TRUE
);
7319 IOleObject_Release(oleobj
);
7320 IOleDocumentView_Release(view
);
7323 release_document(doc
);
7326 static void register_protocol(void)
7328 IInternetSession
*session
;
7331 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
7333 hres
= CoInternetGetSession(0, &session
, 0);
7334 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
7336 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
7337 wsz_winetest
, 0, NULL
, 0);
7338 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
7340 IInternetSession_Release(session
);
7343 static void test_HTMLDoc_ISupportErrorInfo(void)
7345 IHTMLDocument2
*doc
;
7347 ISupportErrorInfo
*sinfo
;
7349 doc
= create_document();
7351 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ISupportErrorInfo
, (void**)&sinfo
);
7352 ok(hres
== S_OK
, "got %x\n", hres
);
7353 ok(sinfo
!= NULL
, "got %p\n", sinfo
);
7356 hres
= ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo
, &IID_IErrorInfo
);
7357 ok(hres
== S_FALSE
, "Expected S_OK, got %x\n", hres
);
7358 ISupportErrorInfo_Release(sinfo
);
7361 release_document(doc
);
7364 static void test_IPersistHistory(void)
7366 IHTMLDocument2
*doc
;
7368 IPersistHistory
*phist
;
7370 doc
= create_document();
7372 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IPersistHistory
, (void**)&phist
);
7373 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
7375 IPersistHistory_Release(phist
);
7377 release_document(doc
);
7380 static BOOL
check_ie(void)
7382 IHTMLDocument2
*doc
;
7383 IHTMLDocument5
*doc5
;
7386 doc
= create_document();
7390 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
7392 IHTMLDocument5_Release(doc5
);
7394 release_document(doc
);
7395 return SUCCEEDED(hres
);
7398 static void test_ServiceProvider(void)
7400 IHTMLDocument3
*doc3
, *doc3_2
;
7401 IServiceProvider
*provider
;
7402 IHTMLDocument2
*doc
, *doc2
;
7406 doc
= create_document();
7410 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&provider
);
7411 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
7413 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IHTMLDocument2
, (void**)&doc2
);
7414 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
7415 ok(iface_cmp((IUnknown
*)doc2
, (IUnknown
*)doc
), "got wrong pointer\n");
7416 IHTMLDocument2_Release(doc2
);
7418 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IHTMLDocument3
, (void**)&doc3
);
7419 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
7420 ok(iface_cmp((IUnknown
*)doc3
, (IUnknown
*)doc
), "got wrong pointer\n");
7422 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument3
, (void**)&doc3_2
);
7423 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
7424 ok(iface_cmp((IUnknown
*)doc3_2
, (IUnknown
*)doc
), "got wrong pointer\n");
7425 ok(iface_cmp((IUnknown
*)doc3_2
, (IUnknown
*)doc3
), "got wrong pointer\n");
7426 IHTMLDocument3_Release(doc3
);
7427 IHTMLDocument3_Release(doc3_2
);
7429 hres
= IServiceProvider_QueryService(provider
, &SID_SContainerDispatch
, &IID_IUnknown
, (void**)&unk
);
7430 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
7431 ok(iface_cmp((IUnknown
*)doc
, unk
), "got wrong pointer\n");
7433 IUnknown_Release(unk
);
7434 IServiceProvider_Release(provider
);
7435 release_document(doc
);
7444 win_skip("Too old IE\n");
7448 container_hwnd
= create_container_window();
7449 register_protocol();
7451 asynchronous_binding
= TRUE
;
7452 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND
);
7454 asynchronous_binding
= FALSE
;
7455 test_HTMLDocument_hlink(HTTP_STATUS_OK
);
7456 test_HTMLDocument(FALSE
, TRUE
);
7457 test_HTMLDocument(TRUE
, FALSE
);
7458 test_HTMLDocument(TRUE
, TRUE
);
7459 test_HTMLDocument_StreamLoad();
7460 test_HTMLDocument_StreamInitNew();
7461 test_editing_mode(FALSE
);
7462 test_editing_mode(TRUE
);
7463 test_HTMLDocument_http(FALSE
);
7464 test_HTMLDocument_http(TRUE
);
7465 test_UIActivate(FALSE
, FALSE
, FALSE
);
7466 test_UIActivate(FALSE
, TRUE
, FALSE
);
7467 test_UIActivate(FALSE
, TRUE
, TRUE
);
7468 test_UIActivate(TRUE
, FALSE
, FALSE
);
7469 test_UIActivate(TRUE
, TRUE
, FALSE
);
7470 test_UIActivate(TRUE
, TRUE
, TRUE
);
7471 test_HTMLDoc_ISupportErrorInfo();
7472 test_IPersistHistory();
7473 test_ServiceProvider();
7475 DestroyWindow(container_hwnd
);