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;
2646 static const LPCSTR expected_state[] = {
2658 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
2659 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2663 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
2664 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
2666 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
2667 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
2669 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
2670 load_state = LD_INTERACTIVE;
2673 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
2674 wine_dbgstr_w(state), load_state);
2675 SysFreeString(state);
2677 hres = IHTMLDocument2_get_body(htmldoc, &elem);
2678 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
2680 IHTMLElement2 *elem2;
2683 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2684 IHTMLElement_Release(elem);
2685 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2687 hres = IHTMLElement2_get_readyState(elem2, &var);
2688 IHTMLElement2_Release(elem2);
2689 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2690 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
2691 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
2694 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
2697 dispparams.cArgs = 0;
2698 dispparams.cNamedArgs = 0;
2699 dispparams.rgdispidNamedArgs = NULL;
2700 dispparams.rgvarg = NULL;
2704 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
2705 &dispparams, &out, NULL, NULL);
2706 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
2708 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
2709 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
2711 test_doscroll((IUnknown*)htmldoc);
2713 IHTMLDocument2_Release(htmldoc);
2716 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
2718 IConnectionPointContainer *tmp_container = NULL;
2719 IConnectionPoint *cp;
2723 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2724 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2728 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
2729 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
2730 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
2732 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
2733 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
2735 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
2736 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
2737 ok(tmp_container == container, "container != tmp_container\n");
2739 IConnectionPointContainer_Release(tmp_container);
2741 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
2742 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
2744 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2747 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
2748 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2751 IConnectionPoint_Release(cp);
2754 static void test_ConnectionPointContainer(IUnknown *unk)
2756 IConnectionPointContainer *container;
2759 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2760 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2764 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
2765 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
2766 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
2768 IConnectionPointContainer_Release(container);
2771 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
2775 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
2777 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
2779 test_readyState((IUnknown*)persist);
2783 CreateBindCtx(0, &bind);
2784 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
2785 (IUnknown*)&ClientSite);
2788 SET_EXPECT(GetDisplayName);
2789 if(!set_clientsite) {
2790 SET_EXPECT(Invoke_AMBIENT_USERMODE);
2791 SET_EXPECT(GetHostInfo);
2792 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
2793 SET_EXPECT(Invoke_AMBIENT_SILENT);
2794 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2795 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
2796 SET_EXPECT(Invoke_AMBIENT_PALETTE);
2797 SET_EXPECT(GetOptionKeyPath);
2798 SET_EXPECT(GetOverrideKeyPath);
2799 SET_EXPECT(GetWindow);
2800 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
2801 SET_EXPECT(Exec_SETPROGRESSMAX);
2802 SET_EXPECT(Exec_SETPROGRESSPOS);
2803 SET_EXPECT(Exec_ShellDocView_37);
2805 if(!container_locked) {
2806 SET_EXPECT(GetContainer);
2807 SET_EXPECT(LockContainer);
2809 SET_EXPECT(OnChanged_READYSTATE);
2810 SET_EXPECT(Exec_ShellDocView_84);
2811 SET_EXPECT(IsSystemMoniker);
2813 SET_EXPECT(BindToStorage);
2814 SET_EXPECT(SetActiveObject);
2815 if(set_clientsite) {
2816 SET_EXPECT(Invoke_AMBIENT_SILENT);
2817 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2818 SET_EXPECT(Exec_ShellDocView_37);
2820 load_state = LD_DOLOAD;
2821 expect_LockContainer_fLock = TRUE;
2822 readystate_set_loading = TRUE;
2824 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
2825 ok(hres == S_OK, "Load failed: %08x\n", hres);
2828 CHECK_CALLED(GetDisplayName);
2829 if(!set_clientsite) {
2830 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
2831 CHECK_CALLED(GetHostInfo);
2832 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
2833 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2834 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2835 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
2836 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
2837 CHECK_CALLED(GetOptionKeyPath);
2838 CHECK_CALLED(GetOverrideKeyPath);
2839 CHECK_CALLED(GetWindow);
2840 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
2841 CHECK_CALLED(Exec_SETPROGRESSMAX);
2842 CHECK_CALLED(Exec_SETPROGRESSPOS);
2843 CHECK_CALLED(Exec_ShellDocView_37);
2845 if(!container_locked) {
2846 CHECK_CALLED(GetContainer);
2847 CHECK_CALLED(LockContainer);
2848 container_locked = TRUE;
2850 CHECK_CALLED(OnChanged_READYSTATE);
2851 SET_CALLED(IsSystemMoniker); /* IE7 */
2852 SET_CALLED(Exec_ShellDocView_84);
2854 CHECK_CALLED(BindToStorage);
2855 SET_CALLED(SetActiveObject); /* FIXME */
2856 if(set_clientsite) {
2857 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2858 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2859 CHECK_CALLED(Exec_ShellDocView_37);
2862 set_clientsite = container_locked = TRUE;
2864 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
2866 IBindCtx_Release(bind);
2868 test_readyState((IUnknown*)persist);
2871 #define DWL_VERBDONE 0x0001
2872 #define DWL_CSS 0x0002
2873 #define DWL_TRYCSS 0x0004
2874 #define DWL_HTTP 0x0008
2876 static void test_download(DWORD flags)
2881 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
2882 ok(hwnd != NULL, "Could not find hidden window\n");
2884 test_readyState(NULL);
2886 if(flags & (DWL_VERBDONE|DWL_HTTP))
2887 SET_EXPECT(Exec_SETPROGRESSMAX);
2888 if((flags & DWL_VERBDONE) && !load_from_stream)
2889 SET_EXPECT(GetHostInfo);
2890 SET_EXPECT(SetStatusText);
2891 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
2892 SET_EXPECT(GetDropTarget);
2893 if(flags & DWL_TRYCSS)
2894 SET_EXPECT(Exec_ShellDocView_84);
2895 if(flags & DWL_CSS) {
2896 SET_EXPECT(CreateInstance);
2898 SET_EXPECT(LockRequest);
2899 SET_EXPECT(Terminate);
2900 SET_EXPECT(Protocol_Read);
2901 SET_EXPECT(UnlockRequest);
2903 SET_EXPECT(Exec_Explorer_69);
2904 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
2905 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
2906 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
2907 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
2908 if(doc_mon != &Moniker) {
2909 SET_EXPECT(OnChanged_1012);
2910 SET_EXPECT(Exec_HTTPEQUIV);
2911 SET_EXPECT(Exec_SETTITLE);
2913 SET_EXPECT(OnChanged_1005);
2914 SET_EXPECT(OnChanged_READYSTATE);
2915 SET_EXPECT(Exec_SETPROGRESSPOS);
2916 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
2917 SET_EXPECT(Exec_ShellDocView_103);
2918 SET_EXPECT(Exec_ShellDocView_105);
2919 SET_EXPECT(Exec_ShellDocView_140);
2920 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2921 SET_EXPECT(Exec_HTTPEQUIV_DONE);
2922 SET_EXPECT(SetStatusText);
2923 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
2925 while(!called_Exec_HTTPEQUIV_DONE && GetMessage(&msg, NULL, 0, 0)) {
2926 TranslateMessage(&msg);
2927 DispatchMessage(&msg);
2930 if(flags & DWL_VERBDONE)
2931 CHECK_CALLED(Exec_SETPROGRESSMAX);
2932 if(flags & DWL_HTTP)
2933 SET_CALLED(Exec_SETPROGRESSMAX);
2934 if((flags & DWL_VERBDONE) && !load_from_stream)
2935 CHECK_CALLED(GetHostInfo);
2936 CHECK_CALLED(SetStatusText);
2937 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
2938 CHECK_CALLED(GetDropTarget);
2939 if(flags & DWL_TRYCSS)
2940 SET_CALLED(Exec_ShellDocView_84);
2941 if(flags & DWL_CSS) {
2942 CHECK_CALLED(CreateInstance);
2943 CHECK_CALLED(Start);
2944 CHECK_CALLED(LockRequest);
2945 CHECK_CALLED(Terminate);
2946 CHECK_CALLED(Protocol_Read);
2947 CHECK_CALLED(UnlockRequest);
2949 SET_CALLED(Exec_Explorer_69);
2950 SET_CALLED(EnableModeless_TRUE); /* IE7 */
2951 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
2952 SET_CALLED(EnableModeless_FALSE); /* IE7 */
2953 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
2954 if(doc_mon != &Moniker) todo_wine {
2955 CHECK_CALLED(OnChanged_1012);
2956 CHECK_CALLED(Exec_HTTPEQUIV);
2957 CHECK_CALLED(Exec_SETTITLE);
2959 CHECK_CALLED(OnChanged_1005);
2960 CHECK_CALLED(OnChanged_READYSTATE);
2961 CHECK_CALLED(Exec_SETPROGRESSPOS);
2962 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
2963 SET_CALLED(Exec_ShellDocView_103);
2964 SET_CALLED(Exec_ShellDocView_105);
2965 SET_CALLED(Exec_ShellDocView_140);
2966 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
2967 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
2968 SET_CALLED(SetStatusText);
2970 load_state = LD_COMPLETE;
2972 test_readyState(NULL);
2975 static void test_Persist(IUnknown *unk, IMoniker *mon)
2977 IPersistMoniker *persist_mon;
2978 IPersistFile *persist_file;
2982 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&persist_file);
2983 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
2984 if(SUCCEEDED(hres)) {
2985 hres = IPersist_GetClassID(persist_file, NULL);
2986 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
2988 hres = IPersist_GetClassID(persist_file, &guid);
2989 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
2990 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
2992 IPersist_Release(persist_file);
2995 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&persist_mon);
2996 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
2997 if(SUCCEEDED(hres)) {
2998 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
2999 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
3001 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
3002 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
3003 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
3005 if(load_state == LD_DOLOAD)
3006 test_Load(persist_mon, mon);
3008 test_readyState(unk);
3010 IPersistMoniker_Release(persist_mon);
3014 static void test_put_href(IUnknown *unk)
3016 IHTMLLocation *location;
3017 IHTMLDocument2 *doc;
3021 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3022 ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
3025 hres = IHTMLDocument2_get_location(doc, &location);
3026 IHTMLDocument2_Release(doc);
3027 ok(hres == S_OK, "get_location failed: %08x\n", hres);
3028 ok(location != NULL, "location == NULL\n");
3030 SET_EXPECT(TranslateUrl);
3031 SET_EXPECT(Navigate);
3032 str = a2bstr("about:blank");
3033 hres = IHTMLLocation_put_href(location, str);
3035 ok(hres == S_OK, "put_href failed: %08x\n", hres);
3036 CHECK_CALLED(TranslateUrl);
3037 CHECK_CALLED(Navigate);
3039 IHTMLLocation_Release(location);
3042 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
3044 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
3045 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
3046 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
3047 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
3048 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
3049 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
3050 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
3051 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
3052 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
3053 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
3054 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
3055 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
3056 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
3057 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
3058 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
3059 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
3060 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
3061 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
3062 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
3063 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
3065 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
3066 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
3068 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
3070 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
3072 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
3073 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
3075 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
3076 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
3078 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
3080 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
3081 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
3084 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3085 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
3087 IOleCommandTarget *cmdtrg;
3088 OLECMD olecmd = {cmdid, 0};
3091 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3092 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3096 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
3097 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
3099 IOleCommandTarget_Release(cmdtrg);
3101 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
3102 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
3105 static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
3110 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
3111 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
3112 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
3113 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
3114 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
3115 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
3116 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
3117 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
3118 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
3119 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
3120 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
3121 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
3122 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
3123 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
3124 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
3125 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
3128 static void test_OleCommandTarget(IUnknown *unk)
3130 IOleCommandTarget *cmdtrg;
3131 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
3135 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3136 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3140 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3141 cmds[i].cmdID = i+1;
3142 cmds[i].cmdf = 0xf0f0;
3145 SET_EXPECT(QueryStatus_OPEN);
3146 SET_EXPECT(QueryStatus_NEW);
3147 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
3148 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3149 CHECK_CALLED(QueryStatus_OPEN);
3150 CHECK_CALLED(QueryStatus_NEW);
3152 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3153 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
3154 if(i+1 == OLECMDID_FIND)
3156 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
3157 i+1, cmds[i].cmdf, expect_cmds[i+1]);
3160 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
3161 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
3163 IOleCommandTarget_Release(cmdtrg);
3166 static void test_OleCommandTarget_fail(IUnknown *unk)
3168 IOleCommandTarget *cmdtrg;
3173 {OLECMDID_OPEN, 0xf0f0},
3174 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
3177 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3178 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
3182 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
3183 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3185 SET_EXPECT(QueryStatus_OPEN);
3186 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
3187 CHECK_CALLED(QueryStatus_OPEN);
3189 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3190 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3191 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
3192 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
3193 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
3194 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
3195 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
3197 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
3198 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
3199 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
3201 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3202 if(!expect_cmds[i]) {
3203 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
3204 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3205 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3206 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3210 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
3211 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3212 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3213 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3215 IOleCommandTarget_Release(cmdtrg);
3218 static void test_exec_onunload(IUnknown *unk)
3220 IOleCommandTarget *cmdtrg;
3224 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3225 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3229 memset(&var, 0x0a, sizeof(var));
3230 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3231 OLECMDEXECOPT_DODEFAULT, NULL, &var);
3232 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3233 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
3234 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
3236 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3237 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3238 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3240 IOleCommandTarget_Release(cmdtrg);
3243 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
3245 IOleCommandTarget *cmdtrg;
3248 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3249 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3256 load_state = LD_DOLOAD;
3259 SET_EXPECT(GetClassID);
3260 SET_EXPECT(SetStatusText);
3261 SET_EXPECT(Exec_ShellDocView_37);
3262 SET_EXPECT(GetHostInfo);
3264 SET_EXPECT(GetDisplayName);
3265 SET_EXPECT(Invoke_AMBIENT_SILENT);
3266 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3267 SET_EXPECT(OnChanged_READYSTATE);
3268 SET_EXPECT(IsSystemMoniker);
3269 SET_EXPECT(Exec_ShellDocView_84);
3271 SET_EXPECT(BindToStorage);
3272 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3275 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3277 expect_status_text = NULL;
3278 readystate_set_loading = TRUE;
3280 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3281 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3282 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3285 CHECK_CALLED(GetClassID);
3286 CHECK_CALLED(SetStatusText);
3287 CHECK_CALLED(Exec_ShellDocView_37);
3288 CHECK_CALLED(GetHostInfo);
3290 CHECK_CALLED(GetDisplayName);
3291 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3292 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3293 CHECK_CALLED(OnChanged_READYSTATE);
3294 SET_CALLED(IsSystemMoniker); /* IE7 */
3295 SET_CALLED(Exec_ShellDocView_84);
3297 CHECK_CALLED(BindToStorage);
3298 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3299 CHECK_CALLED(HideUI);
3300 CHECK_CALLED(ShowUI);
3301 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3303 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
3305 IOleCommandTarget_Release(cmdtrg);
3307 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3308 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3309 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3312 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
3314 IOleCommandTarget *cmdtrg;
3315 VARIANT *in = NULL, _in, *out = NULL, _out;
3318 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3319 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
3326 V_BSTR(in) = SysAllocString(name);
3332 V_I4(out) = 0xdeadbeef;
3335 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
3336 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
3342 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
3343 if(V_VT(out) == VT_BSTR) {
3345 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
3346 "unexpected fontname %s\n", wine_dbgstr_w(name));
3348 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
3353 IOleCommandTarget_Release(cmdtrg);
3356 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
3358 IOleCommandTarget *cmdtrg;
3361 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3362 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3366 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
3367 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3368 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3370 IOleCommandTarget_Release(cmdtrg);
3373 static void test_IsDirty(IUnknown *unk, HRESULT exhres)
3375 IPersistStreamInit *perinit;
3376 IPersistMoniker *permon;
3377 IPersistFile *perfile;
3380 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&perinit);
3381 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
3382 if(SUCCEEDED(hres)) {
3383 hres = IPersistStreamInit_IsDirty(perinit);
3384 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3385 IPersistStreamInit_Release(perinit);
3388 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
3389 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
3390 if(SUCCEEDED(hres)) {
3391 hres = IPersistMoniker_IsDirty(permon);
3392 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3393 IPersistMoniker_Release(permon);
3396 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&perfile);
3397 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
3398 if(SUCCEEDED(hres)) {
3399 hres = IPersistFile_IsDirty(perfile);
3400 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3401 IPersistFile_Release(perfile);
3405 static HWND create_container_window(void)
3407 static const WCHAR wszHTMLDocumentTest[] =
3408 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3409 static WNDCLASSEXW wndclass = {
3410 sizeof(WNDCLASSEXW),
3413 0, 0, NULL, NULL, NULL, NULL, NULL,
3414 wszHTMLDocumentTest,
3418 RegisterClassExW(&wndclass);
3419 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
3420 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
3421 515, 530, NULL, NULL, NULL, NULL);
3424 static void test_DoVerb(IOleObject *oleobj)
3426 RECT rect = {0,0,500,500};
3429 if(!container_locked) {
3430 SET_EXPECT(GetContainer);
3431 SET_EXPECT(LockContainer);
3433 SET_EXPECT(ActivateMe);
3434 expect_LockContainer_fLock = TRUE;
3436 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
3437 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
3439 if(!container_locked) {
3440 CHECK_CALLED(GetContainer);
3441 CHECK_CALLED(LockContainer);
3442 container_locked = TRUE;
3444 CHECK_CALLED(ActivateMe);
3447 #define CLIENTSITE_EXPECTPATH 0x00000001
3448 #define CLIENTSITE_SETNULL 0x00000002
3449 #define CLIENTSITE_DONTSET 0x00000004
3451 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
3453 IOleClientSite *clientsite;
3456 if(flags & CLIENTSITE_SETNULL) {
3457 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3458 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
3460 hres = IOleObject_SetClientSite(oleobj, NULL);
3461 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3463 set_clientsite = FALSE;
3466 if(flags & CLIENTSITE_DONTSET)
3469 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3470 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3471 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
3472 clientsite, set_clientsite ? &ClientSite : NULL);
3474 if(!set_clientsite) {
3475 SET_EXPECT(GetHostInfo);
3476 if(flags & CLIENTSITE_EXPECTPATH) {
3477 SET_EXPECT(GetOptionKeyPath);
3478 SET_EXPECT(GetOverrideKeyPath);
3480 SET_EXPECT(GetWindow);
3481 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3482 SET_EXPECT(Exec_SETPROGRESSMAX);
3483 SET_EXPECT(Exec_SETPROGRESSPOS);
3484 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3485 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3486 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3487 SET_EXPECT(Invoke_AMBIENT_SILENT);
3488 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3489 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3491 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3492 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3494 CHECK_CALLED(GetHostInfo);
3495 if(flags & CLIENTSITE_EXPECTPATH) {
3496 CHECK_CALLED(GetOptionKeyPath);
3497 CHECK_CALLED(GetOverrideKeyPath);
3499 CHECK_CALLED(GetWindow);
3500 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3501 CHECK_CALLED(Exec_SETPROGRESSMAX);
3502 CHECK_CALLED(Exec_SETPROGRESSPOS);
3503 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3504 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3505 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3506 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3507 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3508 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3510 set_clientsite = TRUE;
3513 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3514 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3516 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3517 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3518 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
3521 static void test_OnAmbientPropertyChange(IUnknown *unk)
3523 IOleControl *control = NULL;
3526 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3527 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3531 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3532 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
3533 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3534 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3536 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3537 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
3538 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3539 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3541 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3542 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3543 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
3544 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3545 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3546 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3548 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3549 SET_EXPECT(Invoke_AMBIENT_SILENT);
3550 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
3551 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3552 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3553 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3555 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3556 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
3557 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3558 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3560 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3561 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3562 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3563 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3565 IOleControl_Release(control);
3570 static void test_OnAmbientPropertyChange2(IUnknown *unk)
3572 IOleControl *control = NULL;
3575 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3576 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3580 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3581 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
3583 IOleControl_Release(control);
3586 static void test_Close(IUnknown *unk, BOOL set_client)
3588 IOleObject *oleobj = NULL;
3591 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3592 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3596 SET_EXPECT(GetContainer);
3597 SET_EXPECT(LockContainer);
3598 expect_LockContainer_fLock = FALSE;
3599 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
3600 ok(hres == S_OK, "Close failed: %08x\n", hres);
3601 CHECK_CALLED(GetContainer);
3602 CHECK_CALLED(LockContainer);
3603 container_locked = FALSE;
3606 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
3608 IOleObject_Release(oleobj);
3611 static void test_OnFrameWindowActivate(IUnknown *unk)
3613 IOleInPlaceActiveObject *inplaceact;
3616 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
3617 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
3621 if(set_clientsite) {
3622 expect_OnFrameWindowActivate_fActivate = TRUE;
3623 SET_EXPECT(OnFrameWindowActivate);
3624 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3625 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3626 CHECK_CALLED(OnFrameWindowActivate);
3628 SET_EXPECT(OnFrameWindowActivate);
3629 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3630 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3631 CHECK_CALLED(OnFrameWindowActivate);
3633 expect_OnFrameWindowActivate_fActivate = FALSE;
3634 SET_EXPECT(OnFrameWindowActivate);
3635 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3636 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3637 CHECK_CALLED(OnFrameWindowActivate);
3639 expect_OnFrameWindowActivate_fActivate = TRUE;
3640 SET_EXPECT(OnFrameWindowActivate);
3641 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3642 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3643 CHECK_CALLED(OnFrameWindowActivate);
3645 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3646 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3648 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3649 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3652 IOleInPlaceActiveObject_Release(inplaceact);
3655 static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
3657 IOleInPlaceObjectWindowless *windowlessobj = NULL;
3660 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObjectWindowless,
3661 (void**)&windowlessobj);
3662 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
3667 SET_EXPECT(OnFocus_FALSE);
3669 SET_EXPECT(OnInPlaceDeactivateEx);
3671 SET_EXPECT(OnInPlaceDeactivate);
3673 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
3674 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
3676 CHECK_CALLED(OnFocus_FALSE);
3678 CHECK_CALLED(OnInPlaceDeactivateEx);
3680 CHECK_CALLED(OnInPlaceDeactivate);
3683 IOleInPlaceObjectWindowless_Release(windowlessobj);
3686 static void test_Activate(IUnknown *unk, DWORD flags)
3688 IOleObject *oleobj = NULL;
3689 IOleDocumentView *docview;
3696 IOleDocumentView_Release(view);
3699 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3700 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3702 hres = IOleObject_GetUserClassID(oleobj, NULL);
3703 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
3705 hres = IOleObject_GetUserClassID(oleobj, &guid);
3706 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
3707 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
3709 test_OnFrameWindowActivate(unk);
3711 test_ClientSite(oleobj, flags);
3712 test_InPlaceDeactivate(unk, FALSE);
3713 test_DoVerb(oleobj);
3715 if(call_UIActivate == CallUIActivate_AfterShow) {
3716 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
3717 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
3719 SET_EXPECT(OnFocus_TRUE);
3720 SET_EXPECT(SetActiveObject);
3722 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3723 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3724 expect_status_text = NULL;
3726 hres = IOleDocumentView_UIActivate(docview, TRUE);
3727 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
3729 CHECK_CALLED(OnFocus_TRUE);
3730 CHECK_CALLED(SetActiveObject);
3731 CHECK_CALLED(ShowUI);
3732 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3733 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3735 IOleDocumentView_Release(docview);
3738 IOleObject_Release(oleobj);
3740 test_OnFrameWindowActivate(unk);
3743 static void test_Window(IUnknown *unk, BOOL expect_success)
3745 IOleInPlaceActiveObject *activeobject = NULL;
3749 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
3750 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
3754 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
3756 if(expect_success) {
3757 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
3758 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
3760 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
3761 ok(IsWindow(hwnd), "hwnd is destroyed\n");
3764 IOleInPlaceActiveObject_Release(activeobject);
3767 static void test_CloseView(void)
3769 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
3775 hres = IOleDocumentView_Show(view, FALSE);
3776 ok(hres == S_OK, "Show failed: %08x\n", hres);
3778 hres = IOleDocumentView_CloseView(view, 0);
3779 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
3781 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
3782 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3784 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
3785 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3786 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
3789 static void test_UIDeactivate(void)
3793 if(call_UIActivate == CallUIActivate_AfterShow) {
3794 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3796 if(call_UIActivate != CallUIActivate_None) {
3797 SET_EXPECT(SetActiveObject_null);
3799 SET_EXPECT(OnUIDeactivate);
3802 hres = IOleDocumentView_UIActivate(view, FALSE);
3803 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
3805 if(call_UIActivate != CallUIActivate_None) {
3806 CHECK_CALLED(SetActiveObject_null);
3807 CHECK_CALLED(HideUI);
3808 CHECK_CALLED(OnUIDeactivate);
3810 if(call_UIActivate == CallUIActivate_AfterShow) {
3811 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3815 static void test_Hide(void)
3822 hres = IOleDocumentView_Show(view, FALSE);
3823 ok(hres == S_OK, "Show failed: %08x\n", hres);
3826 static HRESULT create_document(IUnknown **unk)
3828 IHTMLDocument5 *doc5;
3831 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3832 &IID_IUnknown, (void**)unk);
3833 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3837 hres = IUnknown_QueryInterface(*unk, &IID_IHTMLDocument5, (void**)&doc5);
3838 if(SUCCEEDED(hres)) {
3839 IHTMLDocument5_Release(doc5);
3841 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3842 IUnknown_Release(*unk);
3848 static void test_Navigate(IUnknown *unk)
3850 IHlinkTarget *hlink;
3853 hres = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&hlink);
3854 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
3856 SET_EXPECT(ActivateMe);
3857 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
3858 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
3859 CHECK_CALLED(ActivateMe);
3861 IHlinkTarget_Release(hlink);
3864 static void test_external(IUnknown *unk, BOOL initialized)
3866 IDispatch *external;
3867 IHTMLDocument2 *doc;
3868 IHTMLWindow2 *htmlwin;
3871 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3872 ok(hres == S_OK, "QueryInterface(IID_IHTMLWindow2) failed: %08x\n", hres);
3874 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
3875 IHTMLDocument2_Release(doc);
3876 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
3879 SET_EXPECT(GetExternal);
3880 external = (void*)0xdeadbeef;
3881 hres = IHTMLWindow2_get_external(htmlwin, &external);
3883 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
3884 CHECK_CALLED(GetExternal);
3885 ok(external != NULL, "external == NULL\n");
3887 ok(hres == S_OK, "get_external failed: %08x\n", hres);
3888 ok(external == NULL, "external != NULL\n");
3891 IHTMLWindow2_Release(htmlwin);
3894 static void test_StreamLoad(IUnknown *unk)
3896 IPersistStreamInit *init;
3899 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
3900 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
3904 SET_EXPECT(Invoke_AMBIENT_SILENT);
3905 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3906 SET_EXPECT(Exec_ShellDocView_37);
3907 SET_EXPECT(OnChanged_READYSTATE);
3909 readystate_set_loading = TRUE;
3911 hres = IPersistStreamInit_Load(init, &Stream);
3912 ok(hres == S_OK, "Load failed: %08x\n", hres);
3914 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3915 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3916 CHECK_CALLED(Exec_ShellDocView_37);
3917 CHECK_CALLED(OnChanged_READYSTATE);
3920 test_timer(EXPECT_SETTITLE);
3921 test_GetCurMoniker(unk, NULL, about_blank_url);
3923 IPersistStreamInit_Release(init);
3926 static void test_QueryInterface(IUnknown *unk)
3931 static const IID IID_UndocumentedScriptIface =
3932 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
3934 qi = (void*)0xdeadbeef;
3935 hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&qi);
3936 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3937 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
3939 qi = (void*)0xdeadbeef;
3940 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&qi);
3941 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3942 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3944 qi = (void*)0xdeadbeef;
3945 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode2, (void**)&qi);
3946 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3947 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3949 qi = (void*)0xdeadbeef;
3950 hres = IUnknown_QueryInterface(unk, &IID_IPersistPropertyBag, (void**)&qi);
3951 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3952 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3954 qi = (void*)0xdeadbeef;
3955 hres = IUnknown_QueryInterface(unk, &IID_UndocumentedScriptIface, (void**)&qi);
3956 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3957 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3959 qi = (void*)0xdeadbeef;
3960 hres = IUnknown_QueryInterface(unk, &IID_IMarshal, (void**)&qi);
3961 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3962 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3965 static void init_test(enum load_state_t ls) {
3967 hwnd = last_hwnd = NULL;
3968 set_clientsite = FALSE;
3969 load_from_stream = FALSE;
3970 call_UIActivate = CallUIActivate_None;
3976 inplace_deactivated = FALSE;
3979 static void test_HTMLDocument(BOOL do_load)
3985 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
3987 init_test(do_load ? LD_DOLOAD : LD_NO);
3989 hres = create_document(&unk);
3994 test_QueryInterface(unk);
3995 test_IsDirty(unk, S_FALSE);
3996 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
3997 test_external(unk, FALSE);
3998 test_ConnectionPointContainer(unk);
3999 test_GetCurMoniker(unk, NULL, NULL);
4000 test_Persist(unk, &Moniker);
4002 test_OnAmbientPropertyChange2(unk);
4004 test_Activate(unk, CLIENTSITE_EXPECTPATH);
4007 test_download(DWL_CSS|DWL_TRYCSS);
4008 test_GetCurMoniker(unk, &Moniker, NULL);
4011 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4012 test_OleCommandTarget_fail(unk);
4013 test_OleCommandTarget(unk);
4014 test_OnAmbientPropertyChange(unk);
4015 test_Window(unk, TRUE);
4016 test_external(unk, TRUE);
4018 test_UIDeactivate();
4019 test_OleCommandTarget(unk);
4020 test_Window(unk, TRUE);
4021 test_InPlaceDeactivate(unk, TRUE);
4023 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4024 * MSHTML. It doesn't with Wine. */
4026 test_Window(unk, FALSE);
4028 test_InPlaceDeactivate(unk, FALSE);
4030 test_Close(unk, FALSE);
4032 /* Activate HTMLDocument again */
4033 test_Activate(unk, CLIENTSITE_SETNULL);
4034 test_Window(unk, TRUE);
4035 test_OleCommandTarget(unk);
4036 test_UIDeactivate();
4037 test_InPlaceDeactivate(unk, TRUE);
4038 test_Close(unk, FALSE);
4040 /* Activate HTMLDocument again, this time without UIActivate */
4041 call_UIActivate = CallUIActivate_None;
4042 test_Activate(unk, CLIENTSITE_SETNULL);
4043 test_Window(unk, TRUE);
4045 test_UIDeactivate();
4046 test_InPlaceDeactivate(unk, TRUE);
4049 test_Close(unk, TRUE);
4050 test_OnAmbientPropertyChange2(unk);
4051 test_GetCurMoniker(unk, do_load ? &Moniker : NULL, NULL);
4054 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4055 call_UIActivate = CallUIActivate_AfterShow;
4056 test_Activate(unk, 0);
4057 test_Window(unk, TRUE);
4058 test_OleCommandTarget(unk);
4059 test_UIDeactivate();
4060 test_InPlaceDeactivate(unk, TRUE);
4061 test_Close(unk, FALSE);
4062 call_UIActivate = CallUIActivate_None;
4066 IOleDocumentView_Release(view);
4069 ok(IsWindow(hwnd), "hwnd is destroyed\n");
4071 ref = IUnknown_Release(unk);
4072 ok(ref == 0, "ref=%d, expected 0\n", ref);
4074 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
4077 static void test_HTMLDocument_hlink(void)
4083 trace("Testing HTMLDocument (hlink)...\n");
4085 init_test(LD_DOLOAD);
4088 hres = create_document(&unk);
4093 test_ConnectionPointContainer(unk);
4094 test_GetCurMoniker(unk, NULL, NULL);
4095 test_Persist(unk, &Moniker);
4098 IUnknown_Release(unk);
4102 test_download(DWL_CSS|DWL_TRYCSS);
4104 test_IsDirty(unk, S_FALSE);
4105 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4107 test_exec_onunload(unk);
4108 test_Window(unk, TRUE);
4109 test_InPlaceDeactivate(unk, TRUE);
4110 test_Close(unk, FALSE);
4111 test_IsDirty(unk, S_FALSE);
4112 test_GetCurMoniker(unk, &Moniker, NULL);
4115 IOleDocumentView_Release(view);
4118 ref = IUnknown_Release(unk);
4119 ok(ref == 0, "ref=%d, expected 0\n", ref);
4122 static void test_HTMLDocument_http(void)
4129 static const WCHAR http_urlW[] =
4130 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
4132 trace("Testing HTMLDocument (http)...\n");
4134 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
4135 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
4137 init_test(LD_DOLOAD);
4140 hres = create_document(&unk);
4145 test_ConnectionPointContainer(unk);
4146 test_GetCurMoniker(unk, NULL, NULL);
4147 test_Persist(unk, http_mon);
4150 IUnknown_Release(unk);
4154 if (winetest_interactive || ! is_ie_hardened())
4155 test_download(DWL_HTTP);
4157 win_skip("IE running in Enhanced Security Configuration\n");
4159 test_IsDirty(unk, S_FALSE);
4160 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4164 test_InPlaceDeactivate(unk, TRUE);
4165 test_Close(unk, FALSE);
4166 test_IsDirty(unk, S_FALSE);
4167 test_GetCurMoniker(unk, http_mon, NULL);
4170 IOleDocumentView_Release(view);
4173 ref = IUnknown_Release(unk);
4174 ok(!ref, "ref=%d, expected 0\n", ref);
4176 ref = IMoniker_Release(http_mon);
4177 ok(!ref, "ref=%d, expected 0\n", ref);
4180 static void test_HTMLDocument_StreamLoad(void)
4187 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4189 init_test(LD_DOLOAD);
4190 load_from_stream = TRUE;
4192 hres = create_document(&unk);
4197 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4198 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4200 test_readyState(unk);
4201 test_IsDirty(unk, S_FALSE);
4202 test_ConnectionPointContainer(unk);
4203 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4204 test_DoVerb(oleobj);
4205 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4207 IOleObject_Release(oleobj);
4209 test_GetCurMoniker(unk, NULL, NULL);
4210 test_StreamLoad(unk);
4211 test_download(DWL_VERBDONE|DWL_TRYCSS);
4212 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4214 test_UIDeactivate();
4215 test_InPlaceDeactivate(unk, TRUE);
4216 test_Close(unk, FALSE);
4217 test_IsDirty(unk, S_FALSE);
4220 IOleDocumentView_Release(view);
4225 ref = IUnknown_Release(unk);
4226 ok(ref == 0, "ref=%d, expected 0\n", ref);
4229 static void test_edit_uiactivate(IOleObject *oleobj)
4231 IOleDocumentView *docview;
4234 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
4235 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
4237 SET_EXPECT(OnFocus_TRUE);
4238 SET_EXPECT(SetActiveObject);
4240 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4241 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4242 expect_status_text = NULL;
4244 hres = IOleDocumentView_UIActivate(docview, TRUE);
4245 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
4247 CHECK_CALLED(OnFocus_TRUE);
4248 CHECK_CALLED(SetActiveObject);
4249 CHECK_CALLED(ShowUI);
4250 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4251 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4253 IOleDocumentView_Release(docview);
4256 static void test_editing_mode(BOOL do_load)
4263 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
4265 init_test(do_load ? LD_DOLOAD : LD_NO);
4266 call_UIActivate = CallUIActivate_AfterShow;
4268 hres = create_document(&unk);
4273 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4274 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4276 test_readyState(unk);
4277 test_ConnectionPointContainer(unk);
4278 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4279 test_DoVerb(oleobj);
4280 test_edit_uiactivate(oleobj);
4282 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4284 test_Persist(unk, &Moniker);
4285 stream_read = protocol_read = 0;
4286 test_exec_editmode(unk, do_load);
4287 test_UIDeactivate();
4288 call_UIActivate = CallUIActivate_None;
4289 IOleObject_Release(oleobj);
4291 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4292 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
4294 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
4295 test_timer(EXPECT_UPDATEUI);
4296 SET_CALLED(SetStatusText);
4298 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4301 test_exec_fontname(unk, NULL, wszTimesNewRoman);
4302 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
4303 test_timer(EXPECT_UPDATEUI);
4304 test_exec_fontname(unk, NULL, wszArial);
4306 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
4307 test_timer(EXPECT_UPDATEUI);
4308 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4309 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4311 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
4312 test_timer(EXPECT_UPDATEUI);
4313 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4314 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4315 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
4316 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4318 test_exec_noargs(unk, IDM_HORIZONTALLINE);
4319 test_timer(EXPECT_UPDATEUI);
4320 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
4321 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4324 test_UIDeactivate();
4325 test_InPlaceDeactivate(unk, TRUE);
4326 test_Close(unk, FALSE);
4329 IOleDocumentView_Release(view);
4333 ref = IUnknown_Release(unk);
4334 ok(ref == 0, "ref=%d, expected 0\n", ref);
4337 static void register_protocol(void)
4339 IInternetSession *session;
4342 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
4344 hres = CoInternetGetSession(0, &session, 0);
4345 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
4347 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
4348 wsz_winetest, 0, NULL, 0);
4349 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
4351 IInternetSession_Release(session);
4354 static void test_HTMLDoc_ISupportErrorInfo(void)
4358 ISupportErrorInfo *sinfo;
4361 hres = create_document(&unk);
4365 hres = IUnknown_QueryInterface(unk, &IID_ISupportErrorInfo, (void**)&sinfo);
4366 ok(hres == S_OK, "got %x\n", hres);
4367 ok(sinfo != NULL, "got %p\n", sinfo);
4370 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
4371 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
4372 IUnknown_Release(sinfo);
4375 ref = IUnknown_Release(unk);
4376 ok(ref == 0, "ref=%d, expected 0\n", ref);
4379 static void test_IPersistHistory(void)
4384 IPersistHistory *phist;
4386 hres = create_document(&unk);
4390 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&phist);
4391 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
4393 IPersistHistory_Release(phist);
4395 ref = IUnknown_Release(unk);
4396 ok(ref == 0, "ref=%d, expected 0\n", ref);
4402 container_hwnd = create_container_window();
4403 register_protocol();
4405 test_HTMLDocument_hlink();
4407 test_HTMLDocument(FALSE);
4408 test_HTMLDocument(TRUE);
4409 test_HTMLDocument_StreamLoad();
4410 test_editing_mode(FALSE);
4411 test_editing_mode(TRUE);
4412 test_HTMLDocument_http();
4414 test_HTMLDoc_ISupportErrorInfo();
4415 test_IPersistHistory();
4417 DestroyWindow(container_hwnd);