2 * Copyright 2005-2007 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>
40 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
42 #define DEFINE_EXPECT(func) \
43 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
45 #define SET_EXPECT(func) \
46 expect_ ## func = TRUE
48 #define SET_CALLED(func) \
49 called_ ## func = TRUE
51 #define CHECK_EXPECT2(func) \
53 ok(expect_ ##func, "unexpected call " #func "\n"); \
54 called_ ## func = TRUE; \
57 #define CHECK_EXPECT(func) \
59 CHECK_EXPECT2(func); \
60 expect_ ## func = FALSE; \
63 #define CHECK_CALLED(func) \
65 ok(called_ ## func, "expected " #func "\n"); \
66 expect_ ## func = called_ ## func = FALSE; \
69 static IOleDocumentView
*view
= NULL
;
70 static HWND container_hwnd
= NULL
, hwnd
= NULL
, last_hwnd
= NULL
;
72 DEFINE_EXPECT(LockContainer
);
73 DEFINE_EXPECT(SetActiveObject
);
74 DEFINE_EXPECT(SetActiveObject_null
);
75 DEFINE_EXPECT(GetWindow
);
76 DEFINE_EXPECT(CanInPlaceActivate
);
77 DEFINE_EXPECT(OnInPlaceActivate
);
78 DEFINE_EXPECT(OnInPlaceActivateEx
);
79 DEFINE_EXPECT(OnUIActivate
);
80 DEFINE_EXPECT(GetWindowContext
);
81 DEFINE_EXPECT(OnUIDeactivate
);
82 DEFINE_EXPECT(OnInPlaceDeactivate
);
83 DEFINE_EXPECT(OnInPlaceDeactivateEx
);
84 DEFINE_EXPECT(GetContainer
);
85 DEFINE_EXPECT(ShowUI
);
86 DEFINE_EXPECT(ActivateMe
);
87 DEFINE_EXPECT(GetHostInfo
);
88 DEFINE_EXPECT(HideUI
);
89 DEFINE_EXPECT(GetOptionKeyPath
);
90 DEFINE_EXPECT(GetOverrideKeyPath
);
91 DEFINE_EXPECT(SetStatusText
);
92 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT
);
93 DEFINE_EXPECT(QueryStatus_OPEN
);
94 DEFINE_EXPECT(QueryStatus_NEW
);
95 DEFINE_EXPECT(Exec_SETPROGRESSMAX
);
96 DEFINE_EXPECT(Exec_SETPROGRESSPOS
);
97 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE
);
98 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0
);
99 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1
);
100 DEFINE_EXPECT(Exec_ShellDocView_37
);
101 DEFINE_EXPECT(Exec_ShellDocView_84
);
102 DEFINE_EXPECT(Exec_UPDATECOMMANDS
);
103 DEFINE_EXPECT(Exec_SETTITLE
);
104 DEFINE_EXPECT(Exec_HTTPEQUIV
);
105 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
106 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE
);
107 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL
);
108 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
109 DEFINE_EXPECT(Invoke_AMBIENT_SILENT
);
110 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT
);
111 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE
);
112 DEFINE_EXPECT(GetDropTarget
);
113 DEFINE_EXPECT(UpdateUI
);
114 DEFINE_EXPECT(Navigate
);
115 DEFINE_EXPECT(OnFrameWindowActivate
);
116 DEFINE_EXPECT(OnChanged_READYSTATE
);
117 DEFINE_EXPECT(OnChanged_1005
);
118 DEFINE_EXPECT(GetDisplayName
);
119 DEFINE_EXPECT(BindToStorage
);
120 DEFINE_EXPECT(IsSystemMoniker
);
121 DEFINE_EXPECT(GetBindResult
);
122 DEFINE_EXPECT(GetClassID
);
123 DEFINE_EXPECT(Abort
);
125 DEFINE_EXPECT(CreateInstance
);
126 DEFINE_EXPECT(Start
);
127 DEFINE_EXPECT(Terminate
);
128 DEFINE_EXPECT(Protocol_Read
);
129 DEFINE_EXPECT(LockRequest
);
130 DEFINE_EXPECT(UnlockRequest
);
131 DEFINE_EXPECT(OnFocus_TRUE
);
132 DEFINE_EXPECT(OnFocus_FALSE
);
133 DEFINE_EXPECT(RequestUIActivate
);
134 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace
);
135 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject
);
136 DEFINE_EXPECT(GetExternal
);
138 static IUnknown
*doc_unk
;
139 static BOOL expect_LockContainer_fLock
;
140 static BOOL expect_InPlaceUIWindow_SetActiveObject_active
= TRUE
;
142 static BOOL set_clientsite
= FALSE
, container_locked
= FALSE
;
143 static BOOL readystate_set_loading
= FALSE
, load_from_stream
;
144 static BOOL editmode
= FALSE
;
145 static int stream_read
, protocol_read
;
146 static enum load_state_t
{
155 static LPCOLESTR expect_status_text
= NULL
;
157 static const char html_page
[] =
159 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
163 static const char css_data
[] = "body {color: red}";
165 static const WCHAR doc_url
[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
166 static const WCHAR about_blank_url
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
168 static HRESULT
QueryInterface(REFIID riid
, void **ppv
);
169 static void test_MSHTML_QueryStatus(IUnknown
*,DWORD
);
170 static BOOL nogecko
= FALSE
;
172 #define test_readyState(u) _test_readyState(__LINE__,u)
173 static void _test_readyState(unsigned,IUnknown
*);
175 static void test_GetCurMoniker(IUnknown
*,IMoniker
*,LPCWSTR
);
177 static const WCHAR wszTimesNewRoman
[] =
178 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
179 static const WCHAR wszArial
[] =
180 {'A','r','i','a','l',0};
182 static const char *debugstr_guid(REFIID riid
)
186 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
187 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
188 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
189 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
194 static const char *debugstr_w(LPCWSTR str
)
196 static char buf
[1024];
201 WideCharToMultiByte(CP_ACP
, 0, str
, -1, buf
, sizeof(buf
), NULL
, NULL
);
205 #define EXPECT_UPDATEUI 1
206 #define EXPECT_SETTITLE 2
208 static void test_timer(DWORD flags
)
210 BOOL
*b
= &called_Exec_SETTITLE
;
213 if(flags
& EXPECT_UPDATEUI
) {
214 SET_EXPECT(UpdateUI
);
215 SET_EXPECT(Exec_UPDATECOMMANDS
);
216 b
= &called_UpdateUI
;
218 if(flags
& EXPECT_SETTITLE
)
219 SET_EXPECT(Exec_SETTITLE
);
221 while(!*b
&& GetMessage(&msg
, hwnd
, 0, 0)) {
222 TranslateMessage(&msg
);
223 DispatchMessage(&msg
);
226 if(flags
& EXPECT_UPDATEUI
) {
227 CHECK_CALLED(UpdateUI
);
228 CHECK_CALLED(Exec_UPDATECOMMANDS
);
230 if(flags
& EXPECT_SETTITLE
)
231 CHECK_CALLED(Exec_SETTITLE
);
234 DEFINE_GUID(IID_External_unk
,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
236 static HRESULT WINAPI
External_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
240 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
245 if(IsEqualGUID(&IID_IProxyManager
, riid
))
246 return E_NOINTERFACE
; /* TODO */
247 if(IsEqualGUID(&IID_IDispatchEx
, riid
))
248 return E_NOINTERFACE
; /* TODO */
249 if(IsEqualGUID(&IID_External_unk
, riid
))
250 return E_NOINTERFACE
; /* TODO */
252 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
253 return E_NOINTERFACE
;
256 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
261 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
266 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
268 ok(0, "unexpected call\n");
272 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
275 ok(0, "unexpected call\n");
279 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
280 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
282 ok(0, "unexpected call\n");
286 static HRESULT WINAPI
External_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
287 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
288 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
290 ok(0, "unexpected call\n");
294 static const IDispatchVtbl ExternalVtbl
= {
295 External_QueryInterface
,
298 Dispatch_GetTypeInfoCount
,
299 Dispatch_GetTypeInfo
,
300 Dispatch_GetIDsOfNames
,
304 static IDispatch External
= { &ExternalVtbl
};
306 static HRESULT WINAPI
Protocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
308 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
314 return E_NOINTERFACE
;
317 static ULONG WINAPI
Protocol_AddRef(IInternetProtocol
*iface
)
322 static ULONG WINAPI
Protocol_Release(IInternetProtocol
*iface
)
327 static HRESULT WINAPI
Protocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
328 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
329 DWORD grfPI
, DWORD dwReserved
)
335 static const WCHAR wszTextCss
[] = {'t','e','x','t','/','c','s','s',0};
336 static const WCHAR empty_str
= {0};
340 ok(pOIProtSink
!= NULL
, "pOIProtSink == NULL\n");
341 ok(pOIBindInfo
!= NULL
, "pOIBindInfo == NULL\n");
342 ok(!grfPI
, "grfPI = %x\n", grfPI
);
343 ok(!dwReserved
, "dwReserved = %d\n", dwReserved
);
345 memset(&bindinfo
, 0, sizeof(bindinfo
));
346 bindinfo
.cbSize
= sizeof(bindinfo
);
347 hres
= IInternetBindInfo_GetBindInfo(pOIBindInfo
, &bindf
, &bindinfo
);
348 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
349 ok(bindf
== (BINDF_FROMURLMON
|BINDF_PULLDATA
|BINDF_NEEDFILE
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
),
350 "bindf = %x\n", bindf
);
352 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
353 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
354 /* TODO: test stgmedData */
355 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
356 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
357 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
358 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
359 ok(bindinfo
.dwOptions
== 0x80000, "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
360 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
361 /* TODO: test dwCodePage */
362 /* TODO: test securityAttributes */
363 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
364 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
365 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
367 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
368 BINDSTATUS_CACHEFILENAMEAVAILABLE
, &empty_str
);
369 ok(hres
== S_OK
, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres
);
371 hres
= IInternetProtocolSink_ReportProgress(pOIProtSink
,
372 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
, wszTextCss
);
374 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres
);
376 hres
= IInternetProtocolSink_ReportData(pOIProtSink
,
377 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
, 13, 13);
378 ok(hres
== S_OK
, "ReportData failed: %08x\n", hres
);
380 hres
= IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
381 ok(hres
== S_OK
, "ReportResult failed: %08x\n", hres
);
386 static HRESULT WINAPI
Protocol_Continue(IInternetProtocol
*iface
,
387 PROTOCOLDATA
*pProtocolData
)
389 ok(0, "unexpected call\n");
393 static HRESULT WINAPI
Protocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
396 ok(0, "unexpected call\n");
400 static HRESULT WINAPI
Protocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
402 CHECK_EXPECT(Terminate
);
406 static HRESULT WINAPI
Protocol_Suspend(IInternetProtocol
*iface
)
408 ok(0, "unexpected call\n");
412 static HRESULT WINAPI
Protocol_Resume(IInternetProtocol
*iface
)
414 ok(0, "unexpected call\n");
418 static HRESULT WINAPI
Protocol_Read(IInternetProtocol
*iface
, void *pv
,
419 ULONG cb
, ULONG
*pcbRead
)
421 CHECK_EXPECT2(Protocol_Read
);
423 ok(pv
!= NULL
, "pv == NULL\n");
424 ok(cb
> sizeof(css_data
), "cb < sizeof(css_data)\n");
425 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
426 ok(!*pcbRead
, "*pcbRead=%d\n", *pcbRead
);
431 protocol_read
+= *pcbRead
= sizeof(css_data
)-1;
432 memcpy(pv
, css_data
, sizeof(css_data
)-1);
436 static HRESULT WINAPI
Protocol_Seek(IInternetProtocol
*iface
,
437 LARGE_INTEGER dlibMove
, DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
439 ok(0, "unexpected call\n");
443 static HRESULT WINAPI
Protocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
445 CHECK_EXPECT(LockRequest
);
449 static HRESULT WINAPI
Protocol_UnlockRequest(IInternetProtocol
*iface
)
451 CHECK_EXPECT(UnlockRequest
);
455 static const IInternetProtocolVtbl ProtocolVtbl
= {
456 Protocol_QueryInterface
,
467 Protocol_LockRequest
,
468 Protocol_UnlockRequest
471 static IInternetProtocol Protocol
= { &ProtocolVtbl
};
473 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
475 if(!IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
476 ok(0, "unexpected call\n");
477 return E_NOINTERFACE
;
480 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
485 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
490 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
491 REFIID riid
, void **ppv
)
493 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
))
494 return E_NOINTERFACE
;
496 CHECK_EXPECT(CreateInstance
);
497 ok(ppv
!= NULL
, "ppv == NULL\n");
503 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
505 ok(0, "unexpected call\n");
509 static const IClassFactoryVtbl ClassFactoryVtbl
= {
510 ClassFactory_QueryInterface
,
512 ClassFactory_Release
,
513 ClassFactory_CreateInstance
,
514 ClassFactory_LockServer
517 static IClassFactory ClassFactory
= { &ClassFactoryVtbl
};
519 static HRESULT WINAPI
HlinkFrame_QueryInterface(IHlinkFrame
*iface
, REFIID riid
, void **ppv
)
521 ok(0, "unexpected call\n");
525 static ULONG WINAPI
HlinkFrame_AddRef(IHlinkFrame
*iface
)
530 static ULONG WINAPI
HlinkFrame_Release(IHlinkFrame
*iface
)
535 static HRESULT WINAPI
HlinkFrame_SetBrowseContext(IHlinkFrame
*iface
,
536 IHlinkBrowseContext
*pihlbc
)
538 ok(0, "unexpected call\n");
542 static HRESULT WINAPI
HlinkFrame_GetBrowseContext(IHlinkFrame
*iface
,
543 IHlinkBrowseContext
**ppihlbc
)
545 ok(0, "unexpected call\n");
549 static HRESULT WINAPI
HlinkFrame_Navigate(IHlinkFrame
*iface
, DWORD grfHLNF
, LPBC pbc
,
550 IBindStatusCallback
*pibsc
, IHlink
*pihlNavigate
)
554 CHECK_EXPECT(Navigate
);
556 ok(grfHLNF
== 0, "grfHLNF=%d, expected 0\n", grfHLNF
);
557 ok(pbc
!= NULL
, "pbc == NULL\n");
558 ok(pibsc
!= NULL
, "pubsc == NULL\n");
559 ok(pihlNavigate
!= NULL
, "puhlNavigate == NULL\n");
562 LPWSTR frame_name
= (LPWSTR
)0xdeadbeef;
563 LPWSTR location
= (LPWSTR
)0xdeadbeef;
565 IMoniker
*mon
= NULL
;
566 DWORD site_data
= 0xdeadbeef;
568 hres
= IHlink_GetTargetFrameName(pihlNavigate
, &frame_name
);
569 ok(hres
== S_FALSE
, "GetTargetFrameName failed: %08x\n", hres
);
570 ok(frame_name
== NULL
, "frame_name = %p\n", frame_name
);
572 hres
= IHlink_GetMonikerReference(pihlNavigate
, 1, &mon
, &location
);
573 ok(hres
== S_OK
, "GetMonikerReference failed: %08x\n", hres
);
574 ok(location
== NULL
, "location = %p\n", location
);
575 ok(mon
!= NULL
, "mon == NULL\n");
577 hres
= IHlink_GetHlinkSite(pihlNavigate
, &site
, &site_data
);
578 ok(hres
== S_OK
, "GetHlinkSite failed: %08x\n", hres
);
579 ok(site
== NULL
, "site = %p\n, expected NULL\n", site
);
580 ok(site_data
== 0xdeadbeef, "site_data = %x\n", site_data
);
586 static HRESULT WINAPI
HlinkFrame_OnNavigate(IHlinkFrame
*iface
, DWORD grfHLNF
,
587 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
, DWORD dwreserved
)
589 ok(0, "unexpected call\n");
593 static HRESULT WINAPI
HlinkFrame_UpdateHlink(IHlinkFrame
*iface
, ULONG uHLID
,
594 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
596 ok(0, "unexpected call\n");
600 static const IHlinkFrameVtbl HlinkFrameVtbl
= {
601 HlinkFrame_QueryInterface
,
604 HlinkFrame_SetBrowseContext
,
605 HlinkFrame_GetBrowseContext
,
607 HlinkFrame_OnNavigate
,
608 HlinkFrame_UpdateHlink
611 static IHlinkFrame HlinkFrame
= { &HlinkFrameVtbl
};
613 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
614 REFIID riid
, void**ppv
)
616 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
621 ok(0, "unexpected call\n");
622 return E_NOINTERFACE
;
625 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
630 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
635 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
638 case DISPID_READYSTATE
:
639 CHECK_EXPECT2(OnChanged_READYSTATE
);
640 test_MSHTML_QueryStatus(NULL
, OLECMDF_SUPPORTED
641 | (editmode
&& (load_state
== LD_INTERACTIVE
|| load_state
== LD_COMPLETE
)
642 ? OLECMDF_ENABLED
: 0));
644 if(readystate_set_loading
) {
645 readystate_set_loading
= FALSE
;
646 load_state
= LD_LOADING
;
648 test_readyState(NULL
);
651 CHECK_EXPECT(OnChanged_1005
);
652 test_readyState(NULL
);
653 load_state
= LD_INTERACTIVE
;
657 ok(0, "unexpected id %d\n", dispID
);
661 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
663 ok(0, "unexpected call\n");
667 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
668 PropertyNotifySink_QueryInterface
,
669 PropertyNotifySink_AddRef
,
670 PropertyNotifySink_Release
,
671 PropertyNotifySink_OnChanged
,
672 PropertyNotifySink_OnRequestEdit
675 static IPropertyNotifySink PropertyNotifySink
= { &PropertyNotifySinkVtbl
};
677 static HRESULT WINAPI
Stream_QueryInterface(IStream
*iface
, REFIID riid
, void **ppv
)
679 ok(0, "unexpected call\n");
680 return E_NOINTERFACE
;
683 static ULONG WINAPI
Stream_AddRef(IStream
*iface
)
688 static ULONG WINAPI
Stream_Release(IStream
*iface
)
693 static HRESULT WINAPI
Stream_Read(IStream
*iface
, void *pv
,
694 ULONG cb
, ULONG
*pcbRead
)
697 ok(pv
!= NULL
, "pv == NULL\n");
698 ok(cb
> sizeof(html_page
), "cb = %d\n", cb
);
699 ok(pcbRead
!= NULL
, "pcbRead == NULL\n");
700 ok(!*pcbRead
, "*pcbRead = %d\n", *pcbRead
);
705 memcpy(pv
, html_page
, sizeof(html_page
)-1);
706 stream_read
+= *pcbRead
= sizeof(html_page
)-1;
710 static HRESULT WINAPI
Stream_Write(IStream
*iface
, const void *pv
,
711 ULONG cb
, ULONG
*pcbWritten
)
713 ok(0, "unexpected call\n");
717 static HRESULT WINAPI
Stream_Seek(IStream
*iface
, LARGE_INTEGER dlibMove
,
718 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
720 ok(0, "unexpected call\n");
724 static HRESULT WINAPI
Stream_SetSize(IStream
*iface
, ULARGE_INTEGER libNewSize
)
726 ok(0, "unexpected call\n");
730 static HRESULT WINAPI
Stream_CopyTo(IStream
*iface
, IStream
*pstm
,
731 ULARGE_INTEGER cb
, ULARGE_INTEGER
*pcbRead
, ULARGE_INTEGER
*pcbWritten
)
733 ok(0, "unexpected call\n");
737 static HRESULT WINAPI
Stream_Commit(IStream
*iface
, DWORD grfCommitFlags
)
739 ok(0, "unexpected call\n");
743 static HRESULT WINAPI
Stream_Revert(IStream
*iface
)
745 ok(0, "unexpected call\n");
749 static HRESULT WINAPI
Stream_LockRegion(IStream
*iface
, ULARGE_INTEGER libOffset
,
750 ULARGE_INTEGER cb
, DWORD dwLockType
)
752 ok(0, "unexpected call\n");
756 static HRESULT WINAPI
Stream_UnlockRegion(IStream
*iface
,
757 ULARGE_INTEGER libOffset
, ULARGE_INTEGER cb
, DWORD dwLockType
)
759 ok(0, "unexpected call\n");
763 static HRESULT WINAPI
Stream_Stat(IStream
*iface
, STATSTG
*pstatstg
,
766 ok(0, "unexpected call\n");
770 static HRESULT WINAPI
Stream_Clone(IStream
*iface
, IStream
**ppstm
)
772 ok(0, "unexpected call\n");
776 static const IStreamVtbl StreamVtbl
= {
777 Stream_QueryInterface
,
793 static IStream Stream
= { &StreamVtbl
};
795 static HRESULT WINAPI
Binding_QueryInterface(IBinding
*iface
, REFIID riid
, void **ppv
)
797 if(IsEqualGUID(&IID_IWinInetHttpInfo
, riid
))
798 return E_NOINTERFACE
; /* TODO */
800 if(IsEqualGUID(&IID_IWinInetInfo
, riid
))
801 return E_NOINTERFACE
; /* TODO */
803 ok(0, "unexpected call\n");
804 return E_NOINTERFACE
;
807 static ULONG WINAPI
Binding_AddRef(IBinding
*iface
)
812 static ULONG WINAPI
Binding_Release(IBinding
*iface
)
817 static HRESULT WINAPI
Binding_Abort(IBinding
*iface
)
823 static HRESULT WINAPI
Binding_Suspend(IBinding
*iface
)
825 ok(0, "unexpected call\n");
829 static HRESULT WINAPI
Binding_Resume(IBinding
*iface
)
831 ok(0, "unexpected call\n");
835 static HRESULT WINAPI
Binding_SetPriority(IBinding
*iface
, LONG nPriority
)
837 ok(0, "unexpected call\n");
841 static HRESULT WINAPI
Binding_GetPriority(IBinding
*iface
, LONG
*pnPriority
)
843 ok(0, "unexpected call\n");
847 static HRESULT WINAPI
Binding_GetBindResult(IBinding
*iface
, CLSID
*pclsidProtocol
,
848 DWORD
*pdwResult
, LPOLESTR
*pszResult
, DWORD
*pdwReserved
)
850 CHECK_EXPECT(GetBindResult
);
854 static const IBindingVtbl BindingVtbl
= {
855 Binding_QueryInterface
,
863 Binding_GetBindResult
866 static IBinding Binding
= { &BindingVtbl
};
868 DEFINE_GUID(IID_IMoniker_unk
,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
869 DEFINE_GUID(IID_IMoniker_unk2
, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
871 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
875 if(IsEqualGUID(&IID_IMoniker_unk
, riid
))
876 return E_NOINTERFACE
; /* TODO */
877 if(IsEqualGUID(&IID_IMoniker_unk2
, riid
))
878 return E_NOINTERFACE
; /* TODO */
880 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
881 return E_NOINTERFACE
;
884 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
889 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
894 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
896 CHECK_EXPECT(GetClassID
);
897 ok(IsEqualGUID(pClassID
, &IID_NULL
), "pClassID = %s\n", debugstr_guid(pClassID
));
901 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
903 ok(0, "unexpected call\n");
907 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
909 ok(0, "unexpected call\n");
913 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
915 ok(0, "unexpected call\n");
919 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
921 ok(0, "unexpected call\n");
925 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
926 REFIID riidResult
, void **ppvResult
)
928 ok(0, "unexpected call\n");
932 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
933 REFIID riid
, void **ppv
)
935 IBindStatusCallback
*callback
= NULL
;
936 FORMATETC formatetc
= {0xc02d, NULL
, 1, -1, TYMED_ISTREAM
};
942 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
943 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
945 CHECK_EXPECT(BindToStorage
);
947 load_state
= LD_LOADING
;
949 ok(pbc
!= NULL
, "pbc == NULL\n");
950 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
951 ok(IsEqualGUID(&IID_IStream
, riid
), "unexpected riid\n");
952 ok(ppv
!= NULL
, "ppv == NULL\n");
953 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
955 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, (IUnknown
**)&callback
);
956 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
957 ok(callback
!= NULL
, "callback == NULL\n");
959 memset(&bindinfo
, 0xf0, sizeof(bindinfo
));
960 bindinfo
.cbSize
= sizeof(bindinfo
);
962 hres
= IBindStatusCallback_GetBindInfo(callback
, &bindf
, &bindinfo
);
963 ok(hres
== S_OK
, "GetBindInfo failed: %08x\n", hres
);
964 ok(bindf
== (BINDF_PULLDATA
|BINDF_ASYNCSTORAGE
|BINDF_ASYNCHRONOUS
), "bindf = %08x\n", bindf
);
965 ok(bindinfo
.cbSize
== sizeof(bindinfo
), "bindinfo.cbSize=%d\n", bindinfo
.cbSize
);
966 ok(bindinfo
.szExtraInfo
== NULL
, "bindinfo.szExtraInfo=%p\n", bindinfo
.szExtraInfo
);
967 /* TODO: test stgmedData */
968 ok(bindinfo
.grfBindInfoF
== 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo
.grfBindInfoF
);
969 ok(bindinfo
.dwBindVerb
== 0, "bindinfo.dwBindVerb=%d\n", bindinfo
.dwBindVerb
);
970 ok(bindinfo
.szCustomVerb
== 0, "bindinfo.szCustomVerb=%p\n", bindinfo
.szCustomVerb
);
971 ok(bindinfo
.cbstgmedData
== 0, "bindinfo.cbstgmedData=%d\n", bindinfo
.cbstgmedData
);
972 ok(bindinfo
.dwOptions
== 0x80000 || bindinfo
.dwOptions
== 0x4080000,
973 "bindinfo.dwOptions=%x\n", bindinfo
.dwOptions
);
974 ok(bindinfo
.dwOptionsFlags
== 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo
.dwOptionsFlags
);
975 /* TODO: test dwCodePage */
976 /* TODO: test securityAttributes */
977 ok(IsEqualGUID(&IID_NULL
, &bindinfo
.iid
), "unexpected bindinfo.iid\n");
978 ok(bindinfo
.pUnk
== NULL
, "bindinfo.pUnk=%p\n", bindinfo
.pUnk
);
979 ok(bindinfo
.dwReserved
== 0, "bindinfo.dwReserved=%d\n", bindinfo
.dwReserved
);
981 hres
= IBindStatusCallback_OnStartBinding(callback
, 0, &Binding
);
982 ok(hres
== S_OK
, "OnStartBinding failed: %08x\n", hres
);
984 hres
= IBindStatusCallback_OnProgress(callback
, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE
,
986 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres
);
988 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
989 BINDSTATUS_BEGINDOWNLOADDATA
, doc_url
);
990 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres
);
993 stgmedium
.tymed
= TYMED_ISTREAM
;
994 U(stgmedium
).pstm
= &Stream
;
995 stgmedium
.pUnkForRelease
= (IUnknown
*)iface
;
996 hres
= IBindStatusCallback_OnDataAvailable(callback
,
997 BSCF_FIRSTDATANOTIFICATION
|BSCF_LASTDATANOTIFICATION
,
998 sizeof(html_page
)-1, &formatetc
, &stgmedium
);
999 ok(hres
== S_OK
, "OnDataAvailable failed: %08x\n", hres
);
1002 hres
= IBindStatusCallback_OnProgress(callback
, sizeof(html_page
)-1, sizeof(html_page
)-1,
1003 BINDSTATUS_ENDDOWNLOADDATA
, NULL
);
1004 ok(hres
== S_OK
, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres
);
1006 hres
= IBindStatusCallback_OnStopBinding(callback
, S_OK
, NULL
);
1007 ok(hres
== S_OK
, "OnStopBinding failed: %08x\n", hres
);
1009 IBindStatusCallback_Release(callback
);
1014 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
1015 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
1017 ok(0, "unexpected call\n");
1021 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
1022 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
1024 ok(0, "unexpected call\n");
1028 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
1030 ok(0, "unexpected call\n");
1034 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
1036 ok(0, "unexpected call\n");
1040 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
1042 ok(0, "unexpected call\n");
1046 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
1047 IMoniker
*pmkNewlyRunning
)
1049 ok(0, "unexpected call\n");
1053 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
1054 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
1056 ok(0, "unexpected call\n");
1060 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
1062 ok(0, "unexpected call\n");
1066 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
1067 IMoniker
**ppmkPrefix
)
1069 ok(0, "unexpected call\n");
1073 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
1074 IMoniker
**pmkRelPath
)
1076 ok(0, "unexpected call\n");
1080 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1081 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
1083 CHECK_EXPECT2(GetDisplayName
);
1085 /* ok(pbc != NULL, "pbc == NULL\n"); */
1086 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
1087 ok(ppszDisplayName
!= NULL
, "ppszDisplayName == NULL\n");
1089 *ppszDisplayName
= CoTaskMemAlloc(sizeof(doc_url
));
1090 memcpy(*ppszDisplayName
, doc_url
, sizeof(doc_url
));
1095 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
1096 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1098 ok(0, "unexpected call\n");
1102 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
1104 CHECK_EXPECT(IsSystemMoniker
);
1108 static const IMonikerVtbl MonikerVtbl
= {
1109 Moniker_QueryInterface
,
1117 Moniker_BindToObject
,
1118 Moniker_BindToStorage
,
1120 Moniker_ComposeWith
,
1125 Moniker_GetTimeOfLastChange
,
1127 Moniker_CommonPrefixWith
,
1128 Moniker_RelativePathTo
,
1129 Moniker_GetDisplayName
,
1130 Moniker_ParseDisplayName
,
1131 Moniker_IsSystemMoniker
1134 static IMoniker Moniker
= { &MonikerVtbl
};
1136 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1138 return QueryInterface(riid
, ppv
);
1141 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1146 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1151 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
1152 LPOLESTR pszDiaplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1154 ok(0, "unexpected call\n");
1158 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
1159 IEnumUnknown
**ppenum
)
1161 ok(0, "unexpected call\n");
1165 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1167 CHECK_EXPECT(LockContainer
);
1168 ok(expect_LockContainer_fLock
== fLock
, "fLock=%x, expected %x\n", fLock
, expect_LockContainer_fLock
);
1172 static const IOleContainerVtbl OleContainerVtbl
= {
1173 OleContainer_QueryInterface
,
1174 OleContainer_AddRef
,
1175 OleContainer_Release
,
1176 OleContainer_ParseDisplayName
,
1177 OleContainer_EnumObjects
,
1178 OleContainer_LockContainer
1181 static IOleContainer OleContainer
= { &OleContainerVtbl
};
1183 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
1185 ok(0, "unexpected call\n");
1186 return E_NOINTERFACE
;
1189 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
1194 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
1199 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
1201 ok(0, "unexpected call\n");
1205 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
1207 ok(0, "unexpected call\n");
1211 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
1213 ok(0, "unexpected call\n");
1217 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
1218 LPCBORDERWIDTHS pborderwidths
)
1220 ok(0, "unexpected call\n");
1224 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
1225 LPCBORDERWIDTHS pborderwidths
)
1227 CHECK_EXPECT(InPlaceFrame_SetBorderSpace
);
1231 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
1232 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1234 static const WCHAR wszHTML_Document
[] =
1235 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1237 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject
);
1239 if(expect_InPlaceUIWindow_SetActiveObject_active
) {
1240 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1241 if(pActiveObject
&& PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
)
1242 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1245 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1246 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1248 expect_InPlaceUIWindow_SetActiveObject_active
= !expect_InPlaceUIWindow_SetActiveObject_active
;
1252 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
1253 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
1255 static const WCHAR wszHTML_Document
[] =
1256 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1259 CHECK_EXPECT2(SetActiveObject
);
1261 if(pActiveObject
&& PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
)
1262 ok(!lstrcmpW(wszHTML_Document
, pszObjName
), "pszObjName != \"HTML Document\"\n");
1264 CHECK_EXPECT(SetActiveObject_null
);
1266 ok(pActiveObject
== NULL
, "pActiveObject=%p, expected NULL\n", pActiveObject
);
1267 ok(pszObjName
== NULL
, "pszObjName=%p, expected NULL\n", pszObjName
);
1273 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1274 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
1276 ok(0, "unexpected call\n");
1280 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
1281 HOLEMENU holemenu
, HWND hwndActiveObject
)
1283 ok(0, "unexpected call\n");
1287 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
1289 ok(0, "unexpected call\n");
1293 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
1295 CHECK_EXPECT2(SetStatusText
);
1296 if(!expect_status_text
)
1297 ok(pszStatusText
== NULL
, "pszStatusText=%p, expected NULL\n", pszStatusText
);
1301 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
1303 ok(0, "unexpected call\n");
1307 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
1309 ok(0, "unexpected call\n");
1313 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
1314 InPlaceFrame_QueryInterface
,
1315 InPlaceFrame_AddRef
,
1316 InPlaceFrame_Release
,
1317 InPlaceFrame_GetWindow
,
1318 InPlaceFrame_ContextSensitiveHelp
,
1319 InPlaceFrame_GetBorder
,
1320 InPlaceFrame_RequestBorderSpace
,
1321 InPlaceFrame_SetBorderSpace
,
1322 InPlaceFrame_SetActiveObject
,
1323 InPlaceFrame_InsertMenus
,
1324 InPlaceFrame_SetMenu
,
1325 InPlaceFrame_RemoveMenus
,
1326 InPlaceFrame_SetStatusText
,
1327 InPlaceFrame_EnableModeless
,
1328 InPlaceFrame_TranslateAccelerator
1331 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
1333 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
1334 InPlaceFrame_QueryInterface
,
1335 InPlaceFrame_AddRef
,
1336 InPlaceFrame_Release
,
1337 InPlaceFrame_GetWindow
,
1338 InPlaceFrame_ContextSensitiveHelp
,
1339 InPlaceFrame_GetBorder
,
1340 InPlaceFrame_RequestBorderSpace
,
1341 InPlaceFrame_SetBorderSpace
,
1342 InPlaceUIWindow_SetActiveObject
,
1345 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
1347 static HRESULT WINAPI
InPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
1349 return QueryInterface(riid
, ppv
);
1352 static ULONG WINAPI
InPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
1357 static ULONG WINAPI
InPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
1362 static HRESULT WINAPI
InPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
1364 CHECK_EXPECT(GetWindow
);
1365 ok(phwnd
!= NULL
, "phwnd = NULL\n");
1366 *phwnd
= container_hwnd
;
1370 static HRESULT WINAPI
InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
1372 ok(0, "unexpected call\n");
1376 static HRESULT WINAPI
InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1378 CHECK_EXPECT(CanInPlaceActivate
);
1382 static HRESULT WINAPI
InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
1384 CHECK_EXPECT(OnInPlaceActivate
);
1388 static HRESULT WINAPI
InPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
1390 CHECK_EXPECT(OnUIActivate
);
1394 static HRESULT WINAPI
InPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
1395 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1396 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1398 static const RECT rect
= {0,0,500,500};
1400 CHECK_EXPECT(GetWindowContext
);
1402 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
1404 *ppFrame
= &InPlaceFrame
;
1405 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
1407 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
1408 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
1410 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
1411 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
1413 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
1414 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
1416 lpFrameInfo
->cb
= sizeof(*lpFrameInfo
);
1417 lpFrameInfo
->fMDIApp
= FALSE
;
1418 lpFrameInfo
->hwndFrame
= container_hwnd
;
1419 lpFrameInfo
->haccel
= NULL
;
1420 lpFrameInfo
->cAccelEntries
= 0;
1426 static HRESULT WINAPI
InPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtant
)
1428 ok(0, "unexpected call\n");
1432 static HRESULT WINAPI
InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
1434 CHECK_EXPECT(OnUIDeactivate
);
1435 ok(!fUndoable
, "fUndoable = TRUE\n");
1439 static HRESULT WINAPI
InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
1441 CHECK_EXPECT(OnInPlaceDeactivate
);
1445 static HRESULT WINAPI
InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
1447 ok(0, "unexpected call\n");
1451 static HRESULT WINAPI
InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
1453 ok(0, "unexpected call\n");
1457 static HRESULT WINAPI
InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
, LPCRECT lprcPosRect
)
1459 ok(0, "unexpected call\n");
1463 static HRESULT WINAPI
InPlaceSiteEx_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
1465 CHECK_EXPECT(OnInPlaceActivateEx
);
1467 ok(pfNoRedraw
!= NULL
, "pfNoRedraw == NULL\n");
1468 ok(!*pfNoRedraw
, "*pfNoRedraw == TRUE\n");
1469 ok(dwFlags
== 0, "dwFlags = %08x\n", dwFlags
);
1474 static HRESULT WINAPI
InPlaceSiteEx_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
, BOOL fNoRedraw
)
1476 CHECK_EXPECT(OnInPlaceDeactivateEx
);
1478 ok(fNoRedraw
, "fNoRedraw == FALSE\n");
1483 static HRESULT WINAPI
InPlaceSiteEx_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
1485 CHECK_EXPECT(RequestUIActivate
);
1489 static const IOleInPlaceSiteExVtbl InPlaceSiteVtbl
= {
1490 InPlaceSite_QueryInterface
,
1492 InPlaceSite_Release
,
1493 InPlaceSite_GetWindow
,
1494 InPlaceSite_ContextSensitiveHelp
,
1495 InPlaceSite_CanInPlaceActivate
,
1496 InPlaceSite_OnInPlaceActivate
,
1497 InPlaceSite_OnUIActivate
,
1498 InPlaceSite_GetWindowContext
,
1500 InPlaceSite_OnUIDeactivate
,
1501 InPlaceSite_OnInPlaceDeactivate
,
1502 InPlaceSite_DiscardUndoState
,
1503 InPlaceSite_DeactivateAndUndo
,
1504 InPlaceSite_OnPosRectChange
,
1505 InPlaceSiteEx_OnInPlaceActivateEx
,
1506 InPlaceSiteEx_OnInPlaceDeactivateEx
,
1507 InPlaceSiteEx_RequestUIActivate
1510 static IOleInPlaceSiteEx InPlaceSiteEx
= { &InPlaceSiteVtbl
};
1512 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
1514 return QueryInterface(riid
, ppv
);
1517 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
1522 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
1527 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
1529 ok(0, "unexpected call\n");
1533 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAsign
, DWORD dwWhichMoniker
,
1536 ok(0, "unexpected call\n");
1540 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
1542 CHECK_EXPECT(GetContainer
);
1543 ok(ppContainer
!= NULL
, "ppContainer = NULL\n");
1544 *ppContainer
= &OleContainer
;
1548 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
1550 ok(0, "unexpected call\n");
1554 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1556 ok(0, "unexpected call\n");
1560 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
1562 ok(0, "unexpected call\n");
1566 static const IOleClientSiteVtbl ClientSiteVtbl
= {
1567 ClientSite_QueryInterface
,
1570 ClientSite_SaveObject
,
1571 ClientSite_GetMoniker
,
1572 ClientSite_GetContainer
,
1573 ClientSite_ShowObject
,
1574 ClientSite_OnShowWindow
,
1575 ClientSite_RequestNewObjectLayout
1578 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
1580 static HRESULT WINAPI
DocumentSite_QueryInterface(IOleDocumentSite
*iface
, REFIID riid
, void **ppv
)
1582 return QueryInterface(riid
, ppv
);
1585 static ULONG WINAPI
DocumentSite_AddRef(IOleDocumentSite
*iface
)
1590 static ULONG WINAPI
DocumentSite_Release(IOleDocumentSite
*iface
)
1597 CallUIActivate_None
,
1598 CallUIActivate_ActivateMe
,
1599 CallUIActivate_AfterShow
,
1602 static BOOL call_UIActivate
= CallUIActivate_ActivateMe
;
1603 static HRESULT WINAPI
DocumentSite_ActivateMe(IOleDocumentSite
*iface
, IOleDocumentView
*pViewToActivate
)
1605 IOleDocument
*document
;
1608 CHECK_EXPECT(ActivateMe
);
1609 ok(pViewToActivate
!= NULL
, "pViewToActivate = NULL\n");
1611 hres
= IOleDocumentView_QueryInterface(pViewToActivate
, &IID_IOleDocument
, (void**)&document
);
1612 ok(hres
== S_OK
, "could not get IOleDocument: %08x\n", hres
);
1614 if(SUCCEEDED(hres
)) {
1615 hres
= IOleDocument_CreateView(document
, (IOleInPlaceSite
*)&InPlaceSiteEx
, NULL
, 0, &view
);
1616 ok(hres
== S_OK
, "CreateView failed: %08x\n", hres
);
1618 if(SUCCEEDED(hres
)) {
1619 IOleInPlaceActiveObject
*activeobj
= NULL
;
1620 IOleInPlaceSite
*inplacesite
= NULL
;
1621 HWND tmp_hwnd
= NULL
;
1622 static RECT rect
= {0,0,400,500};
1624 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1625 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1626 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteEx
, "inplacesite=%p, expected %p\n",
1627 inplacesite
, &InPlaceSiteEx
);
1629 hres
= IOleDocumentView_SetInPlaceSite(view
, (IOleInPlaceSite
*)&InPlaceSiteEx
);
1630 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
1632 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
1633 ok(hres
== S_OK
, "GetInPlaceSite failed: %08x\n", hres
);
1634 ok(inplacesite
== (IOleInPlaceSite
*)&InPlaceSiteEx
, "inplacesite=%p, expected %p\n",
1635 inplacesite
, &InPlaceSiteEx
);
1637 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobj
);
1638 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject: %08x\n", hres
);
1641 IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1642 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1643 ok(hwnd
== NULL
, "hwnd=%p, expeted NULL\n", hwnd
);
1646 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
1647 SET_EXPECT(CanInPlaceActivate
);
1648 SET_EXPECT(GetWindowContext
);
1649 SET_EXPECT(GetWindow
);
1651 SET_EXPECT(OnInPlaceActivateEx
);
1653 SET_EXPECT(OnInPlaceActivate
);
1654 SET_EXPECT(SetStatusText
);
1655 SET_EXPECT(Exec_SETPROGRESSMAX
);
1656 SET_EXPECT(Exec_SETPROGRESSPOS
);
1657 SET_EXPECT(OnUIActivate
);
1658 SET_EXPECT(SetActiveObject
);
1660 expect_status_text
= NULL
;
1662 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
1665 skip("UIActivate failed: %08x\n", hres
);
1668 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
1670 CHECK_CALLED(CanInPlaceActivate
);
1671 CHECK_CALLED(GetWindowContext
);
1672 CHECK_CALLED(GetWindow
);
1674 CHECK_CALLED(OnInPlaceActivateEx
);
1676 CHECK_CALLED(OnInPlaceActivate
);
1677 CHECK_CALLED(SetStatusText
);
1678 CHECK_CALLED(Exec_SETPROGRESSMAX
);
1679 CHECK_CALLED(Exec_SETPROGRESSPOS
);
1680 CHECK_CALLED(OnUIActivate
);
1681 CHECK_CALLED(SetActiveObject
);
1682 CHECK_CALLED(ShowUI
);
1685 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1686 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1687 ok(hwnd
!= NULL
, "hwnd == NULL\n");
1689 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
1692 hres
= IOleDocumentView_UIActivate(view
, TRUE
);
1693 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
1696 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &tmp_hwnd
);
1697 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1698 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
1702 hres
= IOleDocumentView_SetRect(view
, &rect
);
1703 ok(hres
== S_OK
, "SetRect failed: %08x\n", hres
);
1705 if(call_UIActivate
== CallUIActivate_ActivateMe
) {
1706 hres
= IOleDocumentView_Show(view
, TRUE
);
1707 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
1709 SET_EXPECT(CanInPlaceActivate
);
1710 SET_EXPECT(GetWindowContext
);
1711 SET_EXPECT(GetWindow
);
1713 SET_EXPECT(OnInPlaceActivateEx
);
1715 SET_EXPECT(OnInPlaceActivate
);
1716 SET_EXPECT(SetStatusText
);
1717 SET_EXPECT(Exec_SETPROGRESSMAX
);
1718 SET_EXPECT(Exec_SETPROGRESSPOS
);
1719 SET_EXPECT(OnUIActivate
);
1720 expect_status_text
= (load_state
== LD_COMPLETE
? (LPCOLESTR
)0xdeadbeef : NULL
);
1722 hres
= IOleDocumentView_Show(view
, TRUE
);
1723 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
1725 CHECK_CALLED(CanInPlaceActivate
);
1726 CHECK_CALLED(GetWindowContext
);
1727 CHECK_CALLED(GetWindow
);
1729 CHECK_CALLED(OnInPlaceActivateEx
);
1731 CHECK_CALLED(OnInPlaceActivate
);
1732 CHECK_CALLED(SetStatusText
);
1733 CHECK_CALLED(Exec_SETPROGRESSMAX
);
1734 CHECK_CALLED(Exec_SETPROGRESSPOS
);
1737 hres
= IOleInPlaceActiveObject_GetWindow(activeobj
, &hwnd
);
1738 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1739 ok(hwnd
!= NULL
, "hwnd == NULL\n");
1741 ok(hwnd
== last_hwnd
, "hwnd != last_hwnd\n");
1745 test_timer(EXPECT_UPDATEUI
| ((load_state
== LD_LOADING
) ? EXPECT_SETTITLE
: 0));
1748 IOleInPlaceActiveObject_Release(activeobj
);
1751 IOleDocument_Release(document
);
1757 static const IOleDocumentSiteVtbl DocumentSiteVtbl
= {
1758 DocumentSite_QueryInterface
,
1759 DocumentSite_AddRef
,
1760 DocumentSite_Release
,
1761 DocumentSite_ActivateMe
1764 static IOleDocumentSite DocumentSite
= { &DocumentSiteVtbl
};
1766 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
1768 return QueryInterface(riid
, ppv
);
1771 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
1776 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
1781 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
1783 ok(0, "unexpected call\n");
1787 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
1789 ok(0, "unexpected call\n");
1793 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
1795 ok(0, "unexpected call\n");
1799 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
1800 POINTF
*pPtfContainer
, DWORD dwFlags
)
1802 ok(0, "unexpected call\n");
1806 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
1807 MSG
*pMsg
, DWORD grfModifiers
)
1809 ok(0, "unexpected call\n");
1813 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
1816 CHECK_EXPECT(OnFocus_TRUE
);
1818 CHECK_EXPECT2(OnFocus_FALSE
);
1822 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
1824 ok(0, "unexpected call\n");
1828 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
1829 OleControlSite_QueryInterface
,
1830 OleControlSite_AddRef
,
1831 OleControlSite_Release
,
1832 OleControlSite_OnControlInfoChanged
,
1833 OleControlSite_LockInPlaceActive
,
1834 OleControlSite_GetExtendedControl
,
1835 OleControlSite_TransformCoords
,
1836 OleControlSite_TranslateAccelerator
,
1837 OleControlSite_OnFocus
,
1838 OleControlSite_ShowPropertyFrame
1841 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
1843 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
, REFIID riid
, void **ppv
)
1845 return QueryInterface(riid
, ppv
);
1848 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
1853 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
1858 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
, DWORD dwID
, POINT
*ppt
,
1859 IUnknown
*pcmdtReserved
, IDispatch
*pdicpReserved
)
1861 ok(0, "unexpected call\n");
1865 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
, DOCHOSTUIINFO
*pInfo
)
1867 CHECK_EXPECT(GetHostInfo
);
1868 ok(pInfo
!= NULL
, "pInfo=NULL\n");
1870 ok(pInfo
->cbSize
== sizeof(DOCHOSTUIINFO
), "pInfo->cbSize=%u\n", pInfo
->cbSize
);
1871 ok(!pInfo
->dwFlags
, "pInfo->dwFlags=%08x, expected 0\n", pInfo
->dwFlags
);
1872 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
1873 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
1874 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
1875 ok(!pInfo
->dwDoubleClick
, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo
->dwDoubleClick
);
1876 ok(!pInfo
->pchHostCss
, "pInfo->pchHostCss=%p, expected NULL\n", pInfo
->pchHostCss
);
1877 ok(!pInfo
->pchHostNS
, "pInfo->pchhostNS=%p, expected NULL\n", pInfo
->pchHostNS
);
1882 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
1883 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
1884 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
1886 CHECK_EXPECT(ShowUI
);
1889 ok(dwID
== DOCHOSTUITYPE_AUTHOR
, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID
);
1891 ok(dwID
== DOCHOSTUITYPE_BROWSE
, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID
);
1892 ok(pActiveObject
!= NULL
, "pActiveObject = NULL\n");
1893 ok(pCommandTarget
!= NULL
, "pCommandTarget = NULL\n");
1894 ok(pFrame
== &InPlaceFrame
, "pFrame=%p, expected %p\n", pFrame
, &InPlaceFrame
);
1895 if (expect_InPlaceUIWindow_SetActiveObject_active
)
1896 ok(pDoc
== (IOleInPlaceUIWindow
*)&InPlaceUIWindow
, "pDoc=%p, expected %p\n", pDoc
, &InPlaceUIWindow
);
1898 ok(pDoc
== NULL
, "pDoc=%p, expected NULL\n", pDoc
);
1903 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
1905 CHECK_EXPECT(HideUI
);
1909 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
1911 CHECK_EXPECT(UpdateUI
);
1915 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
, BOOL fEnable
)
1917 ok(0, "unexpected call\n");
1921 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1923 ok(0, "unexpected call\n");
1927 static BOOL expect_OnFrameWindowActivate_fActivate
;
1928 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
, BOOL fActivate
)
1930 CHECK_EXPECT2(OnFrameWindowActivate
);
1931 ok(fActivate
== expect_OnFrameWindowActivate_fActivate
, "fActivate=%x\n", fActivate
);
1935 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
, LPCRECT prcBorder
,
1936 IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
1938 ok(0, "unexpected call\n");
1942 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
, LPMSG lpMsg
,
1943 const GUID
*pguidCmdGroup
, DWORD nCmdID
)
1945 ok(0, "unexpected call\n");
1949 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
1950 LPOLESTR
*pchKey
, DWORD dw
)
1952 CHECK_EXPECT(GetOptionKeyPath
);
1953 ok(pchKey
!= NULL
, "pchKey = NULL\n");
1954 ok(!dw
, "dw=%d, expected 0\n", dw
);
1956 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
1960 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
1961 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
1963 CHECK_EXPECT(GetDropTarget
);
1968 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
, IDispatch
**ppDispatch
)
1970 CHECK_EXPECT(GetExternal
);
1971 *ppDispatch
= &External
;
1975 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
, DWORD dwTranslate
,
1976 OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
1978 ok(0, "unexpected call\n");
1982 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
, IDataObject
*pDO
,
1983 IDataObject
**ppPORet
)
1985 ok(0, "unexpected call\n");
1989 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
1990 LPOLESTR
*pchKey
, DWORD dw
)
1992 CHECK_EXPECT(GetOverrideKeyPath
);
1993 ok(pchKey
!= NULL
, "pchKey = NULL\n");
1995 ok(!*pchKey
, "*pchKey=%p, expected NULL\n", *pchKey
);
1996 ok(!dw
, "dw=%d, xepected 0\n", dw
);
2000 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl
= {
2001 DocHostUIHandler_QueryInterface
,
2002 DocHostUIHandler_AddRef
,
2003 DocHostUIHandler_Release
,
2004 DocHostUIHandler_ShowContextMenu
,
2005 DocHostUIHandler_GetHostInfo
,
2006 DocHostUIHandler_ShowUI
,
2007 DocHostUIHandler_HideUI
,
2008 DocHostUIHandler_UpdateUI
,
2009 DocHostUIHandler_EnableModeless
,
2010 DocHostUIHandler_OnDocWindowActivate
,
2011 DocHostUIHandler_OnFrameWindowActivate
,
2012 DocHostUIHandler_ResizeBorder
,
2013 DocHostUIHandler_TranslateAccelerator
,
2014 DocHostUIHandler_GetOptionKeyPath
,
2015 DocHostUIHandler_GetDropTarget
,
2016 DocHostUIHandler_GetExternal
,
2017 DocHostUIHandler_TranslateUrl
,
2018 DocHostUIHandler_FilterDataObject
,
2019 DocHostUIHandler_GetOverrideKeyPath
2022 static IDocHostUIHandler2 DocHostUIHandler
= { &DocHostUIHandlerVtbl
};
2024 static HRESULT WINAPI
OleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
2025 REFIID riid
, void **ppv
)
2027 return QueryInterface(riid
, ppv
);
2030 static ULONG WINAPI
OleCommandTarget_AddRef(IOleCommandTarget
*iface
)
2035 static ULONG WINAPI
OleCommandTarget_Release(IOleCommandTarget
*iface
)
2040 static HRESULT WINAPI
OleCommandTarget_QueryStatus(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2041 ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
2043 ok(!pguidCmdGroup
, "pguidCmdGroup != MULL\n");
2044 ok(cCmds
== 1, "cCmds=%d, expected 1\n", cCmds
);
2045 ok(!pCmdText
, "pCmdText != NULL\n");
2047 switch(prgCmds
[0].cmdID
) {
2048 case OLECMDID_SETPROGRESSTEXT
:
2049 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2050 prgCmds
[0].cmdf
= OLECMDF_ENABLED
;
2053 CHECK_EXPECT(QueryStatus_OPEN
);
2054 prgCmds
[0].cmdf
= 0;
2057 CHECK_EXPECT(QueryStatus_NEW
);
2058 prgCmds
[0].cmdf
= 0;
2061 ok(0, "unexpected command %d\n", prgCmds
[0].cmdID
);
2067 static HRESULT WINAPI
OleCommandTarget_Exec(IOleCommandTarget
*iface
, const GUID
*pguidCmdGroup
,
2068 DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
2070 test_readyState(NULL
);
2072 if(!pguidCmdGroup
) {
2074 case OLECMDID_SETPROGRESSMAX
:
2075 CHECK_EXPECT2(Exec_SETPROGRESSMAX
);
2076 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2077 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2079 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2080 if(load_state
== LD_NO
)
2081 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2083 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2085 case OLECMDID_SETPROGRESSPOS
:
2086 CHECK_EXPECT2(Exec_SETPROGRESSPOS
);
2087 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2088 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2090 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2091 if(load_state
== LD_NO
)
2092 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2094 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2096 case OLECMDID_HTTPEQUIV_DONE
:
2097 CHECK_EXPECT(Exec_HTTPEQUIV_DONE
);
2098 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2099 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2100 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2101 load_state
= LD_COMPLETE
;
2103 case OLECMDID_SETDOWNLOADSTATE
:
2104 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2105 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2106 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2107 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2109 switch(V_I4(pvaIn
)) {
2111 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2112 load_state
= LD_INTERACTIVE
;
2115 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2118 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn
));
2122 case OLECMDID_UPDATECOMMANDS
:
2123 CHECK_EXPECT(Exec_UPDATECOMMANDS
);
2124 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2125 ok(pvaIn
== NULL
, "pvaIn=%p\n", pvaIn
);
2126 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2128 case OLECMDID_SETTITLE
:
2129 CHECK_EXPECT2(Exec_SETTITLE
);
2130 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2131 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2132 ok(pvaOut
== NULL
, "pvaOut=%p\n", pvaOut
);
2133 ok(V_VT(pvaIn
) == VT_BSTR
, "V_VT(pvaIn)=%d\n", V_VT(pvaIn
));
2134 ok(V_BSTR(pvaIn
) != NULL
, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2136 case OLECMDID_HTTPEQUIV
:
2137 CHECK_EXPECT2(Exec_HTTPEQUIV
);
2138 ok(nCmdexecopt
== OLECMDEXECOPT_DONTPROMPTUSER
, "nCmdexecopts=%08x\n", nCmdexecopt
);
2142 ok(0, "unexpected command %d\n", nCmdID
);
2147 if(IsEqualGUID(&CGID_ShellDocView
, pguidCmdGroup
)) {
2148 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2152 CHECK_EXPECT2(Exec_ShellDocView_37
);
2154 if(load_from_stream
)
2155 test_GetCurMoniker(doc_unk
, NULL
, about_blank_url
);
2157 test_GetCurMoniker(doc_unk
, &Moniker
, NULL
);
2159 ok(pvaOut
== NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2160 ok(pvaIn
!= NULL
, "pvaIn == NULL\n");
2162 ok(V_VT(pvaIn
) == VT_I4
, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn
));
2163 ok(V_I4(pvaIn
) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn
));
2167 CHECK_EXPECT2(Exec_ShellDocView_84
);
2169 ok(pvaIn
== NULL
, "pvaIn == NULL\n");
2170 ok(pvaOut
!= NULL
, "pvaOut=%p, expected NULL\n", pvaOut
);
2172 ok(V_VT(pvaOut
) == VT_EMPTY
, "V_VT(pvaOut)=%d\n", V_VT(pvaOut
));
2176 ok(0, "unexpected command %d\n", nCmdID
);
2181 if(IsEqualGUID(&CGID_MSHTML
, pguidCmdGroup
)) {
2182 ok(nCmdexecopt
== 0, "nCmdexecopts=%08x\n", nCmdexecopt
);
2185 case IDM_PARSECOMPLETE
:
2186 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2187 ok(pvaIn
== NULL
, "pvaIn != NULL\n");
2188 ok(pvaOut
== NULL
, "pvaOut != NULL\n");
2191 ok(0, "unexpected command %d\n", nCmdID
);
2195 if(IsEqualGUID(&CGID_DocHostCmdPriv
, pguidCmdGroup
))
2196 return E_FAIL
; /* TODO */
2198 if(IsEqualGUID(&CGID_Explorer
, pguidCmdGroup
)) {
2199 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID
);
2203 if(IsEqualGUID(&CGID_DocHostCommandHandler
, pguidCmdGroup
)) {
2204 ok(0, "unexpected cmd %d of CGID_DocHostCommandHandler\n", nCmdID
);
2208 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup
));
2212 static IOleCommandTargetVtbl OleCommandTargetVtbl
= {
2213 OleCommandTarget_QueryInterface
,
2214 OleCommandTarget_AddRef
,
2215 OleCommandTarget_Release
,
2216 OleCommandTarget_QueryStatus
,
2217 OleCommandTarget_Exec
2220 static IOleCommandTarget OleCommandTarget
= { &OleCommandTargetVtbl
};
2222 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
2224 return QueryInterface(riid
, ppv
);
2227 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
2228 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
2229 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2231 ok(IsEqualGUID(&IID_NULL
, riid
), "riid != IID_NULL\n");
2232 ok(pDispParams
!= NULL
, "pDispParams == NULL\n");
2233 ok(pExcepInfo
== NULL
, "pExcepInfo=%p, expected NULL\n", pExcepInfo
);
2234 ok(puArgErr
!= NULL
, "puArgErr == NULL\n");
2235 ok(V_VT(pVarResult
) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult
));
2236 ok(wFlags
== DISPATCH_PROPERTYGET
, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags
);
2237 test_readyState(NULL
);
2239 switch(dispIdMember
) {
2240 case DISPID_AMBIENT_USERMODE
:
2241 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE
);
2242 V_VT(pVarResult
) = VT_BOOL
;
2243 V_BOOL(pVarResult
) = VARIANT_TRUE
;
2245 case DISPID_AMBIENT_DLCONTROL
:
2246 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL
);
2248 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
2249 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2251 case DISPID_AMBIENT_SILENT
:
2252 CHECK_EXPECT2(Invoke_AMBIENT_SILENT
);
2253 V_VT(pVarResult
) = VT_BOOL
;
2254 V_BOOL(pVarResult
) = VARIANT_FALSE
;
2256 case DISPID_AMBIENT_USERAGENT
:
2257 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT
);
2259 case DISPID_AMBIENT_PALETTE
:
2260 CHECK_EXPECT(Invoke_AMBIENT_PALETTE
);
2264 ok(0, "unexpected dispid %d\n", dispIdMember
);
2268 static IDispatchVtbl DispatchVtbl
= {
2269 Dispatch_QueryInterface
,
2272 Dispatch_GetTypeInfoCount
,
2273 Dispatch_GetTypeInfo
,
2274 Dispatch_GetIDsOfNames
,
2278 static IDispatch Dispatch
= { &DispatchVtbl
};
2280 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
2281 REFIID riid
, void **ppv
)
2283 return QueryInterface(riid
, ppv
);
2286 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
2291 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
2296 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
2297 REFIID riid
, void **ppv
)
2300 * Services used by HTMLDocument:
2303 * IInternetSecurityManager
2305 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2308 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2309 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2310 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2312 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2313 * IElementBehaviorFactory
2314 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2324 if(IsEqualGUID(&IID_IHlinkFrame
, guidService
)) {
2325 ok(IsEqualGUID(&IID_IHlinkFrame
, riid
), "unexpected riid\n");
2330 return E_NOINTERFACE
;
2333 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2334 ServiceProvider_QueryInterface
,
2335 ServiceProvider_AddRef
,
2336 ServiceProvider_Release
,
2337 ServiceProvider_QueryService
2340 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
2342 DEFINE_GUID(IID_unk1
, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2343 DEFINE_GUID(IID_unk2
, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2344 DEFINE_GUID(IID_unk3
, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2346 static HRESULT
QueryInterface(REFIID riid
, void **ppv
)
2350 if(IsEqualGUID(&IID_IUnknown
, riid
) || IsEqualGUID(&IID_IOleClientSite
, riid
))
2352 else if(IsEqualGUID(&IID_IOleDocumentSite
, riid
))
2353 *ppv
= &DocumentSite
;
2354 else if(IsEqualGUID(&IID_IDocHostUIHandler
, riid
) || IsEqualGUID(&IID_IDocHostUIHandler2
, riid
))
2355 *ppv
= &DocHostUIHandler
;
2356 else if(IsEqualGUID(&IID_IOleContainer
, riid
))
2357 *ppv
= &OleContainer
;
2358 else if(IsEqualGUID(&IID_IOleWindow
, riid
) || IsEqualGUID(&IID_IOleInPlaceSite
, riid
))
2359 *ppv
= &InPlaceSiteEx
;
2360 else if(IsEqualGUID(&IID_IOleCommandTarget
, riid
))
2361 *ppv
= &OleCommandTarget
;
2362 else if(IsEqualGUID(&IID_IDispatch
, riid
))
2364 else if(IsEqualGUID(&IID_IServiceProvider
, riid
))
2365 *ppv
= &ServiceProvider
;
2366 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
))
2367 *ppv
= ipsex
? &InPlaceSiteEx
: NULL
;
2368 else if(IsEqualGUID(&IID_IOleControlSite
, riid
))
2369 *ppv
= &OleControlSite
;
2370 else if(IsEqualGUID(&IID_IDocHostShowUI
, riid
))
2371 return E_NOINTERFACE
; /* TODO */
2372 else if(IsEqualGUID(&IID_IProxyManager
, riid
))
2373 return E_NOINTERFACE
; /* ? */
2374 else if(IsEqualGUID(&IID_unk1
, riid
))
2375 return E_NOINTERFACE
; /* HTMLWindow2 ? */
2376 else if(IsEqualGUID(&IID_unk2
, riid
))
2377 return E_NOINTERFACE
; /* ? */
2378 else if(IsEqualGUID(&IID_unk3
, riid
))
2379 return E_NOINTERFACE
; /* ? */
2381 ok(0, "unexpected riid %s\n", debugstr_guid(riid
));
2385 return E_NOINTERFACE
;
2388 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
2390 return DefWindowProc(hwnd
, msg
, wParam
, lParam
);
2393 static void _test_readyState(unsigned line
, IUnknown
*unk
)
2395 IHTMLDocument2
*htmldoc
;
2396 DISPPARAMS dispparams
;
2401 static const WCHAR wszUninitialized
[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
2402 static const WCHAR wszLoading
[] = {'l','o','a','d','i','n','g',0};
2403 static const WCHAR wszInteractive
[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
2404 static const WCHAR wszComplete
[] = {'c','o','m','p','l','e','t','e',0};
2406 static const LPCWSTR expected_state
[] = {
2418 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&htmldoc
);
2419 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
2423 hres
= IHTMLDocument2_get_readyState(htmldoc
, NULL
);
2424 ok(hres
== E_POINTER
, "get_readyState failed: %08x, expected\n", hres
);
2426 hres
= IHTMLDocument2_get_readyState(htmldoc
, &state
);
2427 ok(hres
== S_OK
, "get_ReadyState failed: %08x\n", hres
);
2429 (!lstrcmpW(state
, expected_state
[load_state
]), "unexpected state \"%s\", expected %d\n",
2430 debugstr_w(state
), load_state
);
2431 SysFreeString(state
);
2433 dispparams
.cArgs
= 0;
2434 dispparams
.cNamedArgs
= 0;
2435 dispparams
.rgdispidNamedArgs
= NULL
;
2436 dispparams
.rgvarg
= NULL
;
2440 hres
= IHTMLDocument2_Invoke(htmldoc
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
,
2441 &dispparams
, &out
, NULL
, NULL
);
2442 ok(hres
== S_OK
, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres
);
2444 ok_(__FILE__
,line
) (V_VT(&out
) == VT_I4
, "V_VT(out)=%d\n", V_VT(&out
));
2445 ok_(__FILE__
,line
) (V_I4(&out
) == load_state
%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out
), load_state
%5);
2447 IHTMLDocument2_Release(htmldoc
);
2450 static void test_ConnectionPoint(IConnectionPointContainer
*container
, REFIID riid
)
2452 IConnectionPointContainer
*tmp_container
= NULL
;
2453 IConnectionPoint
*cp
;
2457 hres
= IConnectionPointContainer_FindConnectionPoint(container
, riid
, &cp
);
2458 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
2462 hres
= IConnectionPoint_GetConnectionInterface(cp
, &iid
);
2463 ok(hres
== S_OK
, "GetConnectionInterface failed: %08x\n", hres
);
2464 ok(IsEqualGUID(riid
, &iid
), "wrong iid\n");
2466 hres
= IConnectionPoint_GetConnectionInterface(cp
, NULL
);
2467 ok(hres
== E_POINTER
, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres
);
2469 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, &tmp_container
);
2470 ok(hres
== S_OK
, "GetConnectionPointContainer failed: %08x\n", hres
);
2471 ok(tmp_container
== container
, "container != tmp_container\n");
2473 IConnectionPointContainer_Release(tmp_container
);
2475 hres
= IConnectionPoint_GetConnectionPointContainer(cp
, NULL
);
2476 ok(hres
== E_POINTER
, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres
);
2478 if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
2481 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&PropertyNotifySink
, &cookie
);
2482 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
2485 IConnectionPoint_Release(cp
);
2488 static void test_ConnectionPointContainer(IUnknown
*unk
)
2490 IConnectionPointContainer
*container
;
2493 hres
= IUnknown_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
2494 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
2498 test_ConnectionPoint(container
, &IID_IPropertyNotifySink
);
2499 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents
);
2500 test_ConnectionPoint(container
, &DIID_HTMLDocumentEvents2
);
2502 IConnectionPointContainer_Release(container
);
2505 static void test_GetCurMoniker(IUnknown
*unk
, IMoniker
*exmon
, LPCWSTR exurl
)
2507 IHTMLDocument2
*doc
;
2508 IPersistMoniker
*permon
;
2509 IMoniker
*mon
= (void*)0xdeadbeef;
2510 BSTR doc_url
= (void*)0xdeadbeef;
2513 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
2514 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
2518 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
2519 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres
);
2521 hres
= IHTMLDocument2_get_URL(doc
, &doc_url
);
2522 ok(hres
== S_OK
, "get_URL failed: %08x\n", hres
);
2524 hres
= IPersistMoniker_GetCurMoniker(permon
, &mon
);
2525 IPersistMoniker_Release(permon
);
2529 BOOL exb
= expect_GetDisplayName
;
2530 BOOL clb
= called_GetDisplayName
;
2532 ok(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
2533 ok(mon
== exmon
, "mon(%p) != exmon(%p)\n", mon
, exmon
);
2535 SET_EXPECT(GetDisplayName
);
2536 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
2537 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
2538 CHECK_CALLED(GetDisplayName
);
2539 expect_GetDisplayName
= exb
;
2540 called_GetDisplayName
= clb
;
2542 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
2547 ok(hres
== S_OK
, "GetCurrentMoniker failed: %08x\n", hres
);
2549 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &url
);
2550 ok(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
2552 ok(!lstrcmpW(url
, exurl
), "unexpected url\n");
2553 ok(!lstrcmpW(url
, doc_url
), "url != doc_url\n");
2557 ok(hres
== E_UNEXPECTED
,
2558 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres
);
2559 ok(mon
== (IMoniker
*)0xdeadbeef, "mon=%p\n", mon
);
2560 ok(!lstrcmpW(doc_url
, about_blank_url
), "doc_url is not about:blank\n");
2563 SysFreeString(doc_url
);
2564 IHTMLDocument_Release(doc
);
2565 if(mon
&& mon
!= (void*)0xdeadbeef)
2566 IMoniker_Release(mon
);
2569 static void test_Load(IPersistMoniker
*persist
)
2573 WCHAR sz_html_clientsite_objectparam
[MAX_PATH
];
2575 lstrcpyW(sz_html_clientsite_objectparam
, SZ_HTML_CLIENTSITE_OBJECTPARAM
);
2577 test_readyState((IUnknown
*)persist
);
2579 CreateBindCtx(0, &bind
);
2580 IBindCtx_RegisterObjectParam(bind
, sz_html_clientsite_objectparam
,
2581 (IUnknown
*)&ClientSite
);
2583 SET_EXPECT(GetDisplayName
);
2584 if(!set_clientsite
) {
2585 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
2586 SET_EXPECT(GetHostInfo
);
2587 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
2588 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2589 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2590 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
2591 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
2592 SET_EXPECT(GetOptionKeyPath
);
2593 SET_EXPECT(GetOverrideKeyPath
);
2594 SET_EXPECT(GetWindow
);
2595 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
2596 SET_EXPECT(Exec_SETPROGRESSMAX
);
2597 SET_EXPECT(Exec_SETPROGRESSPOS
);
2598 SET_EXPECT(Exec_ShellDocView_37
);
2600 if(!container_locked
) {
2601 SET_EXPECT(GetContainer
);
2602 SET_EXPECT(LockContainer
);
2604 SET_EXPECT(OnChanged_READYSTATE
);
2605 SET_EXPECT(Exec_ShellDocView_84
);
2606 SET_EXPECT(BindToStorage
);
2607 SET_EXPECT(SetActiveObject
);
2608 if(set_clientsite
) {
2609 SET_EXPECT(Invoke_AMBIENT_SILENT
);
2610 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2611 SET_EXPECT(Exec_ShellDocView_37
);
2613 load_state
= LD_DOLOAD
;
2614 expect_LockContainer_fLock
= TRUE
;
2615 readystate_set_loading
= TRUE
;
2617 hres
= IPersistMoniker_Load(persist
, FALSE
, &Moniker
, bind
, 0x12);
2618 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
2620 CHECK_CALLED(GetDisplayName
);
2621 if(!set_clientsite
) {
2622 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
2623 CHECK_CALLED(GetHostInfo
);
2624 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
2625 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
2626 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2627 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
2628 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
2629 CHECK_CALLED(GetOptionKeyPath
);
2630 CHECK_CALLED(GetOverrideKeyPath
);
2631 CHECK_CALLED(GetWindow
);
2632 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
2633 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2634 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2635 CHECK_CALLED(Exec_ShellDocView_37
);
2637 if(!container_locked
) {
2638 CHECK_CALLED(GetContainer
);
2639 CHECK_CALLED(LockContainer
);
2640 container_locked
= TRUE
;
2642 CHECK_CALLED(OnChanged_READYSTATE
);
2643 SET_CALLED(Exec_ShellDocView_84
);
2644 CHECK_CALLED(BindToStorage
);
2645 SET_CALLED(SetActiveObject
); /* FIXME */
2646 if(set_clientsite
) {
2647 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
2648 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
2649 CHECK_CALLED(Exec_ShellDocView_37
);
2652 set_clientsite
= container_locked
= TRUE
;
2654 test_GetCurMoniker((IUnknown
*)persist
, &Moniker
, NULL
);
2656 IBindCtx_Release(bind
);
2658 test_readyState((IUnknown
*)persist
);
2661 static void test_download(BOOL verb_done
, BOOL css_dwl
, BOOL css_try_dwl
)
2666 hwnd
= FindWindowA("Internet Explorer_Hidden", NULL
);
2667 ok(hwnd
!= NULL
, "Could not find hidden window\n");
2669 test_readyState(NULL
);
2672 SET_EXPECT(Exec_SETPROGRESSMAX
);
2673 if(!load_from_stream
)
2674 SET_EXPECT(GetHostInfo
);
2676 SET_EXPECT(SetStatusText
);
2677 SET_EXPECT(Exec_SETDOWNLOADSTATE_1
);
2678 SET_EXPECT(GetDropTarget
);
2680 SET_EXPECT(Exec_ShellDocView_84
);
2682 SET_EXPECT(CreateInstance
);
2684 SET_EXPECT(LockRequest
);
2685 SET_EXPECT(Terminate
);
2686 SET_EXPECT(Protocol_Read
);
2687 SET_EXPECT(UnlockRequest
);
2689 SET_EXPECT(OnChanged_1005
);
2690 SET_EXPECT(OnChanged_READYSTATE
);
2691 SET_EXPECT(Exec_SETPROGRESSPOS
);
2692 SET_EXPECT(Exec_SETDOWNLOADSTATE_0
);
2693 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE
);
2694 SET_EXPECT(Exec_HTTPEQUIV_DONE
);
2695 expect_status_text
= (LPWSTR
)0xdeadbeef; /* TODO */
2697 while(!called_Exec_HTTPEQUIV_DONE
&& GetMessage(&msg
, NULL
, 0, 0)) {
2698 TranslateMessage(&msg
);
2699 DispatchMessage(&msg
);
2703 CHECK_CALLED(Exec_SETPROGRESSMAX
);
2704 if(!load_from_stream
)
2705 CHECK_CALLED(GetHostInfo
);
2707 CHECK_CALLED(SetStatusText
);
2708 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1
);
2709 CHECK_CALLED(GetDropTarget
);
2711 SET_CALLED(Exec_ShellDocView_84
);
2713 if(called_CreateInstance
) {
2714 CHECK_CALLED(CreateInstance
);
2715 CHECK_CALLED(Start
);
2716 CHECK_CALLED(LockRequest
);
2717 CHECK_CALLED(Terminate
);
2718 CHECK_CALLED(Protocol_Read
);
2719 CHECK_CALLED(UnlockRequest
);
2721 skip("CreateInstance not called. Assuming no Gecko installed.\n");
2723 SET_CALLED(Exec_ShellDocView_84
);
2724 SET_CALLED(CreateInstance
);
2726 SET_CALLED(LockRequest
);
2727 SET_CALLED(Terminate
);
2728 SET_CALLED(Protocol_Read
);
2729 SET_CALLED(UnlockRequest
);
2734 CHECK_CALLED(OnChanged_1005
);
2735 CHECK_CALLED(OnChanged_READYSTATE
);
2736 CHECK_CALLED(Exec_SETPROGRESSPOS
);
2737 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0
);
2738 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE
);
2739 CHECK_CALLED(Exec_HTTPEQUIV_DONE
);
2741 load_state
= LD_COMPLETE
;
2743 test_readyState(NULL
);
2746 static void test_Persist(IUnknown
*unk
)
2748 IPersistMoniker
*persist_mon
;
2749 IPersistFile
*persist_file
;
2753 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistFile
, (void**)&persist_file
);
2754 ok(hres
== S_OK
, "QueryInterface(IID_IPersist) failed: %08x\n", hres
);
2755 if(SUCCEEDED(hres
)) {
2756 hres
= IPersist_GetClassID(persist_file
, NULL
);
2757 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
2759 hres
= IPersist_GetClassID(persist_file
, &guid
);
2760 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
2761 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
2763 IPersist_Release(persist_file
);
2766 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&persist_mon
);
2767 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres
);
2768 if(SUCCEEDED(hres
)) {
2769 hres
= IPersistMoniker_GetClassID(persist_mon
, NULL
);
2770 ok(hres
== E_INVALIDARG
, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres
);
2772 hres
= IPersistMoniker_GetClassID(persist_mon
, &guid
);
2773 ok(hres
== S_OK
, "GetClassID failed: %08x\n", hres
);
2774 ok(IsEqualGUID(&CLSID_HTMLDocument
, &guid
), "guid != CLSID_HTMLDocument\n");
2776 if(load_state
== LD_DOLOAD
)
2777 test_Load(persist_mon
);
2779 test_readyState(unk
);
2781 IPersistMoniker_Release(persist_mon
);
2785 static const OLECMDF expect_cmds
[OLECMDID_GETPRINTTEMPLATE
+1] = {
2787 OLECMDF_SUPPORTED
, /* OLECMDID_OPEN */
2788 OLECMDF_SUPPORTED
, /* OLECMDID_NEW */
2789 OLECMDF_SUPPORTED
, /* OLECMDID_SAVE */
2790 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SAVEAS */
2791 OLECMDF_SUPPORTED
, /* OLECMDID_SAVECOPYAS */
2792 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINT */
2793 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PRINTPREVIEW */
2794 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PAGESETUP */
2795 OLECMDF_SUPPORTED
, /* OLECMDID_SPELL */
2796 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_PROPERTIES */
2797 OLECMDF_SUPPORTED
, /* OLECMDID_CUT */
2798 OLECMDF_SUPPORTED
, /* OLECMDID_COPY */
2799 OLECMDF_SUPPORTED
, /* OLECMDID_PASTE */
2800 OLECMDF_SUPPORTED
, /* OLECMDID_PASTESPECIAL */
2801 OLECMDF_SUPPORTED
, /* OLECMDID_UNDO */
2802 OLECMDF_SUPPORTED
, /* OLECMDID_REDO */
2803 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_SELECTALL */
2804 OLECMDF_SUPPORTED
, /* OLECMDID_CLEARSELECTION */
2805 OLECMDF_SUPPORTED
, /* OLECMDID_ZOOM */
2806 OLECMDF_SUPPORTED
, /* OLECMDID_GETZOOMRANGE */
2808 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_REFRESH */
2809 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
, /* OLECMDID_STOP */
2811 OLECMDF_SUPPORTED
, /* OLECMDID_STOPDOWNLOAD */
2813 OLECMDF_SUPPORTED
, /* OLECMDID_DELETE */
2815 OLECMDF_SUPPORTED
, /* OLECMDID_ENABLE_INTERACTION */
2816 OLECMDF_SUPPORTED
, /* OLECMDID_ONUNLOAD */
2818 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPAGESETUP */
2819 OLECMDF_SUPPORTED
, /* OLECMDID_SHOWPRINT */
2821 OLECMDF_SUPPORTED
, /* OLECMDID_CLOSE */
2823 OLECMDF_SUPPORTED
, /* OLECMDID_SETPRINTTEMPLATE */
2824 OLECMDF_SUPPORTED
/* OLECMDID_GETPRINTTEMPLATE */
2827 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
2828 static void _test_QueryStatus(unsigned line
, IUnknown
*unk
, REFIID cgid
, ULONG cmdid
, DWORD cmdf
)
2830 IOleCommandTarget
*cmdtrg
;
2831 OLECMD olecmd
= {cmdid
, 0};
2834 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2835 ok_(__FILE__
,line
) (hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
2839 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, cgid
, 1, &olecmd
, NULL
);
2840 ok(hres
== S_OK
, "QueryStatus(%u) failed: %08x\n", cmdid
, hres
);
2842 IOleCommandTarget_Release(cmdtrg
);
2844 ok_(__FILE__
,line
) (olecmd
.cmdID
== cmdid
, "cmdID changed\n");
2845 ok_(__FILE__
,line
) (olecmd
.cmdf
== cmdf
, "(%u) cmdf=%08x, expected %08x\n", cmdid
, olecmd
.cmdf
, cmdf
);
2848 static void test_MSHTML_QueryStatus(IUnknown
*unk
, DWORD cmdf
)
2853 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTNAME
, cmdf
);
2854 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FONTSIZE
, cmdf
);
2855 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_SELECTALL
, cmdf
|OLECMDF_ENABLED
);
2856 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_BOLD
, cmdf
);
2857 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_FORECOLOR
, cmdf
);
2858 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
, cmdf
);
2859 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYLEFT
, cmdf
);
2860 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
, cmdf
);
2861 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ITALIC
, cmdf
);
2862 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNDERLINE
, cmdf
);
2863 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
, cmdf
);
2864 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_ORDERLIST
, cmdf
);
2865 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_UNORDERLIST
, cmdf
);
2866 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_INDENT
, cmdf
);
2867 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_OUTDENT
, cmdf
);
2868 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_DELETE
, cmdf
);
2871 static void test_OleCommandTarget(IUnknown
*unk
)
2873 IOleCommandTarget
*cmdtrg
;
2874 OLECMD cmds
[OLECMDID_GETPRINTTEMPLATE
];
2878 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2879 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres
);
2883 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
2884 cmds
[i
].cmdID
= i
+1;
2885 cmds
[i
].cmdf
= 0xf0f0;
2888 SET_EXPECT(QueryStatus_OPEN
);
2889 SET_EXPECT(QueryStatus_NEW
);
2890 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, sizeof(cmds
)/sizeof(cmds
[0]), cmds
, NULL
);
2891 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2892 CHECK_CALLED(QueryStatus_OPEN
);
2893 CHECK_CALLED(QueryStatus_NEW
);
2895 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
2896 ok(cmds
[i
].cmdID
== i
+1, "cmds[%d].cmdID canged to %x\n", i
, cmds
[i
].cmdID
);
2897 if(i
+1 == OLECMDID_FIND
)
2899 ok(cmds
[i
].cmdf
== expect_cmds
[i
+1], "cmds[%d].cmdf=%x, expected %x\n",
2900 i
+1, cmds
[i
].cmdf
, expect_cmds
[i
+1]);
2903 ok(!cmds
[OLECMDID_FIND
-1].cmdf
|| cmds
[OLECMDID_FIND
-1].cmdf
== (OLECMDF_SUPPORTED
|OLECMDF_ENABLED
),
2904 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds
[OLECMDID_FIND
-1].cmdf
);
2906 IOleCommandTarget_Release(cmdtrg
);
2909 static void test_OleCommandTarget_fail(IUnknown
*unk
)
2911 IOleCommandTarget
*cmdtrg
;
2916 {OLECMDID_OPEN
, 0xf0f0},
2917 {OLECMDID_GETPRINTTEMPLATE
+1, 0xf0f0}
2920 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2921 ok(hres
== S_OK
, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres
);
2925 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 0, NULL
, NULL
);
2926 ok(hres
== S_OK
, "QueryStatus failed: %08x\n", hres
);
2928 SET_EXPECT(QueryStatus_OPEN
);
2929 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 2, cmd
, NULL
);
2930 CHECK_CALLED(QueryStatus_OPEN
);
2932 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
2933 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
2934 ok(cmd
[1].cmdID
== OLECMDID_GETPRINTTEMPLATE
+1,
2935 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd
[0].cmdID
);
2936 ok(cmd
[1].cmdf
== 0, "cmd[0].cmdf=%x, expected 0\n", cmd
[0].cmdf
);
2937 ok(cmd
[0].cmdf
== OLECMDF_SUPPORTED
,
2938 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd
[1].cmdf
);
2940 hres
= IOleCommandTarget_QueryStatus(cmdtrg
, &IID_IHTMLDocument2
, 2, cmd
, NULL
);
2941 ok(hres
== OLECMDERR_E_UNKNOWNGROUP
,
2942 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres
);
2944 for(i
=0; i
<OLECMDID_GETPRINTTEMPLATE
; i
++) {
2945 if(!expect_cmds
[i
]) {
2946 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
2947 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
2948 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
2949 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
2953 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_GETPRINTTEMPLATE
+1,
2954 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
2955 ok(hres
== OLECMDERR_E_NOTSUPPORTED
,
2956 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres
);
2958 IOleCommandTarget_Release(cmdtrg
);
2961 static void test_exec_onunload(IUnknown
*unk
)
2963 IOleCommandTarget
*cmdtrg
;
2967 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2968 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
2972 memset(&var
, 0x0a, sizeof(var
));
2973 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
2974 OLECMDEXECOPT_DODEFAULT
, NULL
, &var
);
2975 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
2976 ok(V_VT(&var
) == VT_BOOL
, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var
));
2977 ok(V_BOOL(&var
) == VARIANT_TRUE
, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var
));
2979 hres
= IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_ONUNLOAD
,
2980 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
2981 ok(hres
== S_OK
, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres
);
2983 IOleCommandTarget_Release(cmdtrg
);
2986 static void test_exec_editmode(IUnknown
*unk
, BOOL loaded
)
2988 IOleCommandTarget
*cmdtrg
;
2991 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
2992 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
2999 load_state
= LD_DOLOAD
;
3002 SET_EXPECT(GetClassID
);
3003 SET_EXPECT(SetStatusText
);
3004 SET_EXPECT(Exec_ShellDocView_37
);
3005 SET_EXPECT(GetHostInfo
);
3007 SET_EXPECT(GetDisplayName
);
3008 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3009 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3010 SET_EXPECT(OnChanged_READYSTATE
);
3011 SET_EXPECT(Exec_ShellDocView_84
);
3013 SET_EXPECT(BindToStorage
);
3014 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3017 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
3019 expect_status_text
= NULL
;
3020 readystate_set_loading
= TRUE
;
3022 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3023 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3024 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3027 CHECK_CALLED(GetClassID
);
3028 CHECK_CALLED(SetStatusText
);
3029 CHECK_CALLED(Exec_ShellDocView_37
);
3030 CHECK_CALLED(GetHostInfo
);
3032 CHECK_CALLED(GetDisplayName
);
3033 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3034 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3035 CHECK_CALLED(OnChanged_READYSTATE
);
3036 SET_CALLED(Exec_ShellDocView_84
);
3038 CHECK_CALLED(BindToStorage
);
3039 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3040 CHECK_CALLED(HideUI
);
3041 CHECK_CALLED(ShowUI
);
3042 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
3044 test_timer(EXPECT_UPDATEUI
|EXPECT_SETTITLE
);
3046 IOleCommandTarget_Release(cmdtrg
);
3048 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_EDITMODE
,
3049 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3050 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3053 static void test_exec_fontname(IUnknown
*unk
, LPCWSTR name
, LPCWSTR exname
)
3055 IOleCommandTarget
*cmdtrg
;
3056 VARIANT
*in
= NULL
, _in
, *out
= NULL
, _out
;
3059 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3060 ok(hres
== S_OK
, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres
);
3067 V_BSTR(in
) = SysAllocString(name
);
3073 V_I4(out
) = 0xdeadbeef;
3076 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, IDM_FONTNAME
, 0, in
, out
);
3078 ok(hres
== S_OK
, "Exec(IDM_FONTNAME) failed: %08x\n", hres
);
3083 if(out
&& !nogecko
) {
3084 ok(V_VT(out
) == VT_BSTR
, "V_VT(out) = %x\n", V_VT(out
));
3085 if(V_VT(out
) == VT_BSTR
) {
3087 ok(!lstrcmpW(V_BSTR(out
), name
? name
: exname
),
3088 "unexpected fontname \"%s\"\n", debugstr_w(name
));
3090 ok(V_BSTR(out
) == NULL
, "V_BSTR(out) != NULL\n");
3095 IOleCommandTarget_Release(cmdtrg
);
3098 static void test_exec_noargs(IUnknown
*unk
, DWORD cmdid
)
3100 IOleCommandTarget
*cmdtrg
;
3103 hres
= IUnknown_QueryInterface(unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
3104 ok(hres
== S_OK
, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres
);
3108 hres
= IOleCommandTarget_Exec(cmdtrg
, &CGID_MSHTML
, cmdid
,
3109 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
3110 ok(hres
== S_OK
, "Exec failed: %08x\n", hres
);
3112 IOleCommandTarget_Release(cmdtrg
);
3115 static void test_IsDirty(IUnknown
*unk
, HRESULT exhres
)
3117 IPersistStreamInit
*perinit
;
3118 IPersistMoniker
*permon
;
3119 IPersistFile
*perfile
;
3122 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistStreamInit
, (void**)&perinit
);
3123 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres
);
3124 if(SUCCEEDED(hres
)) {
3125 hres
= IPersistStreamInit_IsDirty(perinit
);
3126 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3127 IPersistStreamInit_Release(perinit
);
3130 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistMoniker
, (void**)&permon
);
3131 ok(hres
== S_OK
, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres
);
3132 if(SUCCEEDED(hres
)) {
3133 hres
= IPersistMoniker_IsDirty(permon
);
3134 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3135 IPersistMoniker_Release(permon
);
3138 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistFile
, (void**)&perfile
);
3139 ok(hres
== S_OK
, "QueryInterface(IID_IPersistFile failed: %08x\n", hres
);
3140 if(SUCCEEDED(hres
)) {
3141 hres
= IPersistFile_IsDirty(perfile
);
3142 ok(hres
== exhres
, "IsDirty() = %08x, expected %08x\n", hres
, exhres
);
3143 IPersistFile_Release(perfile
);
3147 static HWND
create_container_window(void)
3149 static const WCHAR wszHTMLDocumentTest
[] =
3150 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3151 static WNDCLASSEXW wndclass
= {
3152 sizeof(WNDCLASSEXW
),
3155 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
3156 wszHTMLDocumentTest
,
3160 RegisterClassExW(&wndclass
);
3161 return CreateWindowW(wszHTMLDocumentTest
, wszHTMLDocumentTest
,
3162 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
3163 515, 530, NULL
, NULL
, NULL
, NULL
);
3166 static HRESULT
test_DoVerb(IOleObject
*oleobj
)
3168 RECT rect
= {0,0,500,500};
3171 if(!container_locked
) {
3172 SET_EXPECT(GetContainer
);
3173 SET_EXPECT(LockContainer
);
3175 SET_EXPECT(ActivateMe
);
3176 expect_LockContainer_fLock
= TRUE
;
3178 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_SHOW
, NULL
, &ClientSite
, -1, container_hwnd
, &rect
);
3181 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
3183 if(!container_locked
) {
3184 CHECK_CALLED(GetContainer
);
3185 CHECK_CALLED(LockContainer
);
3186 container_locked
= TRUE
;
3188 CHECK_CALLED(ActivateMe
);
3193 #define CLIENTSITE_EXPECTPATH 0x00000001
3194 #define CLIENTSITE_SETNULL 0x00000002
3195 #define CLIENTSITE_DONTSET 0x00000004
3197 static void test_ClientSite(IOleObject
*oleobj
, DWORD flags
)
3199 IOleClientSite
*clientsite
;
3202 if(flags
& CLIENTSITE_SETNULL
) {
3203 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3204 ok(clientsite
== &ClientSite
, "clientsite=%p, expected %p\n", clientsite
, &ClientSite
);
3206 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
3207 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3209 set_clientsite
= FALSE
;
3212 if(flags
& CLIENTSITE_DONTSET
)
3215 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3216 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
3217 ok(clientsite
== (set_clientsite
? &ClientSite
: NULL
), "GetClientSite() = %p, expected %p\n",
3218 clientsite
, set_clientsite
? &ClientSite
: NULL
);
3220 if(!set_clientsite
) {
3221 SET_EXPECT(GetHostInfo
);
3222 if(flags
& CLIENTSITE_EXPECTPATH
) {
3223 SET_EXPECT(GetOptionKeyPath
);
3224 SET_EXPECT(GetOverrideKeyPath
);
3226 SET_EXPECT(GetWindow
);
3227 SET_EXPECT(QueryStatus_SETPROGRESSTEXT
);
3228 SET_EXPECT(Exec_SETPROGRESSMAX
);
3229 SET_EXPECT(Exec_SETPROGRESSPOS
);
3230 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3231 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3232 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3233 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3234 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3235 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3237 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
3238 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3240 CHECK_CALLED(GetHostInfo
);
3241 if(flags
& CLIENTSITE_EXPECTPATH
) {
3242 CHECK_CALLED(GetOptionKeyPath
);
3243 CHECK_CALLED(GetOverrideKeyPath
);
3245 CHECK_CALLED(GetWindow
);
3246 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT
);
3247 CHECK_CALLED(Exec_SETPROGRESSMAX
);
3248 CHECK_CALLED(Exec_SETPROGRESSPOS
);
3249 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3250 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3251 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3252 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3253 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3254 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3256 set_clientsite
= TRUE
;
3259 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
3260 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
3262 hres
= IOleObject_GetClientSite(oleobj
, &clientsite
);
3263 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
3264 ok(clientsite
== &ClientSite
, "GetClientSite() = %p, expected %p\n", clientsite
, &ClientSite
);
3267 static void test_OnAmbientPropertyChange(IUnknown
*unk
)
3269 IOleControl
*control
= NULL
;
3272 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
3273 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
3277 SET_EXPECT(Invoke_AMBIENT_USERMODE
);
3278 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERMODE
);
3279 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3280 CHECK_CALLED(Invoke_AMBIENT_USERMODE
);
3282 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3283 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_DLCONTROL
);
3284 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3285 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3287 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3288 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3289 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
3290 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3291 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3292 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3294 SET_EXPECT(Invoke_AMBIENT_DLCONTROL
);
3295 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3296 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_SILENT
);
3297 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3298 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL
);
3299 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3301 SET_EXPECT(Invoke_AMBIENT_USERAGENT
);
3302 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_USERAGENT
);
3303 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3304 CHECK_CALLED(Invoke_AMBIENT_USERAGENT
);
3306 SET_EXPECT(Invoke_AMBIENT_PALETTE
);
3307 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
3308 ok(hres
== S_OK
, "OnAmbientChange failed: %08x\n", hres
);
3309 CHECK_CALLED(Invoke_AMBIENT_PALETTE
);
3311 IOleControl_Release(control
);
3316 static void test_OnAmbientPropertyChange2(IUnknown
*unk
)
3318 IOleControl
*control
= NULL
;
3321 hres
= IUnknown_QueryInterface(unk
, &IID_IOleControl
, (void**)&control
);
3322 ok(hres
== S_OK
, "QueryInterface(IID_IOleControl failed: %08x\n", hres
);
3326 hres
= IOleControl_OnAmbientPropertyChange(control
, DISPID_AMBIENT_PALETTE
);
3327 ok(hres
== S_OK
, "OnAmbientPropertyChange failed: %08x\n", hres
);
3329 IOleControl_Release(control
);
3332 static void test_Close(IUnknown
*unk
, BOOL set_client
)
3334 IOleObject
*oleobj
= NULL
;
3337 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
3338 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
3342 SET_EXPECT(GetContainer
);
3343 SET_EXPECT(LockContainer
);
3344 expect_LockContainer_fLock
= FALSE
;
3345 hres
= IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
3346 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
3347 CHECK_CALLED(GetContainer
);
3348 CHECK_CALLED(LockContainer
);
3349 container_locked
= FALSE
;
3352 test_ClientSite(oleobj
, CLIENTSITE_SETNULL
|CLIENTSITE_DONTSET
);
3354 IOleObject_Release(oleobj
);
3357 static void test_OnFrameWindowActivate(IUnknown
*unk
)
3359 IOleInPlaceActiveObject
*inplaceact
;
3362 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceActiveObject
, (void**)&inplaceact
);
3363 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres
);
3367 if(set_clientsite
) {
3368 expect_OnFrameWindowActivate_fActivate
= TRUE
;
3369 SET_EXPECT(OnFrameWindowActivate
);
3370 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
3371 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3372 CHECK_CALLED(OnFrameWindowActivate
);
3374 SET_EXPECT(OnFrameWindowActivate
);
3375 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
3376 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3377 CHECK_CALLED(OnFrameWindowActivate
);
3379 expect_OnFrameWindowActivate_fActivate
= FALSE
;
3380 SET_EXPECT(OnFrameWindowActivate
);
3381 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
3382 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3383 CHECK_CALLED(OnFrameWindowActivate
);
3385 expect_OnFrameWindowActivate_fActivate
= TRUE
;
3386 SET_EXPECT(OnFrameWindowActivate
);
3387 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
3388 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3389 CHECK_CALLED(OnFrameWindowActivate
);
3391 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, FALSE
);
3392 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3394 hres
= IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact
, TRUE
);
3395 ok(hres
== S_OK
, "OnFrameWindowActivate failed: %08x\n", hres
);
3398 IOleInPlaceActiveObject_Release(inplaceact
);
3401 static void test_InPlaceDeactivate(IUnknown
*unk
, BOOL expect_call
)
3403 IOleInPlaceObjectWindowless
*windowlessobj
= NULL
;
3406 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceObjectWindowless
,
3407 (void**)&windowlessobj
);
3408 ok(hres
== S_OK
, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres
);
3413 SET_EXPECT(OnFocus_FALSE
);
3415 SET_EXPECT(OnInPlaceDeactivateEx
);
3417 SET_EXPECT(OnInPlaceDeactivate
);
3419 hres
= IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj
);
3420 ok(hres
== S_OK
, "InPlaceDeactivate failed: %08x\n", hres
);
3422 CHECK_CALLED(OnFocus_FALSE
);
3424 CHECK_CALLED(OnInPlaceDeactivateEx
);
3426 CHECK_CALLED(OnInPlaceDeactivate
);
3429 IOleInPlaceObjectWindowless_Release(windowlessobj
);
3432 static HRESULT
test_Activate(IUnknown
*unk
, DWORD flags
)
3434 IOleObject
*oleobj
= NULL
;
3435 IOleDocumentView
*docview
;
3442 IOleDocumentView_Release(view
);
3445 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
3446 ok(hres
== S_OK
, "QueryInterface(IID_IOleObject) failed: %08x\n", hres
);
3450 hres
= IOleObject_GetUserClassID(oleobj
, NULL
);
3451 ok(hres
== E_INVALIDARG
, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres
);
3453 hres
= IOleObject_GetUserClassID(oleobj
, &guid
);
3454 ok(hres
== S_OK
, "GetUserClassID failed: %08x\n", hres
);
3455 ok(IsEqualGUID(&guid
, &CLSID_HTMLDocument
), "guid != CLSID_HTMLDocument\n");
3457 test_OnFrameWindowActivate(unk
);
3459 test_ClientSite(oleobj
, flags
);
3460 test_InPlaceDeactivate(unk
, FALSE
);
3462 hres
= test_DoVerb(oleobj
);
3464 if(call_UIActivate
== CallUIActivate_AfterShow
) {
3465 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
3466 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
3468 SET_EXPECT(OnFocus_TRUE
);
3469 SET_EXPECT(SetActiveObject
);
3471 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3472 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
3473 expect_status_text
= NULL
;
3475 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
3476 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
3478 CHECK_CALLED(OnFocus_TRUE
);
3479 CHECK_CALLED(SetActiveObject
);
3480 CHECK_CALLED(ShowUI
);
3481 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3482 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
3484 IOleDocumentView_Release(docview
);
3487 IOleObject_Release(oleobj
);
3489 test_OnFrameWindowActivate(unk
);
3494 static void test_Window(IUnknown
*unk
, BOOL expect_success
)
3496 IOleInPlaceActiveObject
*activeobject
= NULL
;
3500 hres
= IOleDocumentView_QueryInterface(view
, &IID_IOleInPlaceActiveObject
, (void**)&activeobject
);
3501 ok(hres
== S_OK
, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres
);
3505 hres
= IOleInPlaceActiveObject_GetWindow(activeobject
, &tmp_hwnd
);
3507 if(expect_success
) {
3508 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
3509 ok(tmp_hwnd
== hwnd
, "tmp_hwnd=%p, expected %p\n", tmp_hwnd
, hwnd
);
3511 ok(hres
== E_FAIL
, "GetWindow returned %08x, expected E_FAIL\n", hres
);
3512 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
3515 IOleInPlaceActiveObject_Release(activeobject
);
3518 static void test_CloseView(void)
3520 IOleInPlaceSite
*inplacesite
= (IOleInPlaceSite
*)0xff00ff00;
3526 hres
= IOleDocumentView_Show(view
, FALSE
);
3527 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
3529 hres
= IOleDocumentView_CloseView(view
, 0);
3530 ok(hres
== S_OK
, "CloseView failed: %08x\n", hres
);
3532 hres
= IOleDocumentView_SetInPlaceSite(view
, NULL
);
3533 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
3535 hres
= IOleDocumentView_GetInPlaceSite(view
, &inplacesite
);
3536 ok(hres
== S_OK
, "SetInPlaceSite failed: %08x\n", hres
);
3537 ok(inplacesite
== NULL
, "inplacesite=%p, expected NULL\n", inplacesite
);
3540 static void test_UIDeactivate(void)
3544 if(call_UIActivate
== CallUIActivate_AfterShow
) {
3545 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3547 if(call_UIActivate
!= CallUIActivate_None
) {
3548 SET_EXPECT(SetActiveObject_null
);
3550 SET_EXPECT(OnUIDeactivate
);
3553 hres
= IOleDocumentView_UIActivate(view
, FALSE
);
3554 ok(hres
== S_OK
, "UIActivate failed: %08x\n", hres
);
3556 if(call_UIActivate
!= CallUIActivate_None
) {
3557 CHECK_CALLED(SetActiveObject_null
);
3558 CHECK_CALLED(HideUI
);
3559 CHECK_CALLED(OnUIDeactivate
);
3561 if(call_UIActivate
== CallUIActivate_AfterShow
) {
3562 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3566 static void test_Hide(void)
3573 hres
= IOleDocumentView_Show(view
, FALSE
);
3574 ok(hres
== S_OK
, "Show failed: %08x\n", hres
);
3577 static HRESULT
create_document(IUnknown
**unk
)
3579 HRESULT hres
= CoCreateInstance(&CLSID_HTMLDocument
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
3580 &IID_IUnknown
, (void**)unk
);
3581 ok(hres
== S_OK
, "CoCreateInstance failed: %08x\n", hres
);
3585 static void test_Navigate(IUnknown
*unk
)
3587 IHlinkTarget
*hlink
;
3590 hres
= IUnknown_QueryInterface(unk
, &IID_IHlinkTarget
, (void**)&hlink
);
3591 ok(hres
== S_OK
, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres
);
3593 SET_EXPECT(ActivateMe
);
3594 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
3595 ok(hres
== S_OK
, "Navigate failed: %08x\n", hres
);
3596 CHECK_CALLED(ActivateMe
);
3598 IHlinkTarget_Release(hlink
);
3601 static void test_external(IUnknown
*unk
, BOOL initialized
)
3603 IDispatch
*external
;
3604 IHTMLDocument2
*doc
;
3605 IHTMLWindow2
*htmlwin
;
3608 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDocument2
, (void**)&doc
);
3609 ok(hres
== S_OK
, "QueryInterface(IID_IHTMLWindow2) failed: %08x\n", hres
);
3611 hres
= IHTMLDocument2_get_parentWindow(doc
, &htmlwin
);
3612 IHTMLDocument2_Release(doc
);
3613 ok(hres
== S_OK
, "get_parentWindow failed: %08x\n", hres
);
3616 SET_EXPECT(GetExternal
);
3617 external
= (void*)0xdeadbeef;
3618 hres
= IHTMLWindow2_get_external(htmlwin
, &external
);
3620 ok(hres
== S_FALSE
|| hres
== S_OK
, "get_external failed: %08x\n", hres
);
3621 CHECK_CALLED(GetExternal
);
3622 ok(external
!= NULL
, "external == NULL\n");
3624 ok(hres
== S_OK
, "get_external failed: %08x\n", hres
);
3625 ok(external
== NULL
, "external != NULL\n");
3628 IHTMLWindow2_Release(htmlwin
);
3631 static void test_StreamLoad(IUnknown
*unk
)
3633 IPersistStreamInit
*init
;
3636 hres
= IUnknown_QueryInterface(unk
, &IID_IPersistStreamInit
, (void**)&init
);
3637 ok(hres
== S_OK
, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres
);
3641 SET_EXPECT(Invoke_AMBIENT_SILENT
);
3642 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3643 SET_EXPECT(Exec_ShellDocView_37
);
3644 SET_EXPECT(OnChanged_READYSTATE
);
3646 readystate_set_loading
= TRUE
;
3648 hres
= IPersistStreamInit_Load(init
, &Stream
);
3649 ok(hres
== S_OK
, "Load failed: %08x\n", hres
);
3651 CHECK_CALLED(Invoke_AMBIENT_SILENT
);
3652 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED
);
3653 CHECK_CALLED(Exec_ShellDocView_37
);
3654 CHECK_CALLED(OnChanged_READYSTATE
);
3657 test_timer(EXPECT_SETTITLE
);
3658 test_GetCurMoniker(unk
, NULL
, about_blank_url
);
3660 IPersistStreamInit_Release(init
);
3663 static void test_QueryInterface(IUnknown
*unk
)
3668 qi
= (void*)0xdeadbeef;
3669 hres
= IUnknown_QueryInterface(unk
, &IID_IRunnableObject
, (void**)&qi
);
3670 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3671 ok(qi
== NULL
, "runnable=%p, ezpected NULL\n", qi
);
3673 qi
= (void*)0xdeadbeef;
3674 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode
, (void**)&qi
);
3675 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3676 ok(qi
== NULL
, "runnable=%p, ezpected NULL\n", qi
);
3678 qi
= (void*)0xdeadbeef;
3679 hres
= IUnknown_QueryInterface(unk
, &IID_IHTMLDOMNode2
, (void**)&qi
);
3680 ok(hres
== E_NOINTERFACE
, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres
);
3681 ok(qi
== NULL
, "runnable=%p, ezpected NULL\n", qi
);
3684 static void init_test(enum load_state_t ls
) {
3686 hwnd
= last_hwnd
= NULL
;
3687 set_clientsite
= FALSE
;
3688 load_from_stream
= FALSE
;
3689 call_UIActivate
= CallUIActivate_None
;
3697 static void test_HTMLDocument(BOOL do_load
)
3703 trace("Testing HTMLDocument (%s)...\n", (do_load
? "load" : "no load"));
3705 init_test(do_load
? LD_DOLOAD
: LD_NO
);
3707 hres
= create_document(&unk
);
3712 test_QueryInterface(unk
);
3713 test_IsDirty(unk
, S_FALSE
);
3714 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3715 test_external(unk
, FALSE
);
3716 test_ConnectionPointContainer(unk
);
3717 test_GetCurMoniker(unk
, NULL
, NULL
);
3720 test_OnAmbientPropertyChange2(unk
);
3722 hres
= test_Activate(unk
, CLIENTSITE_EXPECTPATH
);
3724 IUnknown_Release(unk
);
3729 test_download(FALSE
, TRUE
, TRUE
);
3730 test_GetCurMoniker(unk
, &Moniker
, NULL
);
3733 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3734 test_OleCommandTarget_fail(unk
);
3735 test_OleCommandTarget(unk
);
3736 test_OnAmbientPropertyChange(unk
);
3737 test_Window(unk
, TRUE
);
3738 test_external(unk
, TRUE
);
3740 test_UIDeactivate();
3741 test_OleCommandTarget(unk
);
3742 test_Window(unk
, TRUE
);
3743 test_InPlaceDeactivate(unk
, TRUE
);
3745 /* Calling test_OleCommandTarget here couses Segmentation Fault with native
3746 * MSHTML. It doesn't with Wine. */
3748 test_Window(unk
, FALSE
);
3750 test_InPlaceDeactivate(unk
, FALSE
);
3752 test_Close(unk
, FALSE
);
3754 /* Activate HTMLDocument again */
3755 test_Activate(unk
, CLIENTSITE_SETNULL
);
3756 test_Window(unk
, TRUE
);
3757 test_OleCommandTarget(unk
);
3758 test_UIDeactivate();
3759 test_InPlaceDeactivate(unk
, TRUE
);
3760 test_Close(unk
, FALSE
);
3762 /* Activate HTMLDocument again, this time without UIActivate */
3763 call_UIActivate
= CallUIActivate_None
;
3764 test_Activate(unk
, CLIENTSITE_SETNULL
);
3765 test_Window(unk
, TRUE
);
3767 test_UIDeactivate();
3768 test_InPlaceDeactivate(unk
, TRUE
);
3771 test_Close(unk
, TRUE
);
3772 test_OnAmbientPropertyChange2(unk
);
3773 test_GetCurMoniker(unk
, do_load
? &Moniker
: NULL
, NULL
);
3776 /* Activate HTMLDocument again, calling UIActivate after showing the window */
3777 call_UIActivate
= CallUIActivate_AfterShow
;
3778 test_Activate(unk
, 0);
3779 test_Window(unk
, TRUE
);
3780 test_OleCommandTarget(unk
);
3781 test_UIDeactivate();
3782 test_InPlaceDeactivate(unk
, TRUE
);
3783 test_Close(unk
, FALSE
);
3784 call_UIActivate
= CallUIActivate_None
;
3788 IOleDocumentView_Release(view
);
3791 ok(IsWindow(hwnd
), "hwnd is destroyed\n");
3793 ref
= IUnknown_Release(unk
);
3794 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3796 ok(!IsWindow(hwnd
), "hwnd is not destroyed\n");
3799 static void test_HTMLDocument_hlink(void)
3805 trace("Testing HTMLDocument (hlink)...\n");
3807 init_test(LD_DOLOAD
);
3810 hres
= create_document(&unk
);
3815 test_ConnectionPointContainer(unk
);
3816 test_GetCurMoniker(unk
, NULL
, NULL
);
3820 test_download(FALSE
, TRUE
, TRUE
);
3822 test_IsDirty(unk
, S_FALSE
);
3823 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3825 test_exec_onunload(unk
);
3826 test_Window(unk
, TRUE
);
3827 test_InPlaceDeactivate(unk
, TRUE
);
3828 test_Close(unk
, FALSE
);
3829 test_IsDirty(unk
, S_FALSE
);
3830 test_GetCurMoniker(unk
, &Moniker
, NULL
);
3833 IOleDocumentView_Release(view
);
3836 ref
= IUnknown_Release(unk
);
3837 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3840 static void test_HTMLDocument_StreamLoad(void)
3847 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
3849 init_test(LD_DOLOAD
);
3850 load_from_stream
= TRUE
;
3852 hres
= create_document(&unk
);
3857 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
3858 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
3860 test_readyState(unk
);
3861 test_IsDirty(unk
, S_FALSE
);
3862 test_ConnectionPointContainer(unk
);
3863 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
3864 test_DoVerb(oleobj
);
3865 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3867 IOleObject_Release(oleobj
);
3869 test_GetCurMoniker(unk
, NULL
, NULL
);
3870 test_StreamLoad(unk
);
3871 test_download(TRUE
, FALSE
, TRUE
);
3872 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3874 test_UIDeactivate();
3875 test_InPlaceDeactivate(unk
, TRUE
);
3876 test_Close(unk
, FALSE
);
3877 test_IsDirty(unk
, S_FALSE
);
3880 IOleDocumentView_Release(view
);
3885 ref
= IUnknown_Release(unk
);
3886 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3889 static void test_edit_uiactivate(IOleObject
*oleobj
)
3891 IOleDocumentView
*docview
;
3894 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleDocumentView
, (void **)&docview
);
3895 ok(hres
== S_OK
, "IOleObject_QueryInterface failed with error 0x%08x\n", hres
);
3897 SET_EXPECT(OnFocus_TRUE
);
3898 SET_EXPECT(SetActiveObject
);
3900 SET_EXPECT(InPlaceUIWindow_SetActiveObject
);
3901 SET_EXPECT(InPlaceFrame_SetBorderSpace
);
3902 expect_status_text
= NULL
;
3904 hres
= IOleDocumentView_UIActivate(docview
, TRUE
);
3905 ok(hres
== S_OK
, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres
);
3907 CHECK_CALLED(OnFocus_TRUE
);
3908 CHECK_CALLED(SetActiveObject
);
3909 CHECK_CALLED(ShowUI
);
3910 CHECK_CALLED(InPlaceUIWindow_SetActiveObject
);
3911 CHECK_CALLED(InPlaceFrame_SetBorderSpace
);
3913 IOleDocumentView_Release(docview
);
3916 static void test_editing_mode(BOOL do_load
)
3923 trace("Testing HTMLDocument (edit%s)...\n", do_load
? " load" : "");
3925 init_test(do_load
? LD_DOLOAD
: LD_NO
);
3926 call_UIActivate
= CallUIActivate_AfterShow
;
3928 hres
= create_document(&unk
);
3933 hres
= IUnknown_QueryInterface(unk
, &IID_IOleObject
, (void**)&oleobj
);
3934 ok(hres
== S_OK
, "Could not get IOleObject: %08x\n", hres
);
3936 test_readyState(unk
);
3937 test_ConnectionPointContainer(unk
);
3938 test_ClientSite(oleobj
, CLIENTSITE_EXPECTPATH
);
3939 test_DoVerb(oleobj
);
3940 test_edit_uiactivate(oleobj
);
3942 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3945 stream_read
= protocol_read
= 0;
3946 test_exec_editmode(unk
, do_load
);
3947 test_UIDeactivate();
3948 call_UIActivate
= CallUIActivate_None
;
3949 IOleObject_Release(oleobj
);
3951 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
);
3952 test_download(TRUE
, do_load
, do_load
);
3953 test_timer(EXPECT_UPDATEUI
);
3954 test_MSHTML_QueryStatus(unk
, OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
3957 test_exec_fontname(unk
, NULL
, wszTimesNewRoman
);
3958 test_exec_fontname(unk
, wszArial
, wszTimesNewRoman
);
3959 test_timer(EXPECT_UPDATEUI
);
3960 test_exec_fontname(unk
, NULL
, wszArial
);
3962 test_exec_noargs(unk
, IDM_JUSTIFYRIGHT
);
3963 test_timer(EXPECT_UPDATEUI
);
3965 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
3966 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
3968 test_exec_noargs(unk
, IDM_JUSTIFYCENTER
);
3969 test_timer(EXPECT_UPDATEUI
);
3970 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYRIGHT
,
3971 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
3973 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_JUSTIFYCENTER
,
3974 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
|OLECMDF_LATCHED
);
3976 test_exec_noargs(unk
, IDM_HORIZONTALLINE
);
3977 test_timer(EXPECT_UPDATEUI
);
3978 test_QueryStatus(unk
, &CGID_MSHTML
, IDM_HORIZONTALLINE
,
3979 OLECMDF_SUPPORTED
|OLECMDF_ENABLED
);
3982 test_UIDeactivate();
3983 test_InPlaceDeactivate(unk
, TRUE
);
3984 test_Close(unk
, FALSE
);
3987 IOleDocumentView_Release(view
);
3991 ref
= IUnknown_Release(unk
);
3992 ok(ref
== 0, "ref=%d, expected 0\n", ref
);
3995 static void register_protocol(void)
3997 IInternetSession
*session
;
4000 static const WCHAR wsz_winetest
[] = {'w','i','n','e','t','e','s','t',0};
4002 hres
= CoInternetGetSession(0, &session
, 0);
4003 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
4005 hres
= IInternetSession_RegisterNameSpace(session
, &ClassFactory
, &IID_NULL
,
4006 wsz_winetest
, 0, NULL
, 0);
4007 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
4009 IInternetSession_Release(session
);
4012 static void gecko_installer_workaround(BOOL disable
)
4017 static BOOL has_url
= FALSE
;
4018 static char url
[2048];
4020 if(!disable
&& !has_url
)
4023 res
= RegOpenKey(HKEY_CURRENT_USER
, "Software\\Wine\\MSHTML", &hkey
);
4024 if(res
!= ERROR_SUCCESS
)
4028 DWORD type
, size
= sizeof(url
);
4030 res
= RegQueryValueEx(hkey
, "GeckoUrl", NULL
, &type
, (PVOID
)url
, &size
);
4031 if(res
== ERROR_SUCCESS
&& type
== REG_SZ
)
4034 RegDeleteValue(hkey
, "GeckoUrl");
4036 RegSetValueEx(hkey
, "GeckoUrl", 0, REG_SZ
, (PVOID
)url
, lstrlenA(url
)+1);
4044 gecko_installer_workaround(TRUE
);
4047 container_hwnd
= create_container_window();
4048 register_protocol();
4050 test_HTMLDocument(FALSE
);
4051 test_HTMLDocument(TRUE
);
4052 test_HTMLDocument_hlink();
4053 test_HTMLDocument_StreamLoad();
4054 test_editing_mode(FALSE
);
4055 test_editing_mode(TRUE
);
4057 DestroyWindow(container_hwnd
);
4060 gecko_installer_workaround(FALSE
);