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"
44 #include "mshtml_test.h"
46 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
47 DEFINE_GUID(IID_IProxyManager
,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
48 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
56 #define SET_CALLED(func) \
57 called_ ## func = TRUE
59 #define CHECK_EXPECT2(func) \
61 ok(expect_ ##func, "unexpected call " #func "\n"); \
62 called_ ## func = TRUE; \
65 #define CHECK_EXPECT(func) \
67 CHECK_EXPECT2(func); \
68 expect_ ## func = FALSE; \
71 #define CHECK_CALLED(func) \
73 ok(called_ ## func, "expected " #func "\n"); \
74 expect_ ## func = called_ ## func = FALSE; \
77 #define CHECK_NOT_CALLED(func) \
79 ok(!called_ ## func, "unexpected " #func "\n"); \
80 expect_ ## func = called_ ## func = FALSE; \
83 #define CHECK_CALLED_BROKEN(func) \
85 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
86 expect_ ## func = called_ ## func = FALSE; \
89 #define CLEAR_CALLED(func) \
90 expect_ ## func = called_ ## func = FALSE
92 static IOleDocumentView
*view
= NULL
;
93 static HWND container_hwnd
= NULL
, hwnd
= NULL
, last_hwnd
= NULL
;
95 DEFINE_EXPECT(LockContainer
);
96 DEFINE_EXPECT(SetActiveObject
);
97 DEFINE_EXPECT(SetActiveObject_null
);
98 DEFINE_EXPECT(GetWindow
);
99 DEFINE_EXPECT(CanInPlaceActivate
);
100 DEFINE_EXPECT(OnInPlaceActivate
);
101 DEFINE_EXPECT(OnInPlaceActivateEx
);
102 DEFINE_EXPECT(OnUIActivate
);
103 DEFINE_EXPECT(GetWindowContext
);
104 DEFINE_EXPECT(OnUIDeactivate
);
105 DEFINE_EXPECT(OnInPlaceDeactivate
);
106 DEFINE_EXPECT(OnInPlaceDeactivateEx
);
107 DEFINE_EXPECT(GetContainer
);
108 DEFINE_EXPECT(ShowUI
);
109 DEFINE_EXPECT(ActivateMe
);
110 DEFINE_EXPECT(GetHostInfo
);
111 DEFINE_EXPECT(HideUI
);
112 DEFINE_EXPECT(GetOptionKeyPath
);
113 DEFINE_EXPECT(GetOverrideKeyPath
);
114 DEFINE_EXPECT(SetStatusText
);
115 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
116 DEFINE_EXPECT(QueryStatus_OPEN
);
117 DEFINE_EXPECT(QueryStatus_NEW
);
118 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
119 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
120 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE
);
121 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
122 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
123 DEFINE_EXPECT(Exec_ShellDocView_37
);
124 DEFINE_EXPECT(Exec_ShellDocView_63
);
125 DEFINE_EXPECT(Exec_ShellDocView_67
);
126 DEFINE_EXPECT(Exec_ShellDocView_84
);
127 DEFINE_EXPECT(Exec_ShellDocView_103
);
128 DEFINE_EXPECT(Exec_ShellDocView_105
);
129 DEFINE_EXPECT(Exec_ShellDocView_140
);
130 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
131 DEFINE_EXPECT(Exec_SETTITLE
);
132 DEFINE_EXPECT(Exec_HTTPEQUIV
);
133 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
134 DEFINE_EXPECT(Exec_Explorer_69
);
135 DEFINE_EXPECT(Exec_DOCCANNAVIGATE
);
136 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
137 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
138 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
139 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
140 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
141 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
142 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive
);
143 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading
);
144 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete
);
145 DEFINE_EXPECT(GetDropTarget
);
146 DEFINE_EXPECT(UpdateUI
);
147 DEFINE_EXPECT(Navigate
);
148 DEFINE_EXPECT(OnFrameWindowActivate
);
149 DEFINE_EXPECT(OnChanged_READYSTATE
);
150 DEFINE_EXPECT(OnChanged_1005
);
151 DEFINE_EXPECT(OnChanged_1012
);
152 DEFINE_EXPECT(GetDisplayName
);
153 DEFINE_EXPECT(BindToStorage
);
154 DEFINE_EXPECT(IsSystemMoniker
);
155 DEFINE_EXPECT(GetBindResult
);
156 DEFINE_EXPECT(GetClassID
);
157 DEFINE_EXPECT(Abort
);
159 DEFINE_EXPECT(CreateInstance
);
160 DEFINE_EXPECT(Start
);
161 DEFINE_EXPECT(Terminate
);
162 DEFINE_EXPECT(Protocol_Read
);
163 DEFINE_EXPECT(LockRequest
);
164 DEFINE_EXPECT(UnlockRequest
);
165 DEFINE_EXPECT(OnFocus_TRUE
);
166 DEFINE_EXPECT(OnFocus_FALSE
);
167 DEFINE_EXPECT(RequestUIActivate
);
168 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace
);
169 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject
);
170 DEFINE_EXPECT(GetExternal
);
171 DEFINE_EXPECT(EnableModeless_TRUE
);
172 DEFINE_EXPECT(EnableModeless_FALSE
);
173 DEFINE_EXPECT(Frame_EnableModeless_TRUE
);
174 DEFINE_EXPECT(Frame_EnableModeless_FALSE
);
175 DEFINE_EXPECT(Frame_GetWindow
);
176 DEFINE_EXPECT(TranslateUrl
);
177 DEFINE_EXPECT(Advise_Close
);
178 DEFINE_EXPECT(OnViewChange
);
179 DEFINE_EXPECT(EvaluateNewWindow
);
180 DEFINE_EXPECT(GetTravelLog
);
181 DEFINE_EXPECT(UpdateBackForwardState
);
182 DEFINE_EXPECT(FireNavigateComplete2
);
183 DEFINE_EXPECT(FireDocumentComplete
);
184 DEFINE_EXPECT(GetPendingUrl
);
185 DEFINE_EXPECT(ActiveElementChanged
);
186 DEFINE_EXPECT(IsErrorUrl
);
188 static IUnknown
*doc_unk
;
189 static IMoniker
*doc_mon
;
190 static BOOL expect_LockContainer_fLock
;
191 static BOOL expect_InPlaceUIWindow_SetActiveObject_active
= TRUE
;
192 static BOOL ipsex
, ipsw
;
193 static BOOL set_clientsite
, container_locked
;
194 static BOOL readystate_set_loading
= FALSE
, readystate_set_interactive
= FALSE
, load_from_stream
;
195 static BOOL editmode
= FALSE
, ignore_external_qi
;
196 static BOOL inplace_deactivated
, open_call
;
197 static BOOL complete
, loading_js
;
198 static DWORD status_code
= HTTP_STATUS_OK
;
199 static BOOL asynchronous_binding
= FALSE
;
200 static int stream_read
, protocol_read
;
201 static enum load_state_t
{
210 static LPCOLESTR expect_status_text
= NULL
;
211 static const char *nav_url
;
213 static const char html_page
[] =
215 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
219 static const char css_data
[] = "body {color: red}";
221 static const WCHAR http_urlW
[] =
222 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
224 static const WCHAR doc_url
[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
226 #define DOCHOST_DOCCANNAVIGATE 0
227 #define WM_CONTINUE_BINDING (WM_APP+1)
229 static HRESULT
QueryInterface(REFIID riid
, void **ppv
);
230 static void test_MSHTML_QueryStatus(IHTMLDocument2
*,DWORD
);
232 #define test_readyState(u) _test_readyState(__LINE__,u)
233 static void _test_readyState(unsigned,IUnknown
*);
235 static const WCHAR wszTimesNewRoman
[] =
236 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
237 static const WCHAR wszArial
[] =
238 {'A','r','i','a','l',0};
240 static const char *debugstr_guid(REFIID riid
)
247 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
248 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
249 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
250 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
255 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
258 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
259 return lstrcmpA(stra
, buf
);
262 static const WCHAR
*strstrW( const WCHAR
*str
, const WCHAR
*sub
)
266 const WCHAR
*p1
= str
, *p2
= sub
;
267 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
268 if (!*p2
) return str
;
274 static BSTR
a2bstr(const char *str
)
279 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
280 ret
= SysAllocStringLen(NULL
, len
);
281 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
286 /* Returns true if the user interface is in English. Note that this does not
287 * presume of the formatting of dates, numbers, etc.
289 static BOOL
is_lang_english(void)
291 static HMODULE hkernel32
= NULL
;
292 static LANGID (WINAPI
*pGetThreadUILanguage
)(void) = NULL
;
293 static LANGID (WINAPI
*pGetUserDefaultUILanguage
)(void) = NULL
;
297 hkernel32
= GetModuleHandleA("kernel32.dll");
298 pGetThreadUILanguage
= (void*)GetProcAddress(hkernel32
, "GetThreadUILanguage");
299 pGetUserDefaultUILanguage
= (void*)GetProcAddress(hkernel32
, "GetUserDefaultUILanguage");
301 if (pGetThreadUILanguage
)
302 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH
;
303 if (pGetUserDefaultUILanguage
)
304 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH
;
306 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
309 #define EXPECT_UPDATEUI 1
310 #define EXPECT_SETTITLE 2
312 static void test_timer(DWORD flags
)
314 BOOL
*b
= &called_Exec_SETTITLE
;
317 if(flags
& EXPECT_UPDATEUI
) {
318 SET_EXPECT(UpdateUI
);
319 SET_EXPECT(Exec_UPDATECOMMANDS
);
320 b
= &called_UpdateUI
;
322 if(flags
& EXPECT_SETTITLE
)
323 SET_EXPECT(Exec_SETTITLE
);
325 while(!*b
&& GetMessage(&msg
, hwnd
, 0, 0)) {
326 TranslateMessage(&msg
);
327 DispatchMessage(&msg
);
330 if(flags
& EXPECT_UPDATEUI
) {
331 CHECK_CALLED(UpdateUI
);
332 CHECK_CALLED(Exec_UPDATECOMMANDS
);
334 if(flags
& EXPECT_SETTITLE
)
335 CHECK_CALLED(Exec_SETTITLE
);
338 static IMoniker Moniker
;
340 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
341 static void _test_GetCurMoniker(unsigned line
, IUnknown
*unk
, IMoniker
*exmon
, const char *exurl
)
344 IPersistMoniker
*permon
;
345 IMoniker
*mon
= (void*)0xdeadbeef;
346 BSTR doc_url
= (void*)0xdeadbeef;
352 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
353 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
357 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
358 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
360 hres
= IHTMLDocument2_get_URL(doc
, &doc_url
);
361 ok(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
363 hres
= IPersistMoniker_GetCurMoniker(permon
, &mon
);
364 IPersistMoniker_Release(permon
);
368 BOOL exb
= expect_GetDisplayName
;
369 BOOL clb
= called_GetDisplayName
;
371 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
372 ok_(__FILE__
,line
)(mon
== exmon
, "mon(%p) != exmon(%p)\n", mon
, exmon
);
375 SET_EXPECT(GetDisplayName
);
376 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
377 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
379 CHECK_CALLED(GetDisplayName
);
380 expect_GetDisplayName
= exb
;
381 called_GetDisplayName
= clb
;
383 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
388 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
390 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
391 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
393 ok_(__FILE__
,line
)(!strcmp_wa(url
, exurl
), "unexpected url %s\n", wine_dbgstr_w(url
));
394 ok_(__FILE__
,line
)(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
398 ok_(__FILE__
,line
)(hres
== E_UNEXPECTED
,
399 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres
);
400 ok_(__FILE__
,line
)(mon
== (IMoniker
*)0xdeadbeef, "mon=%p\n", mon
);
401 ok_(__FILE__
,line
)(!strcmp_wa(doc_url
, "about:blank"), "doc_url is not about:blank\n");
404 SysFreeString(doc_url
);
405 IHTMLDocument_Release(doc
);
406 if(mon
&& mon
!= (void*)0xdeadbeef)
407 IMoniker_Release(mon
);
410 DEFINE_GUID(IID_External_unk
,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
412 static HRESULT WINAPI
External_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
416 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
421 if(IsEqualGUID(&IID_IProxyManager
, riid
))
422 return E_NOINTERFACE
; /* TODO */
423 if(IsEqualGUID(&IID_IDispatchEx
, riid
))
424 return E_NOINTERFACE
; /* TODO */
425 if(IsEqualGUID(&IID_External_unk
, riid
))
426 return E_NOINTERFACE
; /* TODO */
428 if(!ignore_external_qi
)
429 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
430 return E_NOINTERFACE
;
433 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
438 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
443 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
445 ok(0, "unexpected call\n");
449 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
452 ok(0, "unexpected call\n");
456 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
457 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
459 ok(0, "unexpected call\n");
463 static HRESULT WINAPI
External_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
464 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
465 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
467 ok(0, "unexpected call\n");
471 static const IDispatchVtbl ExternalVtbl
= {
472 External_QueryInterface
,
475 Dispatch_GetTypeInfoCount
,
476 Dispatch_GetTypeInfo
,
477 Dispatch_GetIDsOfNames
,
481 static IDispatch External
= { &ExternalVtbl
};
483 static HRESULT WINAPI
Protocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
485 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
491 return E_NOINTERFACE
;
494 static ULONG WINAPI
Protocol_AddRef(IInternetProtocol
*iface
)
499 static ULONG WINAPI
Protocol_Release(IInternetProtocol
*iface
)
504 static HRESULT WINAPI
Protocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
505 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
506 DWORD grfPI
, HANDLE_PTR dwReserved
)
512 static const WCHAR wszTextCss
[] = {'t','e','x','t','/','c','s','s',0};
513 static const WCHAR empty_str
= {0};
517 ok(pOIProtSink
!= NULL
, "pOIProtSink == NULL\n");
518 ok(pOIBindInfo
!= NULL
, "pOIBindInfo == NULL\n");
519 ok(!grfPI
, "grfPI = %x\n", grfPI
);
520 ok(!dwReserved
, "dwReserved = %lx\n", dwReserved
);
522 memset(&bindinfo
, 0, sizeof(bindinfo
));
523 bindinfo
.cbSize
= sizeof(bindinfo
);
524 hres
= IInternetBindInfo_GetBindInfo(pOIBindInfo
, &bindf
, &bindinfo
);
525 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
526 ok(bindf
== (BINDF_FROMURLMON
|BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
527 "bindf = %x\n", bindf
);
529 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
530 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
531 /* TODO: test stgmedData */
532 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
533 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
534 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
535 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
536 ok(bindinfo
.dwOptions
== 0x80000 ||
537 bindinfo
.dwOptions
== 0x4080000, /* win2k3 */
538 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
539 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
540 /* TODO: test dwCodePage */
541 /* TODO: test securityAttributes */
542 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
543 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
544 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
546 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
547 BINDSTATUS_CACHEFILENAMEAVAILABLE
, &empty_str
);
548 ok(hres
== S_OK
, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres
);
550 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
551 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
, wszTextCss
);
553 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres
);
555 hres
= IInternetProtocolSink_ReportData(pOIProtSink
,
556 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
, 13, 13);
557 ok(hres
== S_OK
, "ReportData failed: %08x\n", hres
);
559 hres
= IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
560 ok(hres
== S_OK
, "ReportResult failed: %08x\n", hres
);
565 static HRESULT WINAPI
Protocol_Continue(IInternetProtocol
*iface
,
566 PROTOCOLDATA
*pProtocolData
)
568 ok(0, "unexpected call\n");
572 static HRESULT WINAPI
Protocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
575 ok(0, "unexpected call\n");
579 static HRESULT WINAPI
Protocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
581 CHECK_EXPECT(Terminate
);
585 static HRESULT WINAPI
Protocol_Suspend(IInternetProtocol
*iface
)
587 ok(0, "unexpected call\n");
591 static HRESULT WINAPI
Protocol_Resume(IInternetProtocol
*iface
)
593 ok(0, "unexpected call\n");
597 static HRESULT WINAPI
Protocol_Read(IInternetProtocol
*iface
, void *pv
,
598 ULONG cb
, ULONG
*pcbRead
)
600 CHECK_EXPECT2(Protocol_Read
);
602 ok(pv
!= NULL
, "pv == NULL\n");
603 ok(cb
> sizeof(css_data
), "cb < sizeof(css_data)\n");
604 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
605 ok(!*pcbRead
, "*pcbRead=%d\n", *pcbRead
);
610 protocol_read
+= *pcbRead
= sizeof(css_data
)-1;
611 memcpy(pv
, css_data
, sizeof(css_data
)-1);
615 static HRESULT WINAPI
Protocol_Seek(IInternetProtocol
*iface
,
616 LARGE_INTEGER dlibMove
, DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
618 ok(0, "unexpected call\n");
622 static HRESULT WINAPI
Protocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
624 CHECK_EXPECT(LockRequest
);
628 static HRESULT WINAPI
Protocol_UnlockRequest(IInternetProtocol
*iface
)
630 CHECK_EXPECT(UnlockRequest
);
634 static const IInternetProtocolVtbl ProtocolVtbl
= {
635 Protocol_QueryInterface
,
646 Protocol_LockRequest
,
647 Protocol_UnlockRequest
650 static IInternetProtocol Protocol
= { &ProtocolVtbl
};
652 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
654 if(!IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
655 ok(0, "unexpected call\n");
656 return E_NOINTERFACE
;
659 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
664 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
669 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
670 REFIID riid
, void **ppv
)
672 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
673 return E_NOINTERFACE
;
675 CHECK_EXPECT(CreateInstance
);
676 ok(ppv
!= NULL
, "ppv == NULL\n");
682 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
684 ok(0, "unexpected call\n");
688 static const IClassFactoryVtbl ClassFactoryVtbl
= {
689 ClassFactory_QueryInterface
,
691 ClassFactory_Release
,
692 ClassFactory_CreateInstance
,
693 ClassFactory_LockServer
696 static IClassFactory ClassFactory
= { &ClassFactoryVtbl
};
698 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
700 ok(0, "unexpected call\n");
704 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
709 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
714 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
715 IHlinkBrowseContext
*pihlbc
)
717 ok(0, "unexpected call\n");
721 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
722 IHlinkBrowseContext
**ppihlbc
)
724 ok(0, "unexpected call\n");
728 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
729 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
733 CHECK_EXPECT(Navigate
);
735 ok(grfHLNF
== 0, "grfHLNF=%d, expected 0\n", grfHLNF
);
736 ok(pbc
!= NULL
, "pbc == NULL\n");
737 ok(pibsc
!= NULL
, "pubsc == NULL\n");
738 ok(pihlNavigate
!= NULL
, "puhlNavigate == NULL\n");
741 LPWSTR frame_name
= (LPWSTR
)0xdeadbeef;
742 LPWSTR location
= (LPWSTR
)0xdeadbeef;
744 IMoniker
*mon
= NULL
;
745 DWORD site_data
= 0xdeadbeef;
747 hres
= IHlink_GetTargetFrameName(pihlNavigate
, &frame_name
);
749 ok(hres
== S_FALSE
, "GetTargetFrameName failed: %08x\n", hres
);
750 ok(frame_name
== NULL
, "frame_name = %p\n", frame_name
);
752 hres
= IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
753 ok(hres
== S_OK
, "GetMonikerReference failed: %08x\n", hres
);
754 ok(location
== NULL
, "location = %p\n", location
);
755 ok(mon
!= NULL
, "mon == NULL\n");
757 hres
= IHlink_GetHlinkSite(pihlNavigate
, &site
, &site_data
);
758 ok(hres
== S_OK
, "GetHlinkSite failed: %08x\n", hres
);
759 ok(site
== NULL
, "site = %p\n, expected NULL\n", site
);
760 ok(site_data
== 0xdeadbeef, "site_data = %x\n", site_data
);
766 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
767 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
769 ok(0, "unexpected call\n");
773 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
774 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
776 ok(0, "unexpected call\n");
780 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
781 HlinkFrame_QueryInterface
,
784 HlinkFrame_SetBrowseContext
,
785 HlinkFrame_GetBrowseContext
,
787 HlinkFrame_OnNavigate
,
788 HlinkFrame_UpdateHlink
791 static IHlinkFrame HlinkFrame
= { &HlinkFrameVtbl
};
793 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
795 ok(0, "unexpected call\n");
796 return E_NOINTERFACE
;
799 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
804 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
809 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
810 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
811 DWORD dwUserActionTime
)
813 CHECK_EXPECT(EvaluateNewWindow
);
815 ok(!strcmp_wa(pszUrl
, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl
));
816 ok(!strcmp_wa(pszName
, "test"), "pszName = %s\n", wine_dbgstr_w(pszName
));
817 ok(!strcmp_wa(pszUrlContext
, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext
));
818 ok(!pszFeatures
, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures
));
819 ok(!fReplace
, "fReplace = %x\n", fReplace
);
820 ok(dwFlags
== NWMF_FIRST
, "dwFlags = %x\n", dwFlags
);
821 ok(!dwUserActionTime
, "dwUserActionime = %d\n", dwUserActionTime
);
826 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
827 NewWindowManager_QueryInterface
,
828 NewWindowManager_AddRef
,
829 NewWindowManager_Release
,
830 NewWindowManager_EvaluateNewWindow
833 static INewWindowManager NewWindowManager
= { &NewWindowManagerVtbl
};
835 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
836 REFIID riid
, void**ppv
)
838 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
843 ok(0, "unexpected call\n");
844 return E_NOINTERFACE
;
847 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
852 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
857 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
860 case DISPID_READYSTATE
:
861 CHECK_EXPECT2(OnChanged_READYSTATE
);
863 if(!readystate_set_interactive
)
864 test_MSHTML_QueryStatus(NULL
, OLECMDF_SUPPORTED
865 | (editmode
&& (load_state
== LD_INTERACTIVE
|| load_state
== LD_COMPLETE
)
866 ? OLECMDF_ENABLED
: 0));
868 if(readystate_set_loading
) {
869 readystate_set_loading
= FALSE
;
870 load_state
= LD_LOADING
;
872 if(!editmode
|| load_state
!= LD_LOADING
|| !called_Exec_Explorer_69
)
873 test_readyState(NULL
);
876 CHECK_EXPECT(OnChanged_1005
);
878 test_readyState(NULL
);
879 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
882 CHECK_EXPECT(OnChanged_1012
);
897 ok(0, "unexpected id %d\n", dispID
);
901 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
903 ok(0, "unexpected call\n");
907 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
908 PropertyNotifySink_QueryInterface
,
909 PropertyNotifySink_AddRef
,
910 PropertyNotifySink_Release
,
911 PropertyNotifySink_OnChanged
,
912 PropertyNotifySink_OnRequestEdit
915 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
917 static HRESULT WINAPI
Stream_QueryInterface(IStream
*iface
, REFIID riid
, void **ppv
)
919 ok(0, "unexpected call\n");
920 return E_NOINTERFACE
;
923 static ULONG WINAPI
Stream_AddRef(IStream
*iface
)
928 static ULONG WINAPI
Stream_Release(IStream
*iface
)
933 static HRESULT WINAPI
Stream_Read(IStream
*iface
, void *pv
,
934 ULONG cb
, ULONG
*pcbRead
)
937 ok(pv
!= NULL
, "pv == NULL\n");
938 ok(cb
> sizeof(html_page
), "cb = %d\n", cb
);
939 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
940 ok(!*pcbRead
, "*pcbRead = %d\n", *pcbRead
);
945 memcpy(pv
, html_page
, sizeof(html_page
)-1);
946 stream_read
+= *pcbRead
= sizeof(html_page
)-1;
950 static HRESULT WINAPI
Stream_Write(IStream
*iface
, const void *pv
,
951 ULONG cb
, ULONG
*pcbWritten
)
953 ok(0, "unexpected call\n");
957 static HRESULT WINAPI
Stream_Seek(IStream
*iface
, LARGE_INTEGER dlibMove
,
958 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
960 ok(0, "unexpected call\n");
964 static HRESULT WINAPI
Stream_SetSize(IStream
*iface
, ULARGE_INTEGER libNewSize
)
966 ok(0, "unexpected call\n");
970 static HRESULT WINAPI
Stream_CopyTo(IStream
*iface
, IStream
*pstm
,
971 ULARGE_INTEGER cb
, ULARGE_INTEGER
*pcbRead
, ULARGE_INTEGER
*pcbWritten
)
973 ok(0, "unexpected call\n");
977 static HRESULT WINAPI
Stream_Commit(IStream
*iface
, DWORD grfCommitFlags
)
979 ok(0, "unexpected call\n");
983 static HRESULT WINAPI
Stream_Revert(IStream
*iface
)
985 ok(0, "unexpected call\n");
989 static HRESULT WINAPI
Stream_LockRegion(IStream
*iface
, ULARGE_INTEGER libOffset
,
990 ULARGE_INTEGER cb
, DWORD dwLockType
)
992 ok(0, "unexpected call\n");
996 static HRESULT WINAPI
Stream_UnlockRegion(IStream
*iface
,
997 ULARGE_INTEGER libOffset
, ULARGE_INTEGER cb
, DWORD dwLockType
)
999 ok(0, "unexpected call\n");
1003 static HRESULT WINAPI
Stream_Stat(IStream
*iface
, STATSTG
*pstatstg
,
1006 ok(0, "unexpected call\n");
1010 static HRESULT WINAPI
Stream_Clone(IStream
*iface
, IStream
**ppstm
)
1012 ok(0, "unexpected call\n");
1016 static const IStreamVtbl StreamVtbl
= {
1017 Stream_QueryInterface
,
1028 Stream_UnlockRegion
,
1033 static IStream Stream
= { &StreamVtbl
};
1035 static HRESULT WINAPI
WinInetHttpInfo_QueryInterface(
1036 IWinInetHttpInfo
* This
,
1040 ok(0, "unexpected call\n");
1041 return E_NOINTERFACE
;
1044 static ULONG WINAPI
WinInetHttpInfo_AddRef(
1045 IWinInetHttpInfo
* This
)
1050 static ULONG WINAPI
WinInetHttpInfo_Release(
1051 IWinInetHttpInfo
* This
)
1056 static HRESULT WINAPI
WinInetHttpInfo_QueryOption(
1057 IWinInetHttpInfo
* This
,
1062 return E_NOTIMPL
; /* TODO */
1065 static HRESULT WINAPI
WinInetHttpInfo_QueryInfo(
1066 IWinInetHttpInfo
* This
,
1073 ok(pdwReserved
== NULL
, "pdwReserved != NULL\n");
1075 if(dwOption
== (HTTP_QUERY_STATUS_CODE
|HTTP_QUERY_FLAG_NUMBER
)) {
1076 ok(pBuffer
!= NULL
, "pBuffer == NULL\n");
1077 ok(*pcbBuf
== sizeof(DWORD
), "*pcbBuf = %d\n", *pcbBuf
);
1078 ok(pdwFlags
== NULL
, "*pdwFlags != NULL\n");
1079 *((DWORD
*)pBuffer
) = status_code
;
1083 return E_NOTIMPL
; /* TODO */
1086 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
= {
1087 WinInetHttpInfo_QueryInterface
,
1088 WinInetHttpInfo_AddRef
,
1089 WinInetHttpInfo_Release
,
1090 WinInetHttpInfo_QueryOption
,
1091 WinInetHttpInfo_QueryInfo
1094 static IWinInetHttpInfo WinInetHttpInfo
= { &WinInetHttpInfoVtbl
};
1096 static HRESULT WINAPI
Binding_QueryInterface(IBinding
*iface
, REFIID riid
, void **ppv
)
1098 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
1103 if(IsEqualGUID(&IID_IWinInetInfo
, riid
) || IsEqualGUID(&IID_IWinInetHttpInfo
, riid
)) {
1104 *ppv
= &WinInetHttpInfo
;
1108 ok(0, "unexpected call\n");
1109 return E_NOINTERFACE
;
1112 static ULONG WINAPI
Binding_AddRef(IBinding
*iface
)
1117 static ULONG WINAPI
Binding_Release(IBinding
*iface
)
1122 static HRESULT WINAPI
Binding_Abort(IBinding
*iface
)
1124 CHECK_EXPECT(Abort
);
1125 if(asynchronous_binding
)
1126 PeekMessage(NULL
, container_hwnd
, WM_CONTINUE_BINDING
, WM_CONTINUE_BINDING
, PM_REMOVE
);
1130 static HRESULT WINAPI
Binding_Suspend(IBinding
*iface
)
1132 ok(0, "unexpected call\n");
1136 static HRESULT WINAPI
Binding_Resume(IBinding
*iface
)
1138 ok(0, "unexpected call\n");
1142 static HRESULT WINAPI
Binding_SetPriority(IBinding
*iface
, LONG nPriority
)
1144 ok(0, "unexpected call\n");
1148 static HRESULT WINAPI
Binding_GetPriority(IBinding
*iface
, LONG
*pnPriority
)
1150 ok(0, "unexpected call\n");
1154 static HRESULT WINAPI
Binding_GetBindResult(IBinding
*iface
, CLSID
*pclsidProtocol
,
1155 DWORD
*pdwResult
, LPOLESTR
*pszResult
, DWORD
*pdwReserved
)
1157 CHECK_EXPECT(GetBindResult
);
1161 static const IBindingVtbl BindingVtbl
= {
1162 Binding_QueryInterface
,
1168 Binding_SetPriority
,
1169 Binding_GetPriority
,
1170 Binding_GetBindResult
1173 static IBinding Binding
= { &BindingVtbl
};
1175 DEFINE_GUID(IID_IMoniker_unk
,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1176 DEFINE_GUID(IID_IMoniker_unk2
, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1178 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
1182 if(IsEqualGUID(&IID_IMoniker_unk
, riid
))
1183 return E_NOINTERFACE
; /* TODO */
1184 if(IsEqualGUID(&IID_IMoniker_unk2
, riid
))
1185 return E_NOINTERFACE
; /* TODO */
1187 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
1188 return E_NOINTERFACE
;
1191 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
1196 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
1201 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
1203 CHECK_EXPECT(GetClassID
);
1204 ok(IsEqualGUID(pClassID
, &IID_NULL
), "pClassID = %s\n", debugstr_guid(pClassID
));
1208 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
1210 ok(0, "unexpected call\n");
1214 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
1216 ok(0, "unexpected call\n");
1220 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
1222 ok(0, "unexpected call\n");
1226 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
1228 ok(0, "unexpected call\n");
1232 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
1233 REFIID riidResult
, void **ppvResult
)
1235 ok(0, "unexpected call\n");
1239 static void continue_binding(IBindStatusCallback
*callback
)
1241 FORMATETC formatetc
= {0xc02d, NULL
, 1, -1, TYMED_ISTREAM
};
1242 STGMEDIUM stgmedium
;
1245 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
1247 hres
= IBindStatusCallback_OnProgress(callback
, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE
,
1249 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres
);
1251 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1252 BINDSTATUS_BEGINDOWNLOADDATA
, doc_url
);
1253 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres
);
1254 if(status_code
!= HTTP_STATUS_OK
) {
1255 CHECK_CALLED_BROKEN(IsErrorUrl
);
1256 SET_EXPECT(IsErrorUrl
);
1260 stgmedium
.tymed
= TYMED_ISTREAM
;
1261 U(stgmedium
).pstm
= &Stream
;
1262 stgmedium
.pUnkForRelease
= (IUnknown
*)&Moniker
;
1263 hres
= IBindStatusCallback_OnDataAvailable(callback
,
1264 BSCF_FIRSTDATANOTIFICATION
|BSCF_LASTDATANOTIFICATION
,
1265 sizeof(html_page
)-1, &formatetc
, &stgmedium
);
1266 ok(hres
== S_OK
, "OnDataAvailable failed: %08x\n", hres
);
1269 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1270 BINDSTATUS_ENDDOWNLOADDATA
, NULL
);
1271 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres
);
1273 SET_EXPECT(GetBindResult
);
1274 hres
= IBindStatusCallback_OnStopBinding(callback
, S_OK
, NULL
);
1275 ok(hres
== S_OK
, "OnStopBinding failed: %08x\n", hres
);
1276 SET_CALLED(GetBindResult
); /* IE7 */
1278 IBindStatusCallback_Release(callback
);
1281 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1282 REFIID riid
, void **ppv
)
1284 IBindStatusCallback
*callback
= NULL
;
1289 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1291 CHECK_EXPECT(BindToStorage
);
1293 load_state
= LD_LOADING
;
1295 ok(pbc
!= NULL
, "pbc == NULL\n");
1296 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1297 ok(IsEqualGUID(&IID_IStream
, riid
), "unexpected riid\n");
1298 ok(ppv
!= NULL
, "ppv == NULL\n");
1299 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
1301 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, (IUnknown
**)&callback
);
1302 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
1303 ok(callback
!= NULL
, "callback == NULL\n");
1305 memset(&bindinfo
, 0xf0, sizeof(bindinfo
));
1306 bindinfo
.cbSize
= sizeof(bindinfo
);
1308 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
1309 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
1310 ok(bindf
== (BINDF_PULLDATA
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
), "bindf = %08x\n", bindf
);
1311 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
1312 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
1313 /* TODO: test stgmedData */
1314 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
1315 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
1316 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
1317 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
1318 ok(bindinfo
.dwOptions
== 0x80000 || bindinfo
.dwOptions
== 0x4080000,
1319 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
1320 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
1321 /* TODO: test dwCodePage */
1322 /* TODO: test securityAttributes */
1323 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
1324 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
1325 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
1327 hres
= IBindStatusCallback_OnStartBinding(callback
, 0, &Binding
);
1328 ok(hres
== S_OK
, "OnStartBinding failed: %08x\n", hres
);
1330 if(asynchronous_binding
) {
1331 PostMessageW(container_hwnd
, WM_CONTINUE_BINDING
, (WPARAM
)callback
, 0);
1332 return MK_S_ASYNCHRONOUS
;
1335 continue_binding(callback
);
1339 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
1340 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
1342 ok(0, "unexpected call\n");
1346 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
1347 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
1349 ok(0, "unexpected call\n");
1353 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
1355 ok(0, "unexpected call\n");
1359 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
1361 ok(0, "unexpected call\n");
1365 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
1367 ok(0, "unexpected call\n");
1371 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1372 IMoniker
*pmkNewlyRunning
)
1374 ok(0, "unexpected call\n");
1378 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
1379 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
1381 ok(0, "unexpected call\n");
1385 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
1387 ok(0, "unexpected call\n");
1391 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
1392 IMoniker
**ppmkPrefix
)
1394 ok(0, "unexpected call\n");
1398 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
1399 IMoniker
**pmkRelPath
)
1401 ok(0, "unexpected call\n");
1405 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1406 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
1408 CHECK_EXPECT2(GetDisplayName
);
1410 /* ok(pbc != NULL, "pbc == NULL\n"); */
1411 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1412 ok(ppszDisplayName
!= NULL
, "ppszDisplayName == NULL\n");
1414 *ppszDisplayName
= CoTaskMemAlloc(sizeof(doc_url
));
1415 memcpy(*ppszDisplayName
, doc_url
, sizeof(doc_url
));
1420 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1421 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1423 ok(0, "unexpected call\n");
1427 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
1429 CHECK_EXPECT(IsSystemMoniker
);
1433 static const IMonikerVtbl MonikerVtbl
= {
1434 Moniker_QueryInterface
,
1442 Moniker_BindToObject
,
1443 Moniker_BindToStorage
,
1445 Moniker_ComposeWith
,
1450 Moniker_GetTimeOfLastChange
,
1452 Moniker_CommonPrefixWith
,
1453 Moniker_RelativePathTo
,
1454 Moniker_GetDisplayName
,
1455 Moniker_ParseDisplayName
,
1456 Moniker_IsSystemMoniker
1459 static IMoniker Moniker
= { &MonikerVtbl
};
1461 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1463 return QueryInterface(riid
, ppv
);
1466 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1471 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1476 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
1477 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1479 ok(0, "unexpected call\n");
1483 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
1484 IEnumUnknown
**ppenum
)
1486 ok(0, "unexpected call\n");
1490 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1492 CHECK_EXPECT(LockContainer
);
1493 ok(expect_LockContainer_fLock
== fLock
, "fLock=%x, expected %x\n", fLock
, expect_LockContainer_fLock
);
1497 static const IOleContainerVtbl OleContainerVtbl
= {
1498 OleContainer_QueryInterface
,
1499 OleContainer_AddRef
,
1500 OleContainer_Release
,
1501 OleContainer_ParseDisplayName
,
1502 OleContainer_EnumObjects
,
1503 OleContainer_LockContainer
1506 static IOleContainer OleContainer
= { &OleContainerVtbl
};
1508 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1510 return QueryInterface(riid
, ppv
);
1513 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1518 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1523 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1525 ok(0, "unexpected call\n");
1529 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1532 ok(0, "unexpected call\n");
1536 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1538 CHECK_EXPECT(GetContainer
);
1539 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1540 *ppContainer
= &OleContainer
;
1544 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1546 ok(0, "unexpected call\n");
1550 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1552 ok(0, "unexpected call\n");
1556 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1558 ok(0, "unexpected call\n");
1562 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1563 ClientSite_QueryInterface
,
1566 ClientSite_SaveObject
,
1567 ClientSite_GetMoniker
,
1568 ClientSite_GetContainer
,
1569 ClientSite_ShowObject
,
1570 ClientSite_OnShowWindow
,
1571 ClientSite_RequestNewObjectLayout
1574 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1576 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1578 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1580 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1581 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
1584 return E_NOINTERFACE
;
1587 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1592 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1597 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1599 CHECK_EXPECT(Frame_GetWindow
);
1603 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1605 ok(0, "unexpected call\n");
1609 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1611 ok(0, "unexpected call\n");
1615 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1616 LPCBORDERWIDTHS pborderwidths
)
1618 ok(0, "unexpected call\n");
1622 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1623 LPCBORDERWIDTHS pborderwidths
)
1625 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1629 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1630 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1632 static const WCHAR wszHTML_Document
[] =
1633 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1635 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1637 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1638 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1639 if(pActiveObject
&& is_lang_english())
1640 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1643 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1644 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1646 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1650 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1651 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1653 static const WCHAR wszHTML_Document
[] =
1654 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1657 CHECK_EXPECT2(SetActiveObject
);
1659 if(pActiveObject
&& is_lang_english())
1660 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName
));
1662 CHECK_EXPECT(SetActiveObject_null
);
1664 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1665 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1671 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1672 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1674 ok(0, "unexpected call\n");
1678 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1679 HOLEMENU holemenu
, HWND hwndActiveObject
)
1681 ok(0, "unexpected call\n");
1685 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1687 ok(0, "unexpected call\n");
1691 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1693 CHECK_EXPECT2(SetStatusText
);
1694 if(!expect_status_text
)
1695 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1699 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1702 CHECK_EXPECT2(Frame_EnableModeless_TRUE
);
1704 CHECK_EXPECT2(Frame_EnableModeless_FALSE
);
1708 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1710 ok(0, "unexpected call\n");
1714 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1715 InPlaceFrame_QueryInterface
,
1716 InPlaceFrame_AddRef
,
1717 InPlaceFrame_Release
,
1718 InPlaceFrame_GetWindow
,
1719 InPlaceFrame_ContextSensitiveHelp
,
1720 InPlaceFrame_GetBorder
,
1721 InPlaceFrame_RequestBorderSpace
,
1722 InPlaceFrame_SetBorderSpace
,
1723 InPlaceFrame_SetActiveObject
,
1724 InPlaceFrame_InsertMenus
,
1725 InPlaceFrame_SetMenu
,
1726 InPlaceFrame_RemoveMenus
,
1727 InPlaceFrame_SetStatusText
,
1728 InPlaceFrame_EnableModeless
,
1729 InPlaceFrame_TranslateAccelerator
1732 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1734 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1735 InPlaceFrame_QueryInterface
,
1736 InPlaceFrame_AddRef
,
1737 InPlaceFrame_Release
,
1738 InPlaceFrame_GetWindow
,
1739 InPlaceFrame_ContextSensitiveHelp
,
1740 InPlaceFrame_GetBorder
,
1741 InPlaceFrame_RequestBorderSpace
,
1742 InPlaceFrame_SetBorderSpace
,
1743 InPlaceUIWindow_SetActiveObject
,
1746 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1748 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
1750 return QueryInterface(riid
, ppv
);
1753 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
1758 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
1763 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(
1764 IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
1766 IOleClientSite
*client_site
;
1767 IOleObject
*ole_obj
;
1770 CHECK_EXPECT2(GetWindow
);
1771 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1772 *phwnd
= container_hwnd
;
1774 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IOleObject
, (void**)&ole_obj
);
1775 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
1777 hres
= IOleObject_GetClientSite(ole_obj
, &client_site
);
1778 IOleObject_Release(ole_obj
);
1779 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
1780 ok(client_site
== &ClientSite
, "client_site != ClientSite\n");
1781 IOleClientSite_Release(client_site
);
1786 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(
1787 IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
1789 ok(0, "unexpected call\n");
1793 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(
1794 IOleInPlaceSiteWindowless
*iface
)
1796 CHECK_EXPECT(CanInPlaceActivate
);
1800 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(
1801 IOleInPlaceSiteWindowless
*iface
)
1803 CHECK_EXPECT(OnInPlaceActivate
);
1804 inplace_deactivated
= FALSE
;
1808 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(
1809 IOleInPlaceSiteWindowless
*iface
)
1811 CHECK_EXPECT(OnUIActivate
);
1815 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(
1816 IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
1817 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1818 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1820 static const RECT rect
= {0,0,500,500};
1822 CHECK_EXPECT(GetWindowContext
);
1824 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1826 *ppFrame
= &InPlaceFrame
;
1827 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1829 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1830 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1832 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1833 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1835 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1836 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1838 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
1839 lpFrameInfo
->fMDIApp
= FALSE
;
1840 lpFrameInfo
->hwndFrame
= container_hwnd
;
1841 lpFrameInfo
->haccel
= NULL
;
1842 lpFrameInfo
->cAccelEntries
= 0;
1848 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
1849 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
1851 ok(0, "unexpected call\n");
1855 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
1856 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
1858 CHECK_EXPECT(OnUIDeactivate
);
1859 ok(!fUndoable
, "fUndoable = TRUE\n");
1863 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
1864 IOleInPlaceSiteWindowless
*iface
)
1866 CHECK_EXPECT(OnInPlaceDeactivate
);
1867 inplace_deactivated
= TRUE
;
1871 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
1872 IOleInPlaceSiteWindowless
*iface
)
1874 ok(0, "unexpected call\n");
1878 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
1879 IOleInPlaceSiteWindowless
*iface
)
1881 ok(0, "unexpected call\n");
1885 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
1886 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
1888 ok(0, "unexpected call\n");
1892 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
1893 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
1895 CHECK_EXPECT(OnInPlaceActivateEx
);
1897 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
1898 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
1899 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
1904 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1905 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
1907 CHECK_EXPECT(OnInPlaceDeactivateEx
);
1909 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
1914 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
1915 IOleInPlaceSiteWindowless
*iface
)
1917 CHECK_EXPECT2(RequestUIActivate
);
1921 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
1922 IOleInPlaceSiteWindowless
*iface
)
1924 ok(0, "unexpected call\n");
1928 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
1929 IOleInPlaceSiteWindowless
*iface
)
1931 ok(0, "unexpected call\n");
1935 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
1936 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
1938 ok(0, "unexpected call\n");
1942 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
1943 IOleInPlaceSiteWindowless
*iface
)
1945 ok(0, "unexpected call\n");
1949 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
1950 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
1952 ok(0, "unexpected call\n");
1956 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
1957 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
1958 DWORD grfFlags
, HDC
*phDC
)
1960 ok(0, "unexpected call\n");
1964 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
1965 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
1967 ok(0, "unexpected call\n");
1971 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
1972 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
1974 ok(0, "unexpected call\n");
1978 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
1979 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
1981 ok(0, "unexpected call\n");
1985 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
1986 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
1987 LPCRECT pRectScroll
, LPCRECT pRectClip
)
1989 ok(0, "unexpected call\n");
1993 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
1994 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
1996 ok(0, "unexpected call\n");
2000 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
2001 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
2002 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
2004 ok(0, "unexpected call\n");
2008 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
2009 InPlaceSiteWindowless_QueryInterface
,
2010 InPlaceSiteWindowless_AddRef
,
2011 InPlaceSiteWindowless_Release
,
2012 InPlaceSiteWindowless_GetWindow
,
2013 InPlaceSiteWindowless_ContextSensitiveHelp
,
2014 InPlaceSiteWindowless_CanInPlaceActivate
,
2015 InPlaceSiteWindowless_OnInPlaceActivate
,
2016 InPlaceSiteWindowless_OnUIActivate
,
2017 InPlaceSiteWindowless_GetWindowContext
,
2018 InPlaceSiteWindowless_Scroll
,
2019 InPlaceSiteWindowless_OnUIDeactivate
,
2020 InPlaceSiteWindowless_OnInPlaceDeactivate
,
2021 InPlaceSiteWindowless_DiscardUndoState
,
2022 InPlaceSiteWindowless_DeactivateAndUndo
,
2023 InPlaceSiteWindowless_OnPosRectChange
,
2024 InPlaceSiteWindowless_OnInPlaceActivateEx
,
2025 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
2026 InPlaceSiteWindowless_RequestUIActivate
,
2027 InPlaceSiteWindowless_CanWindowlessActivate
,
2028 InPlaceSiteWindowless_GetCapture
,
2029 InPlaceSiteWindowless_SetCapture
,
2030 InPlaceSiteWindowless_GetFocus
,
2031 InPlaceSiteWindowless_SetFocus
,
2032 InPlaceSiteWindowless_GetDC
,
2033 InPlaceSiteWindowless_ReleaseDC
,
2034 InPlaceSiteWindowless_InvalidateRect
,
2035 InPlaceSiteWindowless_InvalidateRgn
,
2036 InPlaceSiteWindowless_ScrollRect
,
2037 InPlaceSiteWindowless_AdjustRect
,
2038 InPlaceSiteWindowless_OnDefWindowMessage
2041 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
2043 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
2045 return QueryInterface(riid
, ppv
);
2048 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
2053 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
2060 CallUIActivate_None
,
2061 CallUIActivate_ActivateMe
,
2062 CallUIActivate_AfterShow
,
2065 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
2066 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
2068 IOleDocument
*document
;
2071 CHECK_EXPECT(ActivateMe
);
2072 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
2074 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
2075 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
2077 if(SUCCEEDED(hres
)) {
2078 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
, NULL
, 0, &view
);
2079 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
2081 if(SUCCEEDED(hres
)) {
2082 IOleInPlaceActiveObject
*activeobj
= NULL
;
2083 IOleInPlaceSite
*inplacesite
= NULL
;
2084 HWND tmp_hwnd
= NULL
;
2085 static RECT rect
= {0,0,400,500};
2087 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2088 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2089 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2090 inplacesite
, &InPlaceSiteWindowless
);
2092 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
);
2093 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
2095 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
2096 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
2097 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
2098 inplacesite
, &InPlaceSiteWindowless
);
2100 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
2101 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
2104 IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2105 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2106 ok(hwnd
== NULL
, "hwnd=%p, expected NULL\n", hwnd
);
2109 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2110 SET_EXPECT(CanInPlaceActivate
);
2111 SET_EXPECT(GetWindowContext
);
2112 SET_EXPECT(GetWindow
);
2114 SET_EXPECT(OnInPlaceActivateEx
);
2116 SET_EXPECT(OnInPlaceActivate
);
2117 SET_EXPECT(SetStatusText
);
2118 SET_EXPECT(Exec_SETPROGRESSMAX
);
2119 SET_EXPECT(Exec_SETPROGRESSPOS
);
2120 SET_EXPECT(OnUIActivate
);
2121 SET_EXPECT(SetActiveObject
);
2123 expect_status_text
= NULL
;
2125 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2126 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2128 CHECK_CALLED(CanInPlaceActivate
);
2129 CHECK_CALLED(GetWindowContext
);
2130 CHECK_CALLED(GetWindow
);
2132 CHECK_CALLED(OnInPlaceActivateEx
);
2134 CHECK_CALLED(OnInPlaceActivate
);
2135 CHECK_CALLED(SetStatusText
);
2136 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2137 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2138 CHECK_CALLED(OnUIActivate
);
2139 CHECK_CALLED(SetActiveObject
);
2140 CHECK_CALLED(ShowUI
);
2143 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2144 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2145 ok(hwnd
!= NULL
, "hwnd == NULL\n");
2147 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2150 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2151 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2154 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
2155 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2156 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
2160 hres
= IOleDocumentView_SetRect(view
, &rect
);
2161 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2163 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2164 hres
= IOleDocumentView_Show(view
, TRUE
);
2165 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2167 SET_EXPECT(CanInPlaceActivate
);
2168 SET_EXPECT(GetWindowContext
);
2169 SET_EXPECT(GetWindow
);
2171 SET_EXPECT(OnInPlaceActivateEx
);
2173 SET_EXPECT(OnInPlaceActivate
);
2174 SET_EXPECT(SetStatusText
);
2175 SET_EXPECT(Exec_SETPROGRESSMAX
);
2176 SET_EXPECT(Exec_SETPROGRESSPOS
);
2177 SET_EXPECT(OnUIActivate
);
2178 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
2180 hres
= IOleDocumentView_Show(view
, TRUE
);
2181 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2183 CHECK_CALLED(CanInPlaceActivate
);
2184 CHECK_CALLED(GetWindowContext
);
2185 CHECK_CALLED(GetWindow
);
2187 CHECK_CALLED(OnInPlaceActivateEx
);
2189 CHECK_CALLED(OnInPlaceActivate
);
2190 CHECK_CALLED(SetStatusText
);
2191 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2192 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2195 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2196 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2197 ok(hwnd
!= NULL
, "hwnd == NULL\n");
2199 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2203 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
2206 IOleInPlaceActiveObject_Release(activeobj
);
2209 IOleDocument_Release(document
);
2215 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2216 DocumentSite_QueryInterface
,
2217 DocumentSite_AddRef
,
2218 DocumentSite_Release
,
2219 DocumentSite_ActivateMe
2222 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2224 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
2226 return QueryInterface(riid
, ppv
);
2229 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
2234 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
2239 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
2241 ok(0, "unexpected call\n");
2245 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
2247 ok(0, "unexpected call\n");
2251 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
2253 ok(0, "unexpected call\n");
2257 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
2258 POINTF
*pPtfContainer
, DWORD dwFlags
)
2260 ok(0, "unexpected call\n");
2264 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
2265 MSG
*pMsg
, DWORD grfModifiers
)
2267 ok(0, "unexpected call\n");
2271 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
2274 CHECK_EXPECT(OnFocus_TRUE
);
2276 CHECK_EXPECT2(OnFocus_FALSE
);
2280 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
2282 ok(0, "unexpected call\n");
2286 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
2287 OleControlSite_QueryInterface
,
2288 OleControlSite_AddRef
,
2289 OleControlSite_Release
,
2290 OleControlSite_OnControlInfoChanged
,
2291 OleControlSite_LockInPlaceActive
,
2292 OleControlSite_GetExtendedControl
,
2293 OleControlSite_TransformCoords
,
2294 OleControlSite_TranslateAccelerator
,
2295 OleControlSite_OnFocus
,
2296 OleControlSite_ShowPropertyFrame
2299 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
2301 static IDocHostUIHandler2
*expect_uihandler_iface
;
2303 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2305 return QueryInterface(riid
, ppv
);
2308 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
2313 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
2318 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
2319 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
2321 ok(0, "unexpected call\n");
2322 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2326 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
2328 CHECK_EXPECT(GetHostInfo
);
2329 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2330 ok(pInfo
!= NULL
, "pInfo=NULL\n");
2332 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
2333 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
2334 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2335 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2336 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
2337 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
2338 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
2339 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
2344 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
2345 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
2346 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
2348 CHECK_EXPECT(ShowUI
);
2349 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2352 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
2354 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
2355 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
2356 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
2357 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
2358 if (expect_InPlaceUIWindow_SetActiveObject_active
)
2359 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
2361 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
2366 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
2368 CHECK_EXPECT(HideUI
);
2369 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2373 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
2375 CHECK_EXPECT(UpdateUI
);
2376 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2380 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
2382 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2384 CHECK_EXPECT2(EnableModeless_TRUE
);
2386 CHECK_EXPECT2(EnableModeless_FALSE
);
2390 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2392 ok(0, "unexpected call\n");
2393 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2397 static BOOL expect_OnFrameWindowActivate_fActivate
;
2398 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2400 CHECK_EXPECT2(OnFrameWindowActivate
);
2401 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2402 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
2406 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
2407 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
2409 ok(0, "unexpected call\n");
2413 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
2414 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
2416 ok(0, "unexpected call\n");
2417 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2421 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
2422 LPOLESTR
*pchKey
, DWORD dw
)
2424 CHECK_EXPECT(GetOptionKeyPath
);
2425 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2426 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2427 ok(!dw
, "dw=%d, expected 0\n", dw
);
2429 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2433 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
2434 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
2436 CHECK_EXPECT(GetDropTarget
);
2437 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2442 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
2444 CHECK_EXPECT(GetExternal
);
2445 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2446 *ppDispatch
= &External
;
2450 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
2451 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
2453 CHECK_EXPECT(TranslateUrl
);
2454 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2455 ok(!dwTranslate
, "dwTranslate = %x\n", dwTranslate
);
2456 ok(!strcmp_wa(pchURLIn
, nav_url
), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn
), nav_url
);
2457 ok(ppchURLOut
!= NULL
, "ppchURLOut == NULL\n");
2458 ok(!*ppchURLOut
, "*ppchURLOut = %p\n", *ppchURLOut
);
2463 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
2464 IDataObject
**ppPORet
)
2466 ok(0, "unexpected call\n");
2467 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2471 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
2472 LPOLESTR
*pchKey
, DWORD dw
)
2474 CHECK_EXPECT(GetOverrideKeyPath
);
2475 ok(iface
== expect_uihandler_iface
, "called on unexpected iface\n");
2476 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2478 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2479 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2483 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2484 DocHostUIHandler_QueryInterface
,
2485 DocHostUIHandler_AddRef
,
2486 DocHostUIHandler_Release
,
2487 DocHostUIHandler_ShowContextMenu
,
2488 DocHostUIHandler_GetHostInfo
,
2489 DocHostUIHandler_ShowUI
,
2490 DocHostUIHandler_HideUI
,
2491 DocHostUIHandler_UpdateUI
,
2492 DocHostUIHandler_EnableModeless
,
2493 DocHostUIHandler_OnDocWindowActivate
,
2494 DocHostUIHandler_OnFrameWindowActivate
,
2495 DocHostUIHandler_ResizeBorder
,
2496 DocHostUIHandler_TranslateAccelerator
,
2497 DocHostUIHandler_GetOptionKeyPath
,
2498 DocHostUIHandler_GetDropTarget
,
2499 DocHostUIHandler_GetExternal
,
2500 DocHostUIHandler_TranslateUrl
,
2501 DocHostUIHandler_FilterDataObject
,
2502 DocHostUIHandler_GetOverrideKeyPath
2505 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2507 static HRESULT WINAPI
CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2509 if(IsEqualGUID(&IID_IDocHostUIHandler2
, riid
)) {
2514 if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2515 return E_NOINTERFACE
;
2517 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2518 return E_NOINTERFACE
; /* TODO */
2520 ok(0, "unexpected call %s\n", debugstr_guid(riid
));
2521 return E_NOINTERFACE
;
2524 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl
= {
2525 CustomDocHostUIHandler_QueryInterface
,
2526 DocHostUIHandler_AddRef
,
2527 DocHostUIHandler_Release
,
2528 DocHostUIHandler_ShowContextMenu
,
2529 DocHostUIHandler_GetHostInfo
,
2530 DocHostUIHandler_ShowUI
,
2531 DocHostUIHandler_HideUI
,
2532 DocHostUIHandler_UpdateUI
,
2533 DocHostUIHandler_EnableModeless
,
2534 DocHostUIHandler_OnDocWindowActivate
,
2535 DocHostUIHandler_OnFrameWindowActivate
,
2536 DocHostUIHandler_ResizeBorder
,
2537 DocHostUIHandler_TranslateAccelerator
,
2538 DocHostUIHandler_GetOptionKeyPath
,
2539 DocHostUIHandler_GetDropTarget
,
2540 DocHostUIHandler_GetExternal
,
2541 DocHostUIHandler_TranslateUrl
,
2542 DocHostUIHandler_FilterDataObject
,
2543 DocHostUIHandler_GetOverrideKeyPath
2546 static IDocHostUIHandler2 CustomDocHostUIHandler
= { &CustomDocHostUIHandlerVtbl
};
2548 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2549 REFIID riid
, void **ppv
)
2551 return QueryInterface(riid
, ppv
);
2554 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2559 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2564 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2565 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2567 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2568 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2569 ok(!pCmdText
, "pCmdText != NULL\n");
2571 switch(prgCmds
[0].cmdID
) {
2572 case OLECMDID_SETPROGRESSTEXT
:
2573 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2574 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2577 CHECK_EXPECT(QueryStatus_OPEN
);
2578 prgCmds
[0].cmdf
= 0;
2581 CHECK_EXPECT(QueryStatus_NEW
);
2582 prgCmds
[0].cmdf
= 0;
2585 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2591 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2592 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2594 if((!pguidCmdGroup
|| !IsEqualGUID(pguidCmdGroup
, &CGID_Explorer
))
2595 && (!pguidCmdGroup
|| !IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
) || nCmdID
!= 63))
2596 test_readyState(NULL
);
2598 if(!pguidCmdGroup
) {
2600 case OLECMDID_SETPROGRESSMAX
:
2601 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2602 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2603 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2605 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2606 if(load_state
== LD_NO
)
2607 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2609 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2611 case OLECMDID_SETPROGRESSPOS
:
2612 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2613 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2614 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2616 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2617 if(load_state
== LD_NO
)
2618 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2620 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2622 case OLECMDID_HTTPEQUIV_DONE
:
2623 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2624 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2625 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2626 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2627 readystate_set_loading
= FALSE
;
2628 readystate_set_interactive
= FALSE
;
2629 load_state
= LD_COMPLETE
;
2631 case OLECMDID_SETDOWNLOADSTATE
:
2632 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2633 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2634 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2635 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2637 switch(V_I4(pvaIn
)) {
2639 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2641 load_state
= LD_INTERACTIVE
;
2644 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2645 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
2648 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2652 case OLECMDID_UPDATECOMMANDS
:
2653 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2654 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2655 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2656 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2658 case OLECMDID_SETTITLE
:
2659 CHECK_EXPECT2(Exec_SETTITLE
);
2660 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2661 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2662 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2663 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2664 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2666 case OLECMDID_HTTPEQUIV
:
2667 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2668 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2669 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2670 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2671 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2672 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) = NULL\n");
2673 test_readyState(NULL
);
2675 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
2676 return E_FAIL
; /* FIXME */
2678 ok(0, "unexpected command %d\n", nCmdID
);
2683 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2684 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2688 CHECK_EXPECT2(Exec_ShellDocView_37
);
2691 test_GetCurMoniker(doc_unk
, NULL
, nav_url
);
2692 else if(load_from_stream
)
2693 test_GetCurMoniker(doc_unk
, NULL
, "about:blank");
2695 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
2697 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2698 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2700 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2701 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2706 IHTMLPrivateWindow
*priv_window
;
2709 CHECK_EXPECT(Exec_ShellDocView_63
);
2710 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2711 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2712 ok(V_UNKNOWN(pvaIn
) != NULL
, "VPUNKNOWN(pvaIn) = NULL\n");
2713 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2714 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2716 hres
= IUnknown_QueryInterface(V_UNKNOWN(pvaIn
), &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
2717 ok(hres
== S_OK
, "Could not get IHTMLPrivateWindow: %08x\n", hres
);
2719 IHTMLPrivateWindow_Release(priv_window
);
2721 load_state
= loading_js
? LD_COMPLETE
: LD_LOADING
;
2722 return S_OK
; /* TODO */
2726 CHECK_EXPECT(Exec_ShellDocView_67
);
2727 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2728 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2729 ok(!strcmp_wa(V_BSTR(pvaIn
), nav_url
), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn
)), nav_url
);
2730 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2731 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2732 ok(V_BOOL(pvaOut
) == VARIANT_TRUE
, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut
));
2733 load_state
= LD_DOLOAD
;
2737 CHECK_EXPECT2(Exec_ShellDocView_84
);
2739 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2740 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2742 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2747 CHECK_EXPECT2(Exec_ShellDocView_103
);
2749 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2750 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2755 CHECK_EXPECT2(Exec_ShellDocView_105
);
2757 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2758 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2763 CHECK_EXPECT2(Exec_ShellDocView_140
);
2765 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2766 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2771 ok(0, "unexpected command %d\n", nCmdID
);
2776 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2777 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2780 case IDM_PARSECOMPLETE
:
2781 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2782 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2783 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2786 ok(0, "unexpected command %d\n", nCmdID
);
2790 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
2792 case DOCHOST_DOCCANNAVIGATE
:
2793 CHECK_EXPECT(Exec_DOCCANNAVIGATE
);
2794 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2795 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2796 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) != VT_UNKNOWN\n");
2797 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2806 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2807 ok(pvaOut
!= NULL
, "pvaOut != NULL\n");
2808 ok(V_VT(pvaIn
) == VT_ARRAY
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2809 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2810 sa
= V_ARRAY(pvaIn
);
2812 dim
= SafeArrayGetDim(sa
);
2813 ok(dim
== 1, "dim = %d\n", dim
);
2814 hres
= SafeArrayGetLBound(sa
, 1, &ind
);
2815 ok(hres
== S_OK
, "SafeArrayGetLBound failed: %x\n", hres
);
2816 ok(ind
== 0, "Lower bound = %d\n", ind
);
2817 hres
= SafeArrayGetUBound(sa
, 1, &ind
);
2818 ok(hres
== S_OK
, "SafeArrayGetUBound failed: %x\n", hres
);
2819 ok(ind
== 7 || broken(ind
== 5), "Upper bound = %d\n", ind
);
2822 SafeArrayGetElement(sa
, &ind
, &var
);
2823 ok(V_VT(&var
) == VT_I4
, "Incorrect data type: %d\n", V_VT(&var
));
2824 ok(V_I4(&var
) == status_code
, "Incorrect error code: %d\n", V_I4(&var
));
2827 SafeArrayGetElement(sa
, &ind
, &var
);
2828 ok(V_VT(&var
) == VT_BSTR
, "Incorrect data type: %d\n", V_VT(&var
));
2829 ok(!strcmp_wa(V_BSTR(&var
), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var
)));
2832 SafeArrayGetElement(sa
, &ind
, &var
);
2833 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
2836 SafeArrayGetElement(sa
, &ind
, &var
);
2837 ok(V_VT(&var
) == VT_UNKNOWN
, "Incorrect data type: %d\n", V_VT(&var
));
2840 SafeArrayGetElement(sa
, &ind
, &var
);
2841 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
2842 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
2845 SafeArrayGetElement(sa
, &ind
, &var
);
2846 ok(V_VT(&var
) == VT_BOOL
, "Incorrect data type: %d\n", V_VT(&var
));
2847 ok(!V_BOOL(&var
), "Unknown value is incorrect\n");
2851 return E_FAIL
; /* TODO */
2855 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
2856 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2860 CHECK_EXPECT2(Exec_Explorer_69
);
2861 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2862 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2865 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
2870 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
2872 case OLECMDID_PAGEACTIONBLOCKED
: /* win2k3 */
2873 SET_EXPECT(SetStatusText
);
2874 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2875 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2877 case OLECMDID_SHOWSCRIPTERROR
:
2881 ok(0, "unexpected command %d\n", nCmdID
);
2886 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup
));
2890 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
2891 OleCommandTarget_QueryInterface
,
2892 OleCommandTarget_AddRef
,
2893 OleCommandTarget_Release
,
2894 OleCommandTarget_QueryStatus
,
2895 OleCommandTarget_Exec
2898 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
2900 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
2902 return QueryInterface(riid
, ppv
);
2905 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
2906 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2907 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2909 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
2910 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
2911 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
2912 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
2913 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
2914 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
2915 test_readyState(NULL
);
2917 switch(dispIdMember
) {
2918 case DISPID_AMBIENT_USERMODE
:
2919 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
2920 V_VT(pVarResult
) = VT_BOOL
;
2921 V_BOOL(pVarResult
) = VARIANT_TRUE
;
2923 case DISPID_AMBIENT_DLCONTROL
:
2924 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
2926 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
2927 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2929 case DISPID_AMBIENT_SILENT
:
2930 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
2931 V_VT(pVarResult
) = VT_BOOL
;
2932 V_BOOL(pVarResult
) = VARIANT_FALSE
;
2934 case DISPID_AMBIENT_USERAGENT
:
2935 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2937 case DISPID_AMBIENT_PALETTE
:
2938 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2942 ok(0, "unexpected dispid %d\n", dispIdMember
);
2946 static const IDispatchVtbl DispatchVtbl
= {
2947 Dispatch_QueryInterface
,
2950 Dispatch_GetTypeInfoCount
,
2951 Dispatch_GetTypeInfo
,
2952 Dispatch_GetIDsOfNames
,
2956 static IDispatch Dispatch
= { &DispatchVtbl
};
2958 static HRESULT WINAPI
EventDispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
2960 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
2965 ok(0, "Unexpected call\n");
2966 return E_NOINTERFACE
;
2969 static HRESULT WINAPI
EventDispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
2970 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2971 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2974 IHTMLDocument2
*doc
;
2977 ok(IsEqualGUID(&IID_NULL
, riid
), "riid = %s\n", debugstr_guid(riid
));
2978 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
2979 ok(pExcepInfo
!= NULL
, "pExcepInfo == NULL\n");
2980 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
2981 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult
));
2982 ok(wFlags
== DISPATCH_METHOD
, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags
);
2984 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IHTMLDocument2
, (void**)&doc
);
2985 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
2987 switch(dispIdMember
) {
2988 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE
:
2989 hres
= IHTMLDocument2_get_readyState(doc
, &state
);
2990 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
2992 if(!strcmp_wa(state
, "interactive"))
2993 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive
);
2994 else if(!strcmp_wa(state
, "loading"))
2995 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading
);
2996 else if(!strcmp_wa(state
, "complete")) {
2997 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete
);
3000 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state
));
3002 SysFreeString(state
);
3004 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE
:
3015 break; /* FIXME: Handle these events. */
3017 ok(0, "Unexpected DISPID: %d\n", dispIdMember
);
3020 IHTMLDocument2_Release(doc
);
3024 static const IDispatchVtbl EventDispatchVtbl
= {
3025 EventDispatch_QueryInterface
,
3028 Dispatch_GetTypeInfoCount
,
3029 Dispatch_GetTypeInfo
,
3030 Dispatch_GetIDsOfNames
,
3031 EventDispatch_Invoke
3034 static IDispatch EventDispatch
= { &EventDispatchVtbl
};
3036 static HRESULT WINAPI
DocObjectService_QueryInterface(
3037 IDocObjectService
* This
,
3041 /* F62D9369-75EF-4578-8856-232802C76468 (ITridentService2) */
3045 static ULONG WINAPI
DocObjectService_AddRef(
3046 IDocObjectService
* This
)
3051 static ULONG WINAPI
DocObjectService_Release(
3052 IDocObjectService
* This
)
3057 static HRESULT WINAPI
DocObjectService_FireBeforeNavigate2(
3058 IDocObjectService
* This
,
3059 IDispatch
*pDispatch
,
3062 LPCWSTR lpszFrameName
,
3065 LPCWSTR lpszHeaders
,
3069 ok(0, "unexpected call\n");
3073 static HRESULT WINAPI
DocObjectService_FireNavigateComplete2(
3074 IDocObjectService
* This
,
3075 IHTMLWindow2
*pHTMLWindow2
,
3078 CHECK_EXPECT(FireNavigateComplete2
);
3082 static HRESULT WINAPI
DocObjectService_FireDownloadBegin(
3083 IDocObjectService
* This
)
3085 ok(0, "unexpected call\n");
3089 static HRESULT WINAPI
DocObjectService_FireDownloadComplete(
3090 IDocObjectService
* This
)
3092 ok(0, "unexpected call\n");
3096 static HRESULT WINAPI
DocObjectService_FireDocumentComplete(
3097 IDocObjectService
* This
,
3098 IHTMLWindow2
*pHTMLWindow
,
3101 CHECK_EXPECT(FireDocumentComplete
);
3105 static HRESULT WINAPI
DocObjectService_UpdateDesktopComponent(
3106 IDocObjectService
* This
,
3107 IHTMLWindow2
*pHTMLWindow
)
3109 ok(0, "unexpected call\n");
3113 static HRESULT WINAPI
DocObjectService_GetPendingUrl(
3114 IDocObjectService
* This
,
3115 BSTR
*pbstrPendingUrl
)
3117 CHECK_EXPECT(GetPendingUrl
);
3121 static HRESULT WINAPI
DocObjectService_ActiveElementChanged(
3122 IDocObjectService
* This
,
3123 IHTMLElement
*pHTMLElement
)
3125 CHECK_EXPECT(ActiveElementChanged
);
3129 static HRESULT WINAPI
DocObjectService_GetUrlSearchComponent(
3130 IDocObjectService
* This
,
3133 ok(0, "unexpected call\n");
3137 static HRESULT WINAPI
DocObjectService_IsErrorUrl(
3138 IDocObjectService
* This
,
3142 CHECK_EXPECT(IsErrorUrl
);
3147 static IDocObjectServiceVtbl DocObjectServiceVtbl
= {
3148 DocObjectService_QueryInterface
,
3149 DocObjectService_AddRef
,
3150 DocObjectService_Release
,
3151 DocObjectService_FireBeforeNavigate2
,
3152 DocObjectService_FireNavigateComplete2
,
3153 DocObjectService_FireDownloadBegin
,
3154 DocObjectService_FireDownloadComplete
,
3155 DocObjectService_FireDocumentComplete
,
3156 DocObjectService_UpdateDesktopComponent
,
3157 DocObjectService_GetPendingUrl
,
3158 DocObjectService_ActiveElementChanged
,
3159 DocObjectService_GetUrlSearchComponent
,
3160 DocObjectService_IsErrorUrl
3163 static IDocObjectService DocObjectService
= { &DocObjectServiceVtbl
};
3165 DEFINE_GUID(IID_ITabBrowserService
, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3167 static HRESULT WINAPI
BrowserService_QueryInterface(
3168 IBrowserService
* This
,
3174 if(IsEqualGUID(&IID_IShellBrowser
, riid
))
3175 return E_NOINTERFACE
; /* TODO */
3177 if(IsEqualGUID(&IID_IDocObjectService
, riid
)) {
3178 *ppvObject
= &DocObjectService
;
3182 if(IsEqualGUID(&IID_ITabBrowserService
, riid
))
3183 return E_NOINTERFACE
; /* TODO */
3185 ok(0, "unexpected call\n");
3186 return E_NOINTERFACE
;
3189 static ULONG WINAPI
BrowserService_AddRef(
3190 IBrowserService
* This
)
3195 static ULONG WINAPI
BrowserService_Release(
3196 IBrowserService
* This
)
3201 static HRESULT WINAPI
BrowserService_GetParentSite(
3202 IBrowserService
* This
,
3203 IOleInPlaceSite
**ppipsite
)
3205 ok(0, "unexpected call\n");
3209 static HRESULT WINAPI
BrowserService_SetTitle(
3210 IBrowserService
* This
,
3214 ok(0, "unexpected call\n");
3218 static HRESULT WINAPI
BrowserService_GetTitle(
3219 IBrowserService
* This
,
3224 ok(0, "unexpected call\n");
3228 static HRESULT WINAPI
BrowserService_GetOleObject(
3229 IBrowserService
* This
,
3230 IOleObject
**ppobjv
)
3232 ok(0, "unexpected call\n");
3236 static HRESULT WINAPI
BrowserService_GetTravelLog(
3237 IBrowserService
* This
,
3240 CHECK_EXPECT(GetTravelLog
);
3244 static HRESULT WINAPI
BrowserService_ShowControlWindow(
3245 IBrowserService
* This
,
3249 ok(0, "unexpected call\n");
3253 static HRESULT WINAPI
BrowserService_IsControlWindowShown(
3254 IBrowserService
* This
,
3258 ok(0, "unexpected call\n");
3262 static HRESULT WINAPI
BrowserService_IEGetDisplayName(
3263 IBrowserService
* This
,
3264 PCIDLIST_ABSOLUTE pidl
,
3268 ok(0, "unexpected call\n");
3272 static HRESULT WINAPI
BrowserService_IEParseDisplayName(
3273 IBrowserService
* This
,
3276 PIDLIST_ABSOLUTE
*ppidlOut
)
3278 ok(0, "unexpected call\n");
3282 static HRESULT WINAPI
BrowserService_DisplayParseError(
3283 IBrowserService
* This
,
3287 ok(0, "unexpected call\n");
3291 static HRESULT WINAPI
BrowserService_NavigateToPidl(
3292 IBrowserService
* This
,
3293 PCIDLIST_ABSOLUTE pidl
,
3296 ok(0, "unexpected call\n");
3300 static HRESULT WINAPI
BrowserService_SetNavigateState(
3301 IBrowserService
* This
,
3304 ok(0, "unexpected call\n");
3308 static HRESULT WINAPI
BrowserService_GetNavigateState(
3309 IBrowserService
* This
,
3312 ok(0, "unexpected call\n");
3316 static HRESULT WINAPI
BrowserService_NotifyRedirect(
3317 IBrowserService
* This
,
3319 PCIDLIST_ABSOLUTE pidl
,
3322 ok(0, "unexpected call\n");
3326 static HRESULT WINAPI
BrowserService_UpdateWindowList(
3327 IBrowserService
* This
)
3329 ok(0, "unexpected call\n");
3333 static HRESULT WINAPI
BrowserService_UpdateBackForwardState(
3334 IBrowserService
* This
)
3336 CHECK_EXPECT(UpdateBackForwardState
);
3340 static HRESULT WINAPI
BrowserService_SetFlags(
3341 IBrowserService
* This
,
3345 ok(0, "unexpected call\n");
3349 static HRESULT WINAPI
BrowserService_GetFlags(
3350 IBrowserService
* This
,
3353 ok(0, "unexpected call\n");
3357 static HRESULT WINAPI
BrowserService_CanNavigateNow(
3358 IBrowserService
* This
)
3360 ok(0, "unexpected call\n");
3364 static HRESULT WINAPI
BrowserService_GetPidl(
3365 IBrowserService
* This
,
3366 PIDLIST_ABSOLUTE
*ppidl
)
3368 ok(0, "unexpected call\n");
3372 static HRESULT WINAPI
BrowserService_SetReferrer(
3373 IBrowserService
* This
,
3374 PCIDLIST_ABSOLUTE pidl
)
3376 ok(0, "unexpected call\n");
3380 static DWORD WINAPI
BrowserService_GetBrowserIndex(
3381 IBrowserService
* This
)
3383 ok(0, "unexpected call\n");
3387 static HRESULT WINAPI
BrowserService_GetBrowserByIndex(
3388 IBrowserService
* This
,
3392 ok(0, "unexpected call\n");
3396 static HRESULT WINAPI
BrowserService_GetHistoryObject(
3397 IBrowserService
* This
,
3402 ok(0, "unexpected call\n");
3406 static HRESULT WINAPI
BrowserService_SetHistoryObject(
3407 IBrowserService
* This
,
3409 BOOL fIsLocalAnchor
)
3411 ok(0, "unexpected call\n");
3415 static HRESULT WINAPI
BrowserService_CacheOLEServer(
3416 IBrowserService
* This
,
3419 ok(0, "unexpected call\n");
3423 static HRESULT WINAPI
BrowserService_GetSetCodePage(
3424 IBrowserService
* This
,
3428 ok(0, "unexpected call\n");
3432 static HRESULT WINAPI
BrowserService_OnHttpEquiv(
3433 IBrowserService
* This
,
3437 VARIANT
*pvarargOut
)
3439 ok(0, "unexpected call\n");
3443 static HRESULT WINAPI
BrowserService_GetPalette(
3444 IBrowserService
* This
,
3447 ok(0, "unexpected call\n");
3451 static HRESULT WINAPI
BrowserService_RegisterWindow(
3452 IBrowserService
* This
,
3453 BOOL fForceRegister
,
3456 ok(0, "unexpected call\n");
3460 static IBrowserServiceVtbl BrowserServiceVtbl
= {
3461 BrowserService_QueryInterface
,
3462 BrowserService_AddRef
,
3463 BrowserService_Release
,
3464 BrowserService_GetParentSite
,
3465 BrowserService_SetTitle
,
3466 BrowserService_GetTitle
,
3467 BrowserService_GetOleObject
,
3468 BrowserService_GetTravelLog
,
3469 BrowserService_ShowControlWindow
,
3470 BrowserService_IsControlWindowShown
,
3471 BrowserService_IEGetDisplayName
,
3472 BrowserService_IEParseDisplayName
,
3473 BrowserService_DisplayParseError
,
3474 BrowserService_NavigateToPidl
,
3475 BrowserService_SetNavigateState
,
3476 BrowserService_GetNavigateState
,
3477 BrowserService_NotifyRedirect
,
3478 BrowserService_UpdateWindowList
,
3479 BrowserService_UpdateBackForwardState
,
3480 BrowserService_SetFlags
,
3481 BrowserService_GetFlags
,
3482 BrowserService_CanNavigateNow
,
3483 BrowserService_GetPidl
,
3484 BrowserService_SetReferrer
,
3485 BrowserService_GetBrowserIndex
,
3486 BrowserService_GetBrowserByIndex
,
3487 BrowserService_GetHistoryObject
,
3488 BrowserService_SetHistoryObject
,
3489 BrowserService_CacheOLEServer
,
3490 BrowserService_GetSetCodePage
,
3491 BrowserService_OnHttpEquiv
,
3492 BrowserService_GetPalette
,
3493 BrowserService_RegisterWindow
3496 static IBrowserService BrowserService
= { &BrowserServiceVtbl
};
3498 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
3499 REFIID riid
, void **ppv
)
3501 return QueryInterface(riid
, ppv
);
3504 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
3509 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
3514 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
3515 REFIID riid
, void **ppv
)
3518 * Services used by HTMLDocument:
3521 * IInternetSecurityManager
3523 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
3526 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
3527 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
3528 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
3530 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
3531 * IElementBehaviorFactory
3532 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
3542 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
3543 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
3548 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
3549 ok(IsEqualGUID(&IID_INewWindowManager
, riid
), "unexpected riid\n");
3550 *ppv
= &NewWindowManager
;
3554 if(IsEqualGUID(&IID_IShellBrowser
, guidService
)) {
3555 ok(IsEqualGUID(&IID_IBrowserService
, riid
), "unexpected riid\n");
3556 *ppv
= &BrowserService
;
3560 return E_NOINTERFACE
;
3563 static const IServiceProviderVtbl ServiceProviderVtbl
= {
3564 ServiceProvider_QueryInterface
,
3565 ServiceProvider_AddRef
,
3566 ServiceProvider_Release
,
3567 ServiceProvider_QueryService
3570 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
3572 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
3573 REFIID riid
, void **ppv
)
3575 return QueryInterface(riid
, ppv
);
3578 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSinkEx
*iface
)
3583 static ULONG WINAPI
AdviseSink_Release(IAdviseSinkEx
*iface
)
3588 static void WINAPI
AdviseSink_OnDataChange(IAdviseSinkEx
*iface
,
3589 FORMATETC
*pFormatetc
, STGMEDIUM
*pStgmed
)
3591 ok(0, "unexpected call\n");
3594 static void WINAPI
AdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
3595 DWORD dwAspect
, LONG lindex
)
3597 ok(0, "unexpected call\n");
3600 static void WINAPI
AdviseSink_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
3602 ok(0, "unexpected call\n");
3605 static void WINAPI
AdviseSink_OnSave(IAdviseSinkEx
*iface
)
3607 ok(0, "unexpected call\n");
3610 static void WINAPI
AdviseSink_OnClose(IAdviseSinkEx
*iface
)
3612 ok(0, "unexpected call\n");
3615 static void WINAPI
AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
3617 ok(0, "unexpected call\n");
3620 static void WINAPI
ObjectAdviseSink_OnClose(IAdviseSinkEx
*iface
)
3622 CHECK_EXPECT(Advise_Close
);
3625 static const IAdviseSinkExVtbl AdviseSinkVtbl
= {
3626 AdviseSink_QueryInterface
,
3629 AdviseSink_OnDataChange
,
3630 AdviseSink_OnViewChange
,
3631 AdviseSink_OnRename
,
3633 ObjectAdviseSink_OnClose
,
3634 AdviseSinkEx_OnViewStatusChange
3637 static IAdviseSinkEx AdviseSink
= { &AdviseSinkVtbl
};
3639 static HRESULT WINAPI
ViewAdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
3640 REFIID riid
, void **ppv
)
3642 if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
3647 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
3649 return E_NOINTERFACE
;
3652 static void WINAPI
ViewAdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
3653 DWORD dwAspect
, LONG lindex
)
3655 CHECK_EXPECT2(OnViewChange
);
3657 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
3658 ok(lindex
== -1, "lindex = %d\n", lindex
);
3661 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl
= {
3662 ViewAdviseSink_QueryInterface
,
3665 AdviseSink_OnDataChange
,
3666 ViewAdviseSink_OnViewChange
,
3667 AdviseSink_OnRename
,
3670 AdviseSinkEx_OnViewStatusChange
3673 static IAdviseSinkEx ViewAdviseSink
= { &ViewAdviseSinkVtbl
};
3675 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
3676 DEFINE_GUID(IID_IThumbnailView
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
3677 DEFINE_GUID(IID_IRenMailEditor
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
3678 DEFINE_GUID(IID_unk4
, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
3679 DEFINE_GUID(IID_IDocHostUIHandlerPriv
, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
3681 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
3685 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
3687 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
3688 *ppv
= &DocumentSite
;
3689 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
3690 *ppv
= &DocHostUIHandler
;
3691 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
3692 *ppv
= &OleContainer
;
3693 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
3694 *ppv
= &InPlaceSiteWindowless
;
3695 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
3696 *ppv
= &OleCommandTarget
;
3697 else if(IsEqualGUID(&IID_IDispatch
, riid
))
3699 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
3700 *ppv
= &ServiceProvider
;
3701 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
3702 *ppv
= ipsex
? &InPlaceSiteWindowless
: NULL
;
3703 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
))
3704 *ppv
= ipsw
? &InPlaceSiteWindowless
: NULL
;
3705 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
3706 *ppv
= &OleControlSite
;
3707 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
3708 return E_NOINTERFACE
; /* TODO */
3709 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
3710 return E_NOINTERFACE
; /* ? */
3711 else if(IsEqualGUID(&IID_unk1
, riid
))
3712 return E_NOINTERFACE
; /* HTMLWindow2 ? */
3713 else if(IsEqualGUID(&IID_IThumbnailView
, riid
))
3714 return E_NOINTERFACE
; /* ? */
3715 else if(IsEqualGUID(&IID_IRenMailEditor
, riid
))
3716 return E_NOINTERFACE
; /* ? */
3717 else if(IsEqualGUID(&IID_unk4
, riid
))
3718 return E_NOINTERFACE
; /* ? */
3719 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv
, riid
))
3720 return E_NOINTERFACE
; /* ? */
3722 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
3726 return E_NOINTERFACE
;
3729 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
3731 if(msg
== WM_CONTINUE_BINDING
) {
3732 IBindStatusCallback
*callback
= (IBindStatusCallback
*)wParam
;
3733 continue_binding(callback
);
3736 return DefWindowProc(hwnd
, msg
, wParam
, lParam
);
3739 static void test_doscroll(IUnknown
*unk
)
3741 IHTMLDocument3
*doc
;
3742 IHTMLElement2
*elem2
;
3747 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument3
, (void**)&doc
);
3748 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
3752 hres
= IHTMLDocument3_get_documentElement(doc
, &elem
);
3753 IHTMLDocument3_Release(doc
);
3754 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
3755 switch(load_state
) {
3759 ok(!elem
, "elem != NULL\n");
3762 case LD_INTERACTIVE
:
3764 ok(elem
!= NULL
, "elem == NULL\n");
3769 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
3770 IHTMLElement_Release(elem
);
3771 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
3774 V_BSTR(&v
) = a2bstr("left");
3775 hres
= IHTMLElement2_doScroll(elem2
, v
);
3776 SysFreeString(V_BSTR(&v
));
3777 IHTMLElement2_Release(elem2
);
3779 if(inplace_deactivated
)
3780 ok(hres
== E_PENDING
, "doScroll failed: %08x\n", hres
);
3781 else if(load_state
== LD_COMPLETE
)
3782 ok(hres
== S_OK
, "doScroll failed: %08x\n", hres
);
3784 ok(hres
== E_PENDING
|| hres
== S_OK
, "doScroll failed: %08x\n", hres
);
3787 static void _test_readyState(unsigned line
, IUnknown
*unk
)
3789 IHTMLDocument2
*htmldoc
;
3790 DISPPARAMS dispparams
;
3796 static const LPCSTR expected_state
[] = {
3811 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
3812 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
3816 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
3817 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
3819 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
3820 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
3822 if(!strcmp_wa(state
, "interactive") && load_state
== LD_LOADING
)
3823 load_state
= LD_INTERACTIVE
;
3826 (!strcmp_wa(state
, expected_state
[load_state
]), "unexpected state %s, expected %d\n",
3827 wine_dbgstr_w(state
), load_state
);
3828 SysFreeString(state
);
3830 hres
= IHTMLDocument2_get_body(htmldoc
, &elem
);
3831 ok_(__FILE__
,line
)(hres
== S_OK
, "get_body failed: %08x\n", hres
);
3833 IHTMLElement2
*elem2
;
3836 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
3837 IHTMLElement_Release(elem
);
3838 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
3840 hres
= IHTMLElement2_get_readyState(elem2
, &var
);
3841 IHTMLElement2_Release(elem2
);
3842 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3843 ok(V_VT(&var
) == VT_BSTR
, "V_VT(state) = %d\n", V_VT(&var
));
3844 ok(!strcmp_wa(V_BSTR(&var
), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var
)));
3847 ok_(__FILE__
,line
)(load_state
!= LD_COMPLETE
, "body is NULL in complete state\n");
3850 dispparams
.cArgs
= 0;
3851 dispparams
.cNamedArgs
= 0;
3852 dispparams
.rgdispidNamedArgs
= NULL
;
3853 dispparams
.rgvarg
= NULL
;
3857 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
3858 &dispparams
, &out
, NULL
, NULL
);
3859 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
3861 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
3862 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
3864 test_doscroll((IUnknown
*)htmldoc
);
3866 IHTMLDocument2_Release(htmldoc
);
3869 static void test_ViewAdviseSink(IHTMLDocument2
*doc
)
3874 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IViewObject
, (void**)&view
);
3875 ok(hres
== S_OK
, "QueryInterface(IID_IViewObject) failed: %08x\n", hres
);
3877 hres
= IViewObject_SetAdvise(view
, DVASPECT_CONTENT
, ADVF_PRIMEFIRST
, (IAdviseSink
*)&ViewAdviseSink
);
3878 ok(hres
== S_OK
, "SetAdvise failed: %08x\n", hres
);
3880 IViewObject_Release(view
);
3883 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
3885 IConnectionPointContainer
*tmp_container
= NULL
;
3886 IConnectionPoint
*cp
;
3891 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3892 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3896 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
3897 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
3898 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
3900 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
3901 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
3903 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
3904 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
3905 ok(tmp_container
== container
, "container != tmp_container\n");
3907 IConnectionPointContainer_Release(tmp_container
);
3909 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
3910 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
3912 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
3913 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
3914 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3915 } else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
3916 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&EventDispatch
, &cookie
);
3917 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3920 IConnectionPoint_Release(cp
);
3923 static void test_ConnectionPointContainer(IHTMLDocument2
*doc
)
3925 IConnectionPointContainer
*container
;
3928 hres
= IUnknown_QueryInterface(doc
, &IID_IConnectionPointContainer
, (void**)&container
);
3929 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3933 test_ConnectionPoint(container
, &IID_IDispatch
);
3934 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
3935 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
3936 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
3938 IConnectionPointContainer_Release(container
);
3941 static void set_custom_uihandler(IHTMLDocument2
*doc
, IDocHostUIHandler2
*uihandler
)
3943 ICustomDoc
*custom_doc
;
3946 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_ICustomDoc
, (void**)&custom_doc
);
3947 ok(hres
== S_OK
, "Could not get ICustomDoc iface: %08x\n", hres
);
3949 expect_uihandler_iface
= uihandler
;
3951 hres
= ICustomDoc_SetUIHandler(custom_doc
, (IDocHostUIHandler
*)uihandler
);
3952 ICustomDoc_Release(custom_doc
);
3953 ok(hres
== S_OK
, "SetUIHandler failed: %08x\n", hres
);
3956 static void test_Load(IPersistMoniker
*persist
, IMoniker
*mon
)
3960 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
3962 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
3964 test_readyState((IUnknown
*)persist
);
3968 CreateBindCtx(0, &bind
);
3969 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
3970 (IUnknown
*)&ClientSite
);
3973 SET_EXPECT(GetDisplayName
);
3974 if(!set_clientsite
) {
3975 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3976 SET_EXPECT(GetHostInfo
);
3977 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3978 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3979 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3980 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3981 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3982 SET_EXPECT(GetOptionKeyPath
);
3983 SET_EXPECT(GetOverrideKeyPath
);
3984 SET_EXPECT(GetWindow
);
3985 SET_EXPECT(Exec_DOCCANNAVIGATE
);
3986 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3987 SET_EXPECT(Exec_SETPROGRESSMAX
);
3988 SET_EXPECT(Exec_SETPROGRESSPOS
);
3989 SET_EXPECT(Exec_ShellDocView_37
);
3991 if(!container_locked
) {
3992 SET_EXPECT(GetContainer
);
3993 SET_EXPECT(LockContainer
);
3995 SET_EXPECT(OnChanged_READYSTATE
);
3996 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
3997 SET_EXPECT(Exec_ShellDocView_84
);
3998 SET_EXPECT(IsSystemMoniker
);
4000 SET_EXPECT(BindToStorage
);
4001 SET_EXPECT(SetActiveObject
);
4002 if(set_clientsite
) {
4003 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4004 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4005 SET_EXPECT(Exec_ShellDocView_37
);
4006 SET_EXPECT(IsErrorUrl
);
4009 SET_EXPECT(GetTravelLog
);
4010 SET_EXPECT(GetPendingUrl
);
4011 load_state
= LD_DOLOAD
;
4012 expect_LockContainer_fLock
= TRUE
;
4013 readystate_set_loading
= TRUE
;
4015 hres
= IPersistMoniker_Load(persist
, FALSE
, mon
, bind
, 0x12);
4016 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4019 CHECK_CALLED(GetDisplayName
);
4020 if(!set_clientsite
) {
4021 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4022 CHECK_CALLED(GetHostInfo
);
4023 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4024 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4025 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4026 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4027 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
4028 CHECK_CALLED(GetOptionKeyPath
);
4029 CHECK_CALLED(GetOverrideKeyPath
);
4030 CHECK_CALLED(GetWindow
);
4031 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
4032 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
4033 CHECK_CALLED(Exec_SETPROGRESSMAX
);
4034 CHECK_CALLED(Exec_SETPROGRESSPOS
);
4035 CHECK_CALLED(Exec_ShellDocView_37
);
4037 if(!container_locked
) {
4038 CHECK_CALLED(GetContainer
);
4039 CHECK_CALLED(LockContainer
);
4040 container_locked
= TRUE
;
4042 CHECK_CALLED(OnChanged_READYSTATE
);
4043 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
4044 SET_CALLED(IsSystemMoniker
); /* IE7 */
4045 SET_CALLED(Exec_ShellDocView_84
);
4047 CHECK_CALLED(BindToStorage
);
4048 SET_CALLED(SetActiveObject
); /* FIXME */
4049 if(set_clientsite
) {
4050 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4051 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4052 CHECK_CALLED(Exec_ShellDocView_37
);
4053 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
4056 todo_wine
CHECK_CALLED(GetTravelLog
);
4057 todo_wine
CHECK_CALLED(GetPendingUrl
);
4059 set_clientsite
= container_locked
= TRUE
;
4061 test_GetCurMoniker((IUnknown
*)persist
, mon
, NULL
);
4063 IBindCtx_Release(bind
);
4065 test_readyState((IUnknown
*)persist
);
4068 #define DWL_VERBDONE 0x0001
4069 #define DWL_CSS 0x0002
4070 #define DWL_TRYCSS 0x0004
4071 #define DWL_HTTP 0x0008
4072 #define DWL_EMPTY 0x0010
4073 #define DWL_JAVASCRIPT 0x0020
4075 static void test_download(DWORD flags
)
4077 const BOOL is_js
= (flags
& DWL_JAVASCRIPT
) != 0;
4082 b
= is_js
? &called_Exec_SETDOWNLOADSTATE_0
: &called_Exec_HTTPEQUIV_DONE
;
4084 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
4085 ok(hwnd
!= NULL
, "Could not find hidden window\n");
4087 test_readyState(NULL
);
4089 if(flags
& (DWL_VERBDONE
|DWL_HTTP
))
4090 SET_EXPECT(Exec_SETPROGRESSMAX
);
4091 if((flags
& DWL_VERBDONE
) && !load_from_stream
&& !is_js
)
4092 SET_EXPECT(GetHostInfo
);
4093 SET_EXPECT(SetStatusText
);
4094 if(!(flags
& DWL_EMPTY
))
4095 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
4097 SET_EXPECT(GetExternal
);
4098 SET_EXPECT(OnViewChange
);
4099 SET_EXPECT(GetDropTarget
);
4100 if(flags
& DWL_TRYCSS
)
4101 SET_EXPECT(Exec_ShellDocView_84
);
4102 if(flags
& DWL_CSS
) {
4103 SET_EXPECT(CreateInstance
);
4105 SET_EXPECT(LockRequest
);
4106 SET_EXPECT(Terminate
);
4107 SET_EXPECT(Protocol_Read
);
4108 SET_EXPECT(UnlockRequest
);
4110 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
)))
4111 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
4113 SET_EXPECT(Invoke_OnReadyStateChange_Complete
);
4114 SET_EXPECT(Exec_Explorer_69
);
4115 SET_EXPECT(EnableModeless_TRUE
); /* IE7 */
4116 SET_EXPECT(Frame_EnableModeless_TRUE
); /* IE7 */
4117 SET_EXPECT(EnableModeless_FALSE
); /* IE7 */
4118 SET_EXPECT(Frame_EnableModeless_FALSE
); /* IE7 */
4119 if(nav_url
&& !is_js
)
4120 SET_EXPECT(Exec_ShellDocView_37
);
4121 if(flags
& DWL_HTTP
) {
4122 SET_EXPECT(OnChanged_1012
);
4123 SET_EXPECT(Exec_HTTPEQUIV
);
4124 SET_EXPECT(Exec_SETTITLE
);
4127 SET_EXPECT(OnChanged_1005
);
4128 SET_EXPECT(OnChanged_READYSTATE
);
4129 SET_EXPECT(Exec_SETPROGRESSPOS
);
4130 if(!(flags
& DWL_EMPTY
))
4131 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
4132 SET_EXPECT(Exec_ShellDocView_103
);
4133 SET_EXPECT(Exec_ShellDocView_105
);
4134 SET_EXPECT(Exec_ShellDocView_140
);
4136 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
4137 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
4139 SET_EXPECT(SetStatusText
);
4141 SET_EXPECT(UpdateUI
);
4142 SET_EXPECT(Exec_UPDATECOMMANDS
);
4143 SET_EXPECT(Exec_SETTITLE
);
4144 SET_EXPECT(UpdateBackForwardState
);
4148 if(!(flags
& DWL_EMPTY
))
4149 SET_EXPECT(FireNavigateComplete2
);
4150 SET_EXPECT(FireDocumentComplete
);
4152 SET_EXPECT(ActiveElementChanged
);
4154 SET_EXPECT(IsErrorUrl
);
4155 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
4157 while(!*b
&& GetMessage(&msg
, NULL
, 0, 0)) {
4158 TranslateMessage(&msg
);
4159 DispatchMessage(&msg
);
4162 if(flags
& DWL_VERBDONE
)
4163 CHECK_CALLED(Exec_SETPROGRESSMAX
);
4164 if(flags
& DWL_HTTP
)
4165 SET_CALLED(Exec_SETPROGRESSMAX
);
4166 if((flags
& DWL_VERBDONE
) && !load_from_stream
&& !is_js
) {
4168 todo_wine
CHECK_CALLED(GetHostInfo
);
4170 CHECK_CALLED(GetHostInfo
);
4172 CHECK_CALLED(SetStatusText
);
4173 if(!(flags
& DWL_EMPTY
))
4174 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
4176 CHECK_CALLED(GetExternal
);
4177 CHECK_CALLED(OnViewChange
);
4178 SET_CALLED(GetDropTarget
);
4179 if(flags
& DWL_TRYCSS
)
4180 SET_CALLED(Exec_ShellDocView_84
);
4181 if(flags
& DWL_CSS
) {
4182 CHECK_CALLED(CreateInstance
);
4183 CHECK_CALLED(Start
);
4184 CHECK_CALLED(LockRequest
);
4185 CHECK_CALLED(Terminate
);
4186 CHECK_CALLED(Protocol_Read
);
4187 CHECK_CALLED(UnlockRequest
);
4189 if(!(flags
& (DWL_EMPTY
|DWL_JAVASCRIPT
)))
4190 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive
);
4192 CHECK_CALLED(Invoke_OnReadyStateChange_Complete
);
4193 SET_CALLED(Exec_Explorer_69
);
4194 SET_CALLED(EnableModeless_TRUE
); /* IE7 */
4195 SET_CALLED(Frame_EnableModeless_TRUE
); /* IE7 */
4196 SET_CALLED(EnableModeless_FALSE
); /* IE7 */
4197 SET_CALLED(Frame_EnableModeless_FALSE
); /* IE7 */
4198 if(nav_url
&& !is_js
)
4199 todo_wine
CHECK_CALLED(Exec_ShellDocView_37
);
4200 if(flags
& DWL_HTTP
) todo_wine
{
4201 CHECK_CALLED(OnChanged_1012
);
4202 CHECK_CALLED(Exec_HTTPEQUIV
);
4203 CHECK_CALLED(Exec_SETTITLE
);
4206 CHECK_CALLED(OnChanged_1005
);
4207 CHECK_CALLED(OnChanged_READYSTATE
);
4208 CHECK_CALLED(Exec_SETPROGRESSPOS
);
4210 SET_CALLED(OnChanged_READYSTATE
); /* sometimes called */
4211 todo_wine
CHECK_CALLED(Exec_SETPROGRESSPOS
);
4213 if(!(flags
& DWL_EMPTY
))
4214 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
4215 SET_CALLED(Exec_ShellDocView_103
);
4216 SET_CALLED(Exec_ShellDocView_105
);
4217 SET_CALLED(Exec_ShellDocView_140
);
4219 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
4220 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
4222 SET_CALLED(SetStatusText
);
4223 if(nav_url
) { /* avoiding race, FIXME: find better way */
4224 SET_CALLED(UpdateUI
);
4225 SET_CALLED(Exec_UPDATECOMMANDS
);
4226 SET_CALLED(Exec_SETTITLE
);
4227 todo_wine
CHECK_CALLED_BROKEN(UpdateBackForwardState
);
4231 if(!(flags
& DWL_EMPTY
))
4232 todo_wine
CHECK_CALLED(FireNavigateComplete2
);
4233 CHECK_CALLED(FireDocumentComplete
);
4235 todo_wine
CHECK_CALLED(ActiveElementChanged
);
4237 todo_wine
CHECK_CALLED_BROKEN(IsErrorUrl
);
4239 load_state
= LD_COMPLETE
;
4241 test_readyState(NULL
);
4244 static void test_Persist(IHTMLDocument2
*doc
, IMoniker
*mon
)
4246 IPersistMoniker
*persist_mon
;
4247 IPersistFile
*persist_file
;
4251 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&persist_file
);
4252 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
4253 if(SUCCEEDED(hres
)) {
4254 hres
= IPersist_GetClassID(persist_file
, NULL
);
4255 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
4257 hres
= IPersist_GetClassID(persist_file
, &guid
);
4258 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
4259 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
4261 IPersist_Release(persist_file
);
4264 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&persist_mon
);
4265 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
4266 if(SUCCEEDED(hres
)) {
4267 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
4268 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
4270 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
4271 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
4272 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
4274 if(load_state
== LD_DOLOAD
)
4275 test_Load(persist_mon
, mon
);
4277 test_readyState((IUnknown
*)doc
);
4279 IPersistMoniker_Release(persist_mon
);
4283 static void test_put_href(IHTMLDocument2
*doc
, BOOL use_replace
, const char *new_nav_url
, BOOL is_js
)
4285 IHTMLPrivateWindow
*priv_window
;
4286 const char *prev_nav_url
;
4287 IHTMLWindow2
*window
;
4288 IHTMLLocation
*location
;
4293 trace("put_href %s...\n", new_nav_url
);
4298 hres
= IHTMLDocument2_get_location(doc
, &location
);
4299 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
4300 ok(location
!= NULL
, "location == NULL\n");
4302 prev_nav_url
= nav_url
;
4303 str
= a2bstr(nav_url
= new_nav_url
);
4304 SET_EXPECT(TranslateUrl
);
4305 SET_EXPECT(Navigate
);
4307 hres
= IHTMLLocation_replace(location
, str
);
4308 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
4310 hres
= IHTMLLocation_put_href(location
, str
);
4311 if(is_js
&& hres
== E_ACCESSDENIED
)
4312 win_skip("put_href: got E_ACCESSDENIED\n");
4314 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
4317 CHECK_CALLED(TranslateUrl
);
4318 CHECK_CALLED(Navigate
);
4320 SET_CALLED(TranslateUrl
);
4321 SET_CALLED(Navigate
);
4324 IHTMLLocation_Release(location
);
4326 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
4327 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4329 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
4330 IHTMLWindow2_Release(window
);
4331 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres
);
4333 readystate_set_loading
= TRUE
;
4334 SET_EXPECT(TranslateUrl
);
4335 SET_EXPECT(Exec_ShellDocView_67
);
4336 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4337 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4338 SET_EXPECT(Exec_ShellDocView_63
);
4341 V_VT(&vempty
) = VT_EMPTY
;
4342 hres
= IHTMLPrivateWindow_SuperNavigate(priv_window
, str
, str2
, NULL
, NULL
, &vempty
, &vempty
, 0);
4343 SysFreeString(str2
);
4344 ok(hres
== S_OK
, "SuperNavigate failed: %08x\n", hres
);
4346 CHECK_CALLED(TranslateUrl
);
4347 CHECK_CALLED(Exec_ShellDocView_67
);
4348 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4349 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4350 CHECK_CALLED(Exec_ShellDocView_63
);
4353 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
4356 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
4357 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
4358 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
4359 SysFreeString(str2
);
4362 ignore_external_qi
= TRUE
;
4364 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
4365 test_download(DWL_VERBDONE
| (is_js
? DWL_JAVASCRIPT
: 0));
4367 ignore_external_qi
= FALSE
;
4369 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
4371 hres
= IHTMLPrivateWindow_GetAddressBarUrl(priv_window
, &str2
);
4372 ok(hres
== S_OK
, "GetAddressBarUrl failed: %08x\n", hres
);
4374 ok(!strcmp_wa(str2
, prev_nav_url
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
4376 ok(!lstrcmpW(str2
, str
), "unexpected address bar url: %s\n", wine_dbgstr_w(str2
));
4377 SysFreeString(str2
);
4379 IHTMLPrivateWindow_Release(priv_window
);
4383 nav_url
= prev_nav_url
;
4386 static void test_open_window(IHTMLDocument2
*doc
)
4388 IHTMLWindow2
*window
, *new_window
;
4392 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
4393 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4395 url
= a2bstr(nav_url
= "about:blank");
4396 name
= a2bstr("test");
4397 new_window
= (void*)0xdeadbeef;
4401 SET_EXPECT(TranslateUrl
);
4402 SET_EXPECT(EvaluateNewWindow
);
4404 hres
= IHTMLWindow2_open(window
, url
, name
, NULL
, VARIANT_FALSE
, &new_window
);
4407 SysFreeString(name
);
4410 CHECK_CALLED(TranslateUrl
);
4412 if(!called_EvaluateNewWindow
) {
4414 win_skip("INewWindowManager not supported\n");
4415 if(SUCCEEDED(hres
) && new_window
)
4416 IHTMLWindow2_Release(new_window
);
4417 IHTMLWindow2_Release(window
);
4422 CHECK_CALLED(EvaluateNewWindow
);
4425 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
4427 ok(new_window
== NULL
, "new_window != NULL\n");
4429 IHTMLWindow2_Release(window
);
4432 static void test_clear(IHTMLDocument2
*doc
)
4436 hres
= IHTMLDocument2_clear(doc
);
4437 ok(hres
== S_OK
, "clear failed: %08x\n", hres
);
4440 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
4442 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
4443 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
4444 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
4445 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
4446 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
4447 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
4448 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
4449 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
4450 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
4451 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
4452 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
4453 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
4454 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
4455 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
4456 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
4457 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
4458 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
4459 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
4460 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
4461 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
4463 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
4464 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
4466 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
4468 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
4470 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
4471 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
4473 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
4474 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
4476 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
4478 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
4479 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
4482 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
4483 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
4485 IOleCommandTarget
*cmdtrg
;
4486 OLECMD olecmd
= {cmdid
, 0};
4489 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4490 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
4494 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
4495 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
4497 IOleCommandTarget_Release(cmdtrg
);
4499 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
4500 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
4503 static void test_MSHTML_QueryStatus(IHTMLDocument2
*doc
, DWORD cmdf
)
4505 IUnknown
*unk
= doc
? (IUnknown
*)doc
: doc_unk
;
4507 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
4508 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
4509 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
4510 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
4511 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
4512 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
4513 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
4514 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
4515 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
4516 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
4517 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
4518 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
4519 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
4520 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
4521 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
4522 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
4525 static void test_OleCommandTarget(IHTMLDocument2
*doc
)
4527 IOleCommandTarget
*cmdtrg
;
4528 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
4532 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4533 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
4537 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
4538 cmds
[i
].cmdID
= i
+1;
4539 cmds
[i
].cmdf
= 0xf0f0;
4542 SET_EXPECT(QueryStatus_OPEN
);
4543 SET_EXPECT(QueryStatus_NEW
);
4544 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
4545 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
4546 CHECK_CALLED(QueryStatus_OPEN
);
4547 CHECK_CALLED(QueryStatus_NEW
);
4549 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
4550 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
4551 if(i
+1 == OLECMDID_FIND
)
4553 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
4554 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
4557 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
4558 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
4560 IOleCommandTarget_Release(cmdtrg
);
4563 static void test_OleCommandTarget_fail(IHTMLDocument2
*doc
)
4565 IOleCommandTarget
*cmdtrg
;
4570 {OLECMDID_OPEN
, 0xf0f0},
4571 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
4574 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4575 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
4579 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
4580 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
4582 SET_EXPECT(QueryStatus_OPEN
);
4583 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
4584 CHECK_CALLED(QueryStatus_OPEN
);
4586 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
4587 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
4588 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
4589 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
4590 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
4591 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
4592 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
4594 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
4595 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
4596 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
4598 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
4599 if(!expect_cmds
[i
]) {
4600 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
4601 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4602 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
4603 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
4607 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
4608 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4609 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
4610 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
4612 IOleCommandTarget_Release(cmdtrg
);
4615 static void test_exec_onunload(IHTMLDocument2
*doc
)
4617 IOleCommandTarget
*cmdtrg
;
4621 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4622 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
4626 memset(&var
, 0x0a, sizeof(var
));
4627 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
4628 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
4629 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
4630 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
4631 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
4633 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
4634 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4635 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
4637 IOleCommandTarget_Release(cmdtrg
);
4640 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
4642 IOleCommandTarget
*cmdtrg
;
4645 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4646 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
4653 load_state
= LD_DOLOAD
;
4656 SET_EXPECT(GetClassID
);
4657 SET_EXPECT(SetStatusText
);
4658 SET_EXPECT(Exec_ShellDocView_37
);
4659 SET_EXPECT(GetHostInfo
);
4661 SET_EXPECT(GetDisplayName
);
4662 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4663 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4664 SET_EXPECT(OnChanged_READYSTATE
);
4665 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
4666 SET_EXPECT(IsSystemMoniker
);
4667 SET_EXPECT(Exec_ShellDocView_84
);
4669 SET_EXPECT(BindToStorage
);
4670 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4673 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
4675 expect_status_text
= NULL
;
4676 readystate_set_loading
= TRUE
;
4678 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
4679 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4680 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
4683 CHECK_CALLED(GetClassID
);
4684 CHECK_CALLED(SetStatusText
);
4685 CHECK_CALLED(Exec_ShellDocView_37
);
4686 CHECK_CALLED(GetHostInfo
);
4688 CHECK_CALLED(GetDisplayName
);
4689 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4690 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4691 CHECK_CALLED(OnChanged_READYSTATE
);
4692 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
4693 SET_CALLED(IsSystemMoniker
); /* IE7 */
4694 SET_CALLED(Exec_ShellDocView_84
);
4696 CHECK_CALLED(BindToStorage
);
4697 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4698 CHECK_CALLED(HideUI
);
4699 CHECK_CALLED(ShowUI
);
4700 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
4702 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
4704 IOleCommandTarget_Release(cmdtrg
);
4706 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
4707 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4708 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
4711 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
4713 IOleCommandTarget
*cmdtrg
;
4714 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
4717 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4718 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
4725 V_BSTR(in
) = SysAllocString(name
);
4731 V_I4(out
) = 0xdeadbeef;
4734 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
4735 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
4741 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
4742 if(V_VT(out
) == VT_BSTR
) {
4744 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
4745 "unexpected fontname %s\n", wine_dbgstr_w(name
));
4747 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
4752 IOleCommandTarget_Release(cmdtrg
);
4755 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
4757 IOleCommandTarget
*cmdtrg
;
4760 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
4761 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
4765 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
4766 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
4767 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
4769 IOleCommandTarget_Release(cmdtrg
);
4772 static void test_IsDirty(IHTMLDocument2
*doc
, HRESULT exhres
)
4774 IPersistStreamInit
*perinit
;
4775 IPersistMoniker
*permon
;
4776 IPersistFile
*perfile
;
4779 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&perinit
);
4780 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
4781 if(SUCCEEDED(hres
)) {
4782 hres
= IPersistStreamInit_IsDirty(perinit
);
4783 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
4784 IPersistStreamInit_Release(perinit
);
4787 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&permon
);
4788 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
4789 if(SUCCEEDED(hres
)) {
4790 hres
= IPersistMoniker_IsDirty(permon
);
4791 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
4792 IPersistMoniker_Release(permon
);
4795 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&perfile
);
4796 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
4797 if(SUCCEEDED(hres
)) {
4798 hres
= IPersistFile_IsDirty(perfile
);
4799 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
4800 IPersistFile_Release(perfile
);
4804 static HWND
create_container_window(void)
4806 static const WCHAR wszHTMLDocumentTest
[] =
4807 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
4808 static WNDCLASSEXW wndclass
= {
4809 sizeof(WNDCLASSEXW
),
4812 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
4813 wszHTMLDocumentTest
,
4817 RegisterClassExW(&wndclass
);
4818 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
4819 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
4820 515, 530, NULL
, NULL
, NULL
, NULL
);
4823 static void test_DoVerb(IOleObject
*oleobj
)
4825 RECT rect
= {0,0,500,500};
4828 if(!container_locked
) {
4829 SET_EXPECT(GetContainer
);
4830 SET_EXPECT(LockContainer
);
4832 SET_EXPECT(ActivateMe
);
4833 expect_LockContainer_fLock
= TRUE
;
4835 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
4836 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
4838 if(!container_locked
) {
4839 CHECK_CALLED(GetContainer
);
4840 CHECK_CALLED(LockContainer
);
4841 container_locked
= TRUE
;
4843 CHECK_CALLED(ActivateMe
);
4846 #define CLIENTSITE_EXPECTPATH 0x00000001
4847 #define CLIENTSITE_SETNULL 0x00000002
4848 #define CLIENTSITE_DONTSET 0x00000004
4850 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
4852 IOleClientSite
*clientsite
;
4855 if(flags
& CLIENTSITE_SETNULL
) {
4856 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
4857 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
4859 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
4861 ok(!clientsite
, "clientsite != NULL\n");
4863 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
4864 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
4866 set_clientsite
= FALSE
;
4869 if(flags
& CLIENTSITE_DONTSET
)
4872 if(!expect_uihandler_iface
)
4873 expect_uihandler_iface
= &DocHostUIHandler
;
4875 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
4876 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
4877 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
4878 clientsite
, set_clientsite
? &ClientSite
: NULL
);
4880 if(!set_clientsite
) {
4881 if(expect_uihandler_iface
)
4882 SET_EXPECT(GetHostInfo
);
4883 if(flags
& CLIENTSITE_EXPECTPATH
) {
4884 SET_EXPECT(GetOptionKeyPath
);
4885 SET_EXPECT(GetOverrideKeyPath
);
4887 SET_EXPECT(GetWindow
);
4888 if(flags
& CLIENTSITE_EXPECTPATH
)
4889 SET_EXPECT(Exec_DOCCANNAVIGATE
);
4890 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
4891 SET_EXPECT(Exec_SETPROGRESSMAX
);
4892 SET_EXPECT(Exec_SETPROGRESSPOS
);
4893 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
4894 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4895 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4896 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4897 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
4898 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
4899 SET_EXPECT(GetTravelLog
);
4901 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
4902 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
4904 if(expect_uihandler_iface
)
4905 CHECK_CALLED(GetHostInfo
);
4906 if(flags
& CLIENTSITE_EXPECTPATH
) {
4907 CHECK_CALLED(GetOptionKeyPath
);
4908 CHECK_CALLED(GetOverrideKeyPath
);
4910 CHECK_CALLED(GetWindow
);
4911 if(flags
& CLIENTSITE_EXPECTPATH
)
4912 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
4913 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
4914 CHECK_CALLED(Exec_SETPROGRESSMAX
);
4915 CHECK_CALLED(Exec_SETPROGRESSPOS
);
4916 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4917 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4918 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4919 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4920 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4921 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
4922 todo_wine
CHECK_CALLED(GetTravelLog
);
4924 set_clientsite
= TRUE
;
4927 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
4928 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
4930 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
4931 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
4932 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
4935 static void test_OnAmbientPropertyChange(IHTMLDocument2
*doc
)
4937 IOleControl
*control
= NULL
;
4940 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
4941 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4945 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
4946 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
4947 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4948 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4950 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4951 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
4952 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4953 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4955 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4956 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4957 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
4958 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4959 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4960 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4962 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4963 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4964 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
4965 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4966 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4967 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4969 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
4970 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
4971 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4972 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4974 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
4975 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4976 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4977 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
4979 IOleControl_Release(control
);
4984 static void test_OnAmbientPropertyChange2(IHTMLDocument2
*doc
)
4986 IOleControl
*control
= NULL
;
4989 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
4990 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4994 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4995 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
4997 IOleControl_Release(control
);
5000 static void test_Close(IHTMLDocument2
*doc
, BOOL set_client
)
5002 IOleObject
*oleobj
= NULL
;
5005 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5006 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
5010 SET_EXPECT(GetContainer
);
5011 SET_EXPECT(LockContainer
);
5012 expect_LockContainer_fLock
= FALSE
;
5013 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
5014 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
5015 CHECK_CALLED(GetContainer
);
5016 CHECK_CALLED(LockContainer
);
5017 container_locked
= FALSE
;
5020 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
5022 IOleObject_Release(oleobj
);
5025 static void test_Advise(IHTMLDocument2
*doc
)
5027 IOleObject
*oleobj
= NULL
;
5028 IEnumSTATDATA
*enum_advise
= (void*)0xdeadbeef;
5032 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5033 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
5037 hres
= IOleObject_Unadvise(oleobj
, 0);
5038 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
5040 hres
= IOleObject_EnumAdvise(oleobj
, &enum_advise
);
5041 ok(hres
== S_OK
, "EnumAdvise returned: %08x\n", hres
);
5042 ok(enum_advise
== NULL
, "enum_advise != NULL\n");
5045 hres
= IOleObject_Advise(oleobj
, NULL
, &conn
);
5046 /* Old IE returns S_OK and sets conn to 1 */
5047 ok(hres
== E_INVALIDARG
|| hres
== S_OK
, "Advise returned: %08x\n", hres
);
5048 ok(conn
== 0 || conn
== 1, "conn = %d\n", conn
);
5050 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, NULL
);
5051 ok(hres
== E_INVALIDARG
, "Advise returned: %08x\n", hres
);
5053 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
5054 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
5055 ok(conn
== 1, "conn = %d\n", conn
);
5057 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
5058 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
5059 ok(conn
== 2, "conn = %d\n", conn
);
5061 hres
= IOleObject_Unadvise(oleobj
, 1);
5062 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
5064 hres
= IOleObject_Unadvise(oleobj
, 1);
5065 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
5067 hres
= IOleObject_Unadvise(oleobj
, 2);
5068 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
5070 IOleObject_Release(oleobj
);
5073 static void test_OnFrameWindowActivate(IUnknown
*unk
)
5075 IOleInPlaceActiveObject
*inplaceact
;
5078 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
5079 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
5083 if(set_clientsite
) {
5084 expect_OnFrameWindowActivate_fActivate
= TRUE
;
5085 SET_EXPECT(OnFrameWindowActivate
);
5086 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
5087 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5088 CHECK_CALLED(OnFrameWindowActivate
);
5090 SET_EXPECT(OnFrameWindowActivate
);
5091 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
5092 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5093 CHECK_CALLED(OnFrameWindowActivate
);
5095 expect_OnFrameWindowActivate_fActivate
= FALSE
;
5096 SET_EXPECT(OnFrameWindowActivate
);
5097 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
5098 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5099 CHECK_CALLED(OnFrameWindowActivate
);
5101 expect_OnFrameWindowActivate_fActivate
= TRUE
;
5102 SET_EXPECT(OnFrameWindowActivate
);
5103 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
5104 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5105 CHECK_CALLED(OnFrameWindowActivate
);
5107 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
5108 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5110 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
5111 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
5114 IOleInPlaceActiveObject_Release(inplaceact
);
5117 static void test_InPlaceDeactivate(IHTMLDocument2
*doc
, BOOL expect_call
)
5119 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
5122 hres
= IUnknown_QueryInterface(doc
, &IID_IOleInPlaceObjectWindowless
,
5123 (void**)&windowlessobj
);
5124 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
5129 SET_EXPECT(OnFocus_FALSE
);
5131 SET_EXPECT(OnInPlaceDeactivateEx
);
5133 SET_EXPECT(OnInPlaceDeactivate
);
5135 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
5136 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
5138 CHECK_CALLED(OnFocus_FALSE
);
5140 CHECK_CALLED(OnInPlaceDeactivateEx
);
5142 CHECK_CALLED(OnInPlaceDeactivate
);
5145 IOleInPlaceObjectWindowless_Release(windowlessobj
);
5148 static void test_Activate(IHTMLDocument2
*doc
, DWORD flags
)
5150 IOleObject
*oleobj
= NULL
;
5151 IOleDocumentView
*docview
;
5158 IOleDocumentView_Release(view
);
5161 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5162 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
5164 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
5165 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
5167 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
5168 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
5169 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
5171 test_OnFrameWindowActivate((IUnknown
*)doc
);
5173 test_ClientSite(oleobj
, flags
);
5174 test_InPlaceDeactivate(doc
, FALSE
);
5175 test_DoVerb(oleobj
);
5177 if(call_UIActivate
== CallUIActivate_AfterShow
) {
5178 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
5179 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
5181 SET_EXPECT(OnFocus_TRUE
);
5182 SET_EXPECT(SetActiveObject
);
5184 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5185 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
5186 expect_status_text
= NULL
;
5188 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
5189 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
5191 CHECK_CALLED(OnFocus_TRUE
);
5192 CHECK_CALLED(SetActiveObject
);
5193 CHECK_CALLED(ShowUI
);
5194 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5195 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
5197 IOleDocumentView_Release(docview
);
5200 IOleObject_Release(oleobj
);
5202 test_OnFrameWindowActivate((IUnknown
*)doc
);
5205 static void test_Window(IHTMLDocument2
*doc
, BOOL expect_success
)
5207 IOleInPlaceActiveObject
*activeobject
= NULL
;
5211 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
5212 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
5216 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
5218 if(expect_success
) {
5219 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
5220 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
5222 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
5223 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
5226 IOleInPlaceActiveObject_Release(activeobject
);
5229 static void test_CloseView(void)
5231 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
5237 hres
= IOleDocumentView_Show(view
, FALSE
);
5238 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
5240 hres
= IOleDocumentView_CloseView(view
, 0);
5241 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
5243 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
5244 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
5246 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
5247 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
5248 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
5251 static void test_UIDeactivate(void)
5255 if(call_UIActivate
== CallUIActivate_AfterShow
) {
5256 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5258 if(call_UIActivate
!= CallUIActivate_None
) {
5259 SET_EXPECT(SetActiveObject_null
);
5261 SET_EXPECT(OnUIDeactivate
);
5264 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
5265 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
5267 if(call_UIActivate
!= CallUIActivate_None
) {
5268 CHECK_CALLED(SetActiveObject_null
);
5269 CHECK_CALLED(HideUI
);
5270 CHECK_CALLED(OnUIDeactivate
);
5272 if(call_UIActivate
== CallUIActivate_AfterShow
) {
5273 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5277 static void test_Hide(void)
5284 hres
= IOleDocumentView_Show(view
, FALSE
);
5285 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
5288 static IHTMLDocument2
*create_document(void)
5290 IHTMLDocument2
*doc
;
5293 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
5294 &IID_IHTMLDocument2
, (void**)&doc
);
5295 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
5302 static void release_document(IHTMLDocument2
*doc
)
5308 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
5309 * To workaround it, we release it via IUnknown iface */
5310 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IUnknown
, (void**)&unk
);
5311 ok(hres
== S_OK
, "Could not get IUnknown iface: %08x\n", hres
);
5313 IHTMLDocument2_Release(doc
);
5314 ref
= IUnknown_Release(unk
);
5315 ok(!ref
, "ref = %d\n", ref
);
5318 static void test_Navigate(IHTMLDocument2
*doc
)
5320 IHlinkTarget
*hlink
;
5323 hres
= IUnknown_QueryInterface(doc
, &IID_IHlinkTarget
, (void**)&hlink
);
5324 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
5326 SET_EXPECT(ActivateMe
);
5327 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
5328 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
5329 CHECK_CALLED(ActivateMe
);
5331 IHlinkTarget_Release(hlink
);
5334 static void test_external(IHTMLDocument2
*doc
, BOOL initialized
)
5336 IDispatch
*external
;
5337 IHTMLWindow2
*htmlwin
;
5340 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
5341 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
5344 SET_EXPECT(GetExternal
);
5345 external
= (void*)0xdeadbeef;
5346 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
5348 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
5349 CHECK_CALLED(GetExternal
);
5350 ok(external
!= NULL
, "external == NULL\n");
5352 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
5353 ok(external
== NULL
, "external != NULL\n");
5356 IHTMLWindow2_Release(htmlwin
);
5359 static void test_StreamLoad(IHTMLDocument2
*doc
)
5361 IPersistStreamInit
*init
;
5364 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
5365 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
5369 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5370 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5371 SET_EXPECT(Exec_ShellDocView_37
);
5372 SET_EXPECT(OnChanged_READYSTATE
);
5373 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5375 SET_EXPECT(GetPendingUrl
);
5376 readystate_set_loading
= TRUE
;
5378 hres
= IPersistStreamInit_Load(init
, &Stream
);
5379 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
5381 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5382 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5383 CHECK_CALLED(Exec_ShellDocView_37
);
5384 CHECK_CALLED(OnChanged_READYSTATE
);
5385 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5387 todo_wine
CHECK_CALLED(GetPendingUrl
);
5389 test_timer(EXPECT_SETTITLE
);
5390 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank");
5392 IPersistStreamInit_Release(init
);
5395 static void test_StreamInitNew(IHTMLDocument2
*doc
)
5397 IPersistStreamInit
*init
;
5400 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
5401 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
5405 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5406 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5407 SET_EXPECT(Exec_ShellDocView_37
);
5408 SET_EXPECT(OnChanged_READYSTATE
);
5409 SET_EXPECT(Invoke_OnReadyStateChange_Loading
);
5410 SET_EXPECT(GetPendingUrl
);
5411 readystate_set_loading
= TRUE
;
5413 hres
= IPersistStreamInit_InitNew(init
);
5414 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
5416 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5417 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5418 CHECK_CALLED(Exec_ShellDocView_37
);
5419 CHECK_CALLED(OnChanged_READYSTATE
);
5420 CHECK_CALLED(Invoke_OnReadyStateChange_Loading
);
5421 todo_wine
CHECK_CALLED(GetPendingUrl
);
5423 test_timer(EXPECT_SETTITLE
);
5424 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:blank");
5426 IPersistStreamInit_Release(init
);
5429 static void test_QueryInterface(IHTMLDocument2
*doc
)
5434 static const IID IID_UndocumentedScriptIface
=
5435 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
5437 qi
= (void*)0xdeadbeef;
5438 hres
= IUnknown_QueryInterface(doc
, &IID_IRunnableObject
, (void**)&qi
);
5439 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5440 ok(qi
== NULL
, "qirunnable=%p, expected NULL\n", qi
);
5442 qi
= (void*)0xdeadbeef;
5443 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&qi
);
5444 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5445 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5447 qi
= (void*)0xdeadbeef;
5448 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode2
, (void**)&qi
);
5449 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5450 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5452 qi
= (void*)0xdeadbeef;
5453 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistPropertyBag
, (void**)&qi
);
5454 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5455 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5457 qi
= (void*)0xdeadbeef;
5458 hres
= IUnknown_QueryInterface(doc
, &IID_UndocumentedScriptIface
, (void**)&qi
);
5459 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5460 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5462 qi
= (void*)0xdeadbeef;
5463 hres
= IUnknown_QueryInterface(doc
, &IID_IMarshal
, (void**)&qi
);
5464 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5465 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5467 qi
= (void*)0xdeadbeef;
5468 hres
= IUnknown_QueryInterface(doc
, &IID_IExternalConnection
, (void**)&qi
);
5469 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5470 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5472 qi
= (void*)0xdeadbeef;
5473 hres
= IUnknown_QueryInterface(doc
, &IID_IStdMarshalInfo
, (void**)&qi
);
5474 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
5475 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
5477 hres
= IUnknown_QueryInterface(doc
, &IID_IDispatch
, (void**)&qi
);
5478 ok(hres
== S_OK
, "Could not get IDispatch interface: %08x\n", hres
);
5479 ok(qi
!= (IUnknown
*)doc
, "disp == doc\n");
5480 IUnknown_Release(qi
);
5483 static void init_test(enum load_state_t ls
) {
5485 hwnd
= last_hwnd
= NULL
;
5486 set_clientsite
= FALSE
;
5487 load_from_stream
= FALSE
;
5488 call_UIActivate
= CallUIActivate_None
;
5495 inplace_deactivated
= FALSE
;
5497 expect_uihandler_iface
= &DocHostUIHandler
;
5500 static void test_HTMLDocument(BOOL do_load
)
5502 IHTMLDocument2
*doc
;
5504 trace("Testing HTMLDocument (%s)...\n", (do_load
? "load" : "no load"));
5506 init_test(do_load
? LD_DOLOAD
: LD_NO
);
5508 doc
= create_document();
5509 doc_unk
= (IUnknown
*)doc
;
5511 test_QueryInterface(doc
);
5513 test_IsDirty(doc
, S_FALSE
);
5514 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5515 test_external(doc
, FALSE
);
5516 test_ViewAdviseSink(doc
);
5517 test_ConnectionPointContainer(doc
);
5518 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
5519 test_Persist(doc
, &Moniker
);
5521 test_OnAmbientPropertyChange2(doc
);
5523 test_Activate(doc
, CLIENTSITE_EXPECTPATH
);
5526 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
5527 test_download(DWL_CSS
|DWL_TRYCSS
);
5528 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
5531 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5532 test_OleCommandTarget_fail(doc
);
5533 test_OleCommandTarget(doc
);
5534 test_OnAmbientPropertyChange(doc
);
5535 test_Window(doc
, TRUE
);
5536 test_external(doc
, TRUE
);
5538 test_UIDeactivate();
5539 test_OleCommandTarget(doc
);
5540 test_Window(doc
, TRUE
);
5541 test_InPlaceDeactivate(doc
, TRUE
);
5543 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
5544 * MSHTML. It doesn't with Wine. */
5546 test_Window(doc
, FALSE
);
5548 test_InPlaceDeactivate(doc
, FALSE
);
5550 test_Close(doc
, FALSE
);
5552 /* Activate HTMLDocument again */
5553 test_Activate(doc
, CLIENTSITE_SETNULL
);
5554 test_Window(doc
, TRUE
);
5555 test_OleCommandTarget(doc
);
5556 test_UIDeactivate();
5557 test_InPlaceDeactivate(doc
, TRUE
);
5558 test_Close(doc
, FALSE
);
5560 /* Activate HTMLDocument again, this time without UIActivate */
5561 call_UIActivate
= CallUIActivate_None
;
5562 test_Activate(doc
, CLIENTSITE_SETNULL
);
5563 test_Window(doc
, TRUE
);
5565 test_external(doc
, TRUE
);
5566 set_custom_uihandler(doc
, NULL
);
5567 test_external(doc
, FALSE
);
5569 test_UIDeactivate();
5570 test_InPlaceDeactivate(doc
, TRUE
);
5573 test_Close(doc
, TRUE
);
5574 test_OnAmbientPropertyChange2(doc
);
5575 test_GetCurMoniker((IUnknown
*)doc
, do_load
? &Moniker
: NULL
, NULL
);
5578 /* Activate HTMLDocument again, calling UIActivate after showing the window */
5579 call_UIActivate
= CallUIActivate_AfterShow
;
5580 test_Activate(doc
, 0);
5581 test_Window(doc
, TRUE
);
5582 test_OleCommandTarget(doc
);
5583 test_UIDeactivate();
5584 test_InPlaceDeactivate(doc
, TRUE
);
5585 test_Close(doc
, FALSE
);
5586 call_UIActivate
= CallUIActivate_None
;
5590 IOleDocumentView_Release(view
);
5593 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
5594 release_document(doc
);
5595 ok(!IsWindow(hwnd
), "hwnd is not destroyed\n");
5598 static void test_HTMLDocument_hlink(DWORD status
)
5600 IHTMLDocument2
*doc
;
5602 trace("Testing HTMLDocument (hlink)...\n");
5604 init_test(LD_DOLOAD
);
5607 doc
= create_document();
5608 doc_unk
= (IUnknown
*)doc
;
5610 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
5611 test_ViewAdviseSink(doc
);
5612 test_ConnectionPointContainer(doc
);
5613 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
5614 test_Persist(doc
, &Moniker
);
5617 status_code
= status
;
5618 test_download(DWL_CSS
|DWL_TRYCSS
);
5619 status_code
= HTTP_STATUS_OK
;
5621 test_IsDirty(doc
, S_FALSE
);
5622 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5624 test_exec_onunload(doc
);
5625 test_Window(doc
, TRUE
);
5626 test_InPlaceDeactivate(doc
, TRUE
);
5627 test_Close(doc
, FALSE
);
5628 test_IsDirty(doc
, S_FALSE
);
5629 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
5631 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
5634 IOleDocumentView_Release(view
);
5637 release_document(doc
);
5640 static void test_cookies(IHTMLDocument2
*doc
)
5648 hres
= IHTMLDocument2_get_cookie(doc
, &str
);
5649 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
5651 size
= sizeof(buf
)/sizeof(WCHAR
);
5652 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
5653 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
5654 ok(!lstrcmpW(buf
, str
), "cookie = %s, expected %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(buf
));
5658 str
= a2bstr("test=testval");
5659 hres
= IHTMLDocument2_put_cookie(doc
, str
);
5660 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
5663 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
5664 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
5665 ok(str2
!= NULL
, "cookie = NULL\n");
5666 size
= sizeof(buf
)/sizeof(WCHAR
);
5667 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
5668 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
5669 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
5670 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
5672 SysFreeString(str2
);
5674 str
= a2bstr("test=testval2");
5675 hres
= IHTMLDocument2_put_cookie(doc
, str
);
5676 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
5679 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
5680 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
5681 ok(str2
!= NULL
, "cookie = NULL\n");
5682 size
= sizeof(buf
)/sizeof(WCHAR
);
5683 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
5684 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
5685 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
5686 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
5688 SysFreeString(str2
);
5691 static void test_HTMLDocument_http(void)
5694 IHTMLDocument2
*doc
;
5698 trace("Testing HTMLDocument (http)...\n");
5700 if(!winetest_interactive
&& is_ie_hardened()) {
5701 win_skip("IE running in Enhanced Security Configuration\n");
5705 init_test(LD_DOLOAD
);
5708 doc
= create_document();
5709 doc_unk
= (IUnknown
*)doc
;
5711 hres
= CreateURLMoniker(NULL
, http_urlW
, &http_mon
);
5712 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
5714 test_ViewAdviseSink(doc
);
5715 test_ConnectionPointContainer(doc
);
5716 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
5717 test_Persist(doc
, http_mon
);
5719 test_download(DWL_HTTP
);
5721 test_IsDirty(doc
, S_FALSE
);
5722 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5723 test_GetCurMoniker((IUnknown
*)doc
, http_mon
, NULL
);
5725 nav_url
= "http://www.winehq.org/"; /* for valid prev nav_url */
5726 test_put_href(doc
, FALSE
, "javascript:external&&undefined", TRUE
);
5728 test_put_href(doc
, FALSE
, "about:blank", FALSE
);
5729 test_put_href(doc
, TRUE
, "about:replace", FALSE
);
5731 test_open_window(doc
);
5733 test_InPlaceDeactivate(doc
, TRUE
);
5734 test_Close(doc
, FALSE
);
5735 test_IsDirty(doc
, S_FALSE
);
5736 test_GetCurMoniker((IUnknown
*)doc
, NULL
, "about:replace");
5739 IOleDocumentView_Release(view
);
5742 release_document(doc
);
5744 ref
= IMoniker_Release(http_mon
);
5745 ok(!ref
, "ref=%d, expected 0\n", ref
);
5748 static void test_QueryService(IHTMLDocument2
*doc
, BOOL success
)
5750 IHTMLWindow2
*window
, *sp_window
;
5751 IServiceProvider
*sp
;
5755 hres
= IUnknown_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&sp
);
5756 ok(hres
== S_OK
, "QueryService returned %08x\n", hres
);
5758 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
5760 ok(hres
== E_NOINTERFACE
, "QueryService returned %08x, expected E_NOINTERFACE\n", hres
);
5761 IServiceProvider_Release(sp
);
5765 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
5766 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
5767 IHlinkFrame_Release(hf
);
5769 IServiceProvider_Release(sp
);
5771 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
5772 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
5774 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IServiceProvider
, (void**)&sp
);
5775 ok(hres
== S_OK
, "Could not get IServiceProvider iface: %08x\n", hres
);
5777 hres
= IServiceProvider_QueryService(sp
, &IID_IHTMLWindow2
, &IID_IHTMLWindow2
, (void**)&sp_window
);
5778 ok(hres
== S_OK
, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres
);
5779 /* FIXME: test returned window */
5780 IHTMLWindow2_Release(sp_window
);
5782 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
5783 ok(hres
== S_OK
, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres
);
5784 ok(hf
== &HlinkFrame
, "hf != HlinkFrame\n");
5785 IHlinkFrame_Release(hf
);
5787 IServiceProvider_Release(sp
);
5788 IHTMLWindow2_Release(window
);
5791 static void test_HTMLDocument_StreamLoad(void)
5793 IHTMLDocument2
*doc
;
5798 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
5800 init_test(LD_DOLOAD
);
5801 load_from_stream
= TRUE
;
5803 doc
= create_document();
5804 doc_unk
= (IUnknown
*)doc
;
5806 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5807 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
5809 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
5810 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5812 test_readyState((IUnknown
*)doc
);
5813 test_IsDirty(doc
, S_FALSE
);
5814 test_ViewAdviseSink(doc
);
5815 test_ConnectionPointContainer(doc
);
5816 test_QueryService(doc
, FALSE
);
5817 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
5818 test_QueryService(doc
, TRUE
);
5819 test_DoVerb(oleobj
);
5820 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5822 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
5823 test_StreamLoad(doc
);
5824 test_download(DWL_VERBDONE
|DWL_TRYCSS
);
5825 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5827 test_UIDeactivate();
5828 test_InPlaceDeactivate(doc
, TRUE
);
5829 SET_EXPECT(Advise_Close
);
5830 test_Close(doc
, TRUE
);
5831 CHECK_CALLED(Advise_Close
);
5832 test_external(doc
, FALSE
);
5833 test_IsDirty(doc
, S_FALSE
);
5835 set_custom_uihandler(doc
, &CustomDocHostUIHandler
);
5836 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
);
5837 test_external(doc
, TRUE
);
5838 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
5839 test_external(doc
, TRUE
);
5840 set_custom_uihandler(doc
, NULL
);
5841 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
5843 IOleObject_Release(oleobj
);
5845 IOleDocumentView_Release(view
);
5849 release_document(doc
);
5852 static void test_HTMLDocument_StreamInitNew(void)
5854 IHTMLDocument2
*doc
;
5859 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
5861 init_test(LD_DOLOAD
);
5862 load_from_stream
= TRUE
;
5864 doc
= create_document();
5865 doc_unk
= (IUnknown
*)doc
;
5867 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5868 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
5870 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
5871 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5873 test_readyState((IUnknown
*)doc
);
5874 test_IsDirty(doc
, S_FALSE
);
5875 test_ViewAdviseSink(doc
);
5876 test_ConnectionPointContainer(doc
);
5877 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
5878 test_DoVerb(oleobj
);
5879 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5881 IOleObject_Release(oleobj
);
5883 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
5884 test_StreamInitNew(doc
);
5886 SET_EXPECT(Invoke_OnReadyStateChange_Interactive
);
5887 test_download(DWL_VERBDONE
|DWL_TRYCSS
|DWL_EMPTY
);
5888 todo_wine
CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive
);
5890 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5892 test_UIDeactivate();
5893 test_InPlaceDeactivate(doc
, TRUE
);
5894 SET_EXPECT(Advise_Close
);
5895 test_Close(doc
, FALSE
);
5896 CHECK_CALLED(Advise_Close
);
5897 test_IsDirty(doc
, S_FALSE
);
5900 IOleDocumentView_Release(view
);
5904 release_document(doc
);
5907 static void test_edit_uiactivate(IOleObject
*oleobj
)
5909 IOleDocumentView
*docview
;
5912 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
5913 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
5915 SET_EXPECT(OnFocus_TRUE
);
5916 SET_EXPECT(SetActiveObject
);
5918 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5919 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
5920 expect_status_text
= NULL
;
5922 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
5923 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
5925 CHECK_CALLED(OnFocus_TRUE
);
5926 CHECK_CALLED(SetActiveObject
);
5927 CHECK_CALLED(ShowUI
);
5928 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5929 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
5931 IOleDocumentView_Release(docview
);
5934 static void test_editing_mode(BOOL do_load
)
5936 IHTMLDocument2
*doc
;
5942 trace("Testing HTMLDocument (edit%s)...\n", do_load
? " load" : "");
5944 init_test(do_load
? LD_DOLOAD
: LD_NO
);
5945 call_UIActivate
= CallUIActivate_AfterShow
;
5947 doc
= create_document();
5948 unk
= doc_unk
= (IUnknown
*)doc
;
5950 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5951 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
5953 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
5954 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
5956 test_readyState((IUnknown
*)doc
);
5957 test_ViewAdviseSink(doc
);
5958 test_ConnectionPointContainer(doc
);
5959 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
5960 test_DoVerb(oleobj
);
5961 test_edit_uiactivate(oleobj
);
5963 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5965 test_Persist(doc
, &Moniker
);
5966 stream_read
= protocol_read
= 0;
5967 test_exec_editmode(unk
, do_load
);
5968 test_UIDeactivate();
5969 call_UIActivate
= CallUIActivate_None
;
5970 IOleObject_Release(oleobj
);
5972 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5973 test_download(DWL_VERBDONE
| (do_load
? DWL_CSS
|DWL_TRYCSS
: 0));
5975 SET_EXPECT(SetStatusText
); /* ignore race in native mshtml */
5976 test_timer(EXPECT_UPDATEUI
);
5977 SET_CALLED(SetStatusText
);
5979 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5982 test_exec_fontname(unk
, NULL
, wszTimesNewRoman
);
5983 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
5984 test_timer(EXPECT_UPDATEUI
);
5985 test_exec_fontname(unk
, NULL
, wszArial
);
5987 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
5988 test_timer(EXPECT_UPDATEUI
);
5989 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5990 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5992 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
5993 test_timer(EXPECT_UPDATEUI
);
5994 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5995 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5996 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
5997 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5999 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
6000 test_timer(EXPECT_UPDATEUI
);
6001 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
6002 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
6005 test_UIDeactivate();
6006 test_InPlaceDeactivate(doc
, TRUE
);
6007 SET_EXPECT(Advise_Close
);
6008 test_Close(doc
, FALSE
);
6009 CHECK_CALLED(Advise_Close
);
6012 IOleDocumentView_Release(view
);
6016 release_document(doc
);
6019 static void test_UIActivate(BOOL do_load
, BOOL use_ipsex
, BOOL use_ipsw
)
6021 IHTMLDocument2
*doc
;
6023 IOleInPlaceSite
*inplacesite
;
6026 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load
, use_ipsex
, use_ipsw
);
6028 init_test(do_load
? LD_DOLOAD
: LD_NO
);
6030 doc
= create_document();
6031 doc_unk
= (IUnknown
*)doc
;
6036 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
6037 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
6039 hres
= IUnknown_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&view
);
6040 ok(hres
== S_OK
, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres
);
6042 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
6043 SET_EXPECT(GetHostInfo
);
6044 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
6045 SET_EXPECT(Invoke_AMBIENT_SILENT
);
6046 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6047 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
6048 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
6049 SET_EXPECT(GetOptionKeyPath
);
6050 SET_EXPECT(GetOverrideKeyPath
);
6051 SET_EXPECT(GetWindow
);
6052 SET_EXPECT(Exec_DOCCANNAVIGATE
);
6053 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
6054 SET_EXPECT(Exec_SETPROGRESSMAX
);
6055 SET_EXPECT(Exec_SETPROGRESSPOS
);
6056 SET_EXPECT(GetTravelLog
);
6058 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
6059 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
6060 set_clientsite
= TRUE
;
6062 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
6063 CHECK_CALLED(GetHostInfo
);
6064 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
6065 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
6066 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
6067 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
6068 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
6069 CHECK_CALLED(GetOptionKeyPath
);
6070 CHECK_CALLED(GetOverrideKeyPath
);
6071 CHECK_CALLED(GetWindow
);
6072 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
6073 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
6074 CHECK_CALLED(Exec_SETPROGRESSMAX
);
6075 CHECK_CALLED(Exec_SETPROGRESSPOS
);
6076 todo_wine
CHECK_CALLED(GetTravelLog
);
6078 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
6079 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
6080 ok(inplacesite
== NULL
, "inplacesite = %p, expected NULL\n", inplacesite
);
6082 SET_EXPECT(GetContainer
);
6083 SET_EXPECT(LockContainer
);
6084 SET_EXPECT(CanInPlaceActivate
);
6085 SET_EXPECT(GetWindowContext
);
6086 SET_EXPECT(GetWindow
);
6088 SET_EXPECT(OnInPlaceActivateEx
);
6089 SET_EXPECT(RequestUIActivate
);
6092 SET_EXPECT(OnInPlaceActivate
);
6093 SET_EXPECT(OnUIActivate
);
6094 SET_EXPECT(SetStatusText
);
6095 SET_EXPECT(Exec_SETPROGRESSMAX
);
6096 SET_EXPECT(Exec_SETPROGRESSPOS
);
6098 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
6099 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
6100 SET_EXPECT(OnFocus_TRUE
);
6101 SET_EXPECT(SetActiveObject
);
6102 expect_LockContainer_fLock
= TRUE
;
6104 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
6105 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
6107 CHECK_CALLED(GetContainer
);
6108 CHECK_CALLED(LockContainer
);
6109 CHECK_CALLED(CanInPlaceActivate
);
6110 CHECK_CALLED(GetWindowContext
);
6111 CHECK_CALLED(GetWindow
);
6113 CHECK_CALLED(OnInPlaceActivateEx
);
6114 SET_EXPECT(RequestUIActivate
);
6117 CHECK_CALLED(OnInPlaceActivate
);
6118 CHECK_CALLED(OnUIActivate
);
6119 CHECK_CALLED(SetStatusText
);
6120 CHECK_CALLED(Exec_SETPROGRESSMAX
);
6121 CHECK_CALLED(Exec_SETPROGRESSPOS
);
6122 CHECK_CALLED(ShowUI
);
6123 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
6124 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
6125 CHECK_CALLED(OnFocus_TRUE
);
6126 CHECK_CALLED(SetActiveObject
);
6127 container_locked
= TRUE
;
6129 SET_EXPECT(SetActiveObject_null
);
6130 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
6132 SET_EXPECT(OnUIDeactivate
);
6134 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
6135 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
6137 CHECK_CALLED(SetActiveObject_null
);
6138 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
6139 CHECK_CALLED(HideUI
);
6140 CHECK_CALLED(OnUIDeactivate
);
6142 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
6143 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
6144 ok(inplacesite
!= NULL
, "inplacesite = NULL\n");
6145 IOleInPlaceSite_Release(inplacesite
);
6147 SET_EXPECT(OnFocus_FALSE
);
6149 SET_EXPECT(OnInPlaceDeactivateEx
);
6151 SET_EXPECT(OnInPlaceDeactivate
);
6155 CHECK_CALLED(OnFocus_FALSE
);
6157 CHECK_CALLED(OnInPlaceDeactivateEx
);
6159 CHECK_CALLED(OnInPlaceDeactivate
);
6161 test_Close(doc
, TRUE
);
6163 IOleObject_Release(oleobj
);
6164 IOleDocumentView_Release(view
);
6167 release_document(doc
);
6170 static void register_protocol(void)
6172 IInternetSession
*session
;
6175 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
6177 hres
= CoInternetGetSession(0, &session
, 0);
6178 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
6180 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
6181 wsz_winetest
, 0, NULL
, 0);
6182 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
6184 IInternetSession_Release(session
);
6187 static void test_HTMLDoc_ISupportErrorInfo(void)
6189 IHTMLDocument2
*doc
;
6191 ISupportErrorInfo
*sinfo
;
6193 doc
= create_document();
6195 hres
= IUnknown_QueryInterface(doc
, &IID_ISupportErrorInfo
, (void**)&sinfo
);
6196 ok(hres
== S_OK
, "got %x\n", hres
);
6197 ok(sinfo
!= NULL
, "got %p\n", sinfo
);
6200 hres
= ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo
, &IID_IErrorInfo
);
6201 ok(hres
== S_FALSE
, "Expected S_OK, got %x\n", hres
);
6202 IUnknown_Release(sinfo
);
6205 release_document(doc
);
6208 static void test_IPersistHistory(void)
6210 IHTMLDocument2
*doc
;
6212 IPersistHistory
*phist
;
6214 doc
= create_document();
6216 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistHistory
, (void**)&phist
);
6217 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
6219 IPersistHistory_Release(phist
);
6221 release_document(doc
);
6224 static BOOL
check_ie(void)
6226 IHTMLDocument2
*doc
;
6227 IHTMLDocument5
*doc5
;
6230 doc
= create_document();
6234 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
6236 IHTMLDocument5_Release(doc5
);
6238 release_document(doc
);
6239 return SUCCEEDED(hres
);
6248 win_skip("Too old IE\n");
6252 container_hwnd
= create_container_window();
6253 register_protocol();
6255 asynchronous_binding
= TRUE
;
6256 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND
);
6258 asynchronous_binding
= FALSE
;
6259 test_HTMLDocument_hlink(HTTP_STATUS_OK
);
6260 test_HTMLDocument(FALSE
);
6261 test_HTMLDocument(TRUE
);
6262 test_HTMLDocument_StreamLoad();
6263 test_HTMLDocument_StreamInitNew();
6264 test_editing_mode(FALSE
);
6265 test_editing_mode(TRUE
);
6266 test_HTMLDocument_http();
6267 test_UIActivate(FALSE
, FALSE
, FALSE
);
6268 test_UIActivate(FALSE
, TRUE
, FALSE
);
6269 test_UIActivate(FALSE
, TRUE
, TRUE
);
6270 test_UIActivate(TRUE
, FALSE
, FALSE
);
6271 test_UIActivate(TRUE
, TRUE
, FALSE
);
6272 test_UIActivate(TRUE
, TRUE
, TRUE
);
6273 test_HTMLDoc_ISupportErrorInfo();
6274 test_IPersistHistory();
6276 DestroyWindow(container_hwnd
);