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>
42 #include "mshtml_test.h"
44 DEFINE_GUID(GUID_NULL
,0,0,0,0,0,0,0,0,0,0,0);
45 DEFINE_GUID(IID_IProxyManager
,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
46 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
48 #define DEFINE_EXPECT(func) \
49 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
51 #define SET_EXPECT(func) \
52 expect_ ## func = TRUE
54 #define SET_CALLED(func) \
55 called_ ## func = TRUE
57 #define CHECK_EXPECT2(func) \
59 ok(expect_ ##func, "unexpected call " #func "\n"); \
60 called_ ## func = TRUE; \
63 #define CHECK_EXPECT(func) \
65 CHECK_EXPECT2(func); \
66 expect_ ## func = FALSE; \
69 #define CHECK_CALLED(func) \
71 ok(called_ ## func, "expected " #func "\n"); \
72 expect_ ## func = called_ ## func = FALSE; \
75 static IOleDocumentView
*view
= NULL
;
76 static HWND container_hwnd
= NULL
, hwnd
= NULL
, last_hwnd
= NULL
;
78 DEFINE_EXPECT(LockContainer
);
79 DEFINE_EXPECT(SetActiveObject
);
80 DEFINE_EXPECT(SetActiveObject_null
);
81 DEFINE_EXPECT(GetWindow
);
82 DEFINE_EXPECT(CanInPlaceActivate
);
83 DEFINE_EXPECT(OnInPlaceActivate
);
84 DEFINE_EXPECT(OnInPlaceActivateEx
);
85 DEFINE_EXPECT(OnUIActivate
);
86 DEFINE_EXPECT(GetWindowContext
);
87 DEFINE_EXPECT(OnUIDeactivate
);
88 DEFINE_EXPECT(OnInPlaceDeactivate
);
89 DEFINE_EXPECT(OnInPlaceDeactivateEx
);
90 DEFINE_EXPECT(GetContainer
);
91 DEFINE_EXPECT(ShowUI
);
92 DEFINE_EXPECT(ActivateMe
);
93 DEFINE_EXPECT(GetHostInfo
);
94 DEFINE_EXPECT(HideUI
);
95 DEFINE_EXPECT(GetOptionKeyPath
);
96 DEFINE_EXPECT(GetOverrideKeyPath
);
97 DEFINE_EXPECT(SetStatusText
);
98 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
99 DEFINE_EXPECT(QueryStatus_OPEN
);
100 DEFINE_EXPECT(QueryStatus_NEW
);
101 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
102 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
103 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE
);
104 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
105 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
106 DEFINE_EXPECT(Exec_ShellDocView_37
);
107 DEFINE_EXPECT(Exec_ShellDocView_63
);
108 DEFINE_EXPECT(Exec_ShellDocView_67
);
109 DEFINE_EXPECT(Exec_ShellDocView_84
);
110 DEFINE_EXPECT(Exec_ShellDocView_103
);
111 DEFINE_EXPECT(Exec_ShellDocView_105
);
112 DEFINE_EXPECT(Exec_ShellDocView_140
);
113 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
114 DEFINE_EXPECT(Exec_SETTITLE
);
115 DEFINE_EXPECT(Exec_HTTPEQUIV
);
116 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
117 DEFINE_EXPECT(Exec_Explorer_69
);
118 DEFINE_EXPECT(Exec_DOCCANNAVIGATE
);
119 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
120 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
121 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
122 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
123 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
124 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
125 DEFINE_EXPECT(GetDropTarget
);
126 DEFINE_EXPECT(UpdateUI
);
127 DEFINE_EXPECT(Navigate
);
128 DEFINE_EXPECT(OnFrameWindowActivate
);
129 DEFINE_EXPECT(OnChanged_READYSTATE
);
130 DEFINE_EXPECT(OnChanged_1005
);
131 DEFINE_EXPECT(OnChanged_1012
);
132 DEFINE_EXPECT(GetDisplayName
);
133 DEFINE_EXPECT(BindToStorage
);
134 DEFINE_EXPECT(IsSystemMoniker
);
135 DEFINE_EXPECT(GetBindResult
);
136 DEFINE_EXPECT(GetClassID
);
137 DEFINE_EXPECT(Abort
);
139 DEFINE_EXPECT(CreateInstance
);
140 DEFINE_EXPECT(Start
);
141 DEFINE_EXPECT(Terminate
);
142 DEFINE_EXPECT(Protocol_Read
);
143 DEFINE_EXPECT(LockRequest
);
144 DEFINE_EXPECT(UnlockRequest
);
145 DEFINE_EXPECT(OnFocus_TRUE
);
146 DEFINE_EXPECT(OnFocus_FALSE
);
147 DEFINE_EXPECT(RequestUIActivate
);
148 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace
);
149 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject
);
150 DEFINE_EXPECT(GetExternal
);
151 DEFINE_EXPECT(EnableModeless_TRUE
);
152 DEFINE_EXPECT(EnableModeless_FALSE
);
153 DEFINE_EXPECT(Frame_EnableModeless_TRUE
);
154 DEFINE_EXPECT(Frame_EnableModeless_FALSE
);
155 DEFINE_EXPECT(Frame_GetWindow
);
156 DEFINE_EXPECT(TranslateUrl
);
157 DEFINE_EXPECT(Advise_Close
);
158 DEFINE_EXPECT(OnViewChange
);
159 DEFINE_EXPECT(EvaluateNewWindow
);
161 static IUnknown
*doc_unk
;
162 static IMoniker
*doc_mon
;
163 static BOOL expect_LockContainer_fLock
;
164 static BOOL expect_InPlaceUIWindow_SetActiveObject_active
= TRUE
;
165 static BOOL ipsex
, ipsw
;
166 static BOOL set_clientsite
, container_locked
, navigated_load
;
167 static BOOL readystate_set_loading
= FALSE
, readystate_set_interactive
= FALSE
, load_from_stream
;
168 static BOOL editmode
= FALSE
, show_failed
;
169 static BOOL inplace_deactivated
, open_call
;
170 static int stream_read
, protocol_read
;
171 static enum load_state_t
{
180 static LPCOLESTR expect_status_text
= NULL
;
182 static const char html_page
[] =
184 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
188 static const char css_data
[] = "body {color: red}";
190 static const WCHAR http_urlW
[] =
191 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
193 static const WCHAR doc_url
[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
194 static const WCHAR about_blank_url
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
196 #define DOCHOST_DOCCANNAVIGATE 0
198 static HRESULT
QueryInterface(REFIID riid
, void **ppv
);
199 static void test_MSHTML_QueryStatus(IHTMLDocument2
*,DWORD
);
201 #define test_readyState(u) _test_readyState(__LINE__,u)
202 static void _test_readyState(unsigned,IUnknown
*);
204 static const WCHAR wszTimesNewRoman
[] =
205 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
206 static const WCHAR wszArial
[] =
207 {'A','r','i','a','l',0};
209 static const char *debugstr_guid(REFIID riid
)
216 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
217 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
218 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
219 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
224 static int strcmp_wa(LPCWSTR strw
, const char *stra
)
227 WideCharToMultiByte(CP_ACP
, 0, strw
, -1, buf
, sizeof(buf
), NULL
, NULL
);
228 return lstrcmpA(stra
, buf
);
231 static const WCHAR
*strstrW( const WCHAR
*str
, const WCHAR
*sub
)
235 const WCHAR
*p1
= str
, *p2
= sub
;
236 while (*p1
&& *p2
&& *p1
== *p2
) { p1
++; p2
++; }
237 if (!*p2
) return str
;
243 static BSTR
a2bstr(const char *str
)
248 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
249 ret
= SysAllocStringLen(NULL
, len
);
250 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
255 static BOOL
is_english(void)
257 return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
258 && PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
261 #define EXPECT_UPDATEUI 1
262 #define EXPECT_SETTITLE 2
264 static void test_timer(DWORD flags
)
266 BOOL
*b
= &called_Exec_SETTITLE
;
269 if(flags
& EXPECT_UPDATEUI
) {
270 SET_EXPECT(UpdateUI
);
271 SET_EXPECT(Exec_UPDATECOMMANDS
);
272 b
= &called_UpdateUI
;
274 if(flags
& EXPECT_SETTITLE
)
275 SET_EXPECT(Exec_SETTITLE
);
277 while(!*b
&& GetMessage(&msg
, hwnd
, 0, 0)) {
278 TranslateMessage(&msg
);
279 DispatchMessage(&msg
);
282 if(flags
& EXPECT_UPDATEUI
) {
283 CHECK_CALLED(UpdateUI
);
284 CHECK_CALLED(Exec_UPDATECOMMANDS
);
286 if(flags
& EXPECT_SETTITLE
)
287 CHECK_CALLED(Exec_SETTITLE
);
290 static IMoniker Moniker
;
292 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
293 static void _test_GetCurMoniker(unsigned line
, IUnknown
*unk
, IMoniker
*exmon
, LPCWSTR exurl
)
296 IPersistMoniker
*permon
;
297 IMoniker
*mon
= (void*)0xdeadbeef;
298 BSTR doc_url
= (void*)0xdeadbeef;
304 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
305 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
309 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
310 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
312 hres
= IHTMLDocument2_get_URL(doc
, &doc_url
);
313 ok(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
315 hres
= IPersistMoniker_GetCurMoniker(permon
, &mon
);
316 IPersistMoniker_Release(permon
);
320 BOOL exb
= expect_GetDisplayName
;
321 BOOL clb
= called_GetDisplayName
;
323 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
324 ok_(__FILE__
,line
)(mon
== exmon
, "mon(%p) != exmon(%p)\n", mon
, exmon
);
327 SET_EXPECT(GetDisplayName
);
328 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
329 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
331 CHECK_CALLED(GetDisplayName
);
332 expect_GetDisplayName
= exb
;
333 called_GetDisplayName
= clb
;
335 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
340 ok_(__FILE__
,line
)(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
342 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
343 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
345 ok(!lstrcmpW(url
, exurl
), "unexpected url %s\n", wine_dbgstr_w(url
));
346 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
350 ok(hres
== E_UNEXPECTED
,
351 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres
);
352 ok(mon
== (IMoniker
*)0xdeadbeef, "mon=%p\n", mon
);
353 ok(!lstrcmpW(doc_url
, about_blank_url
), "doc_url is not about:blank\n");
356 SysFreeString(doc_url
);
357 IHTMLDocument_Release(doc
);
358 if(mon
&& mon
!= (void*)0xdeadbeef)
359 IMoniker_Release(mon
);
362 DEFINE_GUID(IID_External_unk
,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
364 static HRESULT WINAPI
External_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
368 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
373 if(IsEqualGUID(&IID_IProxyManager
, riid
))
374 return E_NOINTERFACE
; /* TODO */
375 if(IsEqualGUID(&IID_IDispatchEx
, riid
))
376 return E_NOINTERFACE
; /* TODO */
377 if(IsEqualGUID(&IID_External_unk
, riid
))
378 return E_NOINTERFACE
; /* TODO */
380 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
381 return E_NOINTERFACE
;
384 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
389 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
394 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
396 ok(0, "unexpected call\n");
400 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
403 ok(0, "unexpected call\n");
407 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
408 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
410 ok(0, "unexpected call\n");
414 static HRESULT WINAPI
External_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
415 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
416 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
418 ok(0, "unexpected call\n");
422 static const IDispatchVtbl ExternalVtbl
= {
423 External_QueryInterface
,
426 Dispatch_GetTypeInfoCount
,
427 Dispatch_GetTypeInfo
,
428 Dispatch_GetIDsOfNames
,
432 static IDispatch External
= { &ExternalVtbl
};
434 static HRESULT WINAPI
Protocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
436 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
442 return E_NOINTERFACE
;
445 static ULONG WINAPI
Protocol_AddRef(IInternetProtocol
*iface
)
450 static ULONG WINAPI
Protocol_Release(IInternetProtocol
*iface
)
455 static HRESULT WINAPI
Protocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
456 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
457 DWORD grfPI
, HANDLE_PTR dwReserved
)
463 static const WCHAR wszTextCss
[] = {'t','e','x','t','/','c','s','s',0};
464 static const WCHAR empty_str
= {0};
468 ok(pOIProtSink
!= NULL
, "pOIProtSink == NULL\n");
469 ok(pOIBindInfo
!= NULL
, "pOIBindInfo == NULL\n");
470 ok(!grfPI
, "grfPI = %x\n", grfPI
);
471 ok(!dwReserved
, "dwReserved = %lx\n", dwReserved
);
473 memset(&bindinfo
, 0, sizeof(bindinfo
));
474 bindinfo
.cbSize
= sizeof(bindinfo
);
475 hres
= IInternetBindInfo_GetBindInfo(pOIBindInfo
, &bindf
, &bindinfo
);
476 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
477 ok(bindf
== (BINDF_FROMURLMON
|BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
478 "bindf = %x\n", bindf
);
480 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
481 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
482 /* TODO: test stgmedData */
483 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
484 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
485 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
486 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
487 ok(bindinfo
.dwOptions
== 0x80000 ||
488 bindinfo
.dwOptions
== 0x4080000, /* win2k3 */
489 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
490 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
491 /* TODO: test dwCodePage */
492 /* TODO: test securityAttributes */
493 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
494 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
495 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
497 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
498 BINDSTATUS_CACHEFILENAMEAVAILABLE
, &empty_str
);
499 ok(hres
== S_OK
, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres
);
501 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
502 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
, wszTextCss
);
504 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres
);
506 hres
= IInternetProtocolSink_ReportData(pOIProtSink
,
507 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
, 13, 13);
508 ok(hres
== S_OK
, "ReportData failed: %08x\n", hres
);
510 hres
= IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
511 ok(hres
== S_OK
, "ReportResult failed: %08x\n", hres
);
516 static HRESULT WINAPI
Protocol_Continue(IInternetProtocol
*iface
,
517 PROTOCOLDATA
*pProtocolData
)
519 ok(0, "unexpected call\n");
523 static HRESULT WINAPI
Protocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
526 ok(0, "unexpected call\n");
530 static HRESULT WINAPI
Protocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
532 CHECK_EXPECT(Terminate
);
536 static HRESULT WINAPI
Protocol_Suspend(IInternetProtocol
*iface
)
538 ok(0, "unexpected call\n");
542 static HRESULT WINAPI
Protocol_Resume(IInternetProtocol
*iface
)
544 ok(0, "unexpected call\n");
548 static HRESULT WINAPI
Protocol_Read(IInternetProtocol
*iface
, void *pv
,
549 ULONG cb
, ULONG
*pcbRead
)
551 CHECK_EXPECT2(Protocol_Read
);
553 ok(pv
!= NULL
, "pv == NULL\n");
554 ok(cb
> sizeof(css_data
), "cb < sizeof(css_data)\n");
555 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
556 ok(!*pcbRead
, "*pcbRead=%d\n", *pcbRead
);
561 protocol_read
+= *pcbRead
= sizeof(css_data
)-1;
562 memcpy(pv
, css_data
, sizeof(css_data
)-1);
566 static HRESULT WINAPI
Protocol_Seek(IInternetProtocol
*iface
,
567 LARGE_INTEGER dlibMove
, DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
569 ok(0, "unexpected call\n");
573 static HRESULT WINAPI
Protocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
575 CHECK_EXPECT(LockRequest
);
579 static HRESULT WINAPI
Protocol_UnlockRequest(IInternetProtocol
*iface
)
581 CHECK_EXPECT(UnlockRequest
);
585 static const IInternetProtocolVtbl ProtocolVtbl
= {
586 Protocol_QueryInterface
,
597 Protocol_LockRequest
,
598 Protocol_UnlockRequest
601 static IInternetProtocol Protocol
= { &ProtocolVtbl
};
603 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
605 if(!IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
606 ok(0, "unexpected call\n");
607 return E_NOINTERFACE
;
610 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
615 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
620 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
621 REFIID riid
, void **ppv
)
623 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
624 return E_NOINTERFACE
;
626 CHECK_EXPECT(CreateInstance
);
627 ok(ppv
!= NULL
, "ppv == NULL\n");
633 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
635 ok(0, "unexpected call\n");
639 static const IClassFactoryVtbl ClassFactoryVtbl
= {
640 ClassFactory_QueryInterface
,
642 ClassFactory_Release
,
643 ClassFactory_CreateInstance
,
644 ClassFactory_LockServer
647 static IClassFactory ClassFactory
= { &ClassFactoryVtbl
};
649 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
651 ok(0, "unexpected call\n");
655 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
660 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
665 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
666 IHlinkBrowseContext
*pihlbc
)
668 ok(0, "unexpected call\n");
672 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
673 IHlinkBrowseContext
**ppihlbc
)
675 ok(0, "unexpected call\n");
679 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
680 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
684 CHECK_EXPECT(Navigate
);
686 ok(grfHLNF
== 0, "grfHLNF=%d, expected 0\n", grfHLNF
);
687 ok(pbc
!= NULL
, "pbc == NULL\n");
688 ok(pibsc
!= NULL
, "pubsc == NULL\n");
689 ok(pihlNavigate
!= NULL
, "puhlNavigate == NULL\n");
692 LPWSTR frame_name
= (LPWSTR
)0xdeadbeef;
693 LPWSTR location
= (LPWSTR
)0xdeadbeef;
695 IMoniker
*mon
= NULL
;
696 DWORD site_data
= 0xdeadbeef;
698 hres
= IHlink_GetTargetFrameName(pihlNavigate
, &frame_name
);
700 ok(hres
== S_FALSE
, "GetTargetFrameName failed: %08x\n", hres
);
701 ok(frame_name
== NULL
, "frame_name = %p\n", frame_name
);
703 hres
= IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
704 ok(hres
== S_OK
, "GetMonikerReference failed: %08x\n", hres
);
705 ok(location
== NULL
, "location = %p\n", location
);
706 ok(mon
!= NULL
, "mon == NULL\n");
708 hres
= IHlink_GetHlinkSite(pihlNavigate
, &site
, &site_data
);
709 ok(hres
== S_OK
, "GetHlinkSite failed: %08x\n", hres
);
710 ok(site
== NULL
, "site = %p\n, expected NULL\n", site
);
712 ok(site_data
== 0xdeadbeef, "site_data = %x\n", site_data
);
718 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
719 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
721 ok(0, "unexpected call\n");
725 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
726 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
728 ok(0, "unexpected call\n");
732 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
733 HlinkFrame_QueryInterface
,
736 HlinkFrame_SetBrowseContext
,
737 HlinkFrame_GetBrowseContext
,
739 HlinkFrame_OnNavigate
,
740 HlinkFrame_UpdateHlink
743 static IHlinkFrame HlinkFrame
= { &HlinkFrameVtbl
};
745 static HRESULT WINAPI
NewWindowManager_QueryInterface(INewWindowManager
*iface
, REFIID riid
, void **ppv
)
747 ok(0, "unexpected call\n");
748 return E_NOINTERFACE
;
751 static ULONG WINAPI
NewWindowManager_AddRef(INewWindowManager
*iface
)
756 static ULONG WINAPI
NewWindowManager_Release(INewWindowManager
*iface
)
761 static HRESULT WINAPI
NewWindowManager_EvaluateNewWindow(INewWindowManager
*iface
, LPCWSTR pszUrl
,
762 LPCWSTR pszName
, LPCWSTR pszUrlContext
, LPCWSTR pszFeatures
, BOOL fReplace
, DWORD dwFlags
,
763 DWORD dwUserActionTime
)
765 CHECK_EXPECT(EvaluateNewWindow
);
767 ok(!strcmp_wa(pszUrl
, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl
));
768 ok(!strcmp_wa(pszName
, "test"), "pszName = %s\n", wine_dbgstr_w(pszName
));
769 ok(!strcmp_wa(pszUrlContext
, "about:blank"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext
));
770 ok(!pszFeatures
, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures
));
771 ok(!fReplace
, "fReplace = %x\n", fReplace
);
772 ok(dwFlags
== NWMF_FIRST
, "dwFlags = %x\n", dwFlags
);
773 ok(!dwUserActionTime
, "dwUserActionime = %d\n", dwUserActionTime
);
778 static const INewWindowManagerVtbl NewWindowManagerVtbl
= {
779 NewWindowManager_QueryInterface
,
780 NewWindowManager_AddRef
,
781 NewWindowManager_Release
,
782 NewWindowManager_EvaluateNewWindow
785 static INewWindowManager NewWindowManager
= { &NewWindowManagerVtbl
};
787 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
788 REFIID riid
, void**ppv
)
790 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
795 ok(0, "unexpected call\n");
796 return E_NOINTERFACE
;
799 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
804 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
809 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
812 case DISPID_READYSTATE
:
813 CHECK_EXPECT2(OnChanged_READYSTATE
);
815 if(!readystate_set_interactive
)
816 test_MSHTML_QueryStatus(NULL
, OLECMDF_SUPPORTED
817 | (editmode
&& (load_state
== LD_INTERACTIVE
|| load_state
== LD_COMPLETE
)
818 ? OLECMDF_ENABLED
: 0));
820 if(readystate_set_loading
) {
821 readystate_set_loading
= FALSE
;
822 load_state
= LD_LOADING
;
824 if(!editmode
|| load_state
!= LD_LOADING
|| !called_Exec_Explorer_69
)
825 test_readyState(NULL
);
828 CHECK_EXPECT(OnChanged_1005
);
830 test_readyState(NULL
);
831 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
834 CHECK_EXPECT(OnChanged_1012
);
843 ok(0, "unexpected id %d\n", dispID
);
847 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
849 ok(0, "unexpected call\n");
853 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
854 PropertyNotifySink_QueryInterface
,
855 PropertyNotifySink_AddRef
,
856 PropertyNotifySink_Release
,
857 PropertyNotifySink_OnChanged
,
858 PropertyNotifySink_OnRequestEdit
861 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
863 static HRESULT WINAPI
Stream_QueryInterface(IStream
*iface
, REFIID riid
, void **ppv
)
865 ok(0, "unexpected call\n");
866 return E_NOINTERFACE
;
869 static ULONG WINAPI
Stream_AddRef(IStream
*iface
)
874 static ULONG WINAPI
Stream_Release(IStream
*iface
)
879 static HRESULT WINAPI
Stream_Read(IStream
*iface
, void *pv
,
880 ULONG cb
, ULONG
*pcbRead
)
883 ok(pv
!= NULL
, "pv == NULL\n");
884 ok(cb
> sizeof(html_page
), "cb = %d\n", cb
);
885 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
886 ok(!*pcbRead
, "*pcbRead = %d\n", *pcbRead
);
891 memcpy(pv
, html_page
, sizeof(html_page
)-1);
892 stream_read
+= *pcbRead
= sizeof(html_page
)-1;
896 static HRESULT WINAPI
Stream_Write(IStream
*iface
, const void *pv
,
897 ULONG cb
, ULONG
*pcbWritten
)
899 ok(0, "unexpected call\n");
903 static HRESULT WINAPI
Stream_Seek(IStream
*iface
, LARGE_INTEGER dlibMove
,
904 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
906 ok(0, "unexpected call\n");
910 static HRESULT WINAPI
Stream_SetSize(IStream
*iface
, ULARGE_INTEGER libNewSize
)
912 ok(0, "unexpected call\n");
916 static HRESULT WINAPI
Stream_CopyTo(IStream
*iface
, IStream
*pstm
,
917 ULARGE_INTEGER cb
, ULARGE_INTEGER
*pcbRead
, ULARGE_INTEGER
*pcbWritten
)
919 ok(0, "unexpected call\n");
923 static HRESULT WINAPI
Stream_Commit(IStream
*iface
, DWORD grfCommitFlags
)
925 ok(0, "unexpected call\n");
929 static HRESULT WINAPI
Stream_Revert(IStream
*iface
)
931 ok(0, "unexpected call\n");
935 static HRESULT WINAPI
Stream_LockRegion(IStream
*iface
, ULARGE_INTEGER libOffset
,
936 ULARGE_INTEGER cb
, DWORD dwLockType
)
938 ok(0, "unexpected call\n");
942 static HRESULT WINAPI
Stream_UnlockRegion(IStream
*iface
,
943 ULARGE_INTEGER libOffset
, ULARGE_INTEGER cb
, DWORD dwLockType
)
945 ok(0, "unexpected call\n");
949 static HRESULT WINAPI
Stream_Stat(IStream
*iface
, STATSTG
*pstatstg
,
952 ok(0, "unexpected call\n");
956 static HRESULT WINAPI
Stream_Clone(IStream
*iface
, IStream
**ppstm
)
958 ok(0, "unexpected call\n");
962 static const IStreamVtbl StreamVtbl
= {
963 Stream_QueryInterface
,
979 static IStream Stream
= { &StreamVtbl
};
981 static HRESULT WINAPI
Binding_QueryInterface(IBinding
*iface
, REFIID riid
, void **ppv
)
983 if(IsEqualGUID(&IID_IWinInetHttpInfo
, riid
))
984 return E_NOINTERFACE
; /* TODO */
986 if(IsEqualGUID(&IID_IWinInetInfo
, riid
))
987 return E_NOINTERFACE
; /* TODO */
989 ok(0, "unexpected call\n");
990 return E_NOINTERFACE
;
993 static ULONG WINAPI
Binding_AddRef(IBinding
*iface
)
998 static ULONG WINAPI
Binding_Release(IBinding
*iface
)
1003 static HRESULT WINAPI
Binding_Abort(IBinding
*iface
)
1005 CHECK_EXPECT(Abort
);
1009 static HRESULT WINAPI
Binding_Suspend(IBinding
*iface
)
1011 ok(0, "unexpected call\n");
1015 static HRESULT WINAPI
Binding_Resume(IBinding
*iface
)
1017 ok(0, "unexpected call\n");
1021 static HRESULT WINAPI
Binding_SetPriority(IBinding
*iface
, LONG nPriority
)
1023 ok(0, "unexpected call\n");
1027 static HRESULT WINAPI
Binding_GetPriority(IBinding
*iface
, LONG
*pnPriority
)
1029 ok(0, "unexpected call\n");
1033 static HRESULT WINAPI
Binding_GetBindResult(IBinding
*iface
, CLSID
*pclsidProtocol
,
1034 DWORD
*pdwResult
, LPOLESTR
*pszResult
, DWORD
*pdwReserved
)
1036 CHECK_EXPECT(GetBindResult
);
1040 static const IBindingVtbl BindingVtbl
= {
1041 Binding_QueryInterface
,
1047 Binding_SetPriority
,
1048 Binding_GetPriority
,
1049 Binding_GetBindResult
1052 static IBinding Binding
= { &BindingVtbl
};
1054 DEFINE_GUID(IID_IMoniker_unk
,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1055 DEFINE_GUID(IID_IMoniker_unk2
, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1057 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
1061 if(IsEqualGUID(&IID_IMoniker_unk
, riid
))
1062 return E_NOINTERFACE
; /* TODO */
1063 if(IsEqualGUID(&IID_IMoniker_unk2
, riid
))
1064 return E_NOINTERFACE
; /* TODO */
1066 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
1067 return E_NOINTERFACE
;
1070 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
1075 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
1080 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
1082 CHECK_EXPECT(GetClassID
);
1083 ok(IsEqualGUID(pClassID
, &IID_NULL
), "pClassID = %s\n", debugstr_guid(pClassID
));
1087 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
1089 ok(0, "unexpected call\n");
1093 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
1095 ok(0, "unexpected call\n");
1099 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
1101 ok(0, "unexpected call\n");
1105 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
1107 ok(0, "unexpected call\n");
1111 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
1112 REFIID riidResult
, void **ppvResult
)
1114 ok(0, "unexpected call\n");
1118 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1119 REFIID riid
, void **ppv
)
1121 IBindStatusCallback
*callback
= NULL
;
1122 FORMATETC formatetc
= {0xc02d, NULL
, 1, -1, TYMED_ISTREAM
};
1123 STGMEDIUM stgmedium
;
1128 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1129 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
1131 CHECK_EXPECT(BindToStorage
);
1133 load_state
= LD_LOADING
;
1135 ok(pbc
!= NULL
, "pbc == NULL\n");
1136 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1137 ok(IsEqualGUID(&IID_IStream
, riid
), "unexpected riid\n");
1138 ok(ppv
!= NULL
, "ppv == NULL\n");
1139 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
1141 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, (IUnknown
**)&callback
);
1142 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
1143 ok(callback
!= NULL
, "callback == NULL\n");
1145 memset(&bindinfo
, 0xf0, sizeof(bindinfo
));
1146 bindinfo
.cbSize
= sizeof(bindinfo
);
1148 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
1149 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
1150 ok(bindf
== (BINDF_PULLDATA
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
), "bindf = %08x\n", bindf
);
1151 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
1152 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
1153 /* TODO: test stgmedData */
1154 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
1155 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
1156 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
1157 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
1158 ok(bindinfo
.dwOptions
== 0x80000 || bindinfo
.dwOptions
== 0x4080000,
1159 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
1160 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
1161 /* TODO: test dwCodePage */
1162 /* TODO: test securityAttributes */
1163 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
1164 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
1165 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
1167 hres
= IBindStatusCallback_OnStartBinding(callback
, 0, &Binding
);
1168 ok(hres
== S_OK
, "OnStartBinding failed: %08x\n", hres
);
1170 hres
= IBindStatusCallback_OnProgress(callback
, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE
,
1172 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres
);
1174 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1175 BINDSTATUS_BEGINDOWNLOADDATA
, doc_url
);
1176 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres
);
1179 stgmedium
.tymed
= TYMED_ISTREAM
;
1180 U(stgmedium
).pstm
= &Stream
;
1181 stgmedium
.pUnkForRelease
= (IUnknown
*)iface
;
1182 hres
= IBindStatusCallback_OnDataAvailable(callback
,
1183 BSCF_FIRSTDATANOTIFICATION
|BSCF_LASTDATANOTIFICATION
,
1184 sizeof(html_page
)-1, &formatetc
, &stgmedium
);
1185 ok(hres
== S_OK
, "OnDataAvailable failed: %08x\n", hres
);
1188 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1189 BINDSTATUS_ENDDOWNLOADDATA
, NULL
);
1190 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres
);
1192 SET_EXPECT(GetBindResult
);
1193 hres
= IBindStatusCallback_OnStopBinding(callback
, S_OK
, NULL
);
1194 ok(hres
== S_OK
, "OnStopBinding failed: %08x\n", hres
);
1195 SET_CALLED(GetBindResult
); /* IE7 */
1197 IBindStatusCallback_Release(callback
);
1202 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
1203 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
1205 ok(0, "unexpected call\n");
1209 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
1210 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
1212 ok(0, "unexpected call\n");
1216 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
1218 ok(0, "unexpected call\n");
1222 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
1224 ok(0, "unexpected call\n");
1228 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
1230 ok(0, "unexpected call\n");
1234 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1235 IMoniker
*pmkNewlyRunning
)
1237 ok(0, "unexpected call\n");
1241 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
1242 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
1244 ok(0, "unexpected call\n");
1248 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
1250 ok(0, "unexpected call\n");
1254 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
1255 IMoniker
**ppmkPrefix
)
1257 ok(0, "unexpected call\n");
1261 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
1262 IMoniker
**pmkRelPath
)
1264 ok(0, "unexpected call\n");
1268 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1269 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
1271 CHECK_EXPECT2(GetDisplayName
);
1273 /* ok(pbc != NULL, "pbc == NULL\n"); */
1274 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1275 ok(ppszDisplayName
!= NULL
, "ppszDisplayName == NULL\n");
1277 *ppszDisplayName
= CoTaskMemAlloc(sizeof(doc_url
));
1278 memcpy(*ppszDisplayName
, doc_url
, sizeof(doc_url
));
1283 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1284 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1286 ok(0, "unexpected call\n");
1290 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
1292 CHECK_EXPECT(IsSystemMoniker
);
1296 static const IMonikerVtbl MonikerVtbl
= {
1297 Moniker_QueryInterface
,
1305 Moniker_BindToObject
,
1306 Moniker_BindToStorage
,
1308 Moniker_ComposeWith
,
1313 Moniker_GetTimeOfLastChange
,
1315 Moniker_CommonPrefixWith
,
1316 Moniker_RelativePathTo
,
1317 Moniker_GetDisplayName
,
1318 Moniker_ParseDisplayName
,
1319 Moniker_IsSystemMoniker
1322 static IMoniker Moniker
= { &MonikerVtbl
};
1324 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1326 return QueryInterface(riid
, ppv
);
1329 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1334 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1339 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
1340 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1342 ok(0, "unexpected call\n");
1346 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
1347 IEnumUnknown
**ppenum
)
1349 ok(0, "unexpected call\n");
1353 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1355 CHECK_EXPECT(LockContainer
);
1356 ok(expect_LockContainer_fLock
== fLock
, "fLock=%x, expected %x\n", fLock
, expect_LockContainer_fLock
);
1360 static const IOleContainerVtbl OleContainerVtbl
= {
1361 OleContainer_QueryInterface
,
1362 OleContainer_AddRef
,
1363 OleContainer_Release
,
1364 OleContainer_ParseDisplayName
,
1365 OleContainer_EnumObjects
,
1366 OleContainer_LockContainer
1369 static IOleContainer OleContainer
= { &OleContainerVtbl
};
1371 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1373 return QueryInterface(riid
, ppv
);
1376 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1381 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1386 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1388 ok(0, "unexpected call\n");
1392 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1395 ok(0, "unexpected call\n");
1399 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1401 CHECK_EXPECT(GetContainer
);
1402 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1403 *ppContainer
= &OleContainer
;
1407 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1409 ok(0, "unexpected call\n");
1413 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1415 ok(0, "unexpected call\n");
1419 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1421 ok(0, "unexpected call\n");
1425 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1426 ClientSite_QueryInterface
,
1429 ClientSite_SaveObject
,
1430 ClientSite_GetMoniker
,
1431 ClientSite_GetContainer
,
1432 ClientSite_ShowObject
,
1433 ClientSite_OnShowWindow
,
1434 ClientSite_RequestNewObjectLayout
1437 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1439 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1441 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1443 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1444 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
1447 return E_NOINTERFACE
;
1450 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1455 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1460 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1462 CHECK_EXPECT(Frame_GetWindow
);
1466 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1468 ok(0, "unexpected call\n");
1472 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1474 ok(0, "unexpected call\n");
1478 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1479 LPCBORDERWIDTHS pborderwidths
)
1481 ok(0, "unexpected call\n");
1485 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1486 LPCBORDERWIDTHS pborderwidths
)
1488 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1492 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1493 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1495 static const WCHAR wszHTML_Document
[] =
1496 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1498 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1500 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1501 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1502 if(pActiveObject
&& is_english())
1503 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1506 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1507 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1509 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1513 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1514 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1516 static const WCHAR wszHTML_Document
[] =
1517 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1520 CHECK_EXPECT2(SetActiveObject
);
1522 if(pActiveObject
&& is_english())
1523 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1525 CHECK_EXPECT(SetActiveObject_null
);
1527 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1528 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1534 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1535 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1537 ok(0, "unexpected call\n");
1541 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1542 HOLEMENU holemenu
, HWND hwndActiveObject
)
1544 ok(0, "unexpected call\n");
1548 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1550 ok(0, "unexpected call\n");
1554 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1556 CHECK_EXPECT2(SetStatusText
);
1557 if(!expect_status_text
)
1558 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1562 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1565 CHECK_EXPECT2(Frame_EnableModeless_TRUE
);
1567 CHECK_EXPECT2(Frame_EnableModeless_FALSE
);
1571 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1573 ok(0, "unexpected call\n");
1577 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1578 InPlaceFrame_QueryInterface
,
1579 InPlaceFrame_AddRef
,
1580 InPlaceFrame_Release
,
1581 InPlaceFrame_GetWindow
,
1582 InPlaceFrame_ContextSensitiveHelp
,
1583 InPlaceFrame_GetBorder
,
1584 InPlaceFrame_RequestBorderSpace
,
1585 InPlaceFrame_SetBorderSpace
,
1586 InPlaceFrame_SetActiveObject
,
1587 InPlaceFrame_InsertMenus
,
1588 InPlaceFrame_SetMenu
,
1589 InPlaceFrame_RemoveMenus
,
1590 InPlaceFrame_SetStatusText
,
1591 InPlaceFrame_EnableModeless
,
1592 InPlaceFrame_TranslateAccelerator
1595 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1597 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1598 InPlaceFrame_QueryInterface
,
1599 InPlaceFrame_AddRef
,
1600 InPlaceFrame_Release
,
1601 InPlaceFrame_GetWindow
,
1602 InPlaceFrame_ContextSensitiveHelp
,
1603 InPlaceFrame_GetBorder
,
1604 InPlaceFrame_RequestBorderSpace
,
1605 InPlaceFrame_SetBorderSpace
,
1606 InPlaceUIWindow_SetActiveObject
,
1609 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1611 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
1613 return QueryInterface(riid
, ppv
);
1616 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
1621 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
1626 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(
1627 IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
1629 IOleClientSite
*client_site
;
1630 IOleObject
*ole_obj
;
1633 CHECK_EXPECT2(GetWindow
);
1634 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1635 *phwnd
= container_hwnd
;
1637 hres
= IUnknown_QueryInterface(doc_unk
, &IID_IOleObject
, (void**)&ole_obj
);
1638 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
1640 hres
= IOleObject_GetClientSite(ole_obj
, &client_site
);
1641 IOleObject_Release(ole_obj
);
1642 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
1643 ok(client_site
== &ClientSite
, "client_site != ClientSite\n");
1644 IOleClientSite_Release(client_site
);
1649 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(
1650 IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
1652 ok(0, "unexpected call\n");
1656 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(
1657 IOleInPlaceSiteWindowless
*iface
)
1659 CHECK_EXPECT(CanInPlaceActivate
);
1663 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(
1664 IOleInPlaceSiteWindowless
*iface
)
1666 CHECK_EXPECT(OnInPlaceActivate
);
1667 inplace_deactivated
= FALSE
;
1671 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(
1672 IOleInPlaceSiteWindowless
*iface
)
1674 CHECK_EXPECT(OnUIActivate
);
1678 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(
1679 IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
1680 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1681 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1683 static const RECT rect
= {0,0,500,500};
1685 CHECK_EXPECT(GetWindowContext
);
1687 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1689 *ppFrame
= &InPlaceFrame
;
1690 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1692 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1693 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1695 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1696 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1698 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1699 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1701 lpFrameInfo
->cb
= sizeof(*lpFrameInfo
);
1702 lpFrameInfo
->fMDIApp
= FALSE
;
1703 lpFrameInfo
->hwndFrame
= container_hwnd
;
1704 lpFrameInfo
->haccel
= NULL
;
1705 lpFrameInfo
->cAccelEntries
= 0;
1711 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
1712 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
1714 ok(0, "unexpected call\n");
1718 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
1719 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
1721 CHECK_EXPECT(OnUIDeactivate
);
1722 ok(!fUndoable
, "fUndoable = TRUE\n");
1726 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
1727 IOleInPlaceSiteWindowless
*iface
)
1729 CHECK_EXPECT(OnInPlaceDeactivate
);
1730 inplace_deactivated
= TRUE
;
1734 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
1735 IOleInPlaceSiteWindowless
*iface
)
1737 ok(0, "unexpected call\n");
1741 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
1742 IOleInPlaceSiteWindowless
*iface
)
1744 ok(0, "unexpected call\n");
1748 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
1749 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
1751 ok(0, "unexpected call\n");
1755 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
1756 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
1758 CHECK_EXPECT(OnInPlaceActivateEx
);
1760 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
1761 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
1762 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
1767 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1768 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
1770 CHECK_EXPECT(OnInPlaceDeactivateEx
);
1772 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
1777 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
1778 IOleInPlaceSiteWindowless
*iface
)
1780 CHECK_EXPECT2(RequestUIActivate
);
1784 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
1785 IOleInPlaceSiteWindowless
*iface
)
1787 ok(0, "unexpected call\n");
1791 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
1792 IOleInPlaceSiteWindowless
*iface
)
1794 ok(0, "unexpected call\n");
1798 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
1799 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
1801 ok(0, "unexpected call\n");
1805 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
1806 IOleInPlaceSiteWindowless
*iface
)
1808 ok(0, "unexpected call\n");
1812 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
1813 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
1815 ok(0, "unexpected call\n");
1819 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
1820 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
1821 DWORD grfFlags
, HDC
*phDC
)
1823 ok(0, "unexpected call\n");
1827 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
1828 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
1830 ok(0, "unexpected call\n");
1834 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
1835 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
1837 ok(0, "unexpected call\n");
1841 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
1842 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
1844 ok(0, "unexpected call\n");
1848 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
1849 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
1850 LPCRECT pRectScroll
, LPCRECT pRectClip
)
1852 ok(0, "unexpected call\n");
1856 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
1857 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
1859 ok(0, "unexpected call\n");
1863 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
1864 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
1865 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
1867 ok(0, "unexpected call\n");
1871 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
1872 InPlaceSiteWindowless_QueryInterface
,
1873 InPlaceSiteWindowless_AddRef
,
1874 InPlaceSiteWindowless_Release
,
1875 InPlaceSiteWindowless_GetWindow
,
1876 InPlaceSiteWindowless_ContextSensitiveHelp
,
1877 InPlaceSiteWindowless_CanInPlaceActivate
,
1878 InPlaceSiteWindowless_OnInPlaceActivate
,
1879 InPlaceSiteWindowless_OnUIActivate
,
1880 InPlaceSiteWindowless_GetWindowContext
,
1881 InPlaceSiteWindowless_Scroll
,
1882 InPlaceSiteWindowless_OnUIDeactivate
,
1883 InPlaceSiteWindowless_OnInPlaceDeactivate
,
1884 InPlaceSiteWindowless_DiscardUndoState
,
1885 InPlaceSiteWindowless_DeactivateAndUndo
,
1886 InPlaceSiteWindowless_OnPosRectChange
,
1887 InPlaceSiteWindowless_OnInPlaceActivateEx
,
1888 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
1889 InPlaceSiteWindowless_RequestUIActivate
,
1890 InPlaceSiteWindowless_CanWindowlessActivate
,
1891 InPlaceSiteWindowless_GetCapture
,
1892 InPlaceSiteWindowless_SetCapture
,
1893 InPlaceSiteWindowless_GetFocus
,
1894 InPlaceSiteWindowless_SetFocus
,
1895 InPlaceSiteWindowless_GetDC
,
1896 InPlaceSiteWindowless_ReleaseDC
,
1897 InPlaceSiteWindowless_InvalidateRect
,
1898 InPlaceSiteWindowless_InvalidateRgn
,
1899 InPlaceSiteWindowless_ScrollRect
,
1900 InPlaceSiteWindowless_AdjustRect
,
1901 InPlaceSiteWindowless_OnDefWindowMessage
1904 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
1906 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
1908 return QueryInterface(riid
, ppv
);
1911 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
1916 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
1923 CallUIActivate_None
,
1924 CallUIActivate_ActivateMe
,
1925 CallUIActivate_AfterShow
,
1928 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
1929 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
1931 IOleDocument
*document
;
1934 CHECK_EXPECT(ActivateMe
);
1935 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
1937 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
1938 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
1940 if(SUCCEEDED(hres
)) {
1941 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
, NULL
, 0, &view
);
1942 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
1944 if(SUCCEEDED(hres
)) {
1945 IOleInPlaceActiveObject
*activeobj
= NULL
;
1946 IOleInPlaceSite
*inplacesite
= NULL
;
1947 HWND tmp_hwnd
= NULL
;
1948 static RECT rect
= {0,0,400,500};
1950 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1951 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1952 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
1953 inplacesite
, &InPlaceSiteWindowless
);
1955 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
);
1956 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
1958 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1959 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1960 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
1961 inplacesite
, &InPlaceSiteWindowless
);
1963 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
1964 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
1967 IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1968 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1969 ok(hwnd
== NULL
, "hwnd=%p, expeted NULL\n", hwnd
);
1972 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
1973 SET_EXPECT(CanInPlaceActivate
);
1974 SET_EXPECT(GetWindowContext
);
1975 SET_EXPECT(GetWindow
);
1977 SET_EXPECT(OnInPlaceActivateEx
);
1979 SET_EXPECT(OnInPlaceActivate
);
1980 SET_EXPECT(SetStatusText
);
1981 SET_EXPECT(Exec_SETPROGRESSMAX
);
1982 SET_EXPECT(Exec_SETPROGRESSPOS
);
1983 SET_EXPECT(OnUIActivate
);
1984 SET_EXPECT(SetActiveObject
);
1986 expect_status_text
= NULL
;
1988 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
1989 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
1991 CHECK_CALLED(CanInPlaceActivate
);
1992 CHECK_CALLED(GetWindowContext
);
1993 CHECK_CALLED(GetWindow
);
1995 CHECK_CALLED(OnInPlaceActivateEx
);
1997 CHECK_CALLED(OnInPlaceActivate
);
1998 CHECK_CALLED(SetStatusText
);
1999 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2000 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2001 CHECK_CALLED(OnUIActivate
);
2002 CHECK_CALLED(SetActiveObject
);
2003 CHECK_CALLED(ShowUI
);
2006 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2007 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2008 ok(hwnd
!= NULL
, "hwnd == NULL\n");
2010 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2013 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2014 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2017 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
2018 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2019 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
2023 hres
= IOleDocumentView_SetRect(view
, &rect
);
2024 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2026 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2027 hres
= IOleDocumentView_Show(view
, TRUE
);
2028 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2030 SET_EXPECT(CanInPlaceActivate
);
2031 SET_EXPECT(GetWindowContext
);
2032 SET_EXPECT(GetWindow
);
2034 SET_EXPECT(OnInPlaceActivateEx
);
2036 SET_EXPECT(OnInPlaceActivate
);
2037 SET_EXPECT(SetStatusText
);
2038 SET_EXPECT(Exec_SETPROGRESSMAX
);
2039 SET_EXPECT(Exec_SETPROGRESSPOS
);
2040 SET_EXPECT(OnUIActivate
);
2041 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
2043 hres
= IOleDocumentView_Show(view
, TRUE
);
2045 win_skip("Show failed\n");
2047 IOleInPlaceActiveObject_Release(activeobj
);
2048 IOleDocument_Release(document
);
2052 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2054 CHECK_CALLED(CanInPlaceActivate
);
2055 CHECK_CALLED(GetWindowContext
);
2056 CHECK_CALLED(GetWindow
);
2058 CHECK_CALLED(OnInPlaceActivateEx
);
2060 CHECK_CALLED(OnInPlaceActivate
);
2061 CHECK_CALLED(SetStatusText
);
2062 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2063 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2066 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2067 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2068 ok(hwnd
!= NULL
, "hwnd == NULL\n");
2070 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2074 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
2077 IOleInPlaceActiveObject_Release(activeobj
);
2080 IOleDocument_Release(document
);
2086 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2087 DocumentSite_QueryInterface
,
2088 DocumentSite_AddRef
,
2089 DocumentSite_Release
,
2090 DocumentSite_ActivateMe
2093 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2095 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
2097 return QueryInterface(riid
, ppv
);
2100 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
2105 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
2110 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
2112 ok(0, "unexpected call\n");
2116 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
2118 ok(0, "unexpected call\n");
2122 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
2124 ok(0, "unexpected call\n");
2128 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
2129 POINTF
*pPtfContainer
, DWORD dwFlags
)
2131 ok(0, "unexpected call\n");
2135 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
2136 MSG
*pMsg
, DWORD grfModifiers
)
2138 ok(0, "unexpected call\n");
2142 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
2145 CHECK_EXPECT(OnFocus_TRUE
);
2147 CHECK_EXPECT2(OnFocus_FALSE
);
2151 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
2153 ok(0, "unexpected call\n");
2157 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
2158 OleControlSite_QueryInterface
,
2159 OleControlSite_AddRef
,
2160 OleControlSite_Release
,
2161 OleControlSite_OnControlInfoChanged
,
2162 OleControlSite_LockInPlaceActive
,
2163 OleControlSite_GetExtendedControl
,
2164 OleControlSite_TransformCoords
,
2165 OleControlSite_TranslateAccelerator
,
2166 OleControlSite_OnFocus
,
2167 OleControlSite_ShowPropertyFrame
2170 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
2172 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2174 return QueryInterface(riid
, ppv
);
2177 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
2182 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
2187 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
2188 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
2190 ok(0, "unexpected call\n");
2194 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
2196 CHECK_EXPECT(GetHostInfo
);
2197 ok(pInfo
!= NULL
, "pInfo=NULL\n");
2199 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
2200 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
2201 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2202 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2203 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
2204 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
2205 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
2206 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
2211 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
2212 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
2213 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
2215 CHECK_EXPECT(ShowUI
);
2218 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
2220 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
2221 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
2222 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
2223 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
2224 if (expect_InPlaceUIWindow_SetActiveObject_active
)
2225 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
2227 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
2232 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
2234 CHECK_EXPECT(HideUI
);
2238 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
2240 CHECK_EXPECT(UpdateUI
);
2244 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
2247 CHECK_EXPECT2(EnableModeless_TRUE
);
2249 CHECK_EXPECT2(EnableModeless_FALSE
);
2253 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2255 ok(0, "unexpected call\n");
2259 static BOOL expect_OnFrameWindowActivate_fActivate
;
2260 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2262 CHECK_EXPECT2(OnFrameWindowActivate
);
2263 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
2267 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
2268 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
2270 ok(0, "unexpected call\n");
2274 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
2275 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
2277 ok(0, "unexpected call\n");
2281 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
2282 LPOLESTR
*pchKey
, DWORD dw
)
2284 CHECK_EXPECT(GetOptionKeyPath
);
2285 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2286 ok(!dw
, "dw=%d, expected 0\n", dw
);
2288 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2292 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
2293 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
2295 CHECK_EXPECT(GetDropTarget
);
2300 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
2302 CHECK_EXPECT(GetExternal
);
2303 *ppDispatch
= &External
;
2307 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
2308 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
2310 CHECK_EXPECT(TranslateUrl
);
2311 ok(!dwTranslate
, "dwTranslate = %x\n", dwTranslate
);
2312 ok(!strcmp_wa(pchURLIn
, "about:blank"), "pchURLIn = %s\n", wine_dbgstr_w(pchURLIn
));
2313 ok(ppchURLOut
!= NULL
, "ppchURLOut == NULL\n");
2314 ok(!*ppchURLOut
, "*ppchURLOut = %p\n", *ppchURLOut
);
2319 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
2320 IDataObject
**ppPORet
)
2322 ok(0, "unexpected call\n");
2326 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
2327 LPOLESTR
*pchKey
, DWORD dw
)
2329 CHECK_EXPECT(GetOverrideKeyPath
);
2330 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2332 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2333 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2337 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2338 DocHostUIHandler_QueryInterface
,
2339 DocHostUIHandler_AddRef
,
2340 DocHostUIHandler_Release
,
2341 DocHostUIHandler_ShowContextMenu
,
2342 DocHostUIHandler_GetHostInfo
,
2343 DocHostUIHandler_ShowUI
,
2344 DocHostUIHandler_HideUI
,
2345 DocHostUIHandler_UpdateUI
,
2346 DocHostUIHandler_EnableModeless
,
2347 DocHostUIHandler_OnDocWindowActivate
,
2348 DocHostUIHandler_OnFrameWindowActivate
,
2349 DocHostUIHandler_ResizeBorder
,
2350 DocHostUIHandler_TranslateAccelerator
,
2351 DocHostUIHandler_GetOptionKeyPath
,
2352 DocHostUIHandler_GetDropTarget
,
2353 DocHostUIHandler_GetExternal
,
2354 DocHostUIHandler_TranslateUrl
,
2355 DocHostUIHandler_FilterDataObject
,
2356 DocHostUIHandler_GetOverrideKeyPath
2359 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2361 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2362 REFIID riid
, void **ppv
)
2364 return QueryInterface(riid
, ppv
);
2367 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2372 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2377 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2378 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2380 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2381 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2382 ok(!pCmdText
, "pCmdText != NULL\n");
2384 switch(prgCmds
[0].cmdID
) {
2385 case OLECMDID_SETPROGRESSTEXT
:
2386 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2387 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2390 CHECK_EXPECT(QueryStatus_OPEN
);
2391 prgCmds
[0].cmdf
= 0;
2394 CHECK_EXPECT(QueryStatus_NEW
);
2395 prgCmds
[0].cmdf
= 0;
2398 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2404 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2405 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2407 if((!pguidCmdGroup
|| !IsEqualGUID(pguidCmdGroup
, &CGID_Explorer
))
2408 && (!pguidCmdGroup
|| !IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
) || nCmdID
!= 63))
2409 test_readyState(NULL
);
2411 if(!pguidCmdGroup
) {
2413 case OLECMDID_SETPROGRESSMAX
:
2414 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2415 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2416 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2418 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2419 if(load_state
== LD_NO
)
2420 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2422 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2424 case OLECMDID_SETPROGRESSPOS
:
2425 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2426 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2427 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2429 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2430 if(load_state
== LD_NO
)
2431 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2433 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2435 case OLECMDID_HTTPEQUIV_DONE
:
2436 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2437 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2438 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2439 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2440 readystate_set_loading
= FALSE
;
2441 readystate_set_interactive
= FALSE
;
2442 load_state
= LD_COMPLETE
;
2444 case OLECMDID_SETDOWNLOADSTATE
:
2445 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2446 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2447 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2448 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2450 switch(V_I4(pvaIn
)) {
2452 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2453 load_state
= LD_INTERACTIVE
;
2456 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2457 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
2460 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2464 case OLECMDID_UPDATECOMMANDS
:
2465 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2466 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2467 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2468 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2470 case OLECMDID_SETTITLE
:
2471 CHECK_EXPECT2(Exec_SETTITLE
);
2472 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2473 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2474 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2475 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2476 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2478 case OLECMDID_HTTPEQUIV
:
2479 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2480 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2481 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2482 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2483 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2484 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) = NULL\n");
2485 test_readyState(NULL
);
2487 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
2488 return E_FAIL
; /* FIXME */
2490 ok(0, "unexpected command %d\n", nCmdID
);
2495 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2496 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2500 CHECK_EXPECT2(Exec_ShellDocView_37
);
2502 if(load_from_stream
|| navigated_load
)
2503 test_GetCurMoniker(doc_unk
, NULL
, about_blank_url
);
2505 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
2507 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2508 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2510 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2511 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2516 IHTMLPrivateWindow
*priv_window
;
2519 CHECK_EXPECT(Exec_ShellDocView_63
);
2520 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2521 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2522 ok(V_UNKNOWN(pvaIn
) != NULL
, "VPUNKNOWN(pvaIn) = NULL\n");
2523 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2524 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2526 hres
= IUnknown_QueryInterface(V_UNKNOWN(pvaIn
), &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
2527 ok(hres
== S_OK
, "Could not get IHTMLPrivateWindow: %08x\n", hres
);
2529 IHTMLPrivateWindow_Release(priv_window
);
2531 load_state
= LD_LOADING
;
2532 return S_OK
; /* TODO */
2536 CHECK_EXPECT(Exec_ShellDocView_67
);
2537 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2538 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2539 ok(!strcmp_wa(V_BSTR(pvaIn
), "about:blank"), "V_BSTR(pvaIn) = %s\n", wine_dbgstr_w(V_BSTR(pvaIn
)));
2540 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2541 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2542 ok(V_BOOL(pvaOut
) == VARIANT_TRUE
, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut
));
2543 load_state
= LD_DOLOAD
;
2547 CHECK_EXPECT2(Exec_ShellDocView_84
);
2549 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2550 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2552 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2557 CHECK_EXPECT2(Exec_ShellDocView_103
);
2559 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2560 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2565 CHECK_EXPECT2(Exec_ShellDocView_105
);
2567 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2568 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2573 CHECK_EXPECT2(Exec_ShellDocView_140
);
2575 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2576 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2581 ok(0, "unexpected command %d\n", nCmdID
);
2586 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2587 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2590 case IDM_PARSECOMPLETE
:
2591 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2592 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2593 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2596 ok(0, "unexpected command %d\n", nCmdID
);
2600 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
2602 case DOCHOST_DOCCANNAVIGATE
:
2603 CHECK_EXPECT(Exec_DOCCANNAVIGATE
);
2604 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2605 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2606 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) != VT_UNKNOWN\n");
2607 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2610 return E_FAIL
; /* TODO */
2614 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
2615 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2619 CHECK_EXPECT2(Exec_Explorer_69
);
2620 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2621 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2624 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
2629 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
2631 case OLECMDID_PAGEACTIONBLOCKED
: /* win2k3 */
2632 SET_EXPECT(SetStatusText
);
2633 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2634 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2636 case OLECMDID_SHOWSCRIPTERROR
:
2640 ok(0, "unexpected command %d\n", nCmdID
);
2645 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup
));
2649 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
2650 OleCommandTarget_QueryInterface
,
2651 OleCommandTarget_AddRef
,
2652 OleCommandTarget_Release
,
2653 OleCommandTarget_QueryStatus
,
2654 OleCommandTarget_Exec
2657 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
2659 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
2661 return QueryInterface(riid
, ppv
);
2664 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
2665 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2666 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2668 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
2669 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
2670 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
2671 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
2672 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
2673 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
2674 test_readyState(NULL
);
2676 switch(dispIdMember
) {
2677 case DISPID_AMBIENT_USERMODE
:
2678 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
2679 V_VT(pVarResult
) = VT_BOOL
;
2680 V_BOOL(pVarResult
) = VARIANT_TRUE
;
2682 case DISPID_AMBIENT_DLCONTROL
:
2683 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
2685 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
2686 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2688 case DISPID_AMBIENT_SILENT
:
2689 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
2690 V_VT(pVarResult
) = VT_BOOL
;
2691 V_BOOL(pVarResult
) = VARIANT_FALSE
;
2693 case DISPID_AMBIENT_USERAGENT
:
2694 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2696 case DISPID_AMBIENT_PALETTE
:
2697 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2701 ok(0, "unexpected dispid %d\n", dispIdMember
);
2705 static IDispatchVtbl DispatchVtbl
= {
2706 Dispatch_QueryInterface
,
2709 Dispatch_GetTypeInfoCount
,
2710 Dispatch_GetTypeInfo
,
2711 Dispatch_GetIDsOfNames
,
2715 static IDispatch Dispatch
= { &DispatchVtbl
};
2717 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
2718 REFIID riid
, void **ppv
)
2720 return QueryInterface(riid
, ppv
);
2723 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
2728 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
2733 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
2734 REFIID riid
, void **ppv
)
2737 * Services used by HTMLDocument:
2740 * IInternetSecurityManager
2742 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2745 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2746 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2747 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2749 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2750 * IElementBehaviorFactory
2751 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2761 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
2762 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
2767 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
2768 ok(IsEqualGUID(&IID_INewWindowManager
, riid
), "unexpected riid\n");
2769 *ppv
= &NewWindowManager
;
2773 return E_NOINTERFACE
;
2776 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2777 ServiceProvider_QueryInterface
,
2778 ServiceProvider_AddRef
,
2779 ServiceProvider_Release
,
2780 ServiceProvider_QueryService
2783 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
2785 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
2786 REFIID riid
, void **ppv
)
2788 return QueryInterface(riid
, ppv
);
2791 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSinkEx
*iface
)
2796 static ULONG WINAPI
AdviseSink_Release(IAdviseSinkEx
*iface
)
2801 static void WINAPI
AdviseSink_OnDataChange(IAdviseSinkEx
*iface
,
2802 FORMATETC
*pFormatetc
, STGMEDIUM
*pStgmed
)
2804 ok(0, "unexpected call\n");
2807 static void WINAPI
AdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
2808 DWORD dwAspect
, LONG lindex
)
2810 ok(0, "unexpected call\n");
2813 static void WINAPI
AdviseSink_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
2815 ok(0, "unexpected call\n");
2818 static void WINAPI
AdviseSink_OnSave(IAdviseSinkEx
*iface
)
2820 ok(0, "unexpected call\n");
2823 static void WINAPI
AdviseSink_OnClose(IAdviseSinkEx
*iface
)
2825 ok(0, "unexpected call\n");
2828 static void WINAPI
AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
2830 ok(0, "unexpected call\n");
2833 static void WINAPI
ObjectAdviseSink_OnClose(IAdviseSinkEx
*iface
)
2835 CHECK_EXPECT(Advise_Close
);
2838 static const IAdviseSinkExVtbl AdviseSinkVtbl
= {
2839 AdviseSink_QueryInterface
,
2842 AdviseSink_OnDataChange
,
2843 AdviseSink_OnViewChange
,
2844 AdviseSink_OnRename
,
2846 ObjectAdviseSink_OnClose
,
2847 AdviseSinkEx_OnViewStatusChange
2850 static IAdviseSinkEx AdviseSink
= { &AdviseSinkVtbl
};
2852 static HRESULT WINAPI
ViewAdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
2853 REFIID riid
, void **ppv
)
2855 if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
2860 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
2862 return E_NOINTERFACE
;
2865 static void WINAPI
ViewAdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
2866 DWORD dwAspect
, LONG lindex
)
2868 CHECK_EXPECT2(OnViewChange
);
2870 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
2871 ok(lindex
== -1, "lindex = %d\n", lindex
);
2874 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl
= {
2875 ViewAdviseSink_QueryInterface
,
2878 AdviseSink_OnDataChange
,
2879 ViewAdviseSink_OnViewChange
,
2880 AdviseSink_OnRename
,
2883 AdviseSinkEx_OnViewStatusChange
2886 static IAdviseSinkEx ViewAdviseSink
= { &ViewAdviseSinkVtbl
};
2888 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2889 DEFINE_GUID(IID_IThumbnailView
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2890 DEFINE_GUID(IID_IRenMailEditor
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2891 DEFINE_GUID(IID_unk4
, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
2892 DEFINE_GUID(IID_IDocHostUIHandlerPriv
, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
2894 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
2898 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
2900 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
2901 *ppv
= &DocumentSite
;
2902 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
2903 *ppv
= &DocHostUIHandler
;
2904 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
2905 *ppv
= &OleContainer
;
2906 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
2907 *ppv
= &InPlaceSiteWindowless
;
2908 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2909 *ppv
= &OleCommandTarget
;
2910 else if(IsEqualGUID(&IID_IDispatch
, riid
))
2912 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
2913 *ppv
= &ServiceProvider
;
2914 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
2915 *ppv
= ipsex
? &InPlaceSiteWindowless
: NULL
;
2916 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
))
2917 *ppv
= ipsw
? &InPlaceSiteWindowless
: NULL
;
2918 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
2919 *ppv
= &OleControlSite
;
2920 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2921 return E_NOINTERFACE
; /* TODO */
2922 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
2923 return E_NOINTERFACE
; /* ? */
2924 else if(IsEqualGUID(&IID_unk1
, riid
))
2925 return E_NOINTERFACE
; /* HTMLWindow2 ? */
2926 else if(IsEqualGUID(&IID_IThumbnailView
, riid
))
2927 return E_NOINTERFACE
; /* ? */
2928 else if(IsEqualGUID(&IID_IRenMailEditor
, riid
))
2929 return E_NOINTERFACE
; /* ? */
2930 else if(IsEqualGUID(&IID_unk4
, riid
))
2931 return E_NOINTERFACE
; /* ? */
2932 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv
, riid
))
2933 return E_NOINTERFACE
; /* ? */
2935 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
2939 return E_NOINTERFACE
;
2942 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
2944 return DefWindowProc(hwnd
, msg
, wParam
, lParam
);
2947 static void test_doscroll(IUnknown
*unk
)
2949 IHTMLDocument3
*doc
;
2950 IHTMLElement2
*elem2
;
2955 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument3
, (void**)&doc
);
2956 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
2960 hres
= IHTMLDocument3_get_documentElement(doc
, &elem
);
2961 IHTMLDocument3_Release(doc
);
2962 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
2963 switch(load_state
) {
2967 ok(!elem
, "elem != NULL\n");
2970 case LD_INTERACTIVE
:
2972 ok(elem
!= NULL
, "elem == NULL\n");
2977 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
2978 IHTMLElement_Release(elem
);
2979 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
2982 V_BSTR(&v
) = a2bstr("left");
2983 hres
= IHTMLElement2_doScroll(elem2
, v
);
2984 SysFreeString(V_BSTR(&v
));
2985 IHTMLElement2_Release(elem2
);
2987 if(inplace_deactivated
)
2988 ok(hres
== E_PENDING
, "doScroll failed: %08x\n", hres
);
2989 else if(load_state
== LD_COMPLETE
)
2990 ok(hres
== S_OK
, "doScroll failed: %08x\n", hres
);
2992 ok(hres
== E_PENDING
|| hres
== S_OK
, "doScroll failed: %08x\n", hres
);
2995 static void _test_readyState(unsigned line
, IUnknown
*unk
)
2997 IHTMLDocument2
*htmldoc
;
2998 DISPPARAMS dispparams
;
3004 static const LPCSTR expected_state
[] = {
3019 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
3020 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
3024 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
3025 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
3027 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
3028 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
3030 if(!strcmp_wa(state
, "interactive") && load_state
== LD_LOADING
)
3031 load_state
= LD_INTERACTIVE
;
3034 (!strcmp_wa(state
, expected_state
[load_state
]), "unexpected state %s, expected %d\n",
3035 wine_dbgstr_w(state
), load_state
);
3036 SysFreeString(state
);
3038 hres
= IHTMLDocument2_get_body(htmldoc
, &elem
);
3039 ok_(__FILE__
,line
)(hres
== S_OK
, "get_body failed: %08x\n", hres
);
3041 IHTMLElement2
*elem2
;
3044 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
3045 IHTMLElement_Release(elem
);
3046 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
3048 hres
= IHTMLElement2_get_readyState(elem2
, &var
);
3049 IHTMLElement2_Release(elem2
);
3050 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3051 ok(V_VT(&var
) == VT_BSTR
, "V_VT(state) = %d\n", V_VT(&var
));
3052 ok(!strcmp_wa(V_BSTR(&var
), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var
)));
3055 ok_(__FILE__
,line
)(load_state
!= LD_COMPLETE
, "body is NULL in complete state\n");
3058 dispparams
.cArgs
= 0;
3059 dispparams
.cNamedArgs
= 0;
3060 dispparams
.rgdispidNamedArgs
= NULL
;
3061 dispparams
.rgvarg
= NULL
;
3065 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
3066 &dispparams
, &out
, NULL
, NULL
);
3067 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
3069 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
3070 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
3072 test_doscroll((IUnknown
*)htmldoc
);
3074 IHTMLDocument2_Release(htmldoc
);
3077 static void test_ViewAdviseSink(IHTMLDocument2
*doc
)
3082 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IViewObject
, (void**)&view
);
3083 ok(hres
== S_OK
, "QueryInterface(IID_IViewObject) failed: %08x\n", hres
);
3085 hres
= IViewObject_SetAdvise(view
, DVASPECT_CONTENT
, ADVF_PRIMEFIRST
, (IAdviseSink
*)&ViewAdviseSink
);
3086 ok(hres
== S_OK
, "SetAdvise failed: %08x\n", hres
);
3088 IViewObject_Release(view
);
3091 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
3093 IConnectionPointContainer
*tmp_container
= NULL
;
3094 IConnectionPoint
*cp
;
3098 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3099 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3103 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
3104 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
3105 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
3107 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
3108 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
3110 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
3111 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
3112 ok(tmp_container
== container
, "container != tmp_container\n");
3114 IConnectionPointContainer_Release(tmp_container
);
3116 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
3117 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
3119 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
3122 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
3123 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3126 IConnectionPoint_Release(cp
);
3129 static void test_ConnectionPointContainer(IHTMLDocument2
*doc
)
3131 IConnectionPointContainer
*container
;
3134 hres
= IUnknown_QueryInterface(doc
, &IID_IConnectionPointContainer
, (void**)&container
);
3135 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3139 test_ConnectionPoint(container
, &IID_IDispatch
);
3140 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
3141 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
3142 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
3144 IConnectionPointContainer_Release(container
);
3147 static void test_Load(IPersistMoniker
*persist
, IMoniker
*mon
)
3151 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
3153 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
3155 test_readyState((IUnknown
*)persist
);
3159 CreateBindCtx(0, &bind
);
3160 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
3161 (IUnknown
*)&ClientSite
);
3164 SET_EXPECT(GetDisplayName
);
3165 if(!set_clientsite
) {
3166 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3167 SET_EXPECT(GetHostInfo
);
3168 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3169 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3170 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3171 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3172 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3173 SET_EXPECT(GetOptionKeyPath
);
3174 SET_EXPECT(GetOverrideKeyPath
);
3175 SET_EXPECT(GetWindow
);
3176 SET_EXPECT(Exec_DOCCANNAVIGATE
);
3177 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3178 SET_EXPECT(Exec_SETPROGRESSMAX
);
3179 SET_EXPECT(Exec_SETPROGRESSPOS
);
3180 SET_EXPECT(Exec_ShellDocView_37
);
3182 if(!container_locked
) {
3183 SET_EXPECT(GetContainer
);
3184 SET_EXPECT(LockContainer
);
3186 SET_EXPECT(OnChanged_READYSTATE
);
3187 SET_EXPECT(Exec_ShellDocView_84
);
3188 SET_EXPECT(IsSystemMoniker
);
3190 SET_EXPECT(BindToStorage
);
3191 SET_EXPECT(SetActiveObject
);
3192 if(set_clientsite
) {
3193 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3194 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3195 SET_EXPECT(Exec_ShellDocView_37
);
3197 load_state
= LD_DOLOAD
;
3198 expect_LockContainer_fLock
= TRUE
;
3199 readystate_set_loading
= TRUE
;
3201 hres
= IPersistMoniker_Load(persist
, FALSE
, mon
, bind
, 0x12);
3202 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
3205 CHECK_CALLED(GetDisplayName
);
3206 if(!set_clientsite
) {
3207 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3208 CHECK_CALLED(GetHostInfo
);
3209 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3210 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3211 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3212 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3213 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3214 CHECK_CALLED(GetOptionKeyPath
);
3215 CHECK_CALLED(GetOverrideKeyPath
);
3216 CHECK_CALLED(GetWindow
);
3217 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
3218 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
3219 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3220 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3221 CHECK_CALLED(Exec_ShellDocView_37
);
3223 if(!container_locked
) {
3224 CHECK_CALLED(GetContainer
);
3225 CHECK_CALLED(LockContainer
);
3226 container_locked
= TRUE
;
3228 CHECK_CALLED(OnChanged_READYSTATE
);
3229 SET_CALLED(IsSystemMoniker
); /* IE7 */
3230 SET_CALLED(Exec_ShellDocView_84
);
3232 CHECK_CALLED(BindToStorage
);
3233 SET_CALLED(SetActiveObject
); /* FIXME */
3234 if(set_clientsite
) {
3235 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3236 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3237 CHECK_CALLED(Exec_ShellDocView_37
);
3240 set_clientsite
= container_locked
= TRUE
;
3242 test_GetCurMoniker((IUnknown
*)persist
, mon
, NULL
);
3244 IBindCtx_Release(bind
);
3246 test_readyState((IUnknown
*)persist
);
3249 #define DWL_VERBDONE 0x0001
3250 #define DWL_CSS 0x0002
3251 #define DWL_TRYCSS 0x0004
3252 #define DWL_HTTP 0x0008
3253 #define DWL_EMPTY 0x0010
3255 static void test_download(DWORD flags
)
3260 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
3261 ok(hwnd
!= NULL
, "Could not find hidden window\n");
3263 test_readyState(NULL
);
3265 if(flags
& (DWL_VERBDONE
|DWL_HTTP
))
3266 SET_EXPECT(Exec_SETPROGRESSMAX
);
3267 if((flags
& DWL_VERBDONE
) && !load_from_stream
)
3268 SET_EXPECT(GetHostInfo
);
3269 SET_EXPECT(SetStatusText
);
3270 if(!(flags
& DWL_EMPTY
))
3271 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
3272 SET_EXPECT(OnViewChange
);
3273 SET_EXPECT(GetDropTarget
);
3274 if(flags
& DWL_TRYCSS
)
3275 SET_EXPECT(Exec_ShellDocView_84
);
3276 if(flags
& DWL_CSS
) {
3277 SET_EXPECT(CreateInstance
);
3279 SET_EXPECT(LockRequest
);
3280 SET_EXPECT(Terminate
);
3281 SET_EXPECT(Protocol_Read
);
3282 SET_EXPECT(UnlockRequest
);
3284 SET_EXPECT(Exec_Explorer_69
);
3285 SET_EXPECT(EnableModeless_TRUE
); /* IE7 */
3286 SET_EXPECT(Frame_EnableModeless_TRUE
); /* IE7 */
3287 SET_EXPECT(EnableModeless_FALSE
); /* IE7 */
3288 SET_EXPECT(Frame_EnableModeless_FALSE
); /* IE7 */
3290 SET_EXPECT(Exec_ShellDocView_37
);
3291 if(flags
& DWL_HTTP
) {
3292 SET_EXPECT(OnChanged_1012
);
3293 SET_EXPECT(Exec_HTTPEQUIV
);
3294 SET_EXPECT(Exec_SETTITLE
);
3296 SET_EXPECT(OnChanged_1005
);
3297 SET_EXPECT(OnChanged_READYSTATE
);
3298 SET_EXPECT(Exec_SETPROGRESSPOS
);
3299 if(!(flags
& DWL_EMPTY
))
3300 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
3301 SET_EXPECT(Exec_ShellDocView_103
);
3302 SET_EXPECT(Exec_ShellDocView_105
);
3303 SET_EXPECT(Exec_ShellDocView_140
);
3304 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
3305 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
3306 SET_EXPECT(SetStatusText
);
3307 if(navigated_load
) {
3308 SET_EXPECT(UpdateUI
);
3309 SET_EXPECT(Exec_UPDATECOMMANDS
);
3310 SET_EXPECT(Exec_SETTITLE
);
3312 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
3314 while(!called_Exec_HTTPEQUIV_DONE
&& GetMessage(&msg
, NULL
, 0, 0)) {
3315 TranslateMessage(&msg
);
3316 DispatchMessage(&msg
);
3319 if(flags
& DWL_VERBDONE
)
3320 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3321 if(flags
& DWL_HTTP
)
3322 SET_CALLED(Exec_SETPROGRESSMAX
);
3323 if((flags
& DWL_VERBDONE
) && !load_from_stream
) {
3325 todo_wine
CHECK_CALLED(GetHostInfo
);
3327 CHECK_CALLED(GetHostInfo
);
3329 CHECK_CALLED(SetStatusText
);
3330 if(!(flags
& DWL_EMPTY
))
3331 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
3332 CHECK_CALLED(OnViewChange
);
3334 CHECK_CALLED(GetDropTarget
);
3336 SET_CALLED(GetDropTarget
);
3337 if(flags
& DWL_TRYCSS
)
3338 SET_CALLED(Exec_ShellDocView_84
);
3339 if(flags
& DWL_CSS
) {
3340 CHECK_CALLED(CreateInstance
);
3341 CHECK_CALLED(Start
);
3342 CHECK_CALLED(LockRequest
);
3343 CHECK_CALLED(Terminate
);
3344 CHECK_CALLED(Protocol_Read
);
3345 CHECK_CALLED(UnlockRequest
);
3347 SET_CALLED(Exec_Explorer_69
);
3348 SET_CALLED(EnableModeless_TRUE
); /* IE7 */
3349 SET_CALLED(Frame_EnableModeless_TRUE
); /* IE7 */
3350 SET_CALLED(EnableModeless_FALSE
); /* IE7 */
3351 SET_CALLED(Frame_EnableModeless_FALSE
); /* IE7 */
3353 todo_wine
CHECK_CALLED(Exec_ShellDocView_37
);
3354 if(flags
& DWL_HTTP
) todo_wine
{
3355 CHECK_CALLED(OnChanged_1012
);
3356 CHECK_CALLED(Exec_HTTPEQUIV
);
3357 CHECK_CALLED(Exec_SETTITLE
);
3359 CHECK_CALLED(OnChanged_1005
);
3360 CHECK_CALLED(OnChanged_READYSTATE
);
3361 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3362 if(!(flags
& DWL_EMPTY
))
3363 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
3364 SET_CALLED(Exec_ShellDocView_103
);
3365 SET_CALLED(Exec_ShellDocView_105
);
3366 SET_CALLED(Exec_ShellDocView_140
);
3367 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
3368 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
3369 SET_CALLED(SetStatusText
);
3370 if(navigated_load
) { /* avoiding race, FIXME: fund better way */
3371 SET_CALLED(UpdateUI
);
3372 SET_CALLED(Exec_UPDATECOMMANDS
);
3373 SET_CALLED(Exec_SETTITLE
);
3376 load_state
= LD_COMPLETE
;
3378 test_readyState(NULL
);
3381 static void test_Persist(IHTMLDocument2
*doc
, IMoniker
*mon
)
3383 IPersistMoniker
*persist_mon
;
3384 IPersistFile
*persist_file
;
3388 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&persist_file
);
3389 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
3390 if(SUCCEEDED(hres
)) {
3391 hres
= IPersist_GetClassID(persist_file
, NULL
);
3392 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
3394 hres
= IPersist_GetClassID(persist_file
, &guid
);
3395 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
3396 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
3398 IPersist_Release(persist_file
);
3401 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&persist_mon
);
3402 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
3403 if(SUCCEEDED(hres
)) {
3404 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
3405 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
3407 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
3408 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
3409 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
3411 if(load_state
== LD_DOLOAD
)
3412 test_Load(persist_mon
, mon
);
3414 test_readyState((IUnknown
*)doc
);
3416 IPersistMoniker_Release(persist_mon
);
3420 static void test_put_href(IHTMLDocument2
*doc
)
3422 IHTMLPrivateWindow
*priv_window
;
3423 IHTMLWindow2
*window
;
3424 IHTMLLocation
*location
;
3430 hres
= IHTMLDocument2_get_location(doc
, &location
);
3431 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
3432 ok(location
!= NULL
, "location == NULL\n");
3434 SET_EXPECT(TranslateUrl
);
3435 SET_EXPECT(Navigate
);
3436 str
= a2bstr("about:blank");
3437 hres
= IHTMLLocation_put_href(location
, str
);
3438 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
3439 CHECK_CALLED(TranslateUrl
);
3440 CHECK_CALLED(Navigate
);
3442 IHTMLLocation_Release(location
);
3444 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3445 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3447 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
3448 IHTMLWindow2_Release(window
);
3449 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres
);
3451 readystate_set_loading
= TRUE
;
3452 navigated_load
= TRUE
;
3453 SET_EXPECT(TranslateUrl
);
3454 SET_EXPECT(Exec_ShellDocView_67
);
3455 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3456 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3457 SET_EXPECT(OnChanged_READYSTATE
);
3458 SET_EXPECT(Exec_ShellDocView_63
);
3461 V_VT(&vempty
) = VT_EMPTY
;
3462 hres
= IHTMLPrivateWindow_SuperNavigate(priv_window
, str
, str2
, NULL
, NULL
, &vempty
, &vempty
, 0);
3464 SysFreeString(str2
);
3465 ok(hres
== S_OK
, "SuperNavigate failed: %08x\n", hres
);
3467 CHECK_CALLED(TranslateUrl
);
3468 CHECK_CALLED(Exec_ShellDocView_67
);
3469 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3470 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3471 SET_CALLED(OnChanged_READYSTATE
); /* not always called */
3472 CHECK_CALLED(Exec_ShellDocView_63
);
3474 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
3475 IHTMLPrivateWindow_Release(priv_window
);
3477 test_download(DWL_VERBDONE
);
3480 static void test_open_window(IHTMLDocument2
*doc
)
3482 IHTMLWindow2
*window
, *new_window
;
3486 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3487 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3489 url
= a2bstr("about:blank");
3490 name
= a2bstr("test");
3491 new_window
= (void*)0xdeadbeef;
3495 SET_EXPECT(TranslateUrl
);
3496 SET_EXPECT(EvaluateNewWindow
);
3498 hres
= IHTMLWindow2_open(window
, url
, name
, NULL
, VARIANT_FALSE
, &new_window
);
3500 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
3502 ok(new_window
== NULL
, "new_window != NULL\n");
3505 CHECK_CALLED(TranslateUrl
);
3507 CHECK_CALLED(EvaluateNewWindow
);
3511 SysFreeString(name
);
3513 IHTMLWindow2_Release(window
);
3514 SysFreeString(name
);
3517 static void test_clear(IHTMLDocument2
*doc
)
3521 hres
= IHTMLDocument2_clear(doc
);
3522 ok(hres
== S_OK
, "clear failed: %08x\n", hres
);
3525 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
3527 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
3528 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
3529 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
3530 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
3531 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
3532 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
3533 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
3534 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
3535 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
3536 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
3537 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
3538 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
3539 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
3540 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
3541 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
3542 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
3543 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
3544 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
3545 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
3546 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
3548 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
3549 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
3551 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
3553 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
3555 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
3556 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
3558 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
3559 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
3561 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
3563 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
3564 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
3567 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3568 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
3570 IOleCommandTarget
*cmdtrg
;
3571 OLECMD olecmd
= {cmdid
, 0};
3574 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3575 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
3579 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
3580 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
3582 IOleCommandTarget_Release(cmdtrg
);
3584 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
3585 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
3588 static void test_MSHTML_QueryStatus(IHTMLDocument2
*doc
, DWORD cmdf
)
3590 IUnknown
*unk
= doc
? (IUnknown
*)doc
: doc_unk
;
3592 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
3593 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
3594 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
3595 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
3596 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
3597 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
3598 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
3599 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
3600 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
3601 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
3602 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
3603 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
3604 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
3605 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
3606 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
3607 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
3610 static void test_OleCommandTarget(IHTMLDocument2
*doc
)
3612 IOleCommandTarget
*cmdtrg
;
3613 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
3617 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3618 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
3622 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3623 cmds
[i
].cmdID
= i
+1;
3624 cmds
[i
].cmdf
= 0xf0f0;
3627 SET_EXPECT(QueryStatus_OPEN
);
3628 SET_EXPECT(QueryStatus_NEW
);
3629 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
3630 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
3631 CHECK_CALLED(QueryStatus_OPEN
);
3632 CHECK_CALLED(QueryStatus_NEW
);
3634 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3635 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
3636 if(i
+1 == OLECMDID_FIND
)
3638 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
3639 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
3642 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
3643 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
3645 IOleCommandTarget_Release(cmdtrg
);
3648 static void test_OleCommandTarget_fail(IHTMLDocument2
*doc
)
3650 IOleCommandTarget
*cmdtrg
;
3655 {OLECMDID_OPEN
, 0xf0f0},
3656 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
3659 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3660 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
3664 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
3665 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
3667 SET_EXPECT(QueryStatus_OPEN
);
3668 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
3669 CHECK_CALLED(QueryStatus_OPEN
);
3671 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3672 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3673 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
3674 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
3675 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
3676 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
3677 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
3679 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
3680 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
3681 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
3683 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3684 if(!expect_cmds
[i
]) {
3685 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
3686 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3687 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3688 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3692 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
3693 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3694 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3695 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3697 IOleCommandTarget_Release(cmdtrg
);
3700 static void test_exec_onunload(IHTMLDocument2
*doc
)
3702 IOleCommandTarget
*cmdtrg
;
3706 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3707 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3711 memset(&var
, 0x0a, sizeof(var
));
3712 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
3713 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
3714 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
3715 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
3716 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
3718 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
3719 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3720 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
3722 IOleCommandTarget_Release(cmdtrg
);
3725 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
3727 IOleCommandTarget
*cmdtrg
;
3730 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3731 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3738 load_state
= LD_DOLOAD
;
3741 SET_EXPECT(GetClassID
);
3742 SET_EXPECT(SetStatusText
);
3743 SET_EXPECT(Exec_ShellDocView_37
);
3744 SET_EXPECT(GetHostInfo
);
3746 SET_EXPECT(GetDisplayName
);
3747 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3748 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3749 SET_EXPECT(OnChanged_READYSTATE
);
3750 SET_EXPECT(IsSystemMoniker
);
3751 SET_EXPECT(Exec_ShellDocView_84
);
3753 SET_EXPECT(BindToStorage
);
3754 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3757 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
3759 expect_status_text
= NULL
;
3760 readystate_set_loading
= TRUE
;
3762 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3763 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3764 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3767 CHECK_CALLED(GetClassID
);
3768 CHECK_CALLED(SetStatusText
);
3769 CHECK_CALLED(Exec_ShellDocView_37
);
3770 CHECK_CALLED(GetHostInfo
);
3772 CHECK_CALLED(GetDisplayName
);
3773 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3774 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3775 CHECK_CALLED(OnChanged_READYSTATE
);
3776 SET_CALLED(IsSystemMoniker
); /* IE7 */
3777 SET_CALLED(Exec_ShellDocView_84
);
3779 CHECK_CALLED(BindToStorage
);
3780 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3781 CHECK_CALLED(HideUI
);
3782 CHECK_CALLED(ShowUI
);
3783 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
3785 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
3787 IOleCommandTarget_Release(cmdtrg
);
3789 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3790 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3791 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3794 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
3796 IOleCommandTarget
*cmdtrg
;
3797 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
3800 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3801 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
3808 V_BSTR(in
) = SysAllocString(name
);
3814 V_I4(out
) = 0xdeadbeef;
3817 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
3818 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
3824 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
3825 if(V_VT(out
) == VT_BSTR
) {
3827 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
3828 "unexpected fontname %s\n", wine_dbgstr_w(name
));
3830 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
3835 IOleCommandTarget_Release(cmdtrg
);
3838 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
3840 IOleCommandTarget
*cmdtrg
;
3843 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3844 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3848 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
3849 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3850 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3852 IOleCommandTarget_Release(cmdtrg
);
3855 static void test_IsDirty(IHTMLDocument2
*doc
, HRESULT exhres
)
3857 IPersistStreamInit
*perinit
;
3858 IPersistMoniker
*permon
;
3859 IPersistFile
*perfile
;
3862 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&perinit
);
3863 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
3864 if(SUCCEEDED(hres
)) {
3865 hres
= IPersistStreamInit_IsDirty(perinit
);
3866 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3867 IPersistStreamInit_Release(perinit
);
3870 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&permon
);
3871 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
3872 if(SUCCEEDED(hres
)) {
3873 hres
= IPersistMoniker_IsDirty(permon
);
3874 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3875 IPersistMoniker_Release(permon
);
3878 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&perfile
);
3879 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
3880 if(SUCCEEDED(hres
)) {
3881 hres
= IPersistFile_IsDirty(perfile
);
3882 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3883 IPersistFile_Release(perfile
);
3887 static HWND
create_container_window(void)
3889 static const WCHAR wszHTMLDocumentTest
[] =
3890 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3891 static WNDCLASSEXW wndclass
= {
3892 sizeof(WNDCLASSEXW
),
3895 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
3896 wszHTMLDocumentTest
,
3900 RegisterClassExW(&wndclass
);
3901 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
3902 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
3903 515, 530, NULL
, NULL
, NULL
, NULL
);
3906 static void test_DoVerb(IOleObject
*oleobj
)
3908 RECT rect
= {0,0,500,500};
3911 if(!container_locked
) {
3912 SET_EXPECT(GetContainer
);
3913 SET_EXPECT(LockContainer
);
3915 SET_EXPECT(ActivateMe
);
3916 expect_LockContainer_fLock
= TRUE
;
3918 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
3919 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
3921 if(!container_locked
) {
3922 CHECK_CALLED(GetContainer
);
3923 CHECK_CALLED(LockContainer
);
3924 container_locked
= TRUE
;
3926 CHECK_CALLED(ActivateMe
);
3929 #define CLIENTSITE_EXPECTPATH 0x00000001
3930 #define CLIENTSITE_SETNULL 0x00000002
3931 #define CLIENTSITE_DONTSET 0x00000004
3933 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
3935 IOleClientSite
*clientsite
;
3938 if(flags
& CLIENTSITE_SETNULL
) {
3939 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3940 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
3942 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
3943 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3945 set_clientsite
= FALSE
;
3948 if(flags
& CLIENTSITE_DONTSET
)
3951 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3952 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
3953 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
3954 clientsite
, set_clientsite
? &ClientSite
: NULL
);
3956 if(!set_clientsite
) {
3957 SET_EXPECT(GetHostInfo
);
3958 if(flags
& CLIENTSITE_EXPECTPATH
) {
3959 SET_EXPECT(GetOptionKeyPath
);
3960 SET_EXPECT(GetOverrideKeyPath
);
3962 SET_EXPECT(GetWindow
);
3963 if(flags
& CLIENTSITE_EXPECTPATH
)
3964 SET_EXPECT(Exec_DOCCANNAVIGATE
);
3965 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3966 SET_EXPECT(Exec_SETPROGRESSMAX
);
3967 SET_EXPECT(Exec_SETPROGRESSPOS
);
3968 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3969 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3970 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3971 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3972 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3973 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3975 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
3976 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3978 CHECK_CALLED(GetHostInfo
);
3979 if(flags
& CLIENTSITE_EXPECTPATH
) {
3980 CHECK_CALLED(GetOptionKeyPath
);
3981 CHECK_CALLED(GetOverrideKeyPath
);
3983 CHECK_CALLED(GetWindow
);
3984 if(flags
& CLIENTSITE_EXPECTPATH
)
3985 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
3986 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
3987 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3988 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3989 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3990 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3991 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3992 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3993 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3994 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3996 set_clientsite
= TRUE
;
3999 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
4000 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
4002 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
4003 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
4004 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
4007 static void test_OnAmbientPropertyChange(IHTMLDocument2
*doc
)
4009 IOleControl
*control
= NULL
;
4012 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
4013 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4017 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
4018 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
4019 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4020 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4022 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4023 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
4024 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4025 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4027 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4028 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4029 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
4030 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4031 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4032 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4034 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4035 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4036 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
4037 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4038 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4039 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4041 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
4042 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
4043 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4044 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4046 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
4047 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4048 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4049 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
4051 IOleControl_Release(control
);
4056 static void test_OnAmbientPropertyChange2(IHTMLDocument2
*doc
)
4058 IOleControl
*control
= NULL
;
4061 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
4062 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4066 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4067 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
4069 IOleControl_Release(control
);
4072 static void test_Close(IHTMLDocument2
*doc
, BOOL set_client
)
4074 IOleObject
*oleobj
= NULL
;
4077 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4078 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4082 SET_EXPECT(GetContainer
);
4083 SET_EXPECT(LockContainer
);
4084 expect_LockContainer_fLock
= FALSE
;
4085 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
4086 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
4087 CHECK_CALLED(GetContainer
);
4088 CHECK_CALLED(LockContainer
);
4089 container_locked
= FALSE
;
4092 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
4094 IOleObject_Release(oleobj
);
4097 static void test_Advise(IHTMLDocument2
*doc
)
4099 IOleObject
*oleobj
= NULL
;
4100 IEnumSTATDATA
*enum_advise
= (void*)0xdeadbeef;
4104 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4105 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4109 hres
= IOleObject_Unadvise(oleobj
, 0);
4110 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
4112 hres
= IOleObject_EnumAdvise(oleobj
, &enum_advise
);
4113 ok(hres
== S_OK
, "EnumAdvise returned: %08x\n", hres
);
4114 ok(enum_advise
== NULL
, "enum_advise != NULL\n");
4117 hres
= IOleObject_Advise(oleobj
, NULL
, &conn
);
4118 /* Old IE returns S_OK and sets conn to 1 */
4119 ok(hres
== E_INVALIDARG
|| hres
== S_OK
, "Advise returned: %08x\n", hres
);
4120 ok(conn
== 0 || conn
== 1, "conn = %d\n", conn
);
4122 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, NULL
);
4123 ok(hres
== E_INVALIDARG
, "Advise returned: %08x\n", hres
);
4125 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4126 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
4127 ok(conn
== 1, "conn = %d\n", conn
);
4129 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4130 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
4131 ok(conn
== 2, "conn = %d\n", conn
);
4133 hres
= IOleObject_Unadvise(oleobj
, 1);
4134 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
4136 hres
= IOleObject_Unadvise(oleobj
, 1);
4137 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
4139 hres
= IOleObject_Unadvise(oleobj
, 2);
4140 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
4142 IOleObject_Release(oleobj
);
4145 static void test_OnFrameWindowActivate(IUnknown
*unk
)
4147 IOleInPlaceActiveObject
*inplaceact
;
4150 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
4151 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
4155 if(set_clientsite
) {
4156 expect_OnFrameWindowActivate_fActivate
= TRUE
;
4157 SET_EXPECT(OnFrameWindowActivate
);
4158 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4159 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4160 CHECK_CALLED(OnFrameWindowActivate
);
4162 SET_EXPECT(OnFrameWindowActivate
);
4163 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4164 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4165 CHECK_CALLED(OnFrameWindowActivate
);
4167 expect_OnFrameWindowActivate_fActivate
= FALSE
;
4168 SET_EXPECT(OnFrameWindowActivate
);
4169 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
4170 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4171 CHECK_CALLED(OnFrameWindowActivate
);
4173 expect_OnFrameWindowActivate_fActivate
= TRUE
;
4174 SET_EXPECT(OnFrameWindowActivate
);
4175 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4176 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4177 CHECK_CALLED(OnFrameWindowActivate
);
4179 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
4180 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4182 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4183 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4186 IOleInPlaceActiveObject_Release(inplaceact
);
4189 static void test_InPlaceDeactivate(IHTMLDocument2
*doc
, BOOL expect_call
)
4191 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
4194 hres
= IUnknown_QueryInterface(doc
, &IID_IOleInPlaceObjectWindowless
,
4195 (void**)&windowlessobj
);
4196 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
4201 SET_EXPECT(OnFocus_FALSE
);
4203 SET_EXPECT(OnInPlaceDeactivateEx
);
4205 SET_EXPECT(OnInPlaceDeactivate
);
4207 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
4208 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
4210 CHECK_CALLED(OnFocus_FALSE
);
4212 CHECK_CALLED(OnInPlaceDeactivateEx
);
4214 CHECK_CALLED(OnInPlaceDeactivate
);
4217 IOleInPlaceObjectWindowless_Release(windowlessobj
);
4220 static void test_Activate(IHTMLDocument2
*doc
, DWORD flags
)
4222 IOleObject
*oleobj
= NULL
;
4223 IOleDocumentView
*docview
;
4230 IOleDocumentView_Release(view
);
4233 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4234 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4236 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
4237 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
4239 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
4240 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
4241 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
4243 test_OnFrameWindowActivate((IUnknown
*)doc
);
4245 test_ClientSite(oleobj
, flags
);
4246 test_InPlaceDeactivate(doc
, FALSE
);
4247 test_DoVerb(oleobj
);
4249 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4250 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
4251 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
4253 SET_EXPECT(OnFocus_TRUE
);
4254 SET_EXPECT(SetActiveObject
);
4256 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4257 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
4258 expect_status_text
= NULL
;
4260 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
4261 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
4263 CHECK_CALLED(OnFocus_TRUE
);
4264 CHECK_CALLED(SetActiveObject
);
4265 CHECK_CALLED(ShowUI
);
4266 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4267 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
4269 IOleDocumentView_Release(docview
);
4272 IOleObject_Release(oleobj
);
4274 test_OnFrameWindowActivate((IUnknown
*)doc
);
4277 static void test_Window(IHTMLDocument2
*doc
, BOOL expect_success
)
4279 IOleInPlaceActiveObject
*activeobject
= NULL
;
4283 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
4284 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
4288 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
4290 if(expect_success
) {
4291 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
4292 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
4294 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
4295 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
4298 IOleInPlaceActiveObject_Release(activeobject
);
4301 static void test_CloseView(void)
4303 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
4309 hres
= IOleDocumentView_Show(view
, FALSE
);
4310 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
4312 hres
= IOleDocumentView_CloseView(view
, 0);
4313 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
4315 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
4316 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
4318 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
4319 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
4320 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
4323 static void test_UIDeactivate(void)
4327 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4328 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4330 if(call_UIActivate
!= CallUIActivate_None
) {
4331 SET_EXPECT(SetActiveObject_null
);
4333 SET_EXPECT(OnUIDeactivate
);
4336 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
4337 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
4339 if(call_UIActivate
!= CallUIActivate_None
) {
4340 CHECK_CALLED(SetActiveObject_null
);
4341 CHECK_CALLED(HideUI
);
4342 CHECK_CALLED(OnUIDeactivate
);
4344 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4345 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4349 static void test_Hide(void)
4356 hres
= IOleDocumentView_Show(view
, FALSE
);
4357 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
4360 static HRESULT
create_document(IHTMLDocument2
**doc
)
4362 IHTMLDocument5
*doc5
;
4365 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
4366 &IID_IHTMLDocument2
, (void**)doc
);
4367 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
4371 hres
= IHTMLDocument2_QueryInterface(*doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
4372 if(SUCCEEDED(hres
)) {
4373 IHTMLDocument5_Release(doc5
);
4375 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
4376 IHTMLDocument2_Release(*doc
);
4382 static void test_Navigate(IHTMLDocument2
*doc
)
4384 IHlinkTarget
*hlink
;
4387 hres
= IUnknown_QueryInterface(doc
, &IID_IHlinkTarget
, (void**)&hlink
);
4388 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
4390 SET_EXPECT(ActivateMe
);
4391 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
4392 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
4393 CHECK_CALLED(ActivateMe
);
4395 IHlinkTarget_Release(hlink
);
4398 static void test_external(IHTMLDocument2
*doc
, BOOL initialized
)
4400 IDispatch
*external
;
4401 IHTMLWindow2
*htmlwin
;
4404 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
4405 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4408 SET_EXPECT(GetExternal
);
4409 external
= (void*)0xdeadbeef;
4410 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
4412 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
4413 CHECK_CALLED(GetExternal
);
4414 ok(external
!= NULL
, "external == NULL\n");
4416 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
4417 ok(external
== NULL
, "external != NULL\n");
4420 IHTMLWindow2_Release(htmlwin
);
4423 static void test_StreamLoad(IHTMLDocument2
*doc
)
4425 IPersistStreamInit
*init
;
4428 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
4429 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
4433 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4434 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4435 SET_EXPECT(Exec_ShellDocView_37
);
4436 SET_EXPECT(OnChanged_READYSTATE
);
4438 readystate_set_loading
= TRUE
;
4440 hres
= IPersistStreamInit_Load(init
, &Stream
);
4441 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4443 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4444 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4445 CHECK_CALLED(Exec_ShellDocView_37
);
4446 CHECK_CALLED(OnChanged_READYSTATE
);
4449 test_timer(EXPECT_SETTITLE
);
4450 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4452 IPersistStreamInit_Release(init
);
4455 static void test_StreamInitNew(IHTMLDocument2
*doc
)
4457 IPersistStreamInit
*init
;
4460 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
4461 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
4465 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4466 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4467 SET_EXPECT(Exec_ShellDocView_37
);
4468 SET_EXPECT(OnChanged_READYSTATE
);
4469 readystate_set_loading
= TRUE
;
4471 hres
= IPersistStreamInit_InitNew(init
);
4472 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4474 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4475 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4476 CHECK_CALLED(Exec_ShellDocView_37
);
4477 CHECK_CALLED(OnChanged_READYSTATE
);
4479 test_timer(EXPECT_SETTITLE
);
4480 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4482 IPersistStreamInit_Release(init
);
4485 static void test_QueryInterface(IHTMLDocument2
*doc
)
4490 static const IID IID_UndocumentedScriptIface
=
4491 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
4493 qi
= (void*)0xdeadbeef;
4494 hres
= IUnknown_QueryInterface(doc
, &IID_IRunnableObject
, (void**)&qi
);
4495 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4496 ok(qi
== NULL
, "qirunnable=%p, expected NULL\n", qi
);
4498 qi
= (void*)0xdeadbeef;
4499 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&qi
);
4500 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4501 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4503 qi
= (void*)0xdeadbeef;
4504 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode2
, (void**)&qi
);
4505 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4506 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4508 qi
= (void*)0xdeadbeef;
4509 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistPropertyBag
, (void**)&qi
);
4510 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4511 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4513 qi
= (void*)0xdeadbeef;
4514 hres
= IUnknown_QueryInterface(doc
, &IID_UndocumentedScriptIface
, (void**)&qi
);
4515 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4516 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4518 qi
= (void*)0xdeadbeef;
4519 hres
= IUnknown_QueryInterface(doc
, &IID_IMarshal
, (void**)&qi
);
4520 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4521 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4523 qi
= (void*)0xdeadbeef;
4524 hres
= IUnknown_QueryInterface(doc
, &IID_IExternalConnection
, (void**)&qi
);
4525 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4526 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4528 qi
= (void*)0xdeadbeef;
4529 hres
= IUnknown_QueryInterface(doc
, &IID_IStdMarshalInfo
, (void**)&qi
);
4530 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4531 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4533 hres
= IUnknown_QueryInterface(doc
, &IID_IDispatch
, (void**)&qi
);
4534 ok(hres
== S_OK
, "Could not get IDispatch interface: %08x\n", hres
);
4535 ok(qi
!= (IUnknown
*)doc
, "disp == doc\n");
4536 IUnknown_Release(qi
);
4539 static void init_test(enum load_state_t ls
) {
4541 hwnd
= last_hwnd
= NULL
;
4542 set_clientsite
= FALSE
;
4543 load_from_stream
= FALSE
;
4544 call_UIActivate
= CallUIActivate_None
;
4550 inplace_deactivated
= FALSE
;
4551 navigated_load
= FALSE
;
4554 static void test_HTMLDocument(BOOL do_load
)
4556 IHTMLDocument2
*doc
;
4560 trace("Testing HTMLDocument (%s)...\n", (do_load
? "load" : "no load"));
4562 init_test(do_load
? LD_DOLOAD
: LD_NO
);
4564 hres
= create_document(&doc
);
4567 doc_unk
= (IUnknown
*)doc
;
4569 test_QueryInterface(doc
);
4571 test_IsDirty(doc
, S_FALSE
);
4572 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4573 test_external(doc
, FALSE
);
4574 test_ViewAdviseSink(doc
);
4575 test_ConnectionPointContainer(doc
);
4576 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4577 test_Persist(doc
, &Moniker
);
4579 test_OnAmbientPropertyChange2(doc
);
4581 test_Activate(doc
, CLIENTSITE_EXPECTPATH
);
4584 test_download(DWL_CSS
|DWL_TRYCSS
);
4585 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4588 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4589 test_OleCommandTarget_fail(doc
);
4590 test_OleCommandTarget(doc
);
4591 test_OnAmbientPropertyChange(doc
);
4592 test_Window(doc
, TRUE
);
4593 test_external(doc
, TRUE
);
4595 test_UIDeactivate();
4596 test_OleCommandTarget(doc
);
4597 test_Window(doc
, TRUE
);
4598 test_InPlaceDeactivate(doc
, TRUE
);
4600 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4601 * MSHTML. It doesn't with Wine. */
4603 test_Window(doc
, FALSE
);
4605 test_InPlaceDeactivate(doc
, FALSE
);
4607 test_Close(doc
, FALSE
);
4609 /* Activate HTMLDocument again */
4610 test_Activate(doc
, CLIENTSITE_SETNULL
);
4611 test_Window(doc
, TRUE
);
4612 test_OleCommandTarget(doc
);
4613 test_UIDeactivate();
4614 test_InPlaceDeactivate(doc
, TRUE
);
4615 test_Close(doc
, FALSE
);
4617 /* Activate HTMLDocument again, this time without UIActivate */
4618 call_UIActivate
= CallUIActivate_None
;
4619 test_Activate(doc
, CLIENTSITE_SETNULL
);
4620 test_Window(doc
, TRUE
);
4622 test_UIDeactivate();
4623 test_InPlaceDeactivate(doc
, TRUE
);
4626 test_Close(doc
, TRUE
);
4627 test_OnAmbientPropertyChange2(doc
);
4628 test_GetCurMoniker((IUnknown
*)doc
, do_load
? &Moniker
: NULL
, NULL
);
4631 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4632 call_UIActivate
= CallUIActivate_AfterShow
;
4633 test_Activate(doc
, 0);
4634 test_Window(doc
, TRUE
);
4635 test_OleCommandTarget(doc
);
4636 test_UIDeactivate();
4637 test_InPlaceDeactivate(doc
, TRUE
);
4638 test_Close(doc
, FALSE
);
4639 call_UIActivate
= CallUIActivate_None
;
4643 IOleDocumentView_Release(view
);
4646 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
4648 ref
= IHTMLDocument2_Release(doc
);
4649 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4651 ok(!IsWindow(hwnd
), "hwnd is not destroyed\n");
4654 static void test_HTMLDocument_hlink(void)
4656 IHTMLDocument2
*doc
;
4660 trace("Testing HTMLDocument (hlink)...\n");
4662 init_test(LD_DOLOAD
);
4665 hres
= create_document(&doc
);
4668 doc_unk
= (IUnknown
*)doc
;
4670 test_ViewAdviseSink(doc
);
4671 test_ConnectionPointContainer(doc
);
4672 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4673 test_Persist(doc
, &Moniker
);
4676 IUnknown_Release(doc
);
4680 test_download(DWL_CSS
|DWL_TRYCSS
);
4682 test_IsDirty(doc
, S_FALSE
);
4683 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4685 test_exec_onunload(doc
);
4686 test_Window(doc
, TRUE
);
4687 test_InPlaceDeactivate(doc
, TRUE
);
4688 test_Close(doc
, FALSE
);
4689 test_IsDirty(doc
, S_FALSE
);
4690 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4692 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4695 IOleDocumentView_Release(view
);
4698 ref
= IHTMLDocument2_Release(doc
);
4699 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4702 static void test_cookies(IHTMLDocument2
*doc
)
4710 hres
= IHTMLDocument2_get_cookie(doc
, &str
);
4711 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4713 size
= sizeof(buf
)/sizeof(WCHAR
);
4714 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4715 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4716 ok(!lstrcmpW(buf
, str
), "cookie = %s, expected %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(buf
));
4720 str
= a2bstr("test=testval");
4721 hres
= IHTMLDocument2_put_cookie(doc
, str
);
4722 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
4725 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
4726 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4727 ok(str2
!= NULL
, "cookie = NULL\n");
4728 size
= sizeof(buf
)/sizeof(WCHAR
);
4729 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4730 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4731 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
4732 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
4734 SysFreeString(str2
);
4736 str
= a2bstr("test=testval2");
4737 hres
= IHTMLDocument2_put_cookie(doc
, str
);
4738 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
4741 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
4742 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4743 ok(str2
!= NULL
, "cookie = NULL\n");
4744 size
= sizeof(buf
)/sizeof(WCHAR
);
4745 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4746 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4747 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
4748 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
4750 SysFreeString(str2
);
4753 static void test_HTMLDocument_http(void)
4756 IHTMLDocument2
*doc
;
4760 trace("Testing HTMLDocument (http)...\n");
4762 if(!winetest_interactive
&& is_ie_hardened()) {
4763 win_skip("IE running in Enhanced Security Configuration\n");
4767 init_test(LD_DOLOAD
);
4770 hres
= create_document(&doc
);
4773 doc_unk
= (IUnknown
*)doc
;
4775 hres
= CreateURLMoniker(NULL
, http_urlW
, &http_mon
);
4776 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
4778 test_ViewAdviseSink(doc
);
4779 test_ConnectionPointContainer(doc
);
4780 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4781 test_Persist(doc
, http_mon
);
4784 IUnknown_Release(doc
);
4788 test_download(DWL_HTTP
);
4790 test_IsDirty(doc
, S_FALSE
);
4791 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4792 test_GetCurMoniker((IUnknown
*)doc
, http_mon
, NULL
);
4795 test_open_window(doc
);
4797 test_InPlaceDeactivate(doc
, TRUE
);
4798 test_Close(doc
, FALSE
);
4799 test_IsDirty(doc
, S_FALSE
);
4800 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4803 IOleDocumentView_Release(view
);
4806 ref
= IHTMLDocument2_Release(doc
);
4807 ok(!ref
, "ref=%d, expected 0\n", ref
);
4809 ref
= IMoniker_Release(http_mon
);
4810 ok(!ref
, "ref=%d, expected 0\n", ref
);
4813 static void test_QueryService(IHTMLDocument2
*doc
, BOOL success
)
4815 IServiceProvider
*sp
;
4819 hres
= IUnknown_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&sp
);
4820 ok(hres
== S_OK
, "QueryService returned %08x\n", hres
);
4822 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
4824 IHlinkFrame_Release(hf
);
4826 ok(hres
== (success
?S_OK
:E_NOINTERFACE
), "QueryService returned %08x, expected %08x\n", hres
, success
?S_OK
:E_NOINTERFACE
);
4828 IServiceProvider_Release(sp
);
4831 static void test_HTMLDocument_StreamLoad(void)
4833 IHTMLDocument2
*doc
;
4839 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4841 init_test(LD_DOLOAD
);
4842 load_from_stream
= TRUE
;
4844 hres
= create_document(&doc
);
4847 doc_unk
= (IUnknown
*)doc
;
4849 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4850 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4852 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4853 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4855 test_readyState((IUnknown
*)doc
);
4856 test_IsDirty(doc
, S_FALSE
);
4857 test_ViewAdviseSink(doc
);
4858 test_ConnectionPointContainer(doc
);
4859 test_QueryService(doc
, FALSE
);
4860 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
4861 test_QueryService(doc
, TRUE
);
4862 test_DoVerb(oleobj
);
4863 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4865 IOleObject_Release(oleobj
);
4867 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4868 test_StreamLoad(doc
);
4869 test_download(DWL_VERBDONE
|DWL_TRYCSS
);
4870 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4872 test_UIDeactivate();
4873 test_InPlaceDeactivate(doc
, TRUE
);
4874 SET_EXPECT(Advise_Close
);
4875 test_Close(doc
, FALSE
);
4876 CHECK_CALLED(Advise_Close
);
4877 test_IsDirty(doc
, S_FALSE
);
4880 IOleDocumentView_Release(view
);
4885 ref
= IHTMLDocument2_Release(doc
);
4886 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4889 static void test_HTMLDocument_StreamInitNew(void)
4891 IHTMLDocument2
*doc
;
4897 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4899 init_test(LD_DOLOAD
);
4900 load_from_stream
= TRUE
;
4902 hres
= create_document(&doc
);
4905 doc_unk
= (IUnknown
*)doc
;
4907 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4908 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4910 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4911 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4913 test_readyState((IUnknown
*)doc
);
4914 test_IsDirty(doc
, S_FALSE
);
4915 test_ViewAdviseSink(doc
);
4916 test_ConnectionPointContainer(doc
);
4917 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
4918 test_DoVerb(oleobj
);
4919 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4921 IOleObject_Release(oleobj
);
4923 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4924 test_StreamInitNew(doc
);
4925 test_download(DWL_VERBDONE
|DWL_TRYCSS
|DWL_EMPTY
);
4926 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4928 test_UIDeactivate();
4929 test_InPlaceDeactivate(doc
, TRUE
);
4930 SET_EXPECT(Advise_Close
);
4931 test_Close(doc
, FALSE
);
4932 CHECK_CALLED(Advise_Close
);
4933 test_IsDirty(doc
, S_FALSE
);
4936 IOleDocumentView_Release(view
);
4941 ref
= IHTMLDocument2_Release(doc
);
4942 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4945 static void test_edit_uiactivate(IOleObject
*oleobj
)
4947 IOleDocumentView
*docview
;
4950 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
4951 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
4953 SET_EXPECT(OnFocus_TRUE
);
4954 SET_EXPECT(SetActiveObject
);
4956 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4957 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
4958 expect_status_text
= NULL
;
4960 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
4961 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
4963 CHECK_CALLED(OnFocus_TRUE
);
4964 CHECK_CALLED(SetActiveObject
);
4965 CHECK_CALLED(ShowUI
);
4966 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4967 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
4969 IOleDocumentView_Release(docview
);
4972 static void test_editing_mode(BOOL do_load
)
4974 IHTMLDocument2
*doc
;
4981 trace("Testing HTMLDocument (edit%s)...\n", do_load
? " load" : "");
4983 init_test(do_load
? LD_DOLOAD
: LD_NO
);
4984 call_UIActivate
= CallUIActivate_AfterShow
;
4986 hres
= create_document(&doc
);
4989 unk
= doc_unk
= (IUnknown
*)doc
;
4991 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4992 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4994 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4995 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4997 test_readyState((IUnknown
*)doc
);
4998 test_ViewAdviseSink(doc
);
4999 test_ConnectionPointContainer(doc
);
5000 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
5001 test_DoVerb(oleobj
);
5002 test_edit_uiactivate(oleobj
);
5004 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5006 test_Persist(doc
, &Moniker
);
5007 stream_read
= protocol_read
= 0;
5008 test_exec_editmode(unk
, do_load
);
5009 test_UIDeactivate();
5010 call_UIActivate
= CallUIActivate_None
;
5011 IOleObject_Release(oleobj
);
5013 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5014 test_download(DWL_VERBDONE
| (do_load
? DWL_CSS
|DWL_TRYCSS
: 0));
5016 SET_EXPECT(SetStatusText
); /* ignore race in native mshtml */
5017 test_timer(EXPECT_UPDATEUI
);
5018 SET_CALLED(SetStatusText
);
5020 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5023 test_exec_fontname(unk
, NULL
, wszTimesNewRoman
);
5024 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
5025 test_timer(EXPECT_UPDATEUI
);
5026 test_exec_fontname(unk
, NULL
, wszArial
);
5028 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
5029 test_timer(EXPECT_UPDATEUI
);
5030 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5031 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5033 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
5034 test_timer(EXPECT_UPDATEUI
);
5035 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5036 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5037 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
5038 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5040 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
5041 test_timer(EXPECT_UPDATEUI
);
5042 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
5043 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5046 test_UIDeactivate();
5047 test_InPlaceDeactivate(doc
, TRUE
);
5048 SET_EXPECT(Advise_Close
);
5049 test_Close(doc
, FALSE
);
5050 CHECK_CALLED(Advise_Close
);
5053 IOleDocumentView_Release(view
);
5057 ref
= IUnknown_Release(unk
);
5058 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5061 static void test_UIActivate(BOOL do_load
, BOOL use_ipsex
, BOOL use_ipsw
)
5063 IHTMLDocument2
*doc
;
5065 IOleInPlaceSite
*inplacesite
;
5069 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load
, use_ipsex
, use_ipsw
);
5071 init_test(do_load
? LD_DOLOAD
: LD_NO
);
5073 hres
= create_document(&doc
);
5076 doc_unk
= (IUnknown
*)doc
;
5081 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5082 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
5084 hres
= IUnknown_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&view
);
5085 ok(hres
== S_OK
, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres
);
5087 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
5088 SET_EXPECT(GetHostInfo
);
5089 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
5090 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5091 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5092 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
5093 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
5094 SET_EXPECT(GetOptionKeyPath
);
5095 SET_EXPECT(GetOverrideKeyPath
);
5096 SET_EXPECT(GetWindow
);
5097 SET_EXPECT(Exec_DOCCANNAVIGATE
);
5098 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
5099 SET_EXPECT(Exec_SETPROGRESSMAX
);
5100 SET_EXPECT(Exec_SETPROGRESSPOS
);
5102 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
5103 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5105 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
5106 CHECK_CALLED(GetHostInfo
);
5107 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
5108 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5109 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5110 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
5111 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
5112 CHECK_CALLED(GetOptionKeyPath
);
5113 CHECK_CALLED(GetOverrideKeyPath
);
5114 CHECK_CALLED(GetWindow
);
5115 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
5116 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
5117 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5118 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5120 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
5121 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
5122 ok(inplacesite
== NULL
, "inplacesite = %p, expected NULL\n", inplacesite
);
5124 SET_EXPECT(GetContainer
);
5125 SET_EXPECT(LockContainer
);
5126 SET_EXPECT(CanInPlaceActivate
);
5127 SET_EXPECT(GetWindowContext
);
5128 SET_EXPECT(GetWindow
);
5130 SET_EXPECT(OnInPlaceActivateEx
);
5131 SET_EXPECT(RequestUIActivate
);
5134 SET_EXPECT(OnInPlaceActivate
);
5135 SET_EXPECT(OnUIActivate
);
5136 SET_EXPECT(SetStatusText
);
5137 SET_EXPECT(Exec_SETPROGRESSMAX
);
5138 SET_EXPECT(Exec_SETPROGRESSPOS
);
5140 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5141 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
5142 SET_EXPECT(OnFocus_TRUE
);
5143 SET_EXPECT(SetActiveObject
);
5144 expect_LockContainer_fLock
= TRUE
;
5146 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
5147 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
5149 CHECK_CALLED(GetContainer
);
5150 CHECK_CALLED(LockContainer
);
5151 CHECK_CALLED(CanInPlaceActivate
);
5152 CHECK_CALLED(GetWindowContext
);
5153 CHECK_CALLED(GetWindow
);
5155 CHECK_CALLED(OnInPlaceActivateEx
);
5156 SET_EXPECT(RequestUIActivate
);
5159 CHECK_CALLED(OnInPlaceActivate
);
5160 CHECK_CALLED(OnUIActivate
);
5161 CHECK_CALLED(SetStatusText
);
5162 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5163 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5164 CHECK_CALLED(ShowUI
);
5165 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5166 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
5167 CHECK_CALLED(OnFocus_TRUE
);
5168 CHECK_CALLED(SetActiveObject
);
5169 container_locked
= TRUE
;
5171 SET_EXPECT(SetActiveObject_null
);
5172 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5174 SET_EXPECT(OnUIDeactivate
);
5176 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
5177 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
5179 CHECK_CALLED(SetActiveObject_null
);
5180 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5181 CHECK_CALLED(HideUI
);
5182 CHECK_CALLED(OnUIDeactivate
);
5184 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
5185 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
5186 ok(inplacesite
!= NULL
, "inplacesite = NULL\n");
5187 IOleInPlaceSite_Release(inplacesite
);
5189 SET_EXPECT(OnFocus_FALSE
);
5191 SET_EXPECT(OnInPlaceDeactivateEx
);
5193 SET_EXPECT(OnInPlaceDeactivate
);
5197 CHECK_CALLED(OnFocus_FALSE
);
5199 CHECK_CALLED(OnInPlaceDeactivateEx
);
5201 CHECK_CALLED(OnInPlaceDeactivate
);
5203 test_Close(doc
, TRUE
);
5205 IOleObject_Release(oleobj
);
5206 IOleDocumentView_Release(view
);
5209 ref
= IHTMLDocument2_Release(doc
);
5210 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5213 static void register_protocol(void)
5215 IInternetSession
*session
;
5218 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
5220 hres
= CoInternetGetSession(0, &session
, 0);
5221 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
5223 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
5224 wsz_winetest
, 0, NULL
, 0);
5225 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
5227 IInternetSession_Release(session
);
5230 static void test_HTMLDoc_ISupportErrorInfo(void)
5232 IHTMLDocument2
*doc
;
5234 ISupportErrorInfo
*sinfo
;
5237 hres
= create_document(&doc
);
5241 hres
= IUnknown_QueryInterface(doc
, &IID_ISupportErrorInfo
, (void**)&sinfo
);
5242 ok(hres
== S_OK
, "got %x\n", hres
);
5243 ok(sinfo
!= NULL
, "got %p\n", sinfo
);
5246 hres
= ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo
, &IID_IErrorInfo
);
5247 ok(hres
== S_FALSE
, "Expected S_OK, got %x\n", hres
);
5248 IUnknown_Release(sinfo
);
5251 ref
= IHTMLDocument2_Release(doc
);
5252 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5255 static void test_IPersistHistory(void)
5257 IHTMLDocument2
*doc
;
5260 IPersistHistory
*phist
;
5262 hres
= create_document(&doc
);
5266 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistHistory
, (void**)&phist
);
5267 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
5269 IPersistHistory_Release(phist
);
5271 ref
= IHTMLDocument2_Release(doc
);
5272 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5278 container_hwnd
= create_container_window();
5279 register_protocol();
5281 test_HTMLDocument_hlink();
5283 test_HTMLDocument(FALSE
);
5284 test_HTMLDocument(TRUE
);
5285 test_HTMLDocument_StreamLoad();
5286 test_HTMLDocument_StreamInitNew();
5287 test_editing_mode(FALSE
);
5288 test_editing_mode(TRUE
);
5289 test_HTMLDocument_http();
5290 test_UIActivate(FALSE
, FALSE
, FALSE
);
5291 test_UIActivate(FALSE
, TRUE
, FALSE
);
5292 test_UIActivate(FALSE
, TRUE
, TRUE
);
5293 test_UIActivate(TRUE
, FALSE
, FALSE
);
5294 test_UIActivate(TRUE
, TRUE
, FALSE
);
5295 test_UIActivate(TRUE
, TRUE
, TRUE
);
5297 test_HTMLDoc_ISupportErrorInfo();
5298 test_IPersistHistory();
5300 DestroyWindow(container_hwnd
);