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
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1373 static const GUID undocumented_frame_iid
= {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1375 if(!IsEqualGUID(&undocumented_frame_iid
, riid
))
1376 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
1379 return E_NOINTERFACE
;
1382 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1387 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1392 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1394 CHECK_EXPECT(Frame_GetWindow
);
1398 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1400 ok(0, "unexpected call\n");
1404 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1406 ok(0, "unexpected call\n");
1410 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1411 LPCBORDERWIDTHS pborderwidths
)
1413 ok(0, "unexpected call\n");
1417 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1418 LPCBORDERWIDTHS pborderwidths
)
1420 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1424 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1425 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1427 static const WCHAR wszHTML_Document
[] =
1428 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1430 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1432 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1433 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1434 if(pActiveObject
&& is_english())
1435 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1438 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1439 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1441 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1445 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1446 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1448 static const WCHAR wszHTML_Document
[] =
1449 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1452 CHECK_EXPECT2(SetActiveObject
);
1454 if(pActiveObject
&& is_english())
1455 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1457 CHECK_EXPECT(SetActiveObject_null
);
1459 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1460 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1466 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1467 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1469 ok(0, "unexpected call\n");
1473 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1474 HOLEMENU holemenu
, HWND hwndActiveObject
)
1476 ok(0, "unexpected call\n");
1480 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1482 ok(0, "unexpected call\n");
1486 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1488 CHECK_EXPECT2(SetStatusText
);
1489 if(!expect_status_text
)
1490 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1494 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1497 CHECK_EXPECT2(Frame_EnableModeless_TRUE
);
1499 CHECK_EXPECT2(Frame_EnableModeless_FALSE
);
1503 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1505 ok(0, "unexpected call\n");
1509 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1510 InPlaceFrame_QueryInterface
,
1511 InPlaceFrame_AddRef
,
1512 InPlaceFrame_Release
,
1513 InPlaceFrame_GetWindow
,
1514 InPlaceFrame_ContextSensitiveHelp
,
1515 InPlaceFrame_GetBorder
,
1516 InPlaceFrame_RequestBorderSpace
,
1517 InPlaceFrame_SetBorderSpace
,
1518 InPlaceFrame_SetActiveObject
,
1519 InPlaceFrame_InsertMenus
,
1520 InPlaceFrame_SetMenu
,
1521 InPlaceFrame_RemoveMenus
,
1522 InPlaceFrame_SetStatusText
,
1523 InPlaceFrame_EnableModeless
,
1524 InPlaceFrame_TranslateAccelerator
1527 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1529 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1530 InPlaceFrame_QueryInterface
,
1531 InPlaceFrame_AddRef
,
1532 InPlaceFrame_Release
,
1533 InPlaceFrame_GetWindow
,
1534 InPlaceFrame_ContextSensitiveHelp
,
1535 InPlaceFrame_GetBorder
,
1536 InPlaceFrame_RequestBorderSpace
,
1537 InPlaceFrame_SetBorderSpace
,
1538 InPlaceUIWindow_SetActiveObject
,
1541 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1543 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
1545 return QueryInterface(riid
, ppv
);
1548 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
1553 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
1558 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(
1559 IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
1561 CHECK_EXPECT2(GetWindow
);
1562 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1563 *phwnd
= container_hwnd
;
1567 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(
1568 IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
1570 ok(0, "unexpected call\n");
1574 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(
1575 IOleInPlaceSiteWindowless
*iface
)
1577 CHECK_EXPECT(CanInPlaceActivate
);
1581 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(
1582 IOleInPlaceSiteWindowless
*iface
)
1584 CHECK_EXPECT(OnInPlaceActivate
);
1585 inplace_deactivated
= FALSE
;
1589 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(
1590 IOleInPlaceSiteWindowless
*iface
)
1592 CHECK_EXPECT(OnUIActivate
);
1596 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(
1597 IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
1598 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1599 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1601 static const RECT rect
= {0,0,500,500};
1603 CHECK_EXPECT(GetWindowContext
);
1605 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1607 *ppFrame
= &InPlaceFrame
;
1608 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1610 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1611 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1613 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1614 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1616 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1617 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1619 lpFrameInfo
->cb
= sizeof(*lpFrameInfo
);
1620 lpFrameInfo
->fMDIApp
= FALSE
;
1621 lpFrameInfo
->hwndFrame
= container_hwnd
;
1622 lpFrameInfo
->haccel
= NULL
;
1623 lpFrameInfo
->cAccelEntries
= 0;
1629 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
1630 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
1632 ok(0, "unexpected call\n");
1636 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
1637 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
1639 CHECK_EXPECT(OnUIDeactivate
);
1640 ok(!fUndoable
, "fUndoable = TRUE\n");
1644 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
1645 IOleInPlaceSiteWindowless
*iface
)
1647 CHECK_EXPECT(OnInPlaceDeactivate
);
1648 inplace_deactivated
= TRUE
;
1652 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
1653 IOleInPlaceSiteWindowless
*iface
)
1655 ok(0, "unexpected call\n");
1659 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
1660 IOleInPlaceSiteWindowless
*iface
)
1662 ok(0, "unexpected call\n");
1666 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
1667 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
1669 ok(0, "unexpected call\n");
1673 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
1674 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
1676 CHECK_EXPECT(OnInPlaceActivateEx
);
1678 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
1679 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
1680 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
1685 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1686 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
1688 CHECK_EXPECT(OnInPlaceDeactivateEx
);
1690 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
1695 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
1696 IOleInPlaceSiteWindowless
*iface
)
1698 CHECK_EXPECT2(RequestUIActivate
);
1702 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
1703 IOleInPlaceSiteWindowless
*iface
)
1705 ok(0, "unexpected call\n");
1709 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
1710 IOleInPlaceSiteWindowless
*iface
)
1712 ok(0, "unexpected call\n");
1716 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
1717 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
1719 ok(0, "unexpected call\n");
1723 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
1724 IOleInPlaceSiteWindowless
*iface
)
1726 ok(0, "unexpected call\n");
1730 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
1731 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
1733 ok(0, "unexpected call\n");
1737 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
1738 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
1739 DWORD grfFlags
, HDC
*phDC
)
1741 ok(0, "unexpected call\n");
1745 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
1746 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
1748 ok(0, "unexpected call\n");
1752 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
1753 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
1755 ok(0, "unexpected call\n");
1759 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
1760 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
1762 ok(0, "unexpected call\n");
1766 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
1767 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
1768 LPCRECT pRectScroll
, LPCRECT pRectClip
)
1770 ok(0, "unexpected call\n");
1774 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
1775 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
1777 ok(0, "unexpected call\n");
1781 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
1782 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
1783 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
1785 ok(0, "unexpected call\n");
1789 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
1790 InPlaceSiteWindowless_QueryInterface
,
1791 InPlaceSiteWindowless_AddRef
,
1792 InPlaceSiteWindowless_Release
,
1793 InPlaceSiteWindowless_GetWindow
,
1794 InPlaceSiteWindowless_ContextSensitiveHelp
,
1795 InPlaceSiteWindowless_CanInPlaceActivate
,
1796 InPlaceSiteWindowless_OnInPlaceActivate
,
1797 InPlaceSiteWindowless_OnUIActivate
,
1798 InPlaceSiteWindowless_GetWindowContext
,
1799 InPlaceSiteWindowless_Scroll
,
1800 InPlaceSiteWindowless_OnUIDeactivate
,
1801 InPlaceSiteWindowless_OnInPlaceDeactivate
,
1802 InPlaceSiteWindowless_DiscardUndoState
,
1803 InPlaceSiteWindowless_DeactivateAndUndo
,
1804 InPlaceSiteWindowless_OnPosRectChange
,
1805 InPlaceSiteWindowless_OnInPlaceActivateEx
,
1806 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
1807 InPlaceSiteWindowless_RequestUIActivate
,
1808 InPlaceSiteWindowless_CanWindowlessActivate
,
1809 InPlaceSiteWindowless_GetCapture
,
1810 InPlaceSiteWindowless_SetCapture
,
1811 InPlaceSiteWindowless_GetFocus
,
1812 InPlaceSiteWindowless_SetFocus
,
1813 InPlaceSiteWindowless_GetDC
,
1814 InPlaceSiteWindowless_ReleaseDC
,
1815 InPlaceSiteWindowless_InvalidateRect
,
1816 InPlaceSiteWindowless_InvalidateRgn
,
1817 InPlaceSiteWindowless_ScrollRect
,
1818 InPlaceSiteWindowless_AdjustRect
,
1819 InPlaceSiteWindowless_OnDefWindowMessage
1822 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
1824 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1826 return QueryInterface(riid
, ppv
);
1829 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1834 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1839 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1841 ok(0, "unexpected call\n");
1845 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
1848 ok(0, "unexpected call\n");
1852 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1854 CHECK_EXPECT(GetContainer
);
1855 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1856 *ppContainer
= &OleContainer
;
1860 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1862 ok(0, "unexpected call\n");
1866 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1868 ok(0, "unexpected call\n");
1872 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1874 ok(0, "unexpected call\n");
1878 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1879 ClientSite_QueryInterface
,
1882 ClientSite_SaveObject
,
1883 ClientSite_GetMoniker
,
1884 ClientSite_GetContainer
,
1885 ClientSite_ShowObject
,
1886 ClientSite_OnShowWindow
,
1887 ClientSite_RequestNewObjectLayout
1890 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1892 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
1894 return QueryInterface(riid
, ppv
);
1897 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
1902 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
1909 CallUIActivate_None
,
1910 CallUIActivate_ActivateMe
,
1911 CallUIActivate_AfterShow
,
1914 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
1915 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
1917 IOleDocument
*document
;
1920 CHECK_EXPECT(ActivateMe
);
1921 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
1923 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
1924 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
1926 if(SUCCEEDED(hres
)) {
1927 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
, NULL
, 0, &view
);
1928 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
1930 if(SUCCEEDED(hres
)) {
1931 IOleInPlaceActiveObject
*activeobj
= NULL
;
1932 IOleInPlaceSite
*inplacesite
= NULL
;
1933 HWND tmp_hwnd
= NULL
;
1934 static RECT rect
= {0,0,400,500};
1936 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1937 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1938 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
1939 inplacesite
, &InPlaceSiteWindowless
);
1941 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteWindowless
);
1942 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
1944 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1945 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1946 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteWindowless
, "inplacesite=%p, expected %p\n",
1947 inplacesite
, &InPlaceSiteWindowless
);
1949 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
1950 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
1953 IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1954 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1955 ok(hwnd
== NULL
, "hwnd=%p, expeted NULL\n", hwnd
);
1958 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
1959 SET_EXPECT(CanInPlaceActivate
);
1960 SET_EXPECT(GetWindowContext
);
1961 SET_EXPECT(GetWindow
);
1963 SET_EXPECT(OnInPlaceActivateEx
);
1965 SET_EXPECT(OnInPlaceActivate
);
1966 SET_EXPECT(SetStatusText
);
1967 SET_EXPECT(Exec_SETPROGRESSMAX
);
1968 SET_EXPECT(Exec_SETPROGRESSPOS
);
1969 SET_EXPECT(OnUIActivate
);
1970 SET_EXPECT(SetActiveObject
);
1972 expect_status_text
= NULL
;
1974 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
1975 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
1977 CHECK_CALLED(CanInPlaceActivate
);
1978 CHECK_CALLED(GetWindowContext
);
1979 CHECK_CALLED(GetWindow
);
1981 CHECK_CALLED(OnInPlaceActivateEx
);
1983 CHECK_CALLED(OnInPlaceActivate
);
1984 CHECK_CALLED(SetStatusText
);
1985 CHECK_CALLED(Exec_SETPROGRESSMAX
);
1986 CHECK_CALLED(Exec_SETPROGRESSPOS
);
1987 CHECK_CALLED(OnUIActivate
);
1988 CHECK_CALLED(SetActiveObject
);
1989 CHECK_CALLED(ShowUI
);
1992 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1993 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1994 ok(hwnd
!= NULL
, "hwnd == NULL\n");
1996 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
1999 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
2000 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
2003 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
2004 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2005 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
2009 hres
= IOleDocumentView_SetRect(view
, &rect
);
2010 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
2012 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
2013 hres
= IOleDocumentView_Show(view
, TRUE
);
2014 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2016 SET_EXPECT(CanInPlaceActivate
);
2017 SET_EXPECT(GetWindowContext
);
2018 SET_EXPECT(GetWindow
);
2020 SET_EXPECT(OnInPlaceActivateEx
);
2022 SET_EXPECT(OnInPlaceActivate
);
2023 SET_EXPECT(SetStatusText
);
2024 SET_EXPECT(Exec_SETPROGRESSMAX
);
2025 SET_EXPECT(Exec_SETPROGRESSPOS
);
2026 SET_EXPECT(OnUIActivate
);
2027 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
2029 hres
= IOleDocumentView_Show(view
, TRUE
);
2031 win_skip("Show failed\n");
2033 IOleInPlaceActiveObject_Release(activeobj
);
2034 IOleDocument_Release(document
);
2038 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
2040 CHECK_CALLED(CanInPlaceActivate
);
2041 CHECK_CALLED(GetWindowContext
);
2042 CHECK_CALLED(GetWindow
);
2044 CHECK_CALLED(OnInPlaceActivateEx
);
2046 CHECK_CALLED(OnInPlaceActivate
);
2047 CHECK_CALLED(SetStatusText
);
2048 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2049 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2052 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
2053 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
2054 ok(hwnd
!= NULL
, "hwnd == NULL\n");
2056 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
2060 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
2063 IOleInPlaceActiveObject_Release(activeobj
);
2066 IOleDocument_Release(document
);
2072 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
2073 DocumentSite_QueryInterface
,
2074 DocumentSite_AddRef
,
2075 DocumentSite_Release
,
2076 DocumentSite_ActivateMe
2079 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
2081 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
2083 return QueryInterface(riid
, ppv
);
2086 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
2091 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
2096 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
2098 ok(0, "unexpected call\n");
2102 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
2104 ok(0, "unexpected call\n");
2108 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
2110 ok(0, "unexpected call\n");
2114 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
2115 POINTF
*pPtfContainer
, DWORD dwFlags
)
2117 ok(0, "unexpected call\n");
2121 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
2122 MSG
*pMsg
, DWORD grfModifiers
)
2124 ok(0, "unexpected call\n");
2128 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
2131 CHECK_EXPECT(OnFocus_TRUE
);
2133 CHECK_EXPECT2(OnFocus_FALSE
);
2137 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
2139 ok(0, "unexpected call\n");
2143 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
2144 OleControlSite_QueryInterface
,
2145 OleControlSite_AddRef
,
2146 OleControlSite_Release
,
2147 OleControlSite_OnControlInfoChanged
,
2148 OleControlSite_LockInPlaceActive
,
2149 OleControlSite_GetExtendedControl
,
2150 OleControlSite_TransformCoords
,
2151 OleControlSite_TranslateAccelerator
,
2152 OleControlSite_OnFocus
,
2153 OleControlSite_ShowPropertyFrame
2156 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
2158 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
2160 return QueryInterface(riid
, ppv
);
2163 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
2168 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
2173 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
2174 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
2176 ok(0, "unexpected call\n");
2180 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
2182 CHECK_EXPECT(GetHostInfo
);
2183 ok(pInfo
!= NULL
, "pInfo=NULL\n");
2185 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
2186 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
2187 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2188 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2189 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
2190 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
2191 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
2192 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
2197 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
2198 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
2199 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
2201 CHECK_EXPECT(ShowUI
);
2204 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
2206 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
2207 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
2208 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
2209 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
2210 if (expect_InPlaceUIWindow_SetActiveObject_active
)
2211 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
2213 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
2218 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
2220 CHECK_EXPECT(HideUI
);
2224 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
2226 CHECK_EXPECT(UpdateUI
);
2230 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
2233 CHECK_EXPECT2(EnableModeless_TRUE
);
2235 CHECK_EXPECT2(EnableModeless_FALSE
);
2239 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2241 ok(0, "unexpected call\n");
2245 static BOOL expect_OnFrameWindowActivate_fActivate
;
2246 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
2248 CHECK_EXPECT2(OnFrameWindowActivate
);
2249 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
2253 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
2254 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
2256 ok(0, "unexpected call\n");
2260 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
2261 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
2263 ok(0, "unexpected call\n");
2267 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
2268 LPOLESTR
*pchKey
, DWORD dw
)
2270 CHECK_EXPECT(GetOptionKeyPath
);
2271 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2272 ok(!dw
, "dw=%d, expected 0\n", dw
);
2274 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2278 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
2279 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
2281 CHECK_EXPECT(GetDropTarget
);
2286 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
2288 CHECK_EXPECT(GetExternal
);
2289 *ppDispatch
= &External
;
2293 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
2294 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
2296 CHECK_EXPECT(TranslateUrl
);
2297 ok(!dwTranslate
, "dwTranslate = %x\n", dwTranslate
);
2298 ok(!strcmp_wa(pchURLIn
, "about:blank"), "pchURLIn = %s\n", wine_dbgstr_w(pchURLIn
));
2299 ok(ppchURLOut
!= NULL
, "ppchURLOut == NULL\n");
2300 ok(!*ppchURLOut
, "*ppchURLOut = %p\n", *ppchURLOut
);
2305 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
2306 IDataObject
**ppPORet
)
2308 ok(0, "unexpected call\n");
2312 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
2313 LPOLESTR
*pchKey
, DWORD dw
)
2315 CHECK_EXPECT(GetOverrideKeyPath
);
2316 ok(pchKey
!= NULL
, "pchKey = NULL\n");
2318 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
2319 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2323 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2324 DocHostUIHandler_QueryInterface
,
2325 DocHostUIHandler_AddRef
,
2326 DocHostUIHandler_Release
,
2327 DocHostUIHandler_ShowContextMenu
,
2328 DocHostUIHandler_GetHostInfo
,
2329 DocHostUIHandler_ShowUI
,
2330 DocHostUIHandler_HideUI
,
2331 DocHostUIHandler_UpdateUI
,
2332 DocHostUIHandler_EnableModeless
,
2333 DocHostUIHandler_OnDocWindowActivate
,
2334 DocHostUIHandler_OnFrameWindowActivate
,
2335 DocHostUIHandler_ResizeBorder
,
2336 DocHostUIHandler_TranslateAccelerator
,
2337 DocHostUIHandler_GetOptionKeyPath
,
2338 DocHostUIHandler_GetDropTarget
,
2339 DocHostUIHandler_GetExternal
,
2340 DocHostUIHandler_TranslateUrl
,
2341 DocHostUIHandler_FilterDataObject
,
2342 DocHostUIHandler_GetOverrideKeyPath
2345 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2347 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2348 REFIID riid
, void **ppv
)
2350 return QueryInterface(riid
, ppv
);
2353 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2358 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2363 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2364 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2366 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2367 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2368 ok(!pCmdText
, "pCmdText != NULL\n");
2370 switch(prgCmds
[0].cmdID
) {
2371 case OLECMDID_SETPROGRESSTEXT
:
2372 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2373 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2376 CHECK_EXPECT(QueryStatus_OPEN
);
2377 prgCmds
[0].cmdf
= 0;
2380 CHECK_EXPECT(QueryStatus_NEW
);
2381 prgCmds
[0].cmdf
= 0;
2384 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2390 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2391 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2393 if((!pguidCmdGroup
|| !IsEqualGUID(pguidCmdGroup
, &CGID_Explorer
))
2394 && (!pguidCmdGroup
|| !IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
) || nCmdID
!= 63))
2395 test_readyState(NULL
);
2397 if(!pguidCmdGroup
) {
2399 case OLECMDID_SETPROGRESSMAX
:
2400 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2401 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2402 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2404 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2405 if(load_state
== LD_NO
)
2406 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2408 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2410 case OLECMDID_SETPROGRESSPOS
:
2411 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2412 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2413 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2415 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2416 if(load_state
== LD_NO
)
2417 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2419 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2421 case OLECMDID_HTTPEQUIV_DONE
:
2422 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2423 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2424 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2425 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2426 readystate_set_loading
= FALSE
;
2427 readystate_set_interactive
= FALSE
;
2428 load_state
= LD_COMPLETE
;
2430 case OLECMDID_SETDOWNLOADSTATE
:
2431 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2432 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2433 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2434 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2436 switch(V_I4(pvaIn
)) {
2438 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2439 load_state
= LD_INTERACTIVE
;
2442 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2443 readystate_set_interactive
= (load_state
!= LD_INTERACTIVE
);
2446 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2450 case OLECMDID_UPDATECOMMANDS
:
2451 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2452 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2453 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2454 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2456 case OLECMDID_SETTITLE
:
2457 CHECK_EXPECT2(Exec_SETTITLE
);
2458 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2459 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2460 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2461 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2462 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2464 case OLECMDID_HTTPEQUIV
:
2465 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2466 ok(!nCmdexecopt
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2467 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2468 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2469 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2470 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) = NULL\n");
2471 test_readyState(NULL
);
2473 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY
:
2474 return E_FAIL
; /* FIXME */
2476 ok(0, "unexpected command %d\n", nCmdID
);
2481 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2482 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2486 CHECK_EXPECT2(Exec_ShellDocView_37
);
2488 if(load_from_stream
|| navigated_load
)
2489 test_GetCurMoniker(doc_unk
, NULL
, about_blank_url
);
2491 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
2493 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2494 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2496 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2497 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2502 IHTMLPrivateWindow
*priv_window
;
2505 CHECK_EXPECT(Exec_ShellDocView_63
);
2506 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2507 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2508 ok(V_UNKNOWN(pvaIn
) != NULL
, "VPUNKNOWN(pvaIn) = NULL\n");
2509 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2510 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2512 hres
= IUnknown_QueryInterface(V_UNKNOWN(pvaIn
), &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
2513 ok(hres
== S_OK
, "Could not get IHTMLPrivateWindow: %08x\n", hres
);
2515 IHTMLPrivateWindow_Release(priv_window
);
2517 load_state
= LD_LOADING
;
2518 return S_OK
; /* TODO */
2522 CHECK_EXPECT(Exec_ShellDocView_67
);
2523 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2524 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn) = %d\n", V_VT(pvaIn
));
2525 ok(!strcmp_wa(V_BSTR(pvaIn
), "about:blank"), "V_BSTR(pvaIn) = %s\n", wine_dbgstr_w(V_BSTR(pvaIn
)));
2526 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2527 ok(V_VT(pvaOut
) == VT_BOOL
, "V_VT(pvaOut) = %d\n", V_VT(pvaOut
));
2528 ok(V_BOOL(pvaOut
) == VARIANT_TRUE
, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut
));
2529 load_state
= LD_DOLOAD
;
2533 CHECK_EXPECT2(Exec_ShellDocView_84
);
2535 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2536 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2538 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2543 CHECK_EXPECT2(Exec_ShellDocView_103
);
2545 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2546 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2551 CHECK_EXPECT2(Exec_ShellDocView_105
);
2553 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2554 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2559 CHECK_EXPECT2(Exec_ShellDocView_140
);
2561 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2562 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2567 ok(0, "unexpected command %d\n", nCmdID
);
2572 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2573 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2576 case IDM_PARSECOMPLETE
:
2577 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2578 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2579 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2582 ok(0, "unexpected command %d\n", nCmdID
);
2586 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
)) {
2588 case DOCHOST_DOCCANNAVIGATE
:
2589 CHECK_EXPECT(Exec_DOCCANNAVIGATE
);
2590 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2591 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2592 ok(V_VT(pvaIn
) == VT_UNKNOWN
, "V_VT(pvaIn) != VT_UNKNOWN\n");
2593 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2596 return E_FAIL
; /* TODO */
2600 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
2601 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2605 CHECK_EXPECT2(Exec_Explorer_69
);
2606 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2607 ok(pvaOut
!= NULL
, "pvaOut == NULL\n");
2610 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
2615 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
2617 case OLECMDID_PAGEACTIONBLOCKED
: /* win2k3 */
2618 SET_EXPECT(SetStatusText
);
2619 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2620 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2622 case OLECMDID_SHOWSCRIPTERROR
:
2626 ok(0, "unexpected command %d\n", nCmdID
);
2631 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup
));
2635 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
2636 OleCommandTarget_QueryInterface
,
2637 OleCommandTarget_AddRef
,
2638 OleCommandTarget_Release
,
2639 OleCommandTarget_QueryStatus
,
2640 OleCommandTarget_Exec
2643 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
2645 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
2647 return QueryInterface(riid
, ppv
);
2650 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
2651 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2652 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2654 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
2655 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
2656 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
2657 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
2658 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
2659 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
2660 test_readyState(NULL
);
2662 switch(dispIdMember
) {
2663 case DISPID_AMBIENT_USERMODE
:
2664 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
2665 V_VT(pVarResult
) = VT_BOOL
;
2666 V_BOOL(pVarResult
) = VARIANT_TRUE
;
2668 case DISPID_AMBIENT_DLCONTROL
:
2669 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
2671 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
2672 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2674 case DISPID_AMBIENT_SILENT
:
2675 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
2676 V_VT(pVarResult
) = VT_BOOL
;
2677 V_BOOL(pVarResult
) = VARIANT_FALSE
;
2679 case DISPID_AMBIENT_USERAGENT
:
2680 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2682 case DISPID_AMBIENT_PALETTE
:
2683 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2687 ok(0, "unexpected dispid %d\n", dispIdMember
);
2691 static IDispatchVtbl DispatchVtbl
= {
2692 Dispatch_QueryInterface
,
2695 Dispatch_GetTypeInfoCount
,
2696 Dispatch_GetTypeInfo
,
2697 Dispatch_GetIDsOfNames
,
2701 static IDispatch Dispatch
= { &DispatchVtbl
};
2703 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
2704 REFIID riid
, void **ppv
)
2706 return QueryInterface(riid
, ppv
);
2709 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
2714 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
2719 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
2720 REFIID riid
, void **ppv
)
2723 * Services used by HTMLDocument:
2726 * IInternetSecurityManager
2728 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2731 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2732 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2733 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2735 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2736 * IElementBehaviorFactory
2737 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2747 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
2748 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
2753 if(IsEqualGUID(&SID_SNewWindowManager
, guidService
)) {
2754 ok(IsEqualGUID(&IID_INewWindowManager
, riid
), "unexpected riid\n");
2755 *ppv
= &NewWindowManager
;
2759 return E_NOINTERFACE
;
2762 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2763 ServiceProvider_QueryInterface
,
2764 ServiceProvider_AddRef
,
2765 ServiceProvider_Release
,
2766 ServiceProvider_QueryService
2769 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
2771 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
2772 REFIID riid
, void **ppv
)
2774 return QueryInterface(riid
, ppv
);
2777 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSinkEx
*iface
)
2782 static ULONG WINAPI
AdviseSink_Release(IAdviseSinkEx
*iface
)
2787 static void WINAPI
AdviseSink_OnDataChange(IAdviseSinkEx
*iface
,
2788 FORMATETC
*pFormatetc
, STGMEDIUM
*pStgmed
)
2790 ok(0, "unexpected call\n");
2793 static void WINAPI
AdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
2794 DWORD dwAspect
, LONG lindex
)
2796 ok(0, "unexpected call\n");
2799 static void WINAPI
AdviseSink_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
2801 ok(0, "unexpected call\n");
2804 static void WINAPI
AdviseSink_OnSave(IAdviseSinkEx
*iface
)
2806 ok(0, "unexpected call\n");
2809 static void WINAPI
AdviseSink_OnClose(IAdviseSinkEx
*iface
)
2811 ok(0, "unexpected call\n");
2814 static void WINAPI
AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
2816 ok(0, "unexpected call\n");
2819 static void WINAPI
ObjectAdviseSink_OnClose(IAdviseSinkEx
*iface
)
2821 CHECK_EXPECT(Advise_Close
);
2824 static const IAdviseSinkExVtbl AdviseSinkVtbl
= {
2825 AdviseSink_QueryInterface
,
2828 AdviseSink_OnDataChange
,
2829 AdviseSink_OnViewChange
,
2830 AdviseSink_OnRename
,
2832 ObjectAdviseSink_OnClose
,
2833 AdviseSinkEx_OnViewStatusChange
2836 static IAdviseSinkEx AdviseSink
= { &AdviseSinkVtbl
};
2838 static HRESULT WINAPI
ViewAdviseSink_QueryInterface(IAdviseSinkEx
*iface
,
2839 REFIID riid
, void **ppv
)
2841 if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
2846 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
2848 return E_NOINTERFACE
;
2851 static void WINAPI
ViewAdviseSink_OnViewChange(IAdviseSinkEx
*iface
,
2852 DWORD dwAspect
, LONG lindex
)
2854 CHECK_EXPECT2(OnViewChange
);
2856 ok(dwAspect
== DVASPECT_CONTENT
, "dwAspect = %d\n", dwAspect
);
2857 ok(lindex
== -1, "lindex = %d\n", lindex
);
2860 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl
= {
2861 ViewAdviseSink_QueryInterface
,
2864 AdviseSink_OnDataChange
,
2865 ViewAdviseSink_OnViewChange
,
2866 AdviseSink_OnRename
,
2869 AdviseSinkEx_OnViewStatusChange
2872 static IAdviseSinkEx ViewAdviseSink
= { &ViewAdviseSinkVtbl
};
2874 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2875 DEFINE_GUID(IID_IThumbnailView
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2876 DEFINE_GUID(IID_IRenMailEditor
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2877 DEFINE_GUID(IID_unk4
, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
2878 DEFINE_GUID(IID_IDocHostUIHandlerPriv
, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
2880 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
2884 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
2886 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
2887 *ppv
= &DocumentSite
;
2888 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
2889 *ppv
= &DocHostUIHandler
;
2890 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
2891 *ppv
= &OleContainer
;
2892 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
2893 *ppv
= &InPlaceSiteWindowless
;
2894 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2895 *ppv
= &OleCommandTarget
;
2896 else if(IsEqualGUID(&IID_IDispatch
, riid
))
2898 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
2899 *ppv
= &ServiceProvider
;
2900 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
2901 *ppv
= ipsex
? &InPlaceSiteWindowless
: NULL
;
2902 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
))
2903 *ppv
= ipsw
? &InPlaceSiteWindowless
: NULL
;
2904 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
2905 *ppv
= &OleControlSite
;
2906 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2907 return E_NOINTERFACE
; /* TODO */
2908 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
2909 return E_NOINTERFACE
; /* ? */
2910 else if(IsEqualGUID(&IID_unk1
, riid
))
2911 return E_NOINTERFACE
; /* HTMLWindow2 ? */
2912 else if(IsEqualGUID(&IID_IThumbnailView
, riid
))
2913 return E_NOINTERFACE
; /* ? */
2914 else if(IsEqualGUID(&IID_IRenMailEditor
, riid
))
2915 return E_NOINTERFACE
; /* ? */
2916 else if(IsEqualGUID(&IID_unk4
, riid
))
2917 return E_NOINTERFACE
; /* ? */
2918 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv
, riid
))
2919 return E_NOINTERFACE
; /* ? */
2921 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
2925 return E_NOINTERFACE
;
2928 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
2930 return DefWindowProc(hwnd
, msg
, wParam
, lParam
);
2933 static void test_doscroll(IUnknown
*unk
)
2935 IHTMLDocument3
*doc
;
2936 IHTMLElement2
*elem2
;
2941 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument3
, (void**)&doc
);
2942 ok(hres
== S_OK
, "Could not get IHTMLDocument3 iface: %08x\n", hres
);
2946 hres
= IHTMLDocument3_get_documentElement(doc
, &elem
);
2947 IHTMLDocument3_Release(doc
);
2948 ok(hres
== S_OK
, "get_documentElement failed: %08x\n", hres
);
2949 switch(load_state
) {
2953 ok(!elem
, "elem != NULL\n");
2956 case LD_INTERACTIVE
:
2958 ok(elem
!= NULL
, "elem == NULL\n");
2963 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
2964 IHTMLElement_Release(elem
);
2965 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
2968 V_BSTR(&v
) = a2bstr("left");
2969 hres
= IHTMLElement2_doScroll(elem2
, v
);
2970 SysFreeString(V_BSTR(&v
));
2971 IHTMLElement2_Release(elem2
);
2973 if(inplace_deactivated
)
2974 ok(hres
== E_PENDING
, "doScroll failed: %08x\n", hres
);
2975 else if(load_state
== LD_COMPLETE
)
2976 ok(hres
== S_OK
, "doScroll failed: %08x\n", hres
);
2978 ok(hres
== E_PENDING
|| hres
== S_OK
, "doScroll failed: %08x\n", hres
);
2981 static void _test_readyState(unsigned line
, IUnknown
*unk
)
2983 IHTMLDocument2
*htmldoc
;
2984 DISPPARAMS dispparams
;
2990 static const LPCSTR expected_state
[] = {
3005 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
3006 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
3010 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
3011 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
3013 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
3014 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
3016 if(!strcmp_wa(state
, "interactive") && load_state
== LD_LOADING
)
3017 load_state
= LD_INTERACTIVE
;
3020 (!strcmp_wa(state
, expected_state
[load_state
]), "unexpected state %s, expected %d\n",
3021 wine_dbgstr_w(state
), load_state
);
3022 SysFreeString(state
);
3024 hres
= IHTMLDocument2_get_body(htmldoc
, &elem
);
3025 ok_(__FILE__
,line
)(hres
== S_OK
, "get_body failed: %08x\n", hres
);
3027 IHTMLElement2
*elem2
;
3030 hres
= IHTMLElement_QueryInterface(elem
, &IID_IHTMLElement2
, (void**)&elem2
);
3031 IHTMLElement_Release(elem
);
3032 ok(hres
== S_OK
, "Could not get IHTMLElement2 iface: %08x\n", hres
);
3034 hres
= IHTMLElement2_get_readyState(elem2
, &var
);
3035 IHTMLElement2_Release(elem2
);
3036 ok(hres
== S_OK
, "get_readyState failed: %08x\n", hres
);
3037 ok(V_VT(&var
) == VT_BSTR
, "V_VT(state) = %d\n", V_VT(&var
));
3038 ok(!strcmp_wa(V_BSTR(&var
), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var
)));
3041 ok_(__FILE__
,line
)(load_state
!= LD_COMPLETE
, "body is NULL in complete state\n");
3044 dispparams
.cArgs
= 0;
3045 dispparams
.cNamedArgs
= 0;
3046 dispparams
.rgdispidNamedArgs
= NULL
;
3047 dispparams
.rgvarg
= NULL
;
3051 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
3052 &dispparams
, &out
, NULL
, NULL
);
3053 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
3055 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
3056 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
3058 test_doscroll((IUnknown
*)htmldoc
);
3060 IHTMLDocument2_Release(htmldoc
);
3063 static void test_ViewAdviseSink(IHTMLDocument2
*doc
)
3068 hres
= IHTMLDocument2_QueryInterface(doc
, &IID_IViewObject
, (void**)&view
);
3069 ok(hres
== S_OK
, "QueryInterface(IID_IViewObject) failed: %08x\n", hres
);
3071 hres
= IViewObject_SetAdvise(view
, DVASPECT_CONTENT
, ADVF_PRIMEFIRST
, (IAdviseSink
*)&ViewAdviseSink
);
3072 ok(hres
== S_OK
, "SetAdvise failed: %08x\n", hres
);
3074 IViewObject_Release(view
);
3077 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
3079 IConnectionPointContainer
*tmp_container
= NULL
;
3080 IConnectionPoint
*cp
;
3084 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
3085 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
3089 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
3090 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
3091 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
3093 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
3094 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
3096 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
3097 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
3098 ok(tmp_container
== container
, "container != tmp_container\n");
3100 IConnectionPointContainer_Release(tmp_container
);
3102 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
3103 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
3105 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
3108 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
3109 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
3112 IConnectionPoint_Release(cp
);
3115 static void test_ConnectionPointContainer(IHTMLDocument2
*doc
)
3117 IConnectionPointContainer
*container
;
3120 hres
= IUnknown_QueryInterface(doc
, &IID_IConnectionPointContainer
, (void**)&container
);
3121 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
3125 test_ConnectionPoint(container
, &IID_IDispatch
);
3126 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
3127 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
3128 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
3130 IConnectionPointContainer_Release(container
);
3133 static void test_Load(IPersistMoniker
*persist
, IMoniker
*mon
)
3137 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
3139 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
3141 test_readyState((IUnknown
*)persist
);
3145 CreateBindCtx(0, &bind
);
3146 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
3147 (IUnknown
*)&ClientSite
);
3150 SET_EXPECT(GetDisplayName
);
3151 if(!set_clientsite
) {
3152 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3153 SET_EXPECT(GetHostInfo
);
3154 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3155 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3156 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3157 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3158 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3159 SET_EXPECT(GetOptionKeyPath
);
3160 SET_EXPECT(GetOverrideKeyPath
);
3161 SET_EXPECT(GetWindow
);
3162 SET_EXPECT(Exec_DOCCANNAVIGATE
);
3163 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3164 SET_EXPECT(Exec_SETPROGRESSMAX
);
3165 SET_EXPECT(Exec_SETPROGRESSPOS
);
3166 SET_EXPECT(Exec_ShellDocView_37
);
3168 if(!container_locked
) {
3169 SET_EXPECT(GetContainer
);
3170 SET_EXPECT(LockContainer
);
3172 SET_EXPECT(OnChanged_READYSTATE
);
3173 SET_EXPECT(Exec_ShellDocView_84
);
3174 SET_EXPECT(IsSystemMoniker
);
3176 SET_EXPECT(BindToStorage
);
3177 SET_EXPECT(SetActiveObject
);
3178 if(set_clientsite
) {
3179 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3180 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3181 SET_EXPECT(Exec_ShellDocView_37
);
3183 load_state
= LD_DOLOAD
;
3184 expect_LockContainer_fLock
= TRUE
;
3185 readystate_set_loading
= TRUE
;
3187 hres
= IPersistMoniker_Load(persist
, FALSE
, mon
, bind
, 0x12);
3188 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
3191 CHECK_CALLED(GetDisplayName
);
3192 if(!set_clientsite
) {
3193 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3194 CHECK_CALLED(GetHostInfo
);
3195 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3196 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3197 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3198 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3199 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3200 CHECK_CALLED(GetOptionKeyPath
);
3201 CHECK_CALLED(GetOverrideKeyPath
);
3202 CHECK_CALLED(GetWindow
);
3203 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
3204 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
3205 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3206 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3207 CHECK_CALLED(Exec_ShellDocView_37
);
3209 if(!container_locked
) {
3210 CHECK_CALLED(GetContainer
);
3211 CHECK_CALLED(LockContainer
);
3212 container_locked
= TRUE
;
3214 CHECK_CALLED(OnChanged_READYSTATE
);
3215 SET_CALLED(IsSystemMoniker
); /* IE7 */
3216 SET_CALLED(Exec_ShellDocView_84
);
3218 CHECK_CALLED(BindToStorage
);
3219 SET_CALLED(SetActiveObject
); /* FIXME */
3220 if(set_clientsite
) {
3221 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3222 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3223 CHECK_CALLED(Exec_ShellDocView_37
);
3226 set_clientsite
= container_locked
= TRUE
;
3228 test_GetCurMoniker((IUnknown
*)persist
, mon
, NULL
);
3230 IBindCtx_Release(bind
);
3232 test_readyState((IUnknown
*)persist
);
3235 #define DWL_VERBDONE 0x0001
3236 #define DWL_CSS 0x0002
3237 #define DWL_TRYCSS 0x0004
3238 #define DWL_HTTP 0x0008
3239 #define DWL_EMPTY 0x0010
3241 static void test_download(DWORD flags
)
3246 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
3247 ok(hwnd
!= NULL
, "Could not find hidden window\n");
3249 test_readyState(NULL
);
3251 if(flags
& (DWL_VERBDONE
|DWL_HTTP
))
3252 SET_EXPECT(Exec_SETPROGRESSMAX
);
3253 if((flags
& DWL_VERBDONE
) && !load_from_stream
)
3254 SET_EXPECT(GetHostInfo
);
3255 SET_EXPECT(SetStatusText
);
3256 if(!(flags
& DWL_EMPTY
))
3257 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
3258 SET_EXPECT(OnViewChange
);
3259 SET_EXPECT(GetDropTarget
);
3260 if(flags
& DWL_TRYCSS
)
3261 SET_EXPECT(Exec_ShellDocView_84
);
3262 if(flags
& DWL_CSS
) {
3263 SET_EXPECT(CreateInstance
);
3265 SET_EXPECT(LockRequest
);
3266 SET_EXPECT(Terminate
);
3267 SET_EXPECT(Protocol_Read
);
3268 SET_EXPECT(UnlockRequest
);
3270 SET_EXPECT(Exec_Explorer_69
);
3271 SET_EXPECT(EnableModeless_TRUE
); /* IE7 */
3272 SET_EXPECT(Frame_EnableModeless_TRUE
); /* IE7 */
3273 SET_EXPECT(EnableModeless_FALSE
); /* IE7 */
3274 SET_EXPECT(Frame_EnableModeless_FALSE
); /* IE7 */
3276 SET_EXPECT(Exec_ShellDocView_37
);
3277 if(flags
& DWL_HTTP
) {
3278 SET_EXPECT(OnChanged_1012
);
3279 SET_EXPECT(Exec_HTTPEQUIV
);
3280 SET_EXPECT(Exec_SETTITLE
);
3282 SET_EXPECT(OnChanged_1005
);
3283 SET_EXPECT(OnChanged_READYSTATE
);
3284 SET_EXPECT(Exec_SETPROGRESSPOS
);
3285 if(!(flags
& DWL_EMPTY
))
3286 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
3287 SET_EXPECT(Exec_ShellDocView_103
);
3288 SET_EXPECT(Exec_ShellDocView_105
);
3289 SET_EXPECT(Exec_ShellDocView_140
);
3290 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
3291 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
3292 SET_EXPECT(SetStatusText
);
3293 if(navigated_load
) {
3294 SET_EXPECT(UpdateUI
);
3295 SET_EXPECT(Exec_UPDATECOMMANDS
);
3296 SET_EXPECT(Exec_SETTITLE
);
3298 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
3300 while(!called_Exec_HTTPEQUIV_DONE
&& GetMessage(&msg
, NULL
, 0, 0)) {
3301 TranslateMessage(&msg
);
3302 DispatchMessage(&msg
);
3305 if(flags
& DWL_VERBDONE
)
3306 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3307 if(flags
& DWL_HTTP
)
3308 SET_CALLED(Exec_SETPROGRESSMAX
);
3309 if((flags
& DWL_VERBDONE
) && !load_from_stream
) {
3311 todo_wine
CHECK_CALLED(GetHostInfo
);
3313 CHECK_CALLED(GetHostInfo
);
3315 CHECK_CALLED(SetStatusText
);
3316 if(!(flags
& DWL_EMPTY
))
3317 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
3318 CHECK_CALLED(OnViewChange
);
3320 CHECK_CALLED(GetDropTarget
);
3322 SET_CALLED(GetDropTarget
);
3323 if(flags
& DWL_TRYCSS
)
3324 SET_CALLED(Exec_ShellDocView_84
);
3325 if(flags
& DWL_CSS
) {
3326 CHECK_CALLED(CreateInstance
);
3327 CHECK_CALLED(Start
);
3328 CHECK_CALLED(LockRequest
);
3329 CHECK_CALLED(Terminate
);
3330 CHECK_CALLED(Protocol_Read
);
3331 CHECK_CALLED(UnlockRequest
);
3333 SET_CALLED(Exec_Explorer_69
);
3334 SET_CALLED(EnableModeless_TRUE
); /* IE7 */
3335 SET_CALLED(Frame_EnableModeless_TRUE
); /* IE7 */
3336 SET_CALLED(EnableModeless_FALSE
); /* IE7 */
3337 SET_CALLED(Frame_EnableModeless_FALSE
); /* IE7 */
3339 todo_wine
CHECK_CALLED(Exec_ShellDocView_37
);
3340 if(flags
& DWL_HTTP
) todo_wine
{
3341 CHECK_CALLED(OnChanged_1012
);
3342 CHECK_CALLED(Exec_HTTPEQUIV
);
3343 CHECK_CALLED(Exec_SETTITLE
);
3345 CHECK_CALLED(OnChanged_1005
);
3346 CHECK_CALLED(OnChanged_READYSTATE
);
3347 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3348 if(!(flags
& DWL_EMPTY
))
3349 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
3350 SET_CALLED(Exec_ShellDocView_103
);
3351 SET_CALLED(Exec_ShellDocView_105
);
3352 SET_CALLED(Exec_ShellDocView_140
);
3353 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
3354 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
3355 SET_CALLED(SetStatusText
);
3356 if(navigated_load
) { /* avoiding race, FIXME: fund better way */
3357 SET_CALLED(UpdateUI
);
3358 SET_CALLED(Exec_UPDATECOMMANDS
);
3359 SET_CALLED(Exec_SETTITLE
);
3362 load_state
= LD_COMPLETE
;
3364 test_readyState(NULL
);
3367 static void test_Persist(IHTMLDocument2
*doc
, IMoniker
*mon
)
3369 IPersistMoniker
*persist_mon
;
3370 IPersistFile
*persist_file
;
3374 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&persist_file
);
3375 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
3376 if(SUCCEEDED(hres
)) {
3377 hres
= IPersist_GetClassID(persist_file
, NULL
);
3378 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
3380 hres
= IPersist_GetClassID(persist_file
, &guid
);
3381 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
3382 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
3384 IPersist_Release(persist_file
);
3387 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&persist_mon
);
3388 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
3389 if(SUCCEEDED(hres
)) {
3390 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
3391 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
3393 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
3394 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
3395 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
3397 if(load_state
== LD_DOLOAD
)
3398 test_Load(persist_mon
, mon
);
3400 test_readyState((IUnknown
*)doc
);
3402 IPersistMoniker_Release(persist_mon
);
3406 static void test_put_href(IHTMLDocument2
*doc
)
3408 IHTMLPrivateWindow
*priv_window
;
3409 IHTMLWindow2
*window
;
3410 IHTMLLocation
*location
;
3416 hres
= IHTMLDocument2_get_location(doc
, &location
);
3417 ok(hres
== S_OK
, "get_location failed: %08x\n", hres
);
3418 ok(location
!= NULL
, "location == NULL\n");
3420 SET_EXPECT(TranslateUrl
);
3421 SET_EXPECT(Navigate
);
3422 str
= a2bstr("about:blank");
3423 hres
= IHTMLLocation_put_href(location
, str
);
3424 ok(hres
== S_OK
, "put_href failed: %08x\n", hres
);
3425 CHECK_CALLED(TranslateUrl
);
3426 CHECK_CALLED(Navigate
);
3428 IHTMLLocation_Release(location
);
3430 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3431 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3433 hres
= IHTMLWindow2_QueryInterface(window
, &IID_IHTMLPrivateWindow
, (void**)&priv_window
);
3434 IHTMLWindow2_Release(window
);
3435 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres
);
3437 readystate_set_loading
= TRUE
;
3438 navigated_load
= TRUE
;
3439 SET_EXPECT(TranslateUrl
);
3440 SET_EXPECT(Exec_ShellDocView_67
);
3441 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3442 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3443 SET_EXPECT(OnChanged_READYSTATE
);
3444 SET_EXPECT(Exec_ShellDocView_63
);
3447 V_VT(&vempty
) = VT_EMPTY
;
3448 hres
= IHTMLPrivateWindow_SuperNavigate(priv_window
, str
, str2
, NULL
, NULL
, &vempty
, &vempty
, 0);
3450 SysFreeString(str2
);
3451 ok(hres
== S_OK
, "SuperNavigate failed: %08x\n", hres
);
3453 CHECK_CALLED(TranslateUrl
);
3454 CHECK_CALLED(Exec_ShellDocView_67
);
3455 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3456 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3457 SET_CALLED(OnChanged_READYSTATE
); /* not always called */
3458 CHECK_CALLED(Exec_ShellDocView_63
);
3460 test_GetCurMoniker(doc_unk
, doc_mon
, NULL
);
3461 IHTMLPrivateWindow_Release(priv_window
);
3463 test_download(DWL_VERBDONE
);
3466 static void test_open_window(IHTMLDocument2
*doc
)
3468 IHTMLWindow2
*window
, *new_window
;
3472 hres
= IHTMLDocument2_get_parentWindow(doc
, &window
);
3473 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3475 url
= a2bstr("about:blank");
3476 name
= a2bstr("test");
3477 new_window
= (void*)0xdeadbeef;
3481 SET_EXPECT(TranslateUrl
);
3482 SET_EXPECT(EvaluateNewWindow
);
3484 hres
= IHTMLWindow2_open(window
, url
, name
, NULL
, VARIANT_FALSE
, &new_window
);
3486 ok(hres
== S_OK
, "open failed: %08x\n", hres
);
3488 ok(new_window
== NULL
, "new_window != NULL\n");
3491 CHECK_CALLED(TranslateUrl
);
3493 CHECK_CALLED(EvaluateNewWindow
);
3497 SysFreeString(name
);
3499 IHTMLWindow2_Release(window
);
3500 SysFreeString(name
);
3503 static void test_clear(IHTMLDocument2
*doc
)
3507 hres
= IHTMLDocument2_clear(doc
);
3508 ok(hres
== S_OK
, "clear failed: %08x\n", hres
);
3511 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
3513 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
3514 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
3515 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
3516 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
3517 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
3518 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
3519 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
3520 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
3521 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
3522 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
3523 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
3524 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
3525 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
3526 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
3527 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
3528 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
3529 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
3530 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
3531 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
3532 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
3534 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
3535 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
3537 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
3539 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
3541 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
3542 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
3544 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
3545 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
3547 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
3549 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
3550 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
3553 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3554 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
3556 IOleCommandTarget
*cmdtrg
;
3557 OLECMD olecmd
= {cmdid
, 0};
3560 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3561 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
3565 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
3566 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
3568 IOleCommandTarget_Release(cmdtrg
);
3570 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
3571 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
3574 static void test_MSHTML_QueryStatus(IHTMLDocument2
*doc
, DWORD cmdf
)
3576 IUnknown
*unk
= doc
? (IUnknown
*)doc
: doc_unk
;
3578 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
3579 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
3580 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
3581 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
3582 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
3583 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
3584 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
3585 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
3586 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
3587 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
3588 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
3589 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
3590 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
3591 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
3592 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
3593 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
3596 static void test_OleCommandTarget(IHTMLDocument2
*doc
)
3598 IOleCommandTarget
*cmdtrg
;
3599 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
3603 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3604 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
3608 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3609 cmds
[i
].cmdID
= i
+1;
3610 cmds
[i
].cmdf
= 0xf0f0;
3613 SET_EXPECT(QueryStatus_OPEN
);
3614 SET_EXPECT(QueryStatus_NEW
);
3615 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
3616 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
3617 CHECK_CALLED(QueryStatus_OPEN
);
3618 CHECK_CALLED(QueryStatus_NEW
);
3620 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3621 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
3622 if(i
+1 == OLECMDID_FIND
)
3624 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
3625 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
3628 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
3629 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
3631 IOleCommandTarget_Release(cmdtrg
);
3634 static void test_OleCommandTarget_fail(IHTMLDocument2
*doc
)
3636 IOleCommandTarget
*cmdtrg
;
3641 {OLECMDID_OPEN
, 0xf0f0},
3642 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
3645 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3646 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
3650 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
3651 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
3653 SET_EXPECT(QueryStatus_OPEN
);
3654 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
3655 CHECK_CALLED(QueryStatus_OPEN
);
3657 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3658 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3659 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
3660 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
3661 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
3662 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
3663 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
3665 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
3666 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
3667 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
3669 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
3670 if(!expect_cmds
[i
]) {
3671 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
3672 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3673 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3674 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3678 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
3679 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3680 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
3681 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
3683 IOleCommandTarget_Release(cmdtrg
);
3686 static void test_exec_onunload(IHTMLDocument2
*doc
)
3688 IOleCommandTarget
*cmdtrg
;
3692 hres
= IUnknown_QueryInterface(doc
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3693 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3697 memset(&var
, 0x0a, sizeof(var
));
3698 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
3699 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
3700 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
3701 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
3702 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
3704 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
3705 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3706 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
3708 IOleCommandTarget_Release(cmdtrg
);
3711 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
3713 IOleCommandTarget
*cmdtrg
;
3716 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3717 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3724 load_state
= LD_DOLOAD
;
3727 SET_EXPECT(GetClassID
);
3728 SET_EXPECT(SetStatusText
);
3729 SET_EXPECT(Exec_ShellDocView_37
);
3730 SET_EXPECT(GetHostInfo
);
3732 SET_EXPECT(GetDisplayName
);
3733 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3734 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3735 SET_EXPECT(OnChanged_READYSTATE
);
3736 SET_EXPECT(IsSystemMoniker
);
3737 SET_EXPECT(Exec_ShellDocView_84
);
3739 SET_EXPECT(BindToStorage
);
3740 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3743 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
3745 expect_status_text
= NULL
;
3746 readystate_set_loading
= TRUE
;
3748 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3749 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3750 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3753 CHECK_CALLED(GetClassID
);
3754 CHECK_CALLED(SetStatusText
);
3755 CHECK_CALLED(Exec_ShellDocView_37
);
3756 CHECK_CALLED(GetHostInfo
);
3758 CHECK_CALLED(GetDisplayName
);
3759 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3760 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3761 CHECK_CALLED(OnChanged_READYSTATE
);
3762 SET_CALLED(IsSystemMoniker
); /* IE7 */
3763 SET_CALLED(Exec_ShellDocView_84
);
3765 CHECK_CALLED(BindToStorage
);
3766 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3767 CHECK_CALLED(HideUI
);
3768 CHECK_CALLED(ShowUI
);
3769 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
3771 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
3773 IOleCommandTarget_Release(cmdtrg
);
3775 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3776 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3777 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3780 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
3782 IOleCommandTarget
*cmdtrg
;
3783 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
3786 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3787 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
3794 V_BSTR(in
) = SysAllocString(name
);
3800 V_I4(out
) = 0xdeadbeef;
3803 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
3804 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
3810 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
3811 if(V_VT(out
) == VT_BSTR
) {
3813 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
3814 "unexpected fontname %s\n", wine_dbgstr_w(name
));
3816 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
3821 IOleCommandTarget_Release(cmdtrg
);
3824 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
3826 IOleCommandTarget
*cmdtrg
;
3829 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3830 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3834 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
3835 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3836 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3838 IOleCommandTarget_Release(cmdtrg
);
3841 static void test_IsDirty(IHTMLDocument2
*doc
, HRESULT exhres
)
3843 IPersistStreamInit
*perinit
;
3844 IPersistMoniker
*permon
;
3845 IPersistFile
*perfile
;
3848 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&perinit
);
3849 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
3850 if(SUCCEEDED(hres
)) {
3851 hres
= IPersistStreamInit_IsDirty(perinit
);
3852 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3853 IPersistStreamInit_Release(perinit
);
3856 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistMoniker
, (void**)&permon
);
3857 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
3858 if(SUCCEEDED(hres
)) {
3859 hres
= IPersistMoniker_IsDirty(permon
);
3860 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3861 IPersistMoniker_Release(permon
);
3864 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistFile
, (void**)&perfile
);
3865 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
3866 if(SUCCEEDED(hres
)) {
3867 hres
= IPersistFile_IsDirty(perfile
);
3868 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3869 IPersistFile_Release(perfile
);
3873 static HWND
create_container_window(void)
3875 static const WCHAR wszHTMLDocumentTest
[] =
3876 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3877 static WNDCLASSEXW wndclass
= {
3878 sizeof(WNDCLASSEXW
),
3881 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
3882 wszHTMLDocumentTest
,
3886 RegisterClassExW(&wndclass
);
3887 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
3888 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
3889 515, 530, NULL
, NULL
, NULL
, NULL
);
3892 static void test_DoVerb(IOleObject
*oleobj
)
3894 RECT rect
= {0,0,500,500};
3897 if(!container_locked
) {
3898 SET_EXPECT(GetContainer
);
3899 SET_EXPECT(LockContainer
);
3901 SET_EXPECT(ActivateMe
);
3902 expect_LockContainer_fLock
= TRUE
;
3904 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
3905 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
3907 if(!container_locked
) {
3908 CHECK_CALLED(GetContainer
);
3909 CHECK_CALLED(LockContainer
);
3910 container_locked
= TRUE
;
3912 CHECK_CALLED(ActivateMe
);
3915 #define CLIENTSITE_EXPECTPATH 0x00000001
3916 #define CLIENTSITE_SETNULL 0x00000002
3917 #define CLIENTSITE_DONTSET 0x00000004
3919 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
3921 IOleClientSite
*clientsite
;
3924 if(flags
& CLIENTSITE_SETNULL
) {
3925 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3926 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
3928 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
3929 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3931 set_clientsite
= FALSE
;
3934 if(flags
& CLIENTSITE_DONTSET
)
3937 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3938 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
3939 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
3940 clientsite
, set_clientsite
? &ClientSite
: NULL
);
3942 if(!set_clientsite
) {
3943 SET_EXPECT(GetHostInfo
);
3944 if(flags
& CLIENTSITE_EXPECTPATH
) {
3945 SET_EXPECT(GetOptionKeyPath
);
3946 SET_EXPECT(GetOverrideKeyPath
);
3948 SET_EXPECT(GetWindow
);
3949 if(flags
& CLIENTSITE_EXPECTPATH
)
3950 SET_EXPECT(Exec_DOCCANNAVIGATE
);
3951 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3952 SET_EXPECT(Exec_SETPROGRESSMAX
);
3953 SET_EXPECT(Exec_SETPROGRESSPOS
);
3954 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3955 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3956 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3957 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3958 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3959 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3961 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
3962 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3964 CHECK_CALLED(GetHostInfo
);
3965 if(flags
& CLIENTSITE_EXPECTPATH
) {
3966 CHECK_CALLED(GetOptionKeyPath
);
3967 CHECK_CALLED(GetOverrideKeyPath
);
3969 CHECK_CALLED(GetWindow
);
3970 if(flags
& CLIENTSITE_EXPECTPATH
)
3971 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
3972 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
3973 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3974 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3975 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3976 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3977 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3978 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3979 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3980 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3982 set_clientsite
= TRUE
;
3985 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
3986 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3988 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3989 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
3990 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
3993 static void test_OnAmbientPropertyChange(IHTMLDocument2
*doc
)
3995 IOleControl
*control
= NULL
;
3998 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
3999 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4003 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
4004 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
4005 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4006 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
4008 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4009 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
4010 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4011 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4013 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4014 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4015 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
4016 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4017 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4018 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4020 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
4021 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4022 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
4023 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4024 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
4025 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4027 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
4028 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
4029 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4030 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
4032 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
4033 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4034 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
4035 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
4037 IOleControl_Release(control
);
4042 static void test_OnAmbientPropertyChange2(IHTMLDocument2
*doc
)
4044 IOleControl
*control
= NULL
;
4047 hres
= IUnknown_QueryInterface(doc
, &IID_IOleControl
, (void**)&control
);
4048 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
4052 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
4053 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
4055 IOleControl_Release(control
);
4058 static void test_Close(IHTMLDocument2
*doc
, BOOL set_client
)
4060 IOleObject
*oleobj
= NULL
;
4063 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4064 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4068 SET_EXPECT(GetContainer
);
4069 SET_EXPECT(LockContainer
);
4070 expect_LockContainer_fLock
= FALSE
;
4071 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
4072 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
4073 CHECK_CALLED(GetContainer
);
4074 CHECK_CALLED(LockContainer
);
4075 container_locked
= FALSE
;
4078 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
4080 IOleObject_Release(oleobj
);
4083 static void test_Advise(IHTMLDocument2
*doc
)
4085 IOleObject
*oleobj
= NULL
;
4086 IEnumSTATDATA
*enum_advise
= (void*)0xdeadbeef;
4090 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4091 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4095 hres
= IOleObject_Unadvise(oleobj
, 0);
4096 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
4098 hres
= IOleObject_EnumAdvise(oleobj
, &enum_advise
);
4099 ok(hres
== S_OK
, "EnumAdvise returned: %08x\n", hres
);
4100 ok(enum_advise
== NULL
, "enum_advise != NULL\n");
4103 hres
= IOleObject_Advise(oleobj
, NULL
, &conn
);
4104 /* Old IE returns S_OK and sets conn to 1 */
4105 ok(hres
== E_INVALIDARG
|| hres
== S_OK
, "Advise returned: %08x\n", hres
);
4106 ok(conn
== 0 || conn
== 1, "conn = %d\n", conn
);
4108 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, NULL
);
4109 ok(hres
== E_INVALIDARG
, "Advise returned: %08x\n", hres
);
4111 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4112 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
4113 ok(conn
== 1, "conn = %d\n", conn
);
4115 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4116 ok(hres
== S_OK
, "Advise returned: %08x\n", hres
);
4117 ok(conn
== 2, "conn = %d\n", conn
);
4119 hres
= IOleObject_Unadvise(oleobj
, 1);
4120 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
4122 hres
= IOleObject_Unadvise(oleobj
, 1);
4123 ok(hres
== OLE_E_NOCONNECTION
, "Unadvise returned: %08x\n", hres
);
4125 hres
= IOleObject_Unadvise(oleobj
, 2);
4126 ok(hres
== S_OK
, "Unadvise returned: %08x\n", hres
);
4128 IOleObject_Release(oleobj
);
4131 static void test_OnFrameWindowActivate(IUnknown
*unk
)
4133 IOleInPlaceActiveObject
*inplaceact
;
4136 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
4137 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
4141 if(set_clientsite
) {
4142 expect_OnFrameWindowActivate_fActivate
= TRUE
;
4143 SET_EXPECT(OnFrameWindowActivate
);
4144 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4145 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4146 CHECK_CALLED(OnFrameWindowActivate
);
4148 SET_EXPECT(OnFrameWindowActivate
);
4149 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4150 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4151 CHECK_CALLED(OnFrameWindowActivate
);
4153 expect_OnFrameWindowActivate_fActivate
= FALSE
;
4154 SET_EXPECT(OnFrameWindowActivate
);
4155 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
4156 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4157 CHECK_CALLED(OnFrameWindowActivate
);
4159 expect_OnFrameWindowActivate_fActivate
= TRUE
;
4160 SET_EXPECT(OnFrameWindowActivate
);
4161 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4162 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4163 CHECK_CALLED(OnFrameWindowActivate
);
4165 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
4166 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4168 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
4169 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
4172 IOleInPlaceActiveObject_Release(inplaceact
);
4175 static void test_InPlaceDeactivate(IHTMLDocument2
*doc
, BOOL expect_call
)
4177 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
4180 hres
= IUnknown_QueryInterface(doc
, &IID_IOleInPlaceObjectWindowless
,
4181 (void**)&windowlessobj
);
4182 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
4187 SET_EXPECT(OnFocus_FALSE
);
4189 SET_EXPECT(OnInPlaceDeactivateEx
);
4191 SET_EXPECT(OnInPlaceDeactivate
);
4193 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
4194 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
4196 CHECK_CALLED(OnFocus_FALSE
);
4198 CHECK_CALLED(OnInPlaceDeactivateEx
);
4200 CHECK_CALLED(OnInPlaceDeactivate
);
4203 IOleInPlaceObjectWindowless_Release(windowlessobj
);
4206 static void test_Activate(IHTMLDocument2
*doc
, DWORD flags
)
4208 IOleObject
*oleobj
= NULL
;
4209 IOleDocumentView
*docview
;
4216 IOleDocumentView_Release(view
);
4219 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4220 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
4222 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
4223 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
4225 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
4226 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
4227 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
4229 test_OnFrameWindowActivate((IUnknown
*)doc
);
4231 test_ClientSite(oleobj
, flags
);
4232 test_InPlaceDeactivate(doc
, FALSE
);
4233 test_DoVerb(oleobj
);
4235 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4236 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
4237 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
4239 SET_EXPECT(OnFocus_TRUE
);
4240 SET_EXPECT(SetActiveObject
);
4242 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4243 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
4244 expect_status_text
= NULL
;
4246 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
4247 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
4249 CHECK_CALLED(OnFocus_TRUE
);
4250 CHECK_CALLED(SetActiveObject
);
4251 CHECK_CALLED(ShowUI
);
4252 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4253 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
4255 IOleDocumentView_Release(docview
);
4258 IOleObject_Release(oleobj
);
4260 test_OnFrameWindowActivate((IUnknown
*)doc
);
4263 static void test_Window(IHTMLDocument2
*doc
, BOOL expect_success
)
4265 IOleInPlaceActiveObject
*activeobject
= NULL
;
4269 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
4270 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
4274 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
4276 if(expect_success
) {
4277 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
4278 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
4280 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
4281 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
4284 IOleInPlaceActiveObject_Release(activeobject
);
4287 static void test_CloseView(void)
4289 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
4295 hres
= IOleDocumentView_Show(view
, FALSE
);
4296 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
4298 hres
= IOleDocumentView_CloseView(view
, 0);
4299 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
4301 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
4302 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
4304 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
4305 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
4306 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
4309 static void test_UIDeactivate(void)
4313 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4314 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4316 if(call_UIActivate
!= CallUIActivate_None
) {
4317 SET_EXPECT(SetActiveObject_null
);
4319 SET_EXPECT(OnUIDeactivate
);
4322 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
4323 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
4325 if(call_UIActivate
!= CallUIActivate_None
) {
4326 CHECK_CALLED(SetActiveObject_null
);
4327 CHECK_CALLED(HideUI
);
4328 CHECK_CALLED(OnUIDeactivate
);
4330 if(call_UIActivate
== CallUIActivate_AfterShow
) {
4331 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4335 static void test_Hide(void)
4342 hres
= IOleDocumentView_Show(view
, FALSE
);
4343 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
4346 static HRESULT
create_document(IHTMLDocument2
**doc
)
4348 IHTMLDocument5
*doc5
;
4351 hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
4352 &IID_IHTMLDocument2
, (void**)doc
);
4353 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
4357 hres
= IHTMLDocument2_QueryInterface(*doc
, &IID_IHTMLDocument5
, (void**)&doc5
);
4358 if(SUCCEEDED(hres
)) {
4359 IHTMLDocument5_Release(doc5
);
4361 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
4362 IHTMLDocument2_Release(*doc
);
4368 static void test_Navigate(IHTMLDocument2
*doc
)
4370 IHlinkTarget
*hlink
;
4373 hres
= IUnknown_QueryInterface(doc
, &IID_IHlinkTarget
, (void**)&hlink
);
4374 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
4376 SET_EXPECT(ActivateMe
);
4377 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
4378 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
4379 CHECK_CALLED(ActivateMe
);
4381 IHlinkTarget_Release(hlink
);
4384 static void test_external(IHTMLDocument2
*doc
, BOOL initialized
)
4386 IDispatch
*external
;
4387 IHTMLWindow2
*htmlwin
;
4390 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
4391 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
4394 SET_EXPECT(GetExternal
);
4395 external
= (void*)0xdeadbeef;
4396 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
4398 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
4399 CHECK_CALLED(GetExternal
);
4400 ok(external
!= NULL
, "external == NULL\n");
4402 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
4403 ok(external
== NULL
, "external != NULL\n");
4406 IHTMLWindow2_Release(htmlwin
);
4409 static void test_StreamLoad(IHTMLDocument2
*doc
)
4411 IPersistStreamInit
*init
;
4414 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
4415 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
4419 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4420 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4421 SET_EXPECT(Exec_ShellDocView_37
);
4422 SET_EXPECT(OnChanged_READYSTATE
);
4424 readystate_set_loading
= TRUE
;
4426 hres
= IPersistStreamInit_Load(init
, &Stream
);
4427 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4429 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4430 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4431 CHECK_CALLED(Exec_ShellDocView_37
);
4432 CHECK_CALLED(OnChanged_READYSTATE
);
4435 test_timer(EXPECT_SETTITLE
);
4436 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4438 IPersistStreamInit_Release(init
);
4441 static void test_StreamInitNew(IHTMLDocument2
*doc
)
4443 IPersistStreamInit
*init
;
4446 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistStreamInit
, (void**)&init
);
4447 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
4451 SET_EXPECT(Invoke_AMBIENT_SILENT
);
4452 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4453 SET_EXPECT(Exec_ShellDocView_37
);
4454 SET_EXPECT(OnChanged_READYSTATE
);
4455 readystate_set_loading
= TRUE
;
4457 hres
= IPersistStreamInit_InitNew(init
);
4458 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
4460 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
4461 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
4462 CHECK_CALLED(Exec_ShellDocView_37
);
4463 CHECK_CALLED(OnChanged_READYSTATE
);
4465 test_timer(EXPECT_SETTITLE
);
4466 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4468 IPersistStreamInit_Release(init
);
4471 static void test_QueryInterface(IHTMLDocument2
*doc
)
4476 static const IID IID_UndocumentedScriptIface
=
4477 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
4479 qi
= (void*)0xdeadbeef;
4480 hres
= IUnknown_QueryInterface(doc
, &IID_IRunnableObject
, (void**)&qi
);
4481 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4482 ok(qi
== NULL
, "qirunnable=%p, expected NULL\n", qi
);
4484 qi
= (void*)0xdeadbeef;
4485 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode
, (void**)&qi
);
4486 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4487 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4489 qi
= (void*)0xdeadbeef;
4490 hres
= IUnknown_QueryInterface(doc
, &IID_IHTMLDOMNode2
, (void**)&qi
);
4491 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4492 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4494 qi
= (void*)0xdeadbeef;
4495 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistPropertyBag
, (void**)&qi
);
4496 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4497 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4499 qi
= (void*)0xdeadbeef;
4500 hres
= IUnknown_QueryInterface(doc
, &IID_UndocumentedScriptIface
, (void**)&qi
);
4501 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4502 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4504 qi
= (void*)0xdeadbeef;
4505 hres
= IUnknown_QueryInterface(doc
, &IID_IMarshal
, (void**)&qi
);
4506 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4507 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4509 qi
= (void*)0xdeadbeef;
4510 hres
= IUnknown_QueryInterface(doc
, &IID_IExternalConnection
, (void**)&qi
);
4511 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4512 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4514 qi
= (void*)0xdeadbeef;
4515 hres
= IUnknown_QueryInterface(doc
, &IID_IStdMarshalInfo
, (void**)&qi
);
4516 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
4517 ok(qi
== NULL
, "qi=%p, expected NULL\n", qi
);
4519 hres
= IUnknown_QueryInterface(doc
, &IID_IDispatch
, (void**)&qi
);
4520 ok(hres
== S_OK
, "Could not get IDispatch interface: %08x\n", hres
);
4521 ok(qi
!= (IUnknown
*)doc
, "disp == doc\n");
4522 IUnknown_Release(qi
);
4525 static void init_test(enum load_state_t ls
) {
4527 hwnd
= last_hwnd
= NULL
;
4528 set_clientsite
= FALSE
;
4529 load_from_stream
= FALSE
;
4530 call_UIActivate
= CallUIActivate_None
;
4536 inplace_deactivated
= FALSE
;
4537 navigated_load
= FALSE
;
4540 static void test_HTMLDocument(BOOL do_load
)
4542 IHTMLDocument2
*doc
;
4546 trace("Testing HTMLDocument (%s)...\n", (do_load
? "load" : "no load"));
4548 init_test(do_load
? LD_DOLOAD
: LD_NO
);
4550 hres
= create_document(&doc
);
4553 doc_unk
= (IUnknown
*)doc
;
4555 test_QueryInterface(doc
);
4557 test_IsDirty(doc
, S_FALSE
);
4558 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4559 test_external(doc
, FALSE
);
4560 test_ViewAdviseSink(doc
);
4561 test_ConnectionPointContainer(doc
);
4562 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4563 test_Persist(doc
, &Moniker
);
4565 test_OnAmbientPropertyChange2(doc
);
4567 test_Activate(doc
, CLIENTSITE_EXPECTPATH
);
4570 test_download(DWL_CSS
|DWL_TRYCSS
);
4571 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4574 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4575 test_OleCommandTarget_fail(doc
);
4576 test_OleCommandTarget(doc
);
4577 test_OnAmbientPropertyChange(doc
);
4578 test_Window(doc
, TRUE
);
4579 test_external(doc
, TRUE
);
4581 test_UIDeactivate();
4582 test_OleCommandTarget(doc
);
4583 test_Window(doc
, TRUE
);
4584 test_InPlaceDeactivate(doc
, TRUE
);
4586 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4587 * MSHTML. It doesn't with Wine. */
4589 test_Window(doc
, FALSE
);
4591 test_InPlaceDeactivate(doc
, FALSE
);
4593 test_Close(doc
, FALSE
);
4595 /* Activate HTMLDocument again */
4596 test_Activate(doc
, CLIENTSITE_SETNULL
);
4597 test_Window(doc
, TRUE
);
4598 test_OleCommandTarget(doc
);
4599 test_UIDeactivate();
4600 test_InPlaceDeactivate(doc
, TRUE
);
4601 test_Close(doc
, FALSE
);
4603 /* Activate HTMLDocument again, this time without UIActivate */
4604 call_UIActivate
= CallUIActivate_None
;
4605 test_Activate(doc
, CLIENTSITE_SETNULL
);
4606 test_Window(doc
, TRUE
);
4608 test_UIDeactivate();
4609 test_InPlaceDeactivate(doc
, TRUE
);
4612 test_Close(doc
, TRUE
);
4613 test_OnAmbientPropertyChange2(doc
);
4614 test_GetCurMoniker((IUnknown
*)doc
, do_load
? &Moniker
: NULL
, NULL
);
4617 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4618 call_UIActivate
= CallUIActivate_AfterShow
;
4619 test_Activate(doc
, 0);
4620 test_Window(doc
, TRUE
);
4621 test_OleCommandTarget(doc
);
4622 test_UIDeactivate();
4623 test_InPlaceDeactivate(doc
, TRUE
);
4624 test_Close(doc
, FALSE
);
4625 call_UIActivate
= CallUIActivate_None
;
4629 IOleDocumentView_Release(view
);
4632 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
4634 ref
= IHTMLDocument2_Release(doc
);
4635 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4637 ok(!IsWindow(hwnd
), "hwnd is not destroyed\n");
4640 static void test_HTMLDocument_hlink(void)
4642 IHTMLDocument2
*doc
;
4646 trace("Testing HTMLDocument (hlink)...\n");
4648 init_test(LD_DOLOAD
);
4651 hres
= create_document(&doc
);
4654 doc_unk
= (IUnknown
*)doc
;
4656 test_ViewAdviseSink(doc
);
4657 test_ConnectionPointContainer(doc
);
4658 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4659 test_Persist(doc
, &Moniker
);
4662 IUnknown_Release(doc
);
4666 test_download(DWL_CSS
|DWL_TRYCSS
);
4668 test_IsDirty(doc
, S_FALSE
);
4669 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4671 test_exec_onunload(doc
);
4672 test_Window(doc
, TRUE
);
4673 test_InPlaceDeactivate(doc
, TRUE
);
4674 test_Close(doc
, FALSE
);
4675 test_IsDirty(doc
, S_FALSE
);
4676 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4678 test_GetCurMoniker((IUnknown
*)doc
, &Moniker
, NULL
);
4681 IOleDocumentView_Release(view
);
4684 ref
= IHTMLDocument2_Release(doc
);
4685 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4688 static void test_cookies(IHTMLDocument2
*doc
)
4696 hres
= IHTMLDocument2_get_cookie(doc
, &str
);
4697 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4699 size
= sizeof(buf
)/sizeof(WCHAR
);
4700 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4701 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4702 ok(!lstrcmpW(buf
, str
), "cookie = %s, expected %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(buf
));
4706 str
= a2bstr("test=testval");
4707 hres
= IHTMLDocument2_put_cookie(doc
, str
);
4708 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
4711 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
4712 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4713 ok(str2
!= NULL
, "cookie = NULL\n");
4714 size
= sizeof(buf
)/sizeof(WCHAR
);
4715 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4716 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4717 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
4718 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
4720 SysFreeString(str2
);
4722 str
= a2bstr("test=testval2");
4723 hres
= IHTMLDocument2_put_cookie(doc
, str
);
4724 ok(hres
== S_OK
, "put_cookie failed: %08x\n", hres
);
4727 hres
= IHTMLDocument2_get_cookie(doc
, &str2
);
4728 ok(hres
== S_OK
, "get_cookie failed: %08x\n", hres
);
4729 ok(str2
!= NULL
, "cookie = NULL\n");
4730 size
= sizeof(buf
)/sizeof(WCHAR
);
4731 b
= InternetGetCookieW(http_urlW
, NULL
, buf
, &size
);
4732 ok(b
, "InternetGetCookieW failed: %08x\n", GetLastError());
4733 ok(!lstrcmpW(buf
, str2
), "cookie = %s, expected %s\n", wine_dbgstr_w(str2
), wine_dbgstr_w(buf
));
4734 ok(strstrW(str2
, str
) != NULL
, "could not find %s in %s\n", wine_dbgstr_w(str
), wine_dbgstr_w(str2
));
4736 SysFreeString(str2
);
4739 static void test_HTMLDocument_http(void)
4742 IHTMLDocument2
*doc
;
4746 trace("Testing HTMLDocument (http)...\n");
4748 if(!winetest_interactive
&& is_ie_hardened()) {
4749 win_skip("IE running in Enhanced Security Configuration\n");
4753 init_test(LD_DOLOAD
);
4756 hres
= create_document(&doc
);
4759 doc_unk
= (IUnknown
*)doc
;
4761 hres
= CreateURLMoniker(NULL
, http_urlW
, &http_mon
);
4762 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
4764 test_ViewAdviseSink(doc
);
4765 test_ConnectionPointContainer(doc
);
4766 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4767 test_Persist(doc
, http_mon
);
4770 IUnknown_Release(doc
);
4774 test_download(DWL_HTTP
);
4776 test_IsDirty(doc
, S_FALSE
);
4777 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4778 test_GetCurMoniker((IUnknown
*)doc
, http_mon
, NULL
);
4781 test_open_window(doc
);
4783 test_InPlaceDeactivate(doc
, TRUE
);
4784 test_Close(doc
, FALSE
);
4785 test_IsDirty(doc
, S_FALSE
);
4786 test_GetCurMoniker((IUnknown
*)doc
, NULL
, about_blank_url
);
4789 IOleDocumentView_Release(view
);
4792 ref
= IHTMLDocument2_Release(doc
);
4793 ok(!ref
, "ref=%d, expected 0\n", ref
);
4795 ref
= IMoniker_Release(http_mon
);
4796 ok(!ref
, "ref=%d, expected 0\n", ref
);
4799 static void test_QueryService(IHTMLDocument2
*doc
, BOOL success
)
4801 IServiceProvider
*sp
;
4805 hres
= IUnknown_QueryInterface(doc
, &IID_IServiceProvider
, (void**)&sp
);
4806 ok(hres
== S_OK
, "QueryService returned %08x\n", hres
);
4808 hres
= IServiceProvider_QueryService(sp
, &IID_IHlinkFrame
, &IID_IHlinkFrame
, (void**)&hf
);
4810 IHlinkFrame_Release(hf
);
4812 ok(hres
== (success
?S_OK
:E_NOINTERFACE
), "QueryService returned %08x, expected %08x\n", hres
, success
?S_OK
:E_NOINTERFACE
);
4814 IServiceProvider_Release(sp
);
4817 static void test_HTMLDocument_StreamLoad(void)
4819 IHTMLDocument2
*doc
;
4825 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4827 init_test(LD_DOLOAD
);
4828 load_from_stream
= TRUE
;
4830 hres
= create_document(&doc
);
4833 doc_unk
= (IUnknown
*)doc
;
4835 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4836 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4838 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4839 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4841 test_readyState((IUnknown
*)doc
);
4842 test_IsDirty(doc
, S_FALSE
);
4843 test_ViewAdviseSink(doc
);
4844 test_ConnectionPointContainer(doc
);
4845 test_QueryService(doc
, FALSE
);
4846 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
4847 test_QueryService(doc
, TRUE
);
4848 test_DoVerb(oleobj
);
4849 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4851 IOleObject_Release(oleobj
);
4853 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4854 test_StreamLoad(doc
);
4855 test_download(DWL_VERBDONE
|DWL_TRYCSS
);
4856 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4858 test_UIDeactivate();
4859 test_InPlaceDeactivate(doc
, TRUE
);
4860 SET_EXPECT(Advise_Close
);
4861 test_Close(doc
, FALSE
);
4862 CHECK_CALLED(Advise_Close
);
4863 test_IsDirty(doc
, S_FALSE
);
4866 IOleDocumentView_Release(view
);
4871 ref
= IHTMLDocument2_Release(doc
);
4872 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4875 static void test_HTMLDocument_StreamInitNew(void)
4877 IHTMLDocument2
*doc
;
4883 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4885 init_test(LD_DOLOAD
);
4886 load_from_stream
= TRUE
;
4888 hres
= create_document(&doc
);
4891 doc_unk
= (IUnknown
*)doc
;
4893 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4894 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4896 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4897 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4899 test_readyState((IUnknown
*)doc
);
4900 test_IsDirty(doc
, S_FALSE
);
4901 test_ViewAdviseSink(doc
);
4902 test_ConnectionPointContainer(doc
);
4903 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
4904 test_DoVerb(oleobj
);
4905 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4907 IOleObject_Release(oleobj
);
4909 test_GetCurMoniker((IUnknown
*)doc
, NULL
, NULL
);
4910 test_StreamInitNew(doc
);
4911 test_download(DWL_VERBDONE
|DWL_TRYCSS
|DWL_EMPTY
);
4912 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4914 test_UIDeactivate();
4915 test_InPlaceDeactivate(doc
, TRUE
);
4916 SET_EXPECT(Advise_Close
);
4917 test_Close(doc
, FALSE
);
4918 CHECK_CALLED(Advise_Close
);
4919 test_IsDirty(doc
, S_FALSE
);
4922 IOleDocumentView_Release(view
);
4927 ref
= IHTMLDocument2_Release(doc
);
4928 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
4931 static void test_edit_uiactivate(IOleObject
*oleobj
)
4933 IOleDocumentView
*docview
;
4936 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
4937 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
4939 SET_EXPECT(OnFocus_TRUE
);
4940 SET_EXPECT(SetActiveObject
);
4942 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
4943 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
4944 expect_status_text
= NULL
;
4946 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
4947 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
4949 CHECK_CALLED(OnFocus_TRUE
);
4950 CHECK_CALLED(SetActiveObject
);
4951 CHECK_CALLED(ShowUI
);
4952 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
4953 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
4955 IOleDocumentView_Release(docview
);
4958 static void test_editing_mode(BOOL do_load
)
4960 IHTMLDocument2
*doc
;
4967 trace("Testing HTMLDocument (edit%s)...\n", do_load
? " load" : "");
4969 init_test(do_load
? LD_DOLOAD
: LD_NO
);
4970 call_UIActivate
= CallUIActivate_AfterShow
;
4972 hres
= create_document(&doc
);
4975 unk
= doc_unk
= (IUnknown
*)doc
;
4977 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
4978 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
4980 hres
= IOleObject_Advise(oleobj
, (IAdviseSink
*)&AdviseSink
, &conn
);
4981 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
4983 test_readyState((IUnknown
*)doc
);
4984 test_ViewAdviseSink(doc
);
4985 test_ConnectionPointContainer(doc
);
4986 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
4987 test_DoVerb(oleobj
);
4988 test_edit_uiactivate(oleobj
);
4990 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
4992 test_Persist(doc
, &Moniker
);
4993 stream_read
= protocol_read
= 0;
4994 test_exec_editmode(unk
, do_load
);
4995 test_UIDeactivate();
4996 call_UIActivate
= CallUIActivate_None
;
4997 IOleObject_Release(oleobj
);
4999 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
);
5000 test_download(DWL_VERBDONE
| (do_load
? DWL_CSS
|DWL_TRYCSS
: 0));
5002 SET_EXPECT(SetStatusText
); /* ignore race in native mshtml */
5003 test_timer(EXPECT_UPDATEUI
);
5004 SET_CALLED(SetStatusText
);
5006 test_MSHTML_QueryStatus(doc
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5009 test_exec_fontname(unk
, NULL
, wszTimesNewRoman
);
5010 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
5011 test_timer(EXPECT_UPDATEUI
);
5012 test_exec_fontname(unk
, NULL
, wszArial
);
5014 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
5015 test_timer(EXPECT_UPDATEUI
);
5016 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5017 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5019 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
5020 test_timer(EXPECT_UPDATEUI
);
5021 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
5022 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5023 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
5024 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
5026 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
5027 test_timer(EXPECT_UPDATEUI
);
5028 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
5029 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
5032 test_UIDeactivate();
5033 test_InPlaceDeactivate(doc
, TRUE
);
5034 SET_EXPECT(Advise_Close
);
5035 test_Close(doc
, FALSE
);
5036 CHECK_CALLED(Advise_Close
);
5039 IOleDocumentView_Release(view
);
5043 ref
= IUnknown_Release(unk
);
5044 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5047 static void test_UIActivate(BOOL do_load
, BOOL use_ipsex
, BOOL use_ipsw
)
5049 IHTMLDocument2
*doc
;
5051 IOleInPlaceSite
*inplacesite
;
5055 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load
, use_ipsex
, use_ipsw
);
5057 init_test(do_load
? LD_DOLOAD
: LD_NO
);
5059 hres
= create_document(&doc
);
5062 doc_unk
= (IUnknown
*)doc
;
5067 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
5068 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
5070 hres
= IUnknown_QueryInterface(doc
, &IID_IOleDocumentView
, (void**)&view
);
5071 ok(hres
== S_OK
, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres
);
5073 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
5074 SET_EXPECT(GetHostInfo
);
5075 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
5076 SET_EXPECT(Invoke_AMBIENT_SILENT
);
5077 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5078 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
5079 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
5080 SET_EXPECT(GetOptionKeyPath
);
5081 SET_EXPECT(GetOverrideKeyPath
);
5082 SET_EXPECT(GetWindow
);
5083 SET_EXPECT(Exec_DOCCANNAVIGATE
);
5084 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
5085 SET_EXPECT(Exec_SETPROGRESSMAX
);
5086 SET_EXPECT(Exec_SETPROGRESSPOS
);
5088 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
5089 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
5091 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
5092 CHECK_CALLED(GetHostInfo
);
5093 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
5094 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
5095 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
5096 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
5097 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
5098 CHECK_CALLED(GetOptionKeyPath
);
5099 CHECK_CALLED(GetOverrideKeyPath
);
5100 CHECK_CALLED(GetWindow
);
5101 CHECK_CALLED(Exec_DOCCANNAVIGATE
);
5102 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
5103 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5104 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5106 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
5107 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
5108 ok(inplacesite
== NULL
, "inplacesite = %p, expected NULL\n", inplacesite
);
5110 SET_EXPECT(GetContainer
);
5111 SET_EXPECT(LockContainer
);
5112 SET_EXPECT(CanInPlaceActivate
);
5113 SET_EXPECT(GetWindowContext
);
5114 SET_EXPECT(GetWindow
);
5116 SET_EXPECT(OnInPlaceActivateEx
);
5117 SET_EXPECT(RequestUIActivate
);
5120 SET_EXPECT(OnInPlaceActivate
);
5121 SET_EXPECT(OnUIActivate
);
5122 SET_EXPECT(SetStatusText
);
5123 SET_EXPECT(Exec_SETPROGRESSMAX
);
5124 SET_EXPECT(Exec_SETPROGRESSPOS
);
5126 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5127 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
5128 SET_EXPECT(OnFocus_TRUE
);
5129 SET_EXPECT(SetActiveObject
);
5130 expect_LockContainer_fLock
= TRUE
;
5132 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
5133 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
5135 CHECK_CALLED(GetContainer
);
5136 CHECK_CALLED(LockContainer
);
5137 CHECK_CALLED(CanInPlaceActivate
);
5138 CHECK_CALLED(GetWindowContext
);
5139 CHECK_CALLED(GetWindow
);
5141 CHECK_CALLED(OnInPlaceActivateEx
);
5142 SET_EXPECT(RequestUIActivate
);
5145 CHECK_CALLED(OnInPlaceActivate
);
5146 CHECK_CALLED(OnUIActivate
);
5147 CHECK_CALLED(SetStatusText
);
5148 CHECK_CALLED(Exec_SETPROGRESSMAX
);
5149 CHECK_CALLED(Exec_SETPROGRESSPOS
);
5150 CHECK_CALLED(ShowUI
);
5151 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5152 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
5153 CHECK_CALLED(OnFocus_TRUE
);
5154 CHECK_CALLED(SetActiveObject
);
5155 container_locked
= TRUE
;
5157 SET_EXPECT(SetActiveObject_null
);
5158 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
5160 SET_EXPECT(OnUIDeactivate
);
5162 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
5163 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
5165 CHECK_CALLED(SetActiveObject_null
);
5166 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
5167 CHECK_CALLED(HideUI
);
5168 CHECK_CALLED(OnUIDeactivate
);
5170 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
5171 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
5172 ok(inplacesite
!= NULL
, "inplacesite = NULL\n");
5173 IOleInPlaceSite_Release(inplacesite
);
5175 SET_EXPECT(OnFocus_FALSE
);
5177 SET_EXPECT(OnInPlaceDeactivateEx
);
5179 SET_EXPECT(OnInPlaceDeactivate
);
5183 CHECK_CALLED(OnFocus_FALSE
);
5185 CHECK_CALLED(OnInPlaceDeactivateEx
);
5187 CHECK_CALLED(OnInPlaceDeactivate
);
5189 test_Close(doc
, TRUE
);
5191 IOleObject_Release(oleobj
);
5192 IOleDocumentView_Release(view
);
5195 ref
= IHTMLDocument2_Release(doc
);
5196 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5199 static void register_protocol(void)
5201 IInternetSession
*session
;
5204 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
5206 hres
= CoInternetGetSession(0, &session
, 0);
5207 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
5209 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
5210 wsz_winetest
, 0, NULL
, 0);
5211 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
5213 IInternetSession_Release(session
);
5216 static void test_HTMLDoc_ISupportErrorInfo(void)
5218 IHTMLDocument2
*doc
;
5220 ISupportErrorInfo
*sinfo
;
5223 hres
= create_document(&doc
);
5227 hres
= IUnknown_QueryInterface(doc
, &IID_ISupportErrorInfo
, (void**)&sinfo
);
5228 ok(hres
== S_OK
, "got %x\n", hres
);
5229 ok(sinfo
!= NULL
, "got %p\n", sinfo
);
5232 hres
= ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo
, &IID_IErrorInfo
);
5233 ok(hres
== S_FALSE
, "Expected S_OK, got %x\n", hres
);
5234 IUnknown_Release(sinfo
);
5237 ref
= IHTMLDocument2_Release(doc
);
5238 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5241 static void test_IPersistHistory(void)
5243 IHTMLDocument2
*doc
;
5246 IPersistHistory
*phist
;
5248 hres
= create_document(&doc
);
5252 hres
= IUnknown_QueryInterface(doc
, &IID_IPersistHistory
, (void**)&phist
);
5253 ok(hres
== S_OK
, "QueryInterface returned %08x, expected S_OK\n", hres
);
5255 IPersistHistory_Release(phist
);
5257 ref
= IHTMLDocument2_Release(doc
);
5258 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
5264 container_hwnd
= create_container_window();
5265 register_protocol();
5267 test_HTMLDocument_hlink();
5269 test_HTMLDocument(FALSE
);
5270 test_HTMLDocument(TRUE
);
5271 test_HTMLDocument_StreamLoad();
5272 test_HTMLDocument_StreamInitNew();
5273 test_editing_mode(FALSE
);
5274 test_editing_mode(TRUE
);
5275 test_HTMLDocument_http();
5276 test_UIActivate(FALSE
, FALSE
, FALSE
);
5277 test_UIActivate(FALSE
, TRUE
, FALSE
);
5278 test_UIActivate(FALSE
, TRUE
, TRUE
);
5279 test_UIActivate(TRUE
, FALSE
, FALSE
);
5280 test_UIActivate(TRUE
, TRUE
, FALSE
);
5281 test_UIActivate(TRUE
, TRUE
, TRUE
);
5283 test_HTMLDoc_ISupportErrorInfo();
5284 test_IPersistHistory();
5286 DestroyWindow(container_hwnd
);