2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
40 #include "mshtml_test.h"
42 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
43 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
44 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
46 #define DEFINE_EXPECT(func) \
47 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
49 #define SET_EXPECT(func) \
50 expect_ ## func = TRUE
52 #define SET_CALLED(func) \
53 called_ ## func = TRUE
55 #define CHECK_EXPECT2(func) \
57 ok(expect_ ##func, "unexpected call " #func "\n"); \
58 called_ ## func = TRUE; \
61 #define CHECK_EXPECT(func) \
63 CHECK_EXPECT2(func); \
64 expect_ ## func = FALSE; \
67 #define CHECK_CALLED(func) \
69 ok(called_ ## func, "expected " #func "\n"); \
70 expect_ ## func = called_ ## func = FALSE; \
73 static IOleDocumentView *view = NULL;
74 static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
76 DEFINE_EXPECT(LockContainer);
77 DEFINE_EXPECT(SetActiveObject);
78 DEFINE_EXPECT(SetActiveObject_null);
79 DEFINE_EXPECT(GetWindow);
80 DEFINE_EXPECT(CanInPlaceActivate);
81 DEFINE_EXPECT(OnInPlaceActivate);
82 DEFINE_EXPECT(OnInPlaceActivateEx);
83 DEFINE_EXPECT(OnUIActivate);
84 DEFINE_EXPECT(GetWindowContext);
85 DEFINE_EXPECT(OnUIDeactivate);
86 DEFINE_EXPECT(OnInPlaceDeactivate);
87 DEFINE_EXPECT(OnInPlaceDeactivateEx);
88 DEFINE_EXPECT(GetContainer);
89 DEFINE_EXPECT(ShowUI);
90 DEFINE_EXPECT(ActivateMe);
91 DEFINE_EXPECT(GetHostInfo);
92 DEFINE_EXPECT(HideUI);
93 DEFINE_EXPECT(GetOptionKeyPath);
94 DEFINE_EXPECT(GetOverrideKeyPath);
95 DEFINE_EXPECT(SetStatusText);
96 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
97 DEFINE_EXPECT(QueryStatus_OPEN);
98 DEFINE_EXPECT(QueryStatus_NEW);
99 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
100 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
101 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
102 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
103 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
104 DEFINE_EXPECT(Exec_ShellDocView_37);
105 DEFINE_EXPECT(Exec_ShellDocView_84);
106 DEFINE_EXPECT(Exec_ShellDocView_103);
107 DEFINE_EXPECT(Exec_ShellDocView_105);
108 DEFINE_EXPECT(Exec_ShellDocView_140);
109 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
110 DEFINE_EXPECT(Exec_SETTITLE);
111 DEFINE_EXPECT(Exec_HTTPEQUIV);
112 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
113 DEFINE_EXPECT(Exec_Explorer_69);
114 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
115 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
116 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
117 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
118 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
119 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
120 DEFINE_EXPECT(GetDropTarget);
121 DEFINE_EXPECT(UpdateUI);
122 DEFINE_EXPECT(Navigate);
123 DEFINE_EXPECT(OnFrameWindowActivate);
124 DEFINE_EXPECT(OnChanged_READYSTATE);
125 DEFINE_EXPECT(OnChanged_1005);
126 DEFINE_EXPECT(OnChanged_1012);
127 DEFINE_EXPECT(GetDisplayName);
128 DEFINE_EXPECT(BindToStorage);
129 DEFINE_EXPECT(IsSystemMoniker);
130 DEFINE_EXPECT(GetBindResult);
131 DEFINE_EXPECT(GetClassID);
132 DEFINE_EXPECT(Abort);
134 DEFINE_EXPECT(CreateInstance);
135 DEFINE_EXPECT(Start);
136 DEFINE_EXPECT(Terminate);
137 DEFINE_EXPECT(Protocol_Read);
138 DEFINE_EXPECT(LockRequest);
139 DEFINE_EXPECT(UnlockRequest);
140 DEFINE_EXPECT(OnFocus_TRUE);
141 DEFINE_EXPECT(OnFocus_FALSE);
142 DEFINE_EXPECT(RequestUIActivate);
143 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
144 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
145 DEFINE_EXPECT(GetExternal);
146 DEFINE_EXPECT(EnableModeless_TRUE);
147 DEFINE_EXPECT(EnableModeless_FALSE);
148 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
149 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
150 DEFINE_EXPECT(Frame_GetWindow);
151 DEFINE_EXPECT(TranslateUrl);
153 static IUnknown *doc_unk;
154 static IMoniker *doc_mon;
155 static BOOL expect_LockContainer_fLock;
156 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
158 static BOOL set_clientsite = FALSE, container_locked = FALSE;
159 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
160 static BOOL editmode = FALSE, show_failed;
161 static BOOL inplace_deactivated;
162 static int stream_read, protocol_read;
163 static enum load_state_t {
172 static LPCOLESTR expect_status_text = NULL;
174 static const char html_page[] =
176 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
180 static const char css_data[] = "body {color: red}";
182 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
183 static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
185 static HRESULT QueryInterface(REFIID riid, void **ppv);
186 static void test_MSHTML_QueryStatus(IUnknown*,DWORD);
188 #define test_readyState(u) _test_readyState(__LINE__,u)
189 static void _test_readyState(unsigned,IUnknown*);
191 static const WCHAR wszTimesNewRoman[] =
192 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
193 static const WCHAR wszArial[] =
194 {'A','r','i','a','l',0};
196 static const char *debugstr_guid(REFIID riid)
200 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
201 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
202 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
203 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
208 static int strcmp_wa(LPCWSTR strw, const char *stra)
211 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
212 return lstrcmpA(stra, buf);
215 static BSTR a2bstr(const char *str)
220 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
221 ret = SysAllocStringLen(NULL, len);
222 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
227 static BOOL is_english(void)
229 return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
230 && PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
233 #define EXPECT_UPDATEUI 1
234 #define EXPECT_SETTITLE 2
236 static void test_timer(DWORD flags)
238 BOOL *b = &called_Exec_SETTITLE;
241 if(flags & EXPECT_UPDATEUI) {
242 SET_EXPECT(UpdateUI);
243 SET_EXPECT(Exec_UPDATECOMMANDS);
244 b = &called_UpdateUI;
246 if(flags & EXPECT_SETTITLE)
247 SET_EXPECT(Exec_SETTITLE);
249 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
250 TranslateMessage(&msg);
251 DispatchMessage(&msg);
254 if(flags & EXPECT_UPDATEUI) {
255 CHECK_CALLED(UpdateUI);
256 CHECK_CALLED(Exec_UPDATECOMMANDS);
258 if(flags & EXPECT_SETTITLE)
259 CHECK_CALLED(Exec_SETTITLE);
262 static IMoniker Moniker;
264 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
265 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, LPCWSTR exurl)
268 IPersistMoniker *permon;
269 IMoniker *mon = (void*)0xdeadbeef;
270 BSTR doc_url = (void*)0xdeadbeef;
273 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
274 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
278 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
279 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
281 hres = IHTMLDocument2_get_URL(doc, &doc_url);
282 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
284 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
285 IPersistMoniker_Release(permon);
289 BOOL exb = expect_GetDisplayName;
290 BOOL clb = called_GetDisplayName;
292 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
293 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
296 SET_EXPECT(GetDisplayName);
297 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
298 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
300 CHECK_CALLED(GetDisplayName);
301 expect_GetDisplayName = exb;
302 called_GetDisplayName = clb;
304 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
309 ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
311 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
312 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
314 ok(!lstrcmpW(url, exurl), "unexpected url\n");
315 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
319 ok(hres == E_UNEXPECTED,
320 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
321 ok(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
322 ok(!lstrcmpW(doc_url, about_blank_url), "doc_url is not about:blank\n");
325 SysFreeString(doc_url);
326 IHTMLDocument_Release(doc);
327 if(mon && mon != (void*)0xdeadbeef)
328 IMoniker_Release(mon);
331 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
333 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
337 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
342 if(IsEqualGUID(&IID_IProxyManager, riid))
343 return E_NOINTERFACE; /* TODO */
344 if(IsEqualGUID(&IID_IDispatchEx, riid))
345 return E_NOINTERFACE; /* TODO */
346 if(IsEqualGUID(&IID_External_unk, riid))
347 return E_NOINTERFACE; /* TODO */
349 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
350 return E_NOINTERFACE;
353 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
358 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
363 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
365 ok(0, "unexpected call\n");
369 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
372 ok(0, "unexpected call\n");
376 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
377 UINT cNames, LCID lcid, DISPID *rgDispId)
379 ok(0, "unexpected call\n");
383 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
384 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
385 EXCEPINFO *pExcepInfo, UINT *puArgErr)
387 ok(0, "unexpected call\n");
391 static const IDispatchVtbl ExternalVtbl = {
392 External_QueryInterface,
395 Dispatch_GetTypeInfoCount,
396 Dispatch_GetTypeInfo,
397 Dispatch_GetIDsOfNames,
401 static IDispatch External = { &ExternalVtbl };
403 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
405 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
411 return E_NOINTERFACE;
414 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
419 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
424 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
425 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
426 DWORD grfPI, HANDLE_PTR dwReserved)
432 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
433 static const WCHAR empty_str = {0};
437 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
438 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
439 ok(!grfPI, "grfPI = %x\n", grfPI);
440 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
442 memset(&bindinfo, 0, sizeof(bindinfo));
443 bindinfo.cbSize = sizeof(bindinfo);
444 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
445 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
446 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
447 "bindf = %x\n", bindf);
449 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
450 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
451 /* TODO: test stgmedData */
452 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
453 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
454 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
455 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
456 ok(bindinfo.dwOptions == 0x80000 ||
457 bindinfo.dwOptions == 0x4080000, /* win2k3 */
458 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
459 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
460 /* TODO: test dwCodePage */
461 /* TODO: test securityAttributes */
462 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
463 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
464 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
466 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
467 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
468 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
470 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
471 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
473 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
475 hres = IInternetProtocolSink_ReportData(pOIProtSink,
476 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
477 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
479 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
480 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
485 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
486 PROTOCOLDATA *pProtocolData)
488 ok(0, "unexpected call\n");
492 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
495 ok(0, "unexpected call\n");
499 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
501 CHECK_EXPECT(Terminate);
505 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
507 ok(0, "unexpected call\n");
511 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
513 ok(0, "unexpected call\n");
517 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
518 ULONG cb, ULONG *pcbRead)
520 CHECK_EXPECT2(Protocol_Read);
522 ok(pv != NULL, "pv == NULL\n");
523 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
524 ok(pcbRead != NULL, "pcbRead == NULL\n");
525 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
530 protocol_read += *pcbRead = sizeof(css_data)-1;
531 memcpy(pv, css_data, sizeof(css_data)-1);
535 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
536 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
538 ok(0, "unexpected call\n");
542 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
544 CHECK_EXPECT(LockRequest);
548 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
550 CHECK_EXPECT(UnlockRequest);
554 static const IInternetProtocolVtbl ProtocolVtbl = {
555 Protocol_QueryInterface,
566 Protocol_LockRequest,
567 Protocol_UnlockRequest
570 static IInternetProtocol Protocol = { &ProtocolVtbl };
572 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
574 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
575 ok(0, "unexpected call\n");
576 return E_NOINTERFACE;
579 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
584 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
589 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
590 REFIID riid, void **ppv)
592 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
593 return E_NOINTERFACE;
595 CHECK_EXPECT(CreateInstance);
596 ok(ppv != NULL, "ppv == NULL\n");
602 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
604 ok(0, "unexpected call\n");
608 static const IClassFactoryVtbl ClassFactoryVtbl = {
609 ClassFactory_QueryInterface,
611 ClassFactory_Release,
612 ClassFactory_CreateInstance,
613 ClassFactory_LockServer
616 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
618 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
620 ok(0, "unexpected call\n");
624 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
629 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
634 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
635 IHlinkBrowseContext *pihlbc)
637 ok(0, "unexpected call\n");
641 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
642 IHlinkBrowseContext **ppihlbc)
644 ok(0, "unexpected call\n");
648 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
649 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
653 CHECK_EXPECT(Navigate);
655 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
656 ok(pbc != NULL, "pbc == NULL\n");
657 ok(pibsc != NULL, "pubsc == NULL\n");
658 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
661 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
662 LPWSTR location = (LPWSTR)0xdeadbeef;
664 IMoniker *mon = NULL;
665 DWORD site_data = 0xdeadbeef;
667 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
669 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
670 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
672 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
673 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
674 ok(location == NULL, "location = %p\n", location);
675 ok(mon != NULL, "mon == NULL\n");
677 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
678 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
679 ok(site == NULL, "site = %p\n, expected NULL\n", site);
681 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
687 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
688 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
690 ok(0, "unexpected call\n");
694 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
695 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
697 ok(0, "unexpected call\n");
701 static const IHlinkFrameVtbl HlinkFrameVtbl = {
702 HlinkFrame_QueryInterface,
705 HlinkFrame_SetBrowseContext,
706 HlinkFrame_GetBrowseContext,
708 HlinkFrame_OnNavigate,
709 HlinkFrame_UpdateHlink
712 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
714 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
715 REFIID riid, void**ppv)
717 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
722 ok(0, "unexpected call\n");
723 return E_NOINTERFACE;
726 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
731 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
736 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
739 case DISPID_READYSTATE:
740 CHECK_EXPECT2(OnChanged_READYSTATE);
742 if(readystate_set_interactive) {
743 readystate_set_interactive = FALSE;
744 load_state = LD_INTERACTIVE;
747 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
748 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
749 ? OLECMDF_ENABLED : 0));
751 if(readystate_set_loading) {
752 readystate_set_loading = FALSE;
753 load_state = LD_LOADING;
755 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
756 test_readyState(NULL);
759 CHECK_EXPECT(OnChanged_1005);
761 test_readyState(NULL);
762 readystate_set_interactive = (load_state != LD_INTERACTIVE);
765 CHECK_EXPECT(OnChanged_1012);
773 ok(0, "unexpected id %d\n", dispID);
777 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
779 ok(0, "unexpected call\n");
783 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
784 PropertyNotifySink_QueryInterface,
785 PropertyNotifySink_AddRef,
786 PropertyNotifySink_Release,
787 PropertyNotifySink_OnChanged,
788 PropertyNotifySink_OnRequestEdit
791 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
793 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
795 ok(0, "unexpected call\n");
796 return E_NOINTERFACE;
799 static ULONG WINAPI Stream_AddRef(IStream *iface)
804 static ULONG WINAPI Stream_Release(IStream *iface)
809 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
810 ULONG cb, ULONG *pcbRead)
813 ok(pv != NULL, "pv == NULL\n");
814 ok(cb > sizeof(html_page), "cb = %d\n", cb);
815 ok(pcbRead != NULL, "pcbRead == NULL\n");
816 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
821 memcpy(pv, html_page, sizeof(html_page)-1);
822 stream_read += *pcbRead = sizeof(html_page)-1;
826 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
827 ULONG cb, ULONG *pcbWritten)
829 ok(0, "unexpected call\n");
833 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
834 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
836 ok(0, "unexpected call\n");
840 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
842 ok(0, "unexpected call\n");
846 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
847 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
849 ok(0, "unexpected call\n");
853 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
855 ok(0, "unexpected call\n");
859 static HRESULT WINAPI Stream_Revert(IStream *iface)
861 ok(0, "unexpected call\n");
865 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
866 ULARGE_INTEGER cb, DWORD dwLockType)
868 ok(0, "unexpected call\n");
872 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
873 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
875 ok(0, "unexpected call\n");
879 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
882 ok(0, "unexpected call\n");
886 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
888 ok(0, "unexpected call\n");
892 static const IStreamVtbl StreamVtbl = {
893 Stream_QueryInterface,
909 static IStream Stream = { &StreamVtbl };
911 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
913 if(IsEqualGUID(&IID_IWinInetHttpInfo, riid))
914 return E_NOINTERFACE; /* TODO */
916 if(IsEqualGUID(&IID_IWinInetInfo, riid))
917 return E_NOINTERFACE; /* TODO */
919 ok(0, "unexpected call\n");
920 return E_NOINTERFACE;
923 static ULONG WINAPI Binding_AddRef(IBinding *iface)
928 static ULONG WINAPI Binding_Release(IBinding *iface)
933 static HRESULT WINAPI Binding_Abort(IBinding *iface)
939 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
941 ok(0, "unexpected call\n");
945 static HRESULT WINAPI Binding_Resume(IBinding *iface)
947 ok(0, "unexpected call\n");
951 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
953 ok(0, "unexpected call\n");
957 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
959 ok(0, "unexpected call\n");
963 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
964 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
966 CHECK_EXPECT(GetBindResult);
970 static const IBindingVtbl BindingVtbl = {
971 Binding_QueryInterface,
979 Binding_GetBindResult
982 static IBinding Binding = { &BindingVtbl };
984 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
985 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
987 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
991 if(IsEqualGUID(&IID_IMoniker_unk, riid))
992 return E_NOINTERFACE; /* TODO */
993 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
994 return E_NOINTERFACE; /* TODO */
996 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
997 return E_NOINTERFACE;
1000 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1005 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1010 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1012 CHECK_EXPECT(GetClassID);
1013 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1017 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1019 ok(0, "unexpected call\n");
1023 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1025 ok(0, "unexpected call\n");
1029 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1031 ok(0, "unexpected call\n");
1035 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1037 ok(0, "unexpected call\n");
1041 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1042 REFIID riidResult, void **ppvResult)
1044 ok(0, "unexpected call\n");
1048 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1049 REFIID riid, void **ppv)
1051 IBindStatusCallback *callback = NULL;
1052 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1053 STGMEDIUM stgmedium;
1058 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1059 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1061 CHECK_EXPECT(BindToStorage);
1063 load_state = LD_LOADING;
1065 ok(pbc != NULL, "pbc == NULL\n");
1066 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1067 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1068 ok(ppv != NULL, "ppv == NULL\n");
1069 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1071 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1072 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1073 ok(callback != NULL, "callback == NULL\n");
1075 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1076 bindinfo.cbSize = sizeof(bindinfo);
1078 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1079 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1080 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1081 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1082 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1083 /* TODO: test stgmedData */
1084 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1085 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1086 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1087 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1088 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1089 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1090 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1091 /* TODO: test dwCodePage */
1092 /* TODO: test securityAttributes */
1093 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1094 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1095 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1097 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1098 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1100 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1102 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1104 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1105 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1106 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1109 stgmedium.tymed = TYMED_ISTREAM;
1110 U(stgmedium).pstm = &Stream;
1111 stgmedium.pUnkForRelease = (IUnknown*)iface;
1112 hres = IBindStatusCallback_OnDataAvailable(callback,
1113 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1114 sizeof(html_page)-1, &formatetc, &stgmedium);
1115 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1118 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1119 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1120 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1122 SET_EXPECT(GetBindResult);
1123 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1124 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1125 SET_CALLED(GetBindResult); /* IE7 */
1127 IBindStatusCallback_Release(callback);
1132 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1133 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1135 ok(0, "unexpected call\n");
1139 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1140 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1142 ok(0, "unexpected call\n");
1146 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1148 ok(0, "unexpected call\n");
1152 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1154 ok(0, "unexpected call\n");
1158 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1160 ok(0, "unexpected call\n");
1164 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1165 IMoniker *pmkNewlyRunning)
1167 ok(0, "unexpected call\n");
1171 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1172 IMoniker *pmkToLeft, FILETIME *pFileTime)
1174 ok(0, "unexpected call\n");
1178 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1180 ok(0, "unexpected call\n");
1184 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1185 IMoniker **ppmkPrefix)
1187 ok(0, "unexpected call\n");
1191 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1192 IMoniker **pmkRelPath)
1194 ok(0, "unexpected call\n");
1198 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1199 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1201 CHECK_EXPECT2(GetDisplayName);
1203 /* ok(pbc != NULL, "pbc == NULL\n"); */
1204 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1205 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1207 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1208 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1213 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1214 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1216 ok(0, "unexpected call\n");
1220 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1222 CHECK_EXPECT(IsSystemMoniker);
1226 static const IMonikerVtbl MonikerVtbl = {
1227 Moniker_QueryInterface,
1235 Moniker_BindToObject,
1236 Moniker_BindToStorage,
1238 Moniker_ComposeWith,
1243 Moniker_GetTimeOfLastChange,
1245 Moniker_CommonPrefixWith,
1246 Moniker_RelativePathTo,
1247 Moniker_GetDisplayName,
1248 Moniker_ParseDisplayName,
1249 Moniker_IsSystemMoniker
1252 static IMoniker Moniker = { &MonikerVtbl };
1254 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1256 return QueryInterface(riid, ppv);
1259 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1264 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1269 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1270 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1272 ok(0, "unexpected call\n");
1276 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1277 IEnumUnknown **ppenum)
1279 ok(0, "unexpected call\n");
1283 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1285 CHECK_EXPECT(LockContainer);
1286 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1290 static const IOleContainerVtbl OleContainerVtbl = {
1291 OleContainer_QueryInterface,
1292 OleContainer_AddRef,
1293 OleContainer_Release,
1294 OleContainer_ParseDisplayName,
1295 OleContainer_EnumObjects,
1296 OleContainer_LockContainer
1299 static IOleContainer OleContainer = { &OleContainerVtbl };
1301 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1303 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1305 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1306 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1309 return E_NOINTERFACE;
1312 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1317 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1322 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1324 CHECK_EXPECT(Frame_GetWindow);
1328 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1330 ok(0, "unexpected call\n");
1334 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1336 ok(0, "unexpected call\n");
1340 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1341 LPCBORDERWIDTHS pborderwidths)
1343 ok(0, "unexpected call\n");
1347 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1348 LPCBORDERWIDTHS pborderwidths)
1350 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1354 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1355 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1357 static const WCHAR wszHTML_Document[] =
1358 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1360 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1362 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1363 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1364 if(pActiveObject && is_english())
1365 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1368 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1369 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1371 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1375 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1376 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1378 static const WCHAR wszHTML_Document[] =
1379 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1382 CHECK_EXPECT2(SetActiveObject);
1384 if(pActiveObject && is_english())
1385 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1387 CHECK_EXPECT(SetActiveObject_null);
1389 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1390 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1396 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1397 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1399 ok(0, "unexpected call\n");
1403 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1404 HOLEMENU holemenu, HWND hwndActiveObject)
1406 ok(0, "unexpected call\n");
1410 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1412 ok(0, "unexpected call\n");
1416 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1418 CHECK_EXPECT2(SetStatusText);
1419 if(!expect_status_text)
1420 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1424 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1427 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1429 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1433 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1435 ok(0, "unexpected call\n");
1439 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1440 InPlaceFrame_QueryInterface,
1441 InPlaceFrame_AddRef,
1442 InPlaceFrame_Release,
1443 InPlaceFrame_GetWindow,
1444 InPlaceFrame_ContextSensitiveHelp,
1445 InPlaceFrame_GetBorder,
1446 InPlaceFrame_RequestBorderSpace,
1447 InPlaceFrame_SetBorderSpace,
1448 InPlaceFrame_SetActiveObject,
1449 InPlaceFrame_InsertMenus,
1450 InPlaceFrame_SetMenu,
1451 InPlaceFrame_RemoveMenus,
1452 InPlaceFrame_SetStatusText,
1453 InPlaceFrame_EnableModeless,
1454 InPlaceFrame_TranslateAccelerator
1457 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1459 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1460 InPlaceFrame_QueryInterface,
1461 InPlaceFrame_AddRef,
1462 InPlaceFrame_Release,
1463 InPlaceFrame_GetWindow,
1464 InPlaceFrame_ContextSensitiveHelp,
1465 InPlaceFrame_GetBorder,
1466 InPlaceFrame_RequestBorderSpace,
1467 InPlaceFrame_SetBorderSpace,
1468 InPlaceUIWindow_SetActiveObject,
1471 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1473 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
1475 return QueryInterface(riid, ppv);
1478 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
1483 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
1488 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
1490 CHECK_EXPECT2(GetWindow);
1491 ok(phwnd != NULL, "phwnd = NULL\n");
1492 *phwnd = container_hwnd;
1496 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
1498 ok(0, "unexpected call\n");
1502 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
1504 CHECK_EXPECT(CanInPlaceActivate);
1508 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
1510 CHECK_EXPECT(OnInPlaceActivate);
1511 inplace_deactivated = FALSE;
1515 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
1517 CHECK_EXPECT(OnUIActivate);
1521 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
1522 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1523 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1525 static const RECT rect = {0,0,500,500};
1527 CHECK_EXPECT(GetWindowContext);
1529 ok(ppFrame != NULL, "ppFrame = NULL\n");
1531 *ppFrame = &InPlaceFrame;
1532 ok(ppDoc != NULL, "ppDoc = NULL\n");
1534 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1535 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1537 memcpy(lprcPosRect, &rect, sizeof(RECT));
1538 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1540 memcpy(lprcClipRect, &rect, sizeof(RECT));
1541 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1543 lpFrameInfo->cb = sizeof(*lpFrameInfo);
1544 lpFrameInfo->fMDIApp = FALSE;
1545 lpFrameInfo->hwndFrame = container_hwnd;
1546 lpFrameInfo->haccel = NULL;
1547 lpFrameInfo->cAccelEntries = 0;
1553 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtant)
1555 ok(0, "unexpected call\n");
1559 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
1561 CHECK_EXPECT(OnUIDeactivate);
1562 ok(!fUndoable, "fUndoable = TRUE\n");
1566 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
1568 CHECK_EXPECT(OnInPlaceDeactivate);
1569 inplace_deactivated = TRUE;
1573 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
1575 ok(0, "unexpected call\n");
1579 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
1581 ok(0, "unexpected call\n");
1585 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface, LPCRECT lprcPosRect)
1587 ok(0, "unexpected call\n");
1591 static HRESULT WINAPI InPlaceSiteEx_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1593 CHECK_EXPECT(OnInPlaceActivateEx);
1595 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1596 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1597 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1602 static HRESULT WINAPI InPlaceSiteEx_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface, BOOL fNoRedraw)
1604 CHECK_EXPECT(OnInPlaceDeactivateEx);
1606 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1611 static HRESULT WINAPI InPlaceSiteEx_RequestUIActivate(IOleInPlaceSiteEx *iface)
1613 CHECK_EXPECT(RequestUIActivate);
1617 static const IOleInPlaceSiteExVtbl InPlaceSiteVtbl = {
1618 InPlaceSite_QueryInterface,
1620 InPlaceSite_Release,
1621 InPlaceSite_GetWindow,
1622 InPlaceSite_ContextSensitiveHelp,
1623 InPlaceSite_CanInPlaceActivate,
1624 InPlaceSite_OnInPlaceActivate,
1625 InPlaceSite_OnUIActivate,
1626 InPlaceSite_GetWindowContext,
1628 InPlaceSite_OnUIDeactivate,
1629 InPlaceSite_OnInPlaceDeactivate,
1630 InPlaceSite_DiscardUndoState,
1631 InPlaceSite_DeactivateAndUndo,
1632 InPlaceSite_OnPosRectChange,
1633 InPlaceSiteEx_OnInPlaceActivateEx,
1634 InPlaceSiteEx_OnInPlaceDeactivateEx,
1635 InPlaceSiteEx_RequestUIActivate
1638 static IOleInPlaceSiteEx InPlaceSiteEx = { &InPlaceSiteVtbl };
1640 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1642 return QueryInterface(riid, ppv);
1645 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1650 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1655 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1657 ok(0, "unexpected call\n");
1661 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1664 ok(0, "unexpected call\n");
1668 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1670 CHECK_EXPECT(GetContainer);
1671 ok(ppContainer != NULL, "ppContainer = NULL\n");
1672 *ppContainer = &OleContainer;
1676 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1678 ok(0, "unexpected call\n");
1682 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1684 ok(0, "unexpected call\n");
1688 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1690 ok(0, "unexpected call\n");
1694 static const IOleClientSiteVtbl ClientSiteVtbl = {
1695 ClientSite_QueryInterface,
1698 ClientSite_SaveObject,
1699 ClientSite_GetMoniker,
1700 ClientSite_GetContainer,
1701 ClientSite_ShowObject,
1702 ClientSite_OnShowWindow,
1703 ClientSite_RequestNewObjectLayout
1706 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1708 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
1710 return QueryInterface(riid, ppv);
1713 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
1718 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
1725 CallUIActivate_None,
1726 CallUIActivate_ActivateMe,
1727 CallUIActivate_AfterShow,
1730 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
1731 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
1733 IOleDocument *document;
1736 CHECK_EXPECT(ActivateMe);
1737 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
1739 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
1740 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
1742 if(SUCCEEDED(hres)) {
1743 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteEx, NULL, 0, &view);
1744 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
1746 if(SUCCEEDED(hres)) {
1747 IOleInPlaceActiveObject *activeobj = NULL;
1748 IOleInPlaceSite *inplacesite = NULL;
1749 HWND tmp_hwnd = NULL;
1750 static RECT rect = {0,0,400,500};
1752 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1753 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1754 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteEx, "inplacesite=%p, expected %p\n",
1755 inplacesite, &InPlaceSiteEx);
1757 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteEx);
1758 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
1760 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1761 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1762 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteEx, "inplacesite=%p, expected %p\n",
1763 inplacesite, &InPlaceSiteEx);
1765 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
1766 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
1769 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1770 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1771 ok(hwnd == NULL, "hwnd=%p, expeted NULL\n", hwnd);
1774 if(call_UIActivate == CallUIActivate_ActivateMe) {
1775 SET_EXPECT(CanInPlaceActivate);
1776 SET_EXPECT(GetWindowContext);
1777 SET_EXPECT(GetWindow);
1779 SET_EXPECT(OnInPlaceActivateEx);
1781 SET_EXPECT(OnInPlaceActivate);
1782 SET_EXPECT(SetStatusText);
1783 SET_EXPECT(Exec_SETPROGRESSMAX);
1784 SET_EXPECT(Exec_SETPROGRESSPOS);
1785 SET_EXPECT(OnUIActivate);
1786 SET_EXPECT(SetActiveObject);
1788 expect_status_text = NULL;
1790 hres = IOleDocumentView_UIActivate(view, TRUE);
1791 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1793 CHECK_CALLED(CanInPlaceActivate);
1794 CHECK_CALLED(GetWindowContext);
1795 CHECK_CALLED(GetWindow);
1797 CHECK_CALLED(OnInPlaceActivateEx);
1799 CHECK_CALLED(OnInPlaceActivate);
1800 CHECK_CALLED(SetStatusText);
1801 CHECK_CALLED(Exec_SETPROGRESSMAX);
1802 CHECK_CALLED(Exec_SETPROGRESSPOS);
1803 CHECK_CALLED(OnUIActivate);
1804 CHECK_CALLED(SetActiveObject);
1805 CHECK_CALLED(ShowUI);
1808 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1809 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1810 ok(hwnd != NULL, "hwnd == NULL\n");
1812 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
1815 hres = IOleDocumentView_UIActivate(view, TRUE);
1816 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1819 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
1820 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1821 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
1825 hres = IOleDocumentView_SetRect(view, &rect);
1826 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
1828 if(call_UIActivate == CallUIActivate_ActivateMe) {
1829 hres = IOleDocumentView_Show(view, TRUE);
1830 ok(hres == S_OK, "Show failed: %08x\n", hres);
1832 SET_EXPECT(CanInPlaceActivate);
1833 SET_EXPECT(GetWindowContext);
1834 SET_EXPECT(GetWindow);
1836 SET_EXPECT(OnInPlaceActivateEx);
1838 SET_EXPECT(OnInPlaceActivate);
1839 SET_EXPECT(SetStatusText);
1840 SET_EXPECT(Exec_SETPROGRESSMAX);
1841 SET_EXPECT(Exec_SETPROGRESSPOS);
1842 SET_EXPECT(OnUIActivate);
1843 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
1845 hres = IOleDocumentView_Show(view, TRUE);
1847 win_skip("Show failed\n");
1849 IOleInPlaceActiveObject_Release(activeobj);
1850 IOleDocument_Release(document);
1854 ok(hres == S_OK, "Show failed: %08x\n", hres);
1856 CHECK_CALLED(CanInPlaceActivate);
1857 CHECK_CALLED(GetWindowContext);
1858 CHECK_CALLED(GetWindow);
1860 CHECK_CALLED(OnInPlaceActivateEx);
1862 CHECK_CALLED(OnInPlaceActivate);
1863 CHECK_CALLED(SetStatusText);
1864 CHECK_CALLED(Exec_SETPROGRESSMAX);
1865 CHECK_CALLED(Exec_SETPROGRESSPOS);
1868 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1869 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1870 ok(hwnd != NULL, "hwnd == NULL\n");
1872 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
1876 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
1879 IOleInPlaceActiveObject_Release(activeobj);
1882 IOleDocument_Release(document);
1888 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
1889 DocumentSite_QueryInterface,
1890 DocumentSite_AddRef,
1891 DocumentSite_Release,
1892 DocumentSite_ActivateMe
1895 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
1897 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
1899 return QueryInterface(riid, ppv);
1902 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
1907 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
1912 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
1914 ok(0, "unexpected call\n");
1918 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
1920 ok(0, "unexpected call\n");
1924 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
1926 ok(0, "unexpected call\n");
1930 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
1931 POINTF *pPtfContainer, DWORD dwFlags)
1933 ok(0, "unexpected call\n");
1937 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
1938 MSG *pMsg, DWORD grfModifiers)
1940 ok(0, "unexpected call\n");
1944 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
1947 CHECK_EXPECT(OnFocus_TRUE);
1949 CHECK_EXPECT2(OnFocus_FALSE);
1953 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
1955 ok(0, "unexpected call\n");
1959 static const IOleControlSiteVtbl OleControlSiteVtbl = {
1960 OleControlSite_QueryInterface,
1961 OleControlSite_AddRef,
1962 OleControlSite_Release,
1963 OleControlSite_OnControlInfoChanged,
1964 OleControlSite_LockInPlaceActive,
1965 OleControlSite_GetExtendedControl,
1966 OleControlSite_TransformCoords,
1967 OleControlSite_TranslateAccelerator,
1968 OleControlSite_OnFocus,
1969 OleControlSite_ShowPropertyFrame
1972 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
1974 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
1976 return QueryInterface(riid, ppv);
1979 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
1984 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
1989 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
1990 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
1992 ok(0, "unexpected call\n");
1996 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
1998 CHECK_EXPECT(GetHostInfo);
1999 ok(pInfo != NULL, "pInfo=NULL\n");
2001 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2002 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2003 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2004 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2005 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2006 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2007 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2008 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2013 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2014 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2015 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2017 CHECK_EXPECT(ShowUI);
2020 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2022 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2023 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2024 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2025 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2026 if (expect_InPlaceUIWindow_SetActiveObject_active)
2027 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2029 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2034 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2036 CHECK_EXPECT(HideUI);
2040 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2042 CHECK_EXPECT(UpdateUI);
2046 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2049 CHECK_EXPECT2(EnableModeless_TRUE);
2051 CHECK_EXPECT2(EnableModeless_FALSE);
2055 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2057 ok(0, "unexpected call\n");
2061 static BOOL expect_OnFrameWindowActivate_fActivate;
2062 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2064 CHECK_EXPECT2(OnFrameWindowActivate);
2065 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2069 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2070 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2072 ok(0, "unexpected call\n");
2076 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2077 const GUID *pguidCmdGroup, DWORD nCmdID)
2079 ok(0, "unexpected call\n");
2083 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2084 LPOLESTR *pchKey, DWORD dw)
2086 CHECK_EXPECT(GetOptionKeyPath);
2087 ok(pchKey != NULL, "pchKey = NULL\n");
2088 ok(!dw, "dw=%d, expected 0\n", dw);
2090 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2094 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2095 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2097 CHECK_EXPECT(GetDropTarget);
2102 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2104 CHECK_EXPECT(GetExternal);
2105 *ppDispatch = &External;
2109 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2110 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2112 CHECK_EXPECT(TranslateUrl);
2113 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2114 ok(!strcmp_wa(pchURLIn, "about:blank"), "pchURLIn = %s\n", wine_dbgstr_w(pchURLIn));
2115 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2116 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2121 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2122 IDataObject **ppPORet)
2124 ok(0, "unexpected call\n");
2128 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2129 LPOLESTR *pchKey, DWORD dw)
2131 CHECK_EXPECT(GetOverrideKeyPath);
2132 ok(pchKey != NULL, "pchKey = NULL\n");
2134 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2135 ok(!dw, "dw=%d, xepected 0\n", dw);
2139 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2140 DocHostUIHandler_QueryInterface,
2141 DocHostUIHandler_AddRef,
2142 DocHostUIHandler_Release,
2143 DocHostUIHandler_ShowContextMenu,
2144 DocHostUIHandler_GetHostInfo,
2145 DocHostUIHandler_ShowUI,
2146 DocHostUIHandler_HideUI,
2147 DocHostUIHandler_UpdateUI,
2148 DocHostUIHandler_EnableModeless,
2149 DocHostUIHandler_OnDocWindowActivate,
2150 DocHostUIHandler_OnFrameWindowActivate,
2151 DocHostUIHandler_ResizeBorder,
2152 DocHostUIHandler_TranslateAccelerator,
2153 DocHostUIHandler_GetOptionKeyPath,
2154 DocHostUIHandler_GetDropTarget,
2155 DocHostUIHandler_GetExternal,
2156 DocHostUIHandler_TranslateUrl,
2157 DocHostUIHandler_FilterDataObject,
2158 DocHostUIHandler_GetOverrideKeyPath
2161 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2163 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2164 REFIID riid, void **ppv)
2166 return QueryInterface(riid, ppv);
2169 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2174 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2179 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2180 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2182 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2183 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2184 ok(!pCmdText, "pCmdText != NULL\n");
2186 switch(prgCmds[0].cmdID) {
2187 case OLECMDID_SETPROGRESSTEXT:
2188 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2189 prgCmds[0].cmdf = OLECMDF_ENABLED;
2192 CHECK_EXPECT(QueryStatus_OPEN);
2193 prgCmds[0].cmdf = 0;
2196 CHECK_EXPECT(QueryStatus_NEW);
2197 prgCmds[0].cmdf = 0;
2200 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2206 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2207 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2209 if(!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2210 test_readyState(NULL);
2212 if(!pguidCmdGroup) {
2214 case OLECMDID_SETPROGRESSMAX:
2215 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2216 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2217 ok(pvaIn != NULL, "pvaIn == NULL\n");
2219 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2220 if(load_state == LD_NO)
2221 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2223 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2225 case OLECMDID_SETPROGRESSPOS:
2226 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2227 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2228 ok(pvaIn != NULL, "pvaIn == NULL\n");
2230 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2231 if(load_state == LD_NO)
2232 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2234 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2236 case OLECMDID_HTTPEQUIV_DONE:
2237 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2238 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2239 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2240 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2241 load_state = LD_COMPLETE;
2243 case OLECMDID_SETDOWNLOADSTATE:
2244 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2245 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2246 ok(pvaIn != NULL, "pvaIn == NULL\n");
2247 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2249 switch(V_I4(pvaIn)) {
2251 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2252 load_state = LD_INTERACTIVE;
2255 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2256 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2259 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2263 case OLECMDID_UPDATECOMMANDS:
2264 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2265 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2266 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2267 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2269 case OLECMDID_SETTITLE:
2270 CHECK_EXPECT2(Exec_SETTITLE);
2271 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2272 ok(pvaIn != NULL, "pvaIn == NULL\n");
2273 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2274 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2275 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2277 case OLECMDID_HTTPEQUIV:
2278 CHECK_EXPECT2(Exec_HTTPEQUIV);
2279 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2280 ok(pvaIn != NULL, "pvaIn == NULL\n");
2281 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2282 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2283 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2284 test_readyState(NULL);
2287 ok(0, "unexpected command %d\n", nCmdID);
2292 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2293 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2297 CHECK_EXPECT2(Exec_ShellDocView_37);
2299 if(load_from_stream)
2300 test_GetCurMoniker(doc_unk, NULL, about_blank_url);
2302 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2304 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2305 ok(pvaIn != NULL, "pvaIn == NULL\n");
2307 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2308 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2312 CHECK_EXPECT2(Exec_ShellDocView_84);
2314 ok(pvaIn == NULL, "pvaIn != NULL\n");
2315 ok(pvaOut != NULL, "pvaOut == NULL\n");
2317 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2322 CHECK_EXPECT2(Exec_ShellDocView_103);
2324 ok(pvaIn == NULL, "pvaIn != NULL\n");
2325 ok(pvaOut == NULL, "pvaOut != NULL\n");
2330 CHECK_EXPECT2(Exec_ShellDocView_105);
2332 ok(pvaIn != NULL, "pvaIn == NULL\n");
2333 ok(pvaOut == NULL, "pvaOut != NULL\n");
2338 CHECK_EXPECT2(Exec_ShellDocView_140);
2340 ok(pvaIn == NULL, "pvaIn != NULL\n");
2341 ok(pvaOut == NULL, "pvaOut != NULL\n");
2346 ok(0, "unexpected command %d\n", nCmdID);
2351 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2352 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2355 case IDM_PARSECOMPLETE:
2356 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2357 ok(pvaIn == NULL, "pvaIn != NULL\n");
2358 ok(pvaOut == NULL, "pvaOut != NULL\n");
2361 ok(0, "unexpected command %d\n", nCmdID);
2365 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup))
2366 return E_FAIL; /* TODO */
2368 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2369 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2373 CHECK_EXPECT2(Exec_Explorer_69);
2374 ok(pvaIn == NULL, "pvaIn != NULL\n");
2375 ok(pvaOut != NULL, "pvaOut == NULL\n");
2378 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2383 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2385 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2386 SET_EXPECT(SetStatusText);
2387 ok(pvaIn == NULL, "pvaIn != NULL\n");
2388 ok(pvaOut == NULL, "pvaOut != NULL\n");
2390 case OLECMDID_SHOWSCRIPTERROR:
2394 ok(0, "unexpected command %d\n", nCmdID);
2399 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2403 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2404 OleCommandTarget_QueryInterface,
2405 OleCommandTarget_AddRef,
2406 OleCommandTarget_Release,
2407 OleCommandTarget_QueryStatus,
2408 OleCommandTarget_Exec
2411 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2413 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2415 return QueryInterface(riid, ppv);
2418 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2419 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2420 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2422 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2423 ok(pDispParams != NULL, "pDispParams == NULL\n");
2424 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2425 ok(puArgErr != NULL, "puArgErr == NULL\n");
2426 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2427 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2428 test_readyState(NULL);
2430 switch(dispIdMember) {
2431 case DISPID_AMBIENT_USERMODE:
2432 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2433 V_VT(pVarResult) = VT_BOOL;
2434 V_BOOL(pVarResult) = VARIANT_TRUE;
2436 case DISPID_AMBIENT_DLCONTROL:
2437 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2439 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2440 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2442 case DISPID_AMBIENT_SILENT:
2443 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2444 V_VT(pVarResult) = VT_BOOL;
2445 V_BOOL(pVarResult) = VARIANT_FALSE;
2447 case DISPID_AMBIENT_USERAGENT:
2448 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2450 case DISPID_AMBIENT_PALETTE:
2451 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2455 ok(0, "unexpected dispid %d\n", dispIdMember);
2459 static IDispatchVtbl DispatchVtbl = {
2460 Dispatch_QueryInterface,
2463 Dispatch_GetTypeInfoCount,
2464 Dispatch_GetTypeInfo,
2465 Dispatch_GetIDsOfNames,
2469 static IDispatch Dispatch = { &DispatchVtbl };
2471 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
2472 REFIID riid, void **ppv)
2474 return QueryInterface(riid, ppv);
2477 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
2482 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
2487 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
2488 REFIID riid, void **ppv)
2491 * Services used by HTMLDocument:
2494 * IInternetSecurityManager
2496 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2499 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2500 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2501 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2503 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2504 * IElementBehaviorFactory
2505 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2515 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
2516 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
2521 return E_NOINTERFACE;
2524 static const IServiceProviderVtbl ServiceProviderVtbl = {
2525 ServiceProvider_QueryInterface,
2526 ServiceProvider_AddRef,
2527 ServiceProvider_Release,
2528 ServiceProvider_QueryService
2531 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
2533 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2534 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2535 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2536 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
2537 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
2539 static HRESULT QueryInterface(REFIID riid, void **ppv)
2543 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
2545 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
2546 *ppv = &DocumentSite;
2547 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
2548 *ppv = &DocHostUIHandler;
2549 else if(IsEqualGUID(&IID_IOleContainer, riid))
2550 *ppv = &OleContainer;
2551 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
2552 *ppv = &InPlaceSiteEx;
2553 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
2554 *ppv = &OleCommandTarget;
2555 else if(IsEqualGUID(&IID_IDispatch, riid))
2557 else if(IsEqualGUID(&IID_IServiceProvider, riid))
2558 *ppv = &ServiceProvider;
2559 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
2560 *ppv = ipsex ? &InPlaceSiteEx : NULL;
2561 else if(IsEqualGUID(&IID_IOleControlSite, riid))
2562 *ppv = &OleControlSite;
2563 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2564 return E_NOINTERFACE; /* TODO */
2565 else if(IsEqualGUID(&IID_IProxyManager, riid))
2566 return E_NOINTERFACE; /* ? */
2567 else if(IsEqualGUID(&IID_unk1, riid))
2568 return E_NOINTERFACE; /* HTMLWindow2 ? */
2569 else if(IsEqualGUID(&IID_IThumbnailView, riid))
2570 return E_NOINTERFACE; /* ? */
2571 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
2572 return E_NOINTERFACE; /* ? */
2573 else if(IsEqualGUID(&IID_unk4, riid))
2574 return E_NOINTERFACE; /* ? */
2575 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
2576 return E_NOINTERFACE; /* ? */
2578 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
2582 return E_NOINTERFACE;
2585 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2587 return DefWindowProc(hwnd, msg, wParam, lParam);
2590 static void test_doscroll(IUnknown *unk)
2592 IHTMLDocument3 *doc;
2593 IHTMLElement2 *elem2;
2598 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
2599 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
2603 hres = IHTMLDocument3_get_documentElement(doc, &elem);
2604 IHTMLDocument3_Release(doc);
2605 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
2606 switch(load_state) {
2609 ok(!elem, "elem != NULL\n");
2612 case LD_INTERACTIVE:
2614 ok(elem != NULL, "elem == NULL\n");
2619 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2620 IHTMLElement_Release(elem);
2621 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2624 V_BSTR(&v) = a2bstr("left");
2625 hres = IHTMLElement2_doScroll(elem2, v);
2626 SysFreeString(V_BSTR(&v));
2627 IHTMLElement2_Release(elem2);
2629 if(inplace_deactivated)
2630 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
2631 else if(load_state == LD_COMPLETE)
2632 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
2634 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
2637 static void _test_readyState(unsigned line, IUnknown *unk)
2639 IHTMLDocument2 *htmldoc;
2640 DISPPARAMS dispparams;
2645 static const LPCSTR expected_state[] = {
2657 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
2658 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2662 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
2663 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
2665 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
2666 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
2668 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
2669 load_state = LD_INTERACTIVE;
2672 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
2673 wine_dbgstr_w(state), load_state);
2674 SysFreeString(state);
2676 dispparams.cArgs = 0;
2677 dispparams.cNamedArgs = 0;
2678 dispparams.rgdispidNamedArgs = NULL;
2679 dispparams.rgvarg = NULL;
2683 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
2684 &dispparams, &out, NULL, NULL);
2685 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
2687 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
2688 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
2690 test_doscroll((IUnknown*)htmldoc);
2692 IHTMLDocument2_Release(htmldoc);
2695 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
2697 IConnectionPointContainer *tmp_container = NULL;
2698 IConnectionPoint *cp;
2702 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2703 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2707 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
2708 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
2709 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
2711 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
2712 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
2714 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
2715 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
2716 ok(tmp_container == container, "container != tmp_container\n");
2718 IConnectionPointContainer_Release(tmp_container);
2720 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
2721 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
2723 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2726 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
2727 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2730 IConnectionPoint_Release(cp);
2733 static void test_ConnectionPointContainer(IUnknown *unk)
2735 IConnectionPointContainer *container;
2738 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2739 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2743 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
2744 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
2745 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
2747 IConnectionPointContainer_Release(container);
2750 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
2754 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
2756 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
2758 test_readyState((IUnknown*)persist);
2762 CreateBindCtx(0, &bind);
2763 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
2764 (IUnknown*)&ClientSite);
2767 SET_EXPECT(GetDisplayName);
2768 if(!set_clientsite) {
2769 SET_EXPECT(Invoke_AMBIENT_USERMODE);
2770 SET_EXPECT(GetHostInfo);
2771 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
2772 SET_EXPECT(Invoke_AMBIENT_SILENT);
2773 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2774 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
2775 SET_EXPECT(Invoke_AMBIENT_PALETTE);
2776 SET_EXPECT(GetOptionKeyPath);
2777 SET_EXPECT(GetOverrideKeyPath);
2778 SET_EXPECT(GetWindow);
2779 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
2780 SET_EXPECT(Exec_SETPROGRESSMAX);
2781 SET_EXPECT(Exec_SETPROGRESSPOS);
2782 SET_EXPECT(Exec_ShellDocView_37);
2784 if(!container_locked) {
2785 SET_EXPECT(GetContainer);
2786 SET_EXPECT(LockContainer);
2788 SET_EXPECT(OnChanged_READYSTATE);
2789 SET_EXPECT(Exec_ShellDocView_84);
2790 SET_EXPECT(IsSystemMoniker);
2792 SET_EXPECT(BindToStorage);
2793 SET_EXPECT(SetActiveObject);
2794 if(set_clientsite) {
2795 SET_EXPECT(Invoke_AMBIENT_SILENT);
2796 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2797 SET_EXPECT(Exec_ShellDocView_37);
2799 load_state = LD_DOLOAD;
2800 expect_LockContainer_fLock = TRUE;
2801 readystate_set_loading = TRUE;
2803 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
2804 ok(hres == S_OK, "Load failed: %08x\n", hres);
2807 CHECK_CALLED(GetDisplayName);
2808 if(!set_clientsite) {
2809 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
2810 CHECK_CALLED(GetHostInfo);
2811 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
2812 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2813 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2814 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
2815 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
2816 CHECK_CALLED(GetOptionKeyPath);
2817 CHECK_CALLED(GetOverrideKeyPath);
2818 CHECK_CALLED(GetWindow);
2819 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
2820 CHECK_CALLED(Exec_SETPROGRESSMAX);
2821 CHECK_CALLED(Exec_SETPROGRESSPOS);
2822 CHECK_CALLED(Exec_ShellDocView_37);
2824 if(!container_locked) {
2825 CHECK_CALLED(GetContainer);
2826 CHECK_CALLED(LockContainer);
2827 container_locked = TRUE;
2829 CHECK_CALLED(OnChanged_READYSTATE);
2830 SET_CALLED(IsSystemMoniker); /* IE7 */
2831 SET_CALLED(Exec_ShellDocView_84);
2833 CHECK_CALLED(BindToStorage);
2834 SET_CALLED(SetActiveObject); /* FIXME */
2835 if(set_clientsite) {
2836 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2837 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2838 CHECK_CALLED(Exec_ShellDocView_37);
2841 set_clientsite = container_locked = TRUE;
2843 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
2845 IBindCtx_Release(bind);
2847 test_readyState((IUnknown*)persist);
2850 #define DWL_VERBDONE 0x0001
2851 #define DWL_CSS 0x0002
2852 #define DWL_TRYCSS 0x0004
2853 #define DWL_HTTP 0x0008
2855 static void test_download(DWORD flags)
2860 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
2861 ok(hwnd != NULL, "Could not find hidden window\n");
2863 test_readyState(NULL);
2865 if(flags & (DWL_VERBDONE|DWL_HTTP))
2866 SET_EXPECT(Exec_SETPROGRESSMAX);
2867 if((flags & DWL_VERBDONE) && !load_from_stream)
2868 SET_EXPECT(GetHostInfo);
2869 SET_EXPECT(SetStatusText);
2870 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
2871 SET_EXPECT(GetDropTarget);
2872 if(flags & DWL_TRYCSS)
2873 SET_EXPECT(Exec_ShellDocView_84);
2874 if(flags & DWL_CSS) {
2875 SET_EXPECT(CreateInstance);
2877 SET_EXPECT(LockRequest);
2878 SET_EXPECT(Terminate);
2879 SET_EXPECT(Protocol_Read);
2880 SET_EXPECT(UnlockRequest);
2882 SET_EXPECT(Exec_Explorer_69);
2883 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
2884 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
2885 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
2886 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
2887 if(doc_mon != &Moniker) {
2888 SET_EXPECT(OnChanged_1012);
2889 SET_EXPECT(Exec_HTTPEQUIV);
2890 SET_EXPECT(Exec_SETTITLE);
2892 SET_EXPECT(OnChanged_1005);
2893 SET_EXPECT(OnChanged_READYSTATE);
2894 SET_EXPECT(Exec_SETPROGRESSPOS);
2895 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
2896 SET_EXPECT(Exec_ShellDocView_103);
2897 SET_EXPECT(Exec_ShellDocView_105);
2898 SET_EXPECT(Exec_ShellDocView_140);
2899 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2900 SET_EXPECT(Exec_HTTPEQUIV_DONE);
2901 SET_EXPECT(SetStatusText);
2902 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
2904 while(!called_Exec_HTTPEQUIV_DONE && GetMessage(&msg, NULL, 0, 0)) {
2905 TranslateMessage(&msg);
2906 DispatchMessage(&msg);
2909 if(flags & DWL_VERBDONE)
2910 CHECK_CALLED(Exec_SETPROGRESSMAX);
2911 if(flags & DWL_HTTP)
2912 SET_CALLED(Exec_SETPROGRESSMAX);
2913 if((flags & DWL_VERBDONE) && !load_from_stream)
2914 CHECK_CALLED(GetHostInfo);
2915 CHECK_CALLED(SetStatusText);
2916 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
2917 CHECK_CALLED(GetDropTarget);
2918 if(flags & DWL_TRYCSS)
2919 SET_CALLED(Exec_ShellDocView_84);
2920 if(flags & DWL_CSS) {
2921 CHECK_CALLED(CreateInstance);
2922 CHECK_CALLED(Start);
2923 CHECK_CALLED(LockRequest);
2924 CHECK_CALLED(Terminate);
2925 CHECK_CALLED(Protocol_Read);
2926 CHECK_CALLED(UnlockRequest);
2928 SET_CALLED(Exec_Explorer_69);
2929 SET_CALLED(EnableModeless_TRUE); /* IE7 */
2930 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
2931 SET_CALLED(EnableModeless_FALSE); /* IE7 */
2932 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
2933 if(doc_mon != &Moniker) todo_wine {
2934 CHECK_CALLED(OnChanged_1012);
2935 CHECK_CALLED(Exec_HTTPEQUIV);
2936 CHECK_CALLED(Exec_SETTITLE);
2938 CHECK_CALLED(OnChanged_1005);
2939 CHECK_CALLED(OnChanged_READYSTATE);
2940 CHECK_CALLED(Exec_SETPROGRESSPOS);
2941 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
2942 SET_CALLED(Exec_ShellDocView_103);
2943 SET_CALLED(Exec_ShellDocView_105);
2944 SET_CALLED(Exec_ShellDocView_140);
2945 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
2946 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
2947 SET_CALLED(SetStatusText);
2949 load_state = LD_COMPLETE;
2951 test_readyState(NULL);
2954 static void test_Persist(IUnknown *unk, IMoniker *mon)
2956 IPersistMoniker *persist_mon;
2957 IPersistFile *persist_file;
2961 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&persist_file);
2962 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
2963 if(SUCCEEDED(hres)) {
2964 hres = IPersist_GetClassID(persist_file, NULL);
2965 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
2967 hres = IPersist_GetClassID(persist_file, &guid);
2968 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
2969 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
2971 IPersist_Release(persist_file);
2974 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&persist_mon);
2975 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
2976 if(SUCCEEDED(hres)) {
2977 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
2978 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
2980 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
2981 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
2982 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
2984 if(load_state == LD_DOLOAD)
2985 test_Load(persist_mon, mon);
2987 test_readyState(unk);
2989 IPersistMoniker_Release(persist_mon);
2993 static void test_put_href(IUnknown *unk)
2995 IHTMLLocation *location;
2996 IHTMLDocument2 *doc;
3000 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3001 ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
3004 hres = IHTMLDocument2_get_location(doc, &location);
3005 IHTMLDocument2_Release(doc);
3006 ok(hres == S_OK, "get_location failed: %08x\n", hres);
3007 ok(location != NULL, "location == NULL\n");
3009 SET_EXPECT(TranslateUrl);
3010 SET_EXPECT(Navigate);
3011 str = a2bstr("about:blank");
3012 hres = IHTMLLocation_put_href(location, str);
3014 ok(hres == S_OK, "put_href failed: %08x\n", hres);
3015 CHECK_CALLED(TranslateUrl);
3016 CHECK_CALLED(Navigate);
3018 IHTMLLocation_Release(location);
3021 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
3023 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
3024 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
3025 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
3026 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
3027 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
3028 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
3029 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
3030 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
3031 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
3032 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
3033 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
3034 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
3035 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
3036 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
3037 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
3038 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
3039 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
3040 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
3041 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
3042 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
3044 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
3045 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
3047 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
3049 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
3051 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
3052 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
3054 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
3055 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
3057 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
3059 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
3060 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
3063 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3064 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
3066 IOleCommandTarget *cmdtrg;
3067 OLECMD olecmd = {cmdid, 0};
3070 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3071 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3075 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
3076 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
3078 IOleCommandTarget_Release(cmdtrg);
3080 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
3081 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
3084 static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
3089 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
3090 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
3091 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
3092 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
3093 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
3094 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
3095 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
3096 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
3097 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
3098 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
3099 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
3100 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
3101 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
3102 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
3103 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
3104 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
3107 static void test_OleCommandTarget(IUnknown *unk)
3109 IOleCommandTarget *cmdtrg;
3110 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
3114 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3115 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3119 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3120 cmds[i].cmdID = i+1;
3121 cmds[i].cmdf = 0xf0f0;
3124 SET_EXPECT(QueryStatus_OPEN);
3125 SET_EXPECT(QueryStatus_NEW);
3126 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
3127 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3128 CHECK_CALLED(QueryStatus_OPEN);
3129 CHECK_CALLED(QueryStatus_NEW);
3131 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3132 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
3133 if(i+1 == OLECMDID_FIND)
3135 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
3136 i+1, cmds[i].cmdf, expect_cmds[i+1]);
3139 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
3140 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
3142 IOleCommandTarget_Release(cmdtrg);
3145 static void test_OleCommandTarget_fail(IUnknown *unk)
3147 IOleCommandTarget *cmdtrg;
3152 {OLECMDID_OPEN, 0xf0f0},
3153 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
3156 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3157 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
3161 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
3162 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3164 SET_EXPECT(QueryStatus_OPEN);
3165 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
3166 CHECK_CALLED(QueryStatus_OPEN);
3168 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3169 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3170 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
3171 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
3172 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
3173 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
3174 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
3176 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
3177 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
3178 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
3180 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3181 if(!expect_cmds[i]) {
3182 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
3183 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3184 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3185 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3189 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
3190 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3191 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3192 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3194 IOleCommandTarget_Release(cmdtrg);
3197 static void test_exec_onunload(IUnknown *unk)
3199 IOleCommandTarget *cmdtrg;
3203 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3204 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3208 memset(&var, 0x0a, sizeof(var));
3209 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3210 OLECMDEXECOPT_DODEFAULT, NULL, &var);
3211 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3212 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
3213 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
3215 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3216 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3217 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3219 IOleCommandTarget_Release(cmdtrg);
3222 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
3224 IOleCommandTarget *cmdtrg;
3227 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3228 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3235 load_state = LD_DOLOAD;
3238 SET_EXPECT(GetClassID);
3239 SET_EXPECT(SetStatusText);
3240 SET_EXPECT(Exec_ShellDocView_37);
3241 SET_EXPECT(GetHostInfo);
3243 SET_EXPECT(GetDisplayName);
3244 SET_EXPECT(Invoke_AMBIENT_SILENT);
3245 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3246 SET_EXPECT(OnChanged_READYSTATE);
3247 SET_EXPECT(IsSystemMoniker);
3248 SET_EXPECT(Exec_ShellDocView_84);
3250 SET_EXPECT(BindToStorage);
3251 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3254 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3256 expect_status_text = NULL;
3257 readystate_set_loading = TRUE;
3259 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3260 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3261 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3264 CHECK_CALLED(GetClassID);
3265 CHECK_CALLED(SetStatusText);
3266 CHECK_CALLED(Exec_ShellDocView_37);
3267 CHECK_CALLED(GetHostInfo);
3269 CHECK_CALLED(GetDisplayName);
3270 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3271 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3272 CHECK_CALLED(OnChanged_READYSTATE);
3273 SET_CALLED(IsSystemMoniker); /* IE7 */
3274 SET_CALLED(Exec_ShellDocView_84);
3276 CHECK_CALLED(BindToStorage);
3277 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3278 CHECK_CALLED(HideUI);
3279 CHECK_CALLED(ShowUI);
3280 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3282 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
3284 IOleCommandTarget_Release(cmdtrg);
3286 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3287 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3288 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3291 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
3293 IOleCommandTarget *cmdtrg;
3294 VARIANT *in = NULL, _in, *out = NULL, _out;
3297 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3298 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
3305 V_BSTR(in) = SysAllocString(name);
3311 V_I4(out) = 0xdeadbeef;
3314 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
3315 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
3321 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
3322 if(V_VT(out) == VT_BSTR) {
3324 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
3325 "unexpected fontname %s\n", wine_dbgstr_w(name));
3327 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
3332 IOleCommandTarget_Release(cmdtrg);
3335 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
3337 IOleCommandTarget *cmdtrg;
3340 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3341 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3345 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
3346 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3347 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3349 IOleCommandTarget_Release(cmdtrg);
3352 static void test_IsDirty(IUnknown *unk, HRESULT exhres)
3354 IPersistStreamInit *perinit;
3355 IPersistMoniker *permon;
3356 IPersistFile *perfile;
3359 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&perinit);
3360 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
3361 if(SUCCEEDED(hres)) {
3362 hres = IPersistStreamInit_IsDirty(perinit);
3363 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3364 IPersistStreamInit_Release(perinit);
3367 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
3368 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
3369 if(SUCCEEDED(hres)) {
3370 hres = IPersistMoniker_IsDirty(permon);
3371 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3372 IPersistMoniker_Release(permon);
3375 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&perfile);
3376 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
3377 if(SUCCEEDED(hres)) {
3378 hres = IPersistFile_IsDirty(perfile);
3379 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3380 IPersistFile_Release(perfile);
3384 static HWND create_container_window(void)
3386 static const WCHAR wszHTMLDocumentTest[] =
3387 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3388 static WNDCLASSEXW wndclass = {
3389 sizeof(WNDCLASSEXW),
3392 0, 0, NULL, NULL, NULL, NULL, NULL,
3393 wszHTMLDocumentTest,
3397 RegisterClassExW(&wndclass);
3398 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
3399 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
3400 515, 530, NULL, NULL, NULL, NULL);
3403 static void test_DoVerb(IOleObject *oleobj)
3405 RECT rect = {0,0,500,500};
3408 if(!container_locked) {
3409 SET_EXPECT(GetContainer);
3410 SET_EXPECT(LockContainer);
3412 SET_EXPECT(ActivateMe);
3413 expect_LockContainer_fLock = TRUE;
3415 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
3416 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
3418 if(!container_locked) {
3419 CHECK_CALLED(GetContainer);
3420 CHECK_CALLED(LockContainer);
3421 container_locked = TRUE;
3423 CHECK_CALLED(ActivateMe);
3426 #define CLIENTSITE_EXPECTPATH 0x00000001
3427 #define CLIENTSITE_SETNULL 0x00000002
3428 #define CLIENTSITE_DONTSET 0x00000004
3430 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
3432 IOleClientSite *clientsite;
3435 if(flags & CLIENTSITE_SETNULL) {
3436 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3437 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
3439 hres = IOleObject_SetClientSite(oleobj, NULL);
3440 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3442 set_clientsite = FALSE;
3445 if(flags & CLIENTSITE_DONTSET)
3448 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3449 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3450 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
3451 clientsite, set_clientsite ? &ClientSite : NULL);
3453 if(!set_clientsite) {
3454 SET_EXPECT(GetHostInfo);
3455 if(flags & CLIENTSITE_EXPECTPATH) {
3456 SET_EXPECT(GetOptionKeyPath);
3457 SET_EXPECT(GetOverrideKeyPath);
3459 SET_EXPECT(GetWindow);
3460 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3461 SET_EXPECT(Exec_SETPROGRESSMAX);
3462 SET_EXPECT(Exec_SETPROGRESSPOS);
3463 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3464 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3465 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3466 SET_EXPECT(Invoke_AMBIENT_SILENT);
3467 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3468 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3470 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3471 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3473 CHECK_CALLED(GetHostInfo);
3474 if(flags & CLIENTSITE_EXPECTPATH) {
3475 CHECK_CALLED(GetOptionKeyPath);
3476 CHECK_CALLED(GetOverrideKeyPath);
3478 CHECK_CALLED(GetWindow);
3479 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3480 CHECK_CALLED(Exec_SETPROGRESSMAX);
3481 CHECK_CALLED(Exec_SETPROGRESSPOS);
3482 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3483 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3484 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3485 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3486 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3487 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3489 set_clientsite = TRUE;
3492 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3493 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3495 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3496 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3497 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
3500 static void test_OnAmbientPropertyChange(IUnknown *unk)
3502 IOleControl *control = NULL;
3505 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3506 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3510 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3511 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
3512 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3513 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3515 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3516 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
3517 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3518 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3520 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3521 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3522 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
3523 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3524 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3525 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3527 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3528 SET_EXPECT(Invoke_AMBIENT_SILENT);
3529 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
3530 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3531 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3532 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3534 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3535 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
3536 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3537 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3539 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3540 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3541 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3542 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3544 IOleControl_Release(control);
3549 static void test_OnAmbientPropertyChange2(IUnknown *unk)
3551 IOleControl *control = NULL;
3554 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3555 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3559 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3560 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
3562 IOleControl_Release(control);
3565 static void test_Close(IUnknown *unk, BOOL set_client)
3567 IOleObject *oleobj = NULL;
3570 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3571 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3575 SET_EXPECT(GetContainer);
3576 SET_EXPECT(LockContainer);
3577 expect_LockContainer_fLock = FALSE;
3578 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
3579 ok(hres == S_OK, "Close failed: %08x\n", hres);
3580 CHECK_CALLED(GetContainer);
3581 CHECK_CALLED(LockContainer);
3582 container_locked = FALSE;
3585 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
3587 IOleObject_Release(oleobj);
3590 static void test_OnFrameWindowActivate(IUnknown *unk)
3592 IOleInPlaceActiveObject *inplaceact;
3595 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
3596 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
3600 if(set_clientsite) {
3601 expect_OnFrameWindowActivate_fActivate = TRUE;
3602 SET_EXPECT(OnFrameWindowActivate);
3603 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3604 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3605 CHECK_CALLED(OnFrameWindowActivate);
3607 SET_EXPECT(OnFrameWindowActivate);
3608 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3609 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3610 CHECK_CALLED(OnFrameWindowActivate);
3612 expect_OnFrameWindowActivate_fActivate = FALSE;
3613 SET_EXPECT(OnFrameWindowActivate);
3614 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3615 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3616 CHECK_CALLED(OnFrameWindowActivate);
3618 expect_OnFrameWindowActivate_fActivate = TRUE;
3619 SET_EXPECT(OnFrameWindowActivate);
3620 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3621 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3622 CHECK_CALLED(OnFrameWindowActivate);
3624 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3625 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3627 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3628 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3631 IOleInPlaceActiveObject_Release(inplaceact);
3634 static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
3636 IOleInPlaceObjectWindowless *windowlessobj = NULL;
3639 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObjectWindowless,
3640 (void**)&windowlessobj);
3641 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
3646 SET_EXPECT(OnFocus_FALSE);
3648 SET_EXPECT(OnInPlaceDeactivateEx);
3650 SET_EXPECT(OnInPlaceDeactivate);
3652 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
3653 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
3655 CHECK_CALLED(OnFocus_FALSE);
3657 CHECK_CALLED(OnInPlaceDeactivateEx);
3659 CHECK_CALLED(OnInPlaceDeactivate);
3662 IOleInPlaceObjectWindowless_Release(windowlessobj);
3665 static void test_Activate(IUnknown *unk, DWORD flags)
3667 IOleObject *oleobj = NULL;
3668 IOleDocumentView *docview;
3675 IOleDocumentView_Release(view);
3678 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3679 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3681 hres = IOleObject_GetUserClassID(oleobj, NULL);
3682 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
3684 hres = IOleObject_GetUserClassID(oleobj, &guid);
3685 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
3686 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
3688 test_OnFrameWindowActivate(unk);
3690 test_ClientSite(oleobj, flags);
3691 test_InPlaceDeactivate(unk, FALSE);
3692 test_DoVerb(oleobj);
3694 if(call_UIActivate == CallUIActivate_AfterShow) {
3695 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
3696 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
3698 SET_EXPECT(OnFocus_TRUE);
3699 SET_EXPECT(SetActiveObject);
3701 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3702 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3703 expect_status_text = NULL;
3705 hres = IOleDocumentView_UIActivate(docview, TRUE);
3706 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
3708 CHECK_CALLED(OnFocus_TRUE);
3709 CHECK_CALLED(SetActiveObject);
3710 CHECK_CALLED(ShowUI);
3711 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3712 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3714 IOleDocumentView_Release(docview);
3717 IOleObject_Release(oleobj);
3719 test_OnFrameWindowActivate(unk);
3722 static void test_Window(IUnknown *unk, BOOL expect_success)
3724 IOleInPlaceActiveObject *activeobject = NULL;
3728 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
3729 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
3733 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
3735 if(expect_success) {
3736 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
3737 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
3739 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
3740 ok(IsWindow(hwnd), "hwnd is destroyed\n");
3743 IOleInPlaceActiveObject_Release(activeobject);
3746 static void test_CloseView(void)
3748 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
3754 hres = IOleDocumentView_Show(view, FALSE);
3755 ok(hres == S_OK, "Show failed: %08x\n", hres);
3757 hres = IOleDocumentView_CloseView(view, 0);
3758 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
3760 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
3761 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3763 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
3764 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3765 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
3768 static void test_UIDeactivate(void)
3772 if(call_UIActivate == CallUIActivate_AfterShow) {
3773 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3775 if(call_UIActivate != CallUIActivate_None) {
3776 SET_EXPECT(SetActiveObject_null);
3778 SET_EXPECT(OnUIDeactivate);
3781 hres = IOleDocumentView_UIActivate(view, FALSE);
3782 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
3784 if(call_UIActivate != CallUIActivate_None) {
3785 CHECK_CALLED(SetActiveObject_null);
3786 CHECK_CALLED(HideUI);
3787 CHECK_CALLED(OnUIDeactivate);
3789 if(call_UIActivate == CallUIActivate_AfterShow) {
3790 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3794 static void test_Hide(void)
3801 hres = IOleDocumentView_Show(view, FALSE);
3802 ok(hres == S_OK, "Show failed: %08x\n", hres);
3805 static HRESULT create_document(IUnknown **unk)
3807 IHTMLDocument5 *doc5;
3810 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3811 &IID_IUnknown, (void**)unk);
3812 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3816 hres = IUnknown_QueryInterface(*unk, &IID_IHTMLDocument5, (void**)&doc5);
3817 if(SUCCEEDED(hres)) {
3818 IHTMLDocument5_Release(doc5);
3820 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3821 IUnknown_Release(*unk);
3827 static void test_Navigate(IUnknown *unk)
3829 IHlinkTarget *hlink;
3832 hres = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&hlink);
3833 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
3835 SET_EXPECT(ActivateMe);
3836 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
3837 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
3838 CHECK_CALLED(ActivateMe);
3840 IHlinkTarget_Release(hlink);
3843 static void test_external(IUnknown *unk, BOOL initialized)
3845 IDispatch *external;
3846 IHTMLDocument2 *doc;
3847 IHTMLWindow2 *htmlwin;
3850 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3851 ok(hres == S_OK, "QueryInterface(IID_IHTMLWindow2) failed: %08x\n", hres);
3853 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
3854 IHTMLDocument2_Release(doc);
3855 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
3858 SET_EXPECT(GetExternal);
3859 external = (void*)0xdeadbeef;
3860 hres = IHTMLWindow2_get_external(htmlwin, &external);
3862 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
3863 CHECK_CALLED(GetExternal);
3864 ok(external != NULL, "external == NULL\n");
3866 ok(hres == S_OK, "get_external failed: %08x\n", hres);
3867 ok(external == NULL, "external != NULL\n");
3870 IHTMLWindow2_Release(htmlwin);
3873 static void test_StreamLoad(IUnknown *unk)
3875 IPersistStreamInit *init;
3878 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
3879 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
3883 SET_EXPECT(Invoke_AMBIENT_SILENT);
3884 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3885 SET_EXPECT(Exec_ShellDocView_37);
3886 SET_EXPECT(OnChanged_READYSTATE);
3888 readystate_set_loading = TRUE;
3890 hres = IPersistStreamInit_Load(init, &Stream);
3891 ok(hres == S_OK, "Load failed: %08x\n", hres);
3893 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3894 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3895 CHECK_CALLED(Exec_ShellDocView_37);
3896 CHECK_CALLED(OnChanged_READYSTATE);
3899 test_timer(EXPECT_SETTITLE);
3900 test_GetCurMoniker(unk, NULL, about_blank_url);
3902 IPersistStreamInit_Release(init);
3905 static void test_QueryInterface(IUnknown *unk)
3910 static const IID IID_UndocumentedScriptIface =
3911 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
3913 qi = (void*)0xdeadbeef;
3914 hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&qi);
3915 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3916 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
3918 qi = (void*)0xdeadbeef;
3919 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&qi);
3920 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3921 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3923 qi = (void*)0xdeadbeef;
3924 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode2, (void**)&qi);
3925 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3926 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3928 qi = (void*)0xdeadbeef;
3929 hres = IUnknown_QueryInterface(unk, &IID_IPersistPropertyBag, (void**)&qi);
3930 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3931 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3933 qi = (void*)0xdeadbeef;
3934 hres = IUnknown_QueryInterface(unk, &IID_UndocumentedScriptIface, (void**)&qi);
3935 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3936 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3938 qi = (void*)0xdeadbeef;
3939 hres = IUnknown_QueryInterface(unk, &IID_IMarshal, (void**)&qi);
3940 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3941 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3944 static void init_test(enum load_state_t ls) {
3946 hwnd = last_hwnd = NULL;
3947 set_clientsite = FALSE;
3948 load_from_stream = FALSE;
3949 call_UIActivate = CallUIActivate_None;
3955 inplace_deactivated = FALSE;
3958 static void test_HTMLDocument(BOOL do_load)
3964 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
3966 init_test(do_load ? LD_DOLOAD : LD_NO);
3968 hres = create_document(&unk);
3973 test_QueryInterface(unk);
3974 test_IsDirty(unk, S_FALSE);
3975 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
3976 test_external(unk, FALSE);
3977 test_ConnectionPointContainer(unk);
3978 test_GetCurMoniker(unk, NULL, NULL);
3979 test_Persist(unk, &Moniker);
3981 test_OnAmbientPropertyChange2(unk);
3983 test_Activate(unk, CLIENTSITE_EXPECTPATH);
3986 test_download(DWL_CSS|DWL_TRYCSS);
3987 test_GetCurMoniker(unk, &Moniker, NULL);
3990 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
3991 test_OleCommandTarget_fail(unk);
3992 test_OleCommandTarget(unk);
3993 test_OnAmbientPropertyChange(unk);
3994 test_Window(unk, TRUE);
3995 test_external(unk, TRUE);
3997 test_UIDeactivate();
3998 test_OleCommandTarget(unk);
3999 test_Window(unk, TRUE);
4000 test_InPlaceDeactivate(unk, TRUE);
4002 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4003 * MSHTML. It doesn't with Wine. */
4005 test_Window(unk, FALSE);
4007 test_InPlaceDeactivate(unk, FALSE);
4009 test_Close(unk, FALSE);
4011 /* Activate HTMLDocument again */
4012 test_Activate(unk, CLIENTSITE_SETNULL);
4013 test_Window(unk, TRUE);
4014 test_OleCommandTarget(unk);
4015 test_UIDeactivate();
4016 test_InPlaceDeactivate(unk, TRUE);
4017 test_Close(unk, FALSE);
4019 /* Activate HTMLDocument again, this time without UIActivate */
4020 call_UIActivate = CallUIActivate_None;
4021 test_Activate(unk, CLIENTSITE_SETNULL);
4022 test_Window(unk, TRUE);
4024 test_UIDeactivate();
4025 test_InPlaceDeactivate(unk, TRUE);
4028 test_Close(unk, TRUE);
4029 test_OnAmbientPropertyChange2(unk);
4030 test_GetCurMoniker(unk, do_load ? &Moniker : NULL, NULL);
4033 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4034 call_UIActivate = CallUIActivate_AfterShow;
4035 test_Activate(unk, 0);
4036 test_Window(unk, TRUE);
4037 test_OleCommandTarget(unk);
4038 test_UIDeactivate();
4039 test_InPlaceDeactivate(unk, TRUE);
4040 test_Close(unk, FALSE);
4041 call_UIActivate = CallUIActivate_None;
4045 IOleDocumentView_Release(view);
4048 ok(IsWindow(hwnd), "hwnd is destroyed\n");
4050 ref = IUnknown_Release(unk);
4051 ok(ref == 0, "ref=%d, expected 0\n", ref);
4053 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
4056 static void test_HTMLDocument_hlink(void)
4062 trace("Testing HTMLDocument (hlink)...\n");
4064 init_test(LD_DOLOAD);
4067 hres = create_document(&unk);
4072 test_ConnectionPointContainer(unk);
4073 test_GetCurMoniker(unk, NULL, NULL);
4074 test_Persist(unk, &Moniker);
4077 IUnknown_Release(unk);
4081 test_download(DWL_CSS|DWL_TRYCSS);
4083 test_IsDirty(unk, S_FALSE);
4084 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4086 test_exec_onunload(unk);
4087 test_Window(unk, TRUE);
4088 test_InPlaceDeactivate(unk, TRUE);
4089 test_Close(unk, FALSE);
4090 test_IsDirty(unk, S_FALSE);
4091 test_GetCurMoniker(unk, &Moniker, NULL);
4094 IOleDocumentView_Release(view);
4097 ref = IUnknown_Release(unk);
4098 ok(ref == 0, "ref=%d, expected 0\n", ref);
4101 static void test_HTMLDocument_http(void)
4108 static const WCHAR http_urlW[] =
4109 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
4111 trace("Testing HTMLDocument (http)...\n");
4113 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
4114 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
4116 init_test(LD_DOLOAD);
4119 hres = create_document(&unk);
4124 test_ConnectionPointContainer(unk);
4125 test_GetCurMoniker(unk, NULL, NULL);
4126 test_Persist(unk, http_mon);
4129 IUnknown_Release(unk);
4133 if (winetest_interactive || ! is_ie_hardened())
4134 test_download(DWL_HTTP);
4136 win_skip("IE running in Enhanced Security Configuration\n");
4138 test_IsDirty(unk, S_FALSE);
4139 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4143 test_InPlaceDeactivate(unk, TRUE);
4144 test_Close(unk, FALSE);
4145 test_IsDirty(unk, S_FALSE);
4146 test_GetCurMoniker(unk, http_mon, NULL);
4149 IOleDocumentView_Release(view);
4152 ref = IUnknown_Release(unk);
4153 ok(!ref, "ref=%d, expected 0\n", ref);
4155 ref = IMoniker_Release(http_mon);
4156 ok(!ref, "ref=%d, expected 0\n", ref);
4159 static void test_HTMLDocument_StreamLoad(void)
4166 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4168 init_test(LD_DOLOAD);
4169 load_from_stream = TRUE;
4171 hres = create_document(&unk);
4176 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4177 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4179 test_readyState(unk);
4180 test_IsDirty(unk, S_FALSE);
4181 test_ConnectionPointContainer(unk);
4182 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4183 test_DoVerb(oleobj);
4184 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4186 IOleObject_Release(oleobj);
4188 test_GetCurMoniker(unk, NULL, NULL);
4189 test_StreamLoad(unk);
4190 test_download(DWL_VERBDONE|DWL_TRYCSS);
4191 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4193 test_UIDeactivate();
4194 test_InPlaceDeactivate(unk, TRUE);
4195 test_Close(unk, FALSE);
4196 test_IsDirty(unk, S_FALSE);
4199 IOleDocumentView_Release(view);
4204 ref = IUnknown_Release(unk);
4205 ok(ref == 0, "ref=%d, expected 0\n", ref);
4208 static void test_edit_uiactivate(IOleObject *oleobj)
4210 IOleDocumentView *docview;
4213 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
4214 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
4216 SET_EXPECT(OnFocus_TRUE);
4217 SET_EXPECT(SetActiveObject);
4219 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4220 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4221 expect_status_text = NULL;
4223 hres = IOleDocumentView_UIActivate(docview, TRUE);
4224 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
4226 CHECK_CALLED(OnFocus_TRUE);
4227 CHECK_CALLED(SetActiveObject);
4228 CHECK_CALLED(ShowUI);
4229 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4230 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4232 IOleDocumentView_Release(docview);
4235 static void test_editing_mode(BOOL do_load)
4242 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
4244 init_test(do_load ? LD_DOLOAD : LD_NO);
4245 call_UIActivate = CallUIActivate_AfterShow;
4247 hres = create_document(&unk);
4252 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4253 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4255 test_readyState(unk);
4256 test_ConnectionPointContainer(unk);
4257 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4258 test_DoVerb(oleobj);
4259 test_edit_uiactivate(oleobj);
4261 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4263 test_Persist(unk, &Moniker);
4264 stream_read = protocol_read = 0;
4265 test_exec_editmode(unk, do_load);
4266 test_UIDeactivate();
4267 call_UIActivate = CallUIActivate_None;
4268 IOleObject_Release(oleobj);
4270 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4271 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
4273 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
4274 test_timer(EXPECT_UPDATEUI);
4275 SET_CALLED(SetStatusText);
4277 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4280 test_exec_fontname(unk, NULL, wszTimesNewRoman);
4281 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
4282 test_timer(EXPECT_UPDATEUI);
4283 test_exec_fontname(unk, NULL, wszArial);
4285 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
4286 test_timer(EXPECT_UPDATEUI);
4287 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4288 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4290 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
4291 test_timer(EXPECT_UPDATEUI);
4292 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4293 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4294 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
4295 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4297 test_exec_noargs(unk, IDM_HORIZONTALLINE);
4298 test_timer(EXPECT_UPDATEUI);
4299 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
4300 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4303 test_UIDeactivate();
4304 test_InPlaceDeactivate(unk, TRUE);
4305 test_Close(unk, FALSE);
4308 IOleDocumentView_Release(view);
4312 ref = IUnknown_Release(unk);
4313 ok(ref == 0, "ref=%d, expected 0\n", ref);
4316 static void register_protocol(void)
4318 IInternetSession *session;
4321 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
4323 hres = CoInternetGetSession(0, &session, 0);
4324 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
4326 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
4327 wsz_winetest, 0, NULL, 0);
4328 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
4330 IInternetSession_Release(session);
4333 static void test_HTMLDoc_ISupportErrorInfo(void)
4337 ISupportErrorInfo *sinfo;
4340 hres = create_document(&unk);
4344 hres = IUnknown_QueryInterface(unk, &IID_ISupportErrorInfo, (void**)&sinfo);
4345 ok(hres == S_OK, "got %x\n", hres);
4346 ok(sinfo != NULL, "got %p\n", sinfo);
4349 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
4350 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
4351 IUnknown_Release(sinfo);
4354 ref = IUnknown_Release(unk);
4355 ok(ref == 0, "ref=%d, expected 0\n", ref);
4358 static void test_IPersistHistory(void)
4363 IPersistHistory *phist;
4365 hres = create_document(&unk);
4369 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&phist);
4370 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
4372 IPersistHistory_Release(phist);
4374 ref = IUnknown_Release(unk);
4375 ok(ref == 0, "ref=%d, expected 0\n", ref);
4381 container_hwnd = create_container_window();
4382 register_protocol();
4384 test_HTMLDocument_hlink();
4386 test_HTMLDocument(FALSE);
4387 test_HTMLDocument(TRUE);
4388 test_HTMLDocument_StreamLoad();
4389 test_editing_mode(FALSE);
4390 test_editing_mode(TRUE);
4391 test_HTMLDocument_http();
4393 test_HTMLDoc_ISupportErrorInfo();
4394 test_IPersistHistory();
4396 DestroyWindow(container_hwnd);