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>
41 #include "mshtml_test.h"
43 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
44 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
45 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
47 #define DEFINE_EXPECT(func) \
48 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
50 #define SET_EXPECT(func) \
51 expect_ ## func = TRUE
53 #define SET_CALLED(func) \
54 called_ ## func = TRUE
56 #define CHECK_EXPECT2(func) \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 called_ ## func = TRUE; \
62 #define CHECK_EXPECT(func) \
64 CHECK_EXPECT2(func); \
65 expect_ ## func = FALSE; \
68 #define CHECK_CALLED(func) \
70 ok(called_ ## func, "expected " #func "\n"); \
71 expect_ ## func = called_ ## func = FALSE; \
74 static IOleDocumentView *view = NULL;
75 static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
77 DEFINE_EXPECT(LockContainer);
78 DEFINE_EXPECT(SetActiveObject);
79 DEFINE_EXPECT(SetActiveObject_null);
80 DEFINE_EXPECT(GetWindow);
81 DEFINE_EXPECT(CanInPlaceActivate);
82 DEFINE_EXPECT(OnInPlaceActivate);
83 DEFINE_EXPECT(OnInPlaceActivateEx);
84 DEFINE_EXPECT(OnUIActivate);
85 DEFINE_EXPECT(GetWindowContext);
86 DEFINE_EXPECT(OnUIDeactivate);
87 DEFINE_EXPECT(OnInPlaceDeactivate);
88 DEFINE_EXPECT(OnInPlaceDeactivateEx);
89 DEFINE_EXPECT(GetContainer);
90 DEFINE_EXPECT(ShowUI);
91 DEFINE_EXPECT(ActivateMe);
92 DEFINE_EXPECT(GetHostInfo);
93 DEFINE_EXPECT(HideUI);
94 DEFINE_EXPECT(GetOptionKeyPath);
95 DEFINE_EXPECT(GetOverrideKeyPath);
96 DEFINE_EXPECT(SetStatusText);
97 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
98 DEFINE_EXPECT(QueryStatus_OPEN);
99 DEFINE_EXPECT(QueryStatus_NEW);
100 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
101 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
102 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
103 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
104 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
105 DEFINE_EXPECT(Exec_ShellDocView_37);
106 DEFINE_EXPECT(Exec_ShellDocView_84);
107 DEFINE_EXPECT(Exec_ShellDocView_103);
108 DEFINE_EXPECT(Exec_ShellDocView_105);
109 DEFINE_EXPECT(Exec_ShellDocView_140);
110 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
111 DEFINE_EXPECT(Exec_SETTITLE);
112 DEFINE_EXPECT(Exec_HTTPEQUIV);
113 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
114 DEFINE_EXPECT(Exec_Explorer_69);
115 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
116 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
117 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
118 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
119 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
120 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
121 DEFINE_EXPECT(GetDropTarget);
122 DEFINE_EXPECT(UpdateUI);
123 DEFINE_EXPECT(Navigate);
124 DEFINE_EXPECT(OnFrameWindowActivate);
125 DEFINE_EXPECT(OnChanged_READYSTATE);
126 DEFINE_EXPECT(OnChanged_1005);
127 DEFINE_EXPECT(OnChanged_1012);
128 DEFINE_EXPECT(GetDisplayName);
129 DEFINE_EXPECT(BindToStorage);
130 DEFINE_EXPECT(IsSystemMoniker);
131 DEFINE_EXPECT(GetBindResult);
132 DEFINE_EXPECT(GetClassID);
133 DEFINE_EXPECT(Abort);
135 DEFINE_EXPECT(CreateInstance);
136 DEFINE_EXPECT(Start);
137 DEFINE_EXPECT(Terminate);
138 DEFINE_EXPECT(Protocol_Read);
139 DEFINE_EXPECT(LockRequest);
140 DEFINE_EXPECT(UnlockRequest);
141 DEFINE_EXPECT(OnFocus_TRUE);
142 DEFINE_EXPECT(OnFocus_FALSE);
143 DEFINE_EXPECT(RequestUIActivate);
144 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
145 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
146 DEFINE_EXPECT(GetExternal);
147 DEFINE_EXPECT(EnableModeless_TRUE);
148 DEFINE_EXPECT(EnableModeless_FALSE);
149 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
150 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
151 DEFINE_EXPECT(Frame_GetWindow);
152 DEFINE_EXPECT(TranslateUrl);
153 DEFINE_EXPECT(Advise_Close);
155 static IUnknown *doc_unk;
156 static IMoniker *doc_mon;
157 static BOOL expect_LockContainer_fLock;
158 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
159 static BOOL ipsex, ipsw;
160 static BOOL set_clientsite = FALSE, container_locked = FALSE;
161 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
162 static BOOL editmode = FALSE, show_failed;
163 static BOOL inplace_deactivated;
164 static int stream_read, protocol_read;
165 static enum load_state_t {
174 static LPCOLESTR expect_status_text = NULL;
176 static const char html_page[] =
178 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
182 static const char css_data[] = "body {color: red}";
184 static const WCHAR http_urlW[] =
185 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
187 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
188 static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
190 static HRESULT QueryInterface(REFIID riid, void **ppv);
191 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
193 #define test_readyState(u) _test_readyState(__LINE__,u)
194 static void _test_readyState(unsigned,IUnknown*);
196 static const WCHAR wszTimesNewRoman[] =
197 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
198 static const WCHAR wszArial[] =
199 {'A','r','i','a','l',0};
201 static const char *debugstr_guid(REFIID riid)
205 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
206 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
207 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
208 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
213 static int strcmp_wa(LPCWSTR strw, const char *stra)
216 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
217 return lstrcmpA(stra, buf);
220 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
224 const WCHAR *p1 = str, *p2 = sub;
225 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
226 if (!*p2) return str;
232 static BSTR a2bstr(const char *str)
237 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
238 ret = SysAllocStringLen(NULL, len);
239 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
244 static BOOL is_english(void)
246 return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
247 && PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
250 #define EXPECT_UPDATEUI 1
251 #define EXPECT_SETTITLE 2
253 static void test_timer(DWORD flags)
255 BOOL *b = &called_Exec_SETTITLE;
258 if(flags & EXPECT_UPDATEUI) {
259 SET_EXPECT(UpdateUI);
260 SET_EXPECT(Exec_UPDATECOMMANDS);
261 b = &called_UpdateUI;
263 if(flags & EXPECT_SETTITLE)
264 SET_EXPECT(Exec_SETTITLE);
266 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
267 TranslateMessage(&msg);
268 DispatchMessage(&msg);
271 if(flags & EXPECT_UPDATEUI) {
272 CHECK_CALLED(UpdateUI);
273 CHECK_CALLED(Exec_UPDATECOMMANDS);
275 if(flags & EXPECT_SETTITLE)
276 CHECK_CALLED(Exec_SETTITLE);
279 static IMoniker Moniker;
281 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
282 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, LPCWSTR exurl)
285 IPersistMoniker *permon;
286 IMoniker *mon = (void*)0xdeadbeef;
287 BSTR doc_url = (void*)0xdeadbeef;
290 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
291 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
295 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
296 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
298 hres = IHTMLDocument2_get_URL(doc, &doc_url);
299 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
301 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
302 IPersistMoniker_Release(permon);
306 BOOL exb = expect_GetDisplayName;
307 BOOL clb = called_GetDisplayName;
309 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
310 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
313 SET_EXPECT(GetDisplayName);
314 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
315 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
317 CHECK_CALLED(GetDisplayName);
318 expect_GetDisplayName = exb;
319 called_GetDisplayName = clb;
321 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
326 ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
328 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
329 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
331 ok(!lstrcmpW(url, exurl), "unexpected url\n");
332 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
336 ok(hres == E_UNEXPECTED,
337 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
338 ok(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
339 ok(!lstrcmpW(doc_url, about_blank_url), "doc_url is not about:blank\n");
342 SysFreeString(doc_url);
343 IHTMLDocument_Release(doc);
344 if(mon && mon != (void*)0xdeadbeef)
345 IMoniker_Release(mon);
348 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
350 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
354 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
359 if(IsEqualGUID(&IID_IProxyManager, riid))
360 return E_NOINTERFACE; /* TODO */
361 if(IsEqualGUID(&IID_IDispatchEx, riid))
362 return E_NOINTERFACE; /* TODO */
363 if(IsEqualGUID(&IID_External_unk, riid))
364 return E_NOINTERFACE; /* TODO */
366 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
367 return E_NOINTERFACE;
370 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
375 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
380 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
382 ok(0, "unexpected call\n");
386 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
389 ok(0, "unexpected call\n");
393 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
394 UINT cNames, LCID lcid, DISPID *rgDispId)
396 ok(0, "unexpected call\n");
400 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
401 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
402 EXCEPINFO *pExcepInfo, UINT *puArgErr)
404 ok(0, "unexpected call\n");
408 static const IDispatchVtbl ExternalVtbl = {
409 External_QueryInterface,
412 Dispatch_GetTypeInfoCount,
413 Dispatch_GetTypeInfo,
414 Dispatch_GetIDsOfNames,
418 static IDispatch External = { &ExternalVtbl };
420 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
422 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
428 return E_NOINTERFACE;
431 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
436 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
441 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
442 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
443 DWORD grfPI, HANDLE_PTR dwReserved)
449 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
450 static const WCHAR empty_str = {0};
454 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
455 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
456 ok(!grfPI, "grfPI = %x\n", grfPI);
457 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
459 memset(&bindinfo, 0, sizeof(bindinfo));
460 bindinfo.cbSize = sizeof(bindinfo);
461 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
462 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
463 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
464 "bindf = %x\n", bindf);
466 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
467 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
468 /* TODO: test stgmedData */
469 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
470 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
471 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
472 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
473 ok(bindinfo.dwOptions == 0x80000 ||
474 bindinfo.dwOptions == 0x4080000, /* win2k3 */
475 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
476 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
477 /* TODO: test dwCodePage */
478 /* TODO: test securityAttributes */
479 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
480 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
481 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
483 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
484 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
485 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
487 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
488 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
490 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
492 hres = IInternetProtocolSink_ReportData(pOIProtSink,
493 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
494 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
496 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
497 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
502 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
503 PROTOCOLDATA *pProtocolData)
505 ok(0, "unexpected call\n");
509 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
512 ok(0, "unexpected call\n");
516 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
518 CHECK_EXPECT(Terminate);
522 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
524 ok(0, "unexpected call\n");
528 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
530 ok(0, "unexpected call\n");
534 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
535 ULONG cb, ULONG *pcbRead)
537 CHECK_EXPECT2(Protocol_Read);
539 ok(pv != NULL, "pv == NULL\n");
540 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
541 ok(pcbRead != NULL, "pcbRead == NULL\n");
542 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
547 protocol_read += *pcbRead = sizeof(css_data)-1;
548 memcpy(pv, css_data, sizeof(css_data)-1);
552 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
553 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
555 ok(0, "unexpected call\n");
559 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
561 CHECK_EXPECT(LockRequest);
565 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
567 CHECK_EXPECT(UnlockRequest);
571 static const IInternetProtocolVtbl ProtocolVtbl = {
572 Protocol_QueryInterface,
583 Protocol_LockRequest,
584 Protocol_UnlockRequest
587 static IInternetProtocol Protocol = { &ProtocolVtbl };
589 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
591 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
592 ok(0, "unexpected call\n");
593 return E_NOINTERFACE;
596 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
601 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
606 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
607 REFIID riid, void **ppv)
609 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
610 return E_NOINTERFACE;
612 CHECK_EXPECT(CreateInstance);
613 ok(ppv != NULL, "ppv == NULL\n");
619 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
621 ok(0, "unexpected call\n");
625 static const IClassFactoryVtbl ClassFactoryVtbl = {
626 ClassFactory_QueryInterface,
628 ClassFactory_Release,
629 ClassFactory_CreateInstance,
630 ClassFactory_LockServer
633 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
635 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
637 ok(0, "unexpected call\n");
641 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
646 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
651 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
652 IHlinkBrowseContext *pihlbc)
654 ok(0, "unexpected call\n");
658 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
659 IHlinkBrowseContext **ppihlbc)
661 ok(0, "unexpected call\n");
665 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
666 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
670 CHECK_EXPECT(Navigate);
672 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
673 ok(pbc != NULL, "pbc == NULL\n");
674 ok(pibsc != NULL, "pubsc == NULL\n");
675 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
678 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
679 LPWSTR location = (LPWSTR)0xdeadbeef;
681 IMoniker *mon = NULL;
682 DWORD site_data = 0xdeadbeef;
684 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
686 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
687 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
689 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
690 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
691 ok(location == NULL, "location = %p\n", location);
692 ok(mon != NULL, "mon == NULL\n");
694 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
695 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
696 ok(site == NULL, "site = %p\n, expected NULL\n", site);
698 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
704 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
705 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
707 ok(0, "unexpected call\n");
711 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
712 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
714 ok(0, "unexpected call\n");
718 static const IHlinkFrameVtbl HlinkFrameVtbl = {
719 HlinkFrame_QueryInterface,
722 HlinkFrame_SetBrowseContext,
723 HlinkFrame_GetBrowseContext,
725 HlinkFrame_OnNavigate,
726 HlinkFrame_UpdateHlink
729 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
731 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
732 REFIID riid, void**ppv)
734 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
739 ok(0, "unexpected call\n");
740 return E_NOINTERFACE;
743 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
748 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
753 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
756 case DISPID_READYSTATE:
757 CHECK_EXPECT2(OnChanged_READYSTATE);
759 if(readystate_set_interactive) {
760 readystate_set_interactive = FALSE;
761 load_state = LD_INTERACTIVE;
764 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
765 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
766 ? OLECMDF_ENABLED : 0));
768 if(readystate_set_loading) {
769 readystate_set_loading = FALSE;
770 load_state = LD_LOADING;
772 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
773 test_readyState(NULL);
776 CHECK_EXPECT(OnChanged_1005);
778 test_readyState(NULL);
779 readystate_set_interactive = (load_state != LD_INTERACTIVE);
782 CHECK_EXPECT(OnChanged_1012);
791 ok(0, "unexpected id %d\n", dispID);
795 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
797 ok(0, "unexpected call\n");
801 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
802 PropertyNotifySink_QueryInterface,
803 PropertyNotifySink_AddRef,
804 PropertyNotifySink_Release,
805 PropertyNotifySink_OnChanged,
806 PropertyNotifySink_OnRequestEdit
809 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
811 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
813 ok(0, "unexpected call\n");
814 return E_NOINTERFACE;
817 static ULONG WINAPI Stream_AddRef(IStream *iface)
822 static ULONG WINAPI Stream_Release(IStream *iface)
827 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
828 ULONG cb, ULONG *pcbRead)
831 ok(pv != NULL, "pv == NULL\n");
832 ok(cb > sizeof(html_page), "cb = %d\n", cb);
833 ok(pcbRead != NULL, "pcbRead == NULL\n");
834 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
839 memcpy(pv, html_page, sizeof(html_page)-1);
840 stream_read += *pcbRead = sizeof(html_page)-1;
844 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
845 ULONG cb, ULONG *pcbWritten)
847 ok(0, "unexpected call\n");
851 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
852 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
854 ok(0, "unexpected call\n");
858 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
860 ok(0, "unexpected call\n");
864 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
865 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
867 ok(0, "unexpected call\n");
871 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
873 ok(0, "unexpected call\n");
877 static HRESULT WINAPI Stream_Revert(IStream *iface)
879 ok(0, "unexpected call\n");
883 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
884 ULARGE_INTEGER cb, DWORD dwLockType)
886 ok(0, "unexpected call\n");
890 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
891 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
893 ok(0, "unexpected call\n");
897 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
900 ok(0, "unexpected call\n");
904 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
906 ok(0, "unexpected call\n");
910 static const IStreamVtbl StreamVtbl = {
911 Stream_QueryInterface,
927 static IStream Stream = { &StreamVtbl };
929 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
931 if(IsEqualGUID(&IID_IWinInetHttpInfo, riid))
932 return E_NOINTERFACE; /* TODO */
934 if(IsEqualGUID(&IID_IWinInetInfo, riid))
935 return E_NOINTERFACE; /* TODO */
937 ok(0, "unexpected call\n");
938 return E_NOINTERFACE;
941 static ULONG WINAPI Binding_AddRef(IBinding *iface)
946 static ULONG WINAPI Binding_Release(IBinding *iface)
951 static HRESULT WINAPI Binding_Abort(IBinding *iface)
957 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
959 ok(0, "unexpected call\n");
963 static HRESULT WINAPI Binding_Resume(IBinding *iface)
965 ok(0, "unexpected call\n");
969 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
971 ok(0, "unexpected call\n");
975 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
977 ok(0, "unexpected call\n");
981 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
982 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
984 CHECK_EXPECT(GetBindResult);
988 static const IBindingVtbl BindingVtbl = {
989 Binding_QueryInterface,
997 Binding_GetBindResult
1000 static IBinding Binding = { &BindingVtbl };
1002 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1003 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1005 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1009 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1010 return E_NOINTERFACE; /* TODO */
1011 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1012 return E_NOINTERFACE; /* TODO */
1014 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1015 return E_NOINTERFACE;
1018 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1023 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1028 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1030 CHECK_EXPECT(GetClassID);
1031 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1035 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1037 ok(0, "unexpected call\n");
1041 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1043 ok(0, "unexpected call\n");
1047 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1049 ok(0, "unexpected call\n");
1053 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1055 ok(0, "unexpected call\n");
1059 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1060 REFIID riidResult, void **ppvResult)
1062 ok(0, "unexpected call\n");
1066 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1067 REFIID riid, void **ppv)
1069 IBindStatusCallback *callback = NULL;
1070 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1071 STGMEDIUM stgmedium;
1076 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1077 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1079 CHECK_EXPECT(BindToStorage);
1081 load_state = LD_LOADING;
1083 ok(pbc != NULL, "pbc == NULL\n");
1084 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1085 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1086 ok(ppv != NULL, "ppv == NULL\n");
1087 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1089 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1090 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1091 ok(callback != NULL, "callback == NULL\n");
1093 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1094 bindinfo.cbSize = sizeof(bindinfo);
1096 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1097 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1098 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1099 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1100 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1101 /* TODO: test stgmedData */
1102 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1103 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1104 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1105 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1106 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1107 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1108 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1109 /* TODO: test dwCodePage */
1110 /* TODO: test securityAttributes */
1111 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1112 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1113 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1115 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1116 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1118 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1120 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1122 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1123 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1124 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1127 stgmedium.tymed = TYMED_ISTREAM;
1128 U(stgmedium).pstm = &Stream;
1129 stgmedium.pUnkForRelease = (IUnknown*)iface;
1130 hres = IBindStatusCallback_OnDataAvailable(callback,
1131 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1132 sizeof(html_page)-1, &formatetc, &stgmedium);
1133 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1136 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1137 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1138 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1140 SET_EXPECT(GetBindResult);
1141 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1142 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1143 SET_CALLED(GetBindResult); /* IE7 */
1145 IBindStatusCallback_Release(callback);
1150 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1151 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1153 ok(0, "unexpected call\n");
1157 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1158 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1160 ok(0, "unexpected call\n");
1164 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1166 ok(0, "unexpected call\n");
1170 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1172 ok(0, "unexpected call\n");
1176 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1178 ok(0, "unexpected call\n");
1182 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1183 IMoniker *pmkNewlyRunning)
1185 ok(0, "unexpected call\n");
1189 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1190 IMoniker *pmkToLeft, FILETIME *pFileTime)
1192 ok(0, "unexpected call\n");
1196 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1198 ok(0, "unexpected call\n");
1202 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1203 IMoniker **ppmkPrefix)
1205 ok(0, "unexpected call\n");
1209 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1210 IMoniker **pmkRelPath)
1212 ok(0, "unexpected call\n");
1216 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1217 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1219 CHECK_EXPECT2(GetDisplayName);
1221 /* ok(pbc != NULL, "pbc == NULL\n"); */
1222 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1223 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1225 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1226 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1231 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1232 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1234 ok(0, "unexpected call\n");
1238 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1240 CHECK_EXPECT(IsSystemMoniker);
1244 static const IMonikerVtbl MonikerVtbl = {
1245 Moniker_QueryInterface,
1253 Moniker_BindToObject,
1254 Moniker_BindToStorage,
1256 Moniker_ComposeWith,
1261 Moniker_GetTimeOfLastChange,
1263 Moniker_CommonPrefixWith,
1264 Moniker_RelativePathTo,
1265 Moniker_GetDisplayName,
1266 Moniker_ParseDisplayName,
1267 Moniker_IsSystemMoniker
1270 static IMoniker Moniker = { &MonikerVtbl };
1272 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1274 return QueryInterface(riid, ppv);
1277 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1282 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1287 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1288 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1290 ok(0, "unexpected call\n");
1294 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1295 IEnumUnknown **ppenum)
1297 ok(0, "unexpected call\n");
1301 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1303 CHECK_EXPECT(LockContainer);
1304 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1308 static const IOleContainerVtbl OleContainerVtbl = {
1309 OleContainer_QueryInterface,
1310 OleContainer_AddRef,
1311 OleContainer_Release,
1312 OleContainer_ParseDisplayName,
1313 OleContainer_EnumObjects,
1314 OleContainer_LockContainer
1317 static IOleContainer OleContainer = { &OleContainerVtbl };
1319 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1321 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1323 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1324 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1327 return E_NOINTERFACE;
1330 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1335 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1340 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1342 CHECK_EXPECT(Frame_GetWindow);
1346 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1348 ok(0, "unexpected call\n");
1352 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1354 ok(0, "unexpected call\n");
1358 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1359 LPCBORDERWIDTHS pborderwidths)
1361 ok(0, "unexpected call\n");
1365 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1366 LPCBORDERWIDTHS pborderwidths)
1368 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1372 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1373 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1375 static const WCHAR wszHTML_Document[] =
1376 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1378 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1380 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1381 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1382 if(pActiveObject && is_english())
1383 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1386 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1387 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1389 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1393 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1394 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1396 static const WCHAR wszHTML_Document[] =
1397 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1400 CHECK_EXPECT2(SetActiveObject);
1402 if(pActiveObject && is_english())
1403 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1405 CHECK_EXPECT(SetActiveObject_null);
1407 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1408 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1414 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1415 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1417 ok(0, "unexpected call\n");
1421 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1422 HOLEMENU holemenu, HWND hwndActiveObject)
1424 ok(0, "unexpected call\n");
1428 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1430 ok(0, "unexpected call\n");
1434 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1436 CHECK_EXPECT2(SetStatusText);
1437 if(!expect_status_text)
1438 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1442 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1445 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1447 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1451 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1453 ok(0, "unexpected call\n");
1457 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1458 InPlaceFrame_QueryInterface,
1459 InPlaceFrame_AddRef,
1460 InPlaceFrame_Release,
1461 InPlaceFrame_GetWindow,
1462 InPlaceFrame_ContextSensitiveHelp,
1463 InPlaceFrame_GetBorder,
1464 InPlaceFrame_RequestBorderSpace,
1465 InPlaceFrame_SetBorderSpace,
1466 InPlaceFrame_SetActiveObject,
1467 InPlaceFrame_InsertMenus,
1468 InPlaceFrame_SetMenu,
1469 InPlaceFrame_RemoveMenus,
1470 InPlaceFrame_SetStatusText,
1471 InPlaceFrame_EnableModeless,
1472 InPlaceFrame_TranslateAccelerator
1475 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1477 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1478 InPlaceFrame_QueryInterface,
1479 InPlaceFrame_AddRef,
1480 InPlaceFrame_Release,
1481 InPlaceFrame_GetWindow,
1482 InPlaceFrame_ContextSensitiveHelp,
1483 InPlaceFrame_GetBorder,
1484 InPlaceFrame_RequestBorderSpace,
1485 InPlaceFrame_SetBorderSpace,
1486 InPlaceUIWindow_SetActiveObject,
1489 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1491 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1493 return QueryInterface(riid, ppv);
1496 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1501 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1506 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1507 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1509 CHECK_EXPECT2(GetWindow);
1510 ok(phwnd != NULL, "phwnd = NULL\n");
1511 *phwnd = container_hwnd;
1515 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1516 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1518 ok(0, "unexpected call\n");
1522 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1523 IOleInPlaceSiteWindowless *iface)
1525 CHECK_EXPECT(CanInPlaceActivate);
1529 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1530 IOleInPlaceSiteWindowless *iface)
1532 CHECK_EXPECT(OnInPlaceActivate);
1533 inplace_deactivated = FALSE;
1537 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1538 IOleInPlaceSiteWindowless *iface)
1540 CHECK_EXPECT(OnUIActivate);
1544 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1545 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1546 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1547 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1549 static const RECT rect = {0,0,500,500};
1551 CHECK_EXPECT(GetWindowContext);
1553 ok(ppFrame != NULL, "ppFrame = NULL\n");
1555 *ppFrame = &InPlaceFrame;
1556 ok(ppDoc != NULL, "ppDoc = NULL\n");
1558 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1559 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1561 memcpy(lprcPosRect, &rect, sizeof(RECT));
1562 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1564 memcpy(lprcClipRect, &rect, sizeof(RECT));
1565 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1567 lpFrameInfo->cb = sizeof(*lpFrameInfo);
1568 lpFrameInfo->fMDIApp = FALSE;
1569 lpFrameInfo->hwndFrame = container_hwnd;
1570 lpFrameInfo->haccel = NULL;
1571 lpFrameInfo->cAccelEntries = 0;
1577 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1578 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1580 ok(0, "unexpected call\n");
1584 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1585 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1587 CHECK_EXPECT(OnUIDeactivate);
1588 ok(!fUndoable, "fUndoable = TRUE\n");
1592 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1593 IOleInPlaceSiteWindowless *iface)
1595 CHECK_EXPECT(OnInPlaceDeactivate);
1596 inplace_deactivated = TRUE;
1600 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1601 IOleInPlaceSiteWindowless *iface)
1603 ok(0, "unexpected call\n");
1607 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1608 IOleInPlaceSiteWindowless *iface)
1610 ok(0, "unexpected call\n");
1614 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1615 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1617 ok(0, "unexpected call\n");
1621 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1622 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1624 CHECK_EXPECT(OnInPlaceActivateEx);
1626 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1627 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1628 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1633 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1634 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1636 CHECK_EXPECT(OnInPlaceDeactivateEx);
1638 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1643 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1644 IOleInPlaceSiteWindowless *iface)
1646 CHECK_EXPECT2(RequestUIActivate);
1650 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1651 IOleInPlaceSiteWindowless *iface)
1653 ok(0, "unexpected call\n");
1657 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1658 IOleInPlaceSiteWindowless *iface)
1660 ok(0, "unexpected call\n");
1664 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1665 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1667 ok(0, "unexpected call\n");
1671 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1672 IOleInPlaceSiteWindowless *iface)
1674 ok(0, "unexpected call\n");
1678 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
1679 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
1681 ok(0, "unexpected call\n");
1685 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
1686 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
1687 DWORD grfFlags, HDC *phDC)
1689 ok(0, "unexpected call\n");
1693 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
1694 IOleInPlaceSiteWindowless *iface, HDC hDC)
1696 ok(0, "unexpected call\n");
1700 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
1701 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
1703 ok(0, "unexpected call\n");
1707 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
1708 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
1710 ok(0, "unexpected call\n");
1714 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
1715 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
1716 LPCRECT pRectScroll, LPCRECT pRectClip)
1718 ok(0, "unexpected call\n");
1722 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
1723 IOleInPlaceSiteWindowless *iface, LPRECT prc)
1725 ok(0, "unexpected call\n");
1729 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
1730 IOleInPlaceSiteWindowless *iface, UINT msg,
1731 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
1733 ok(0, "unexpected call\n");
1737 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
1738 InPlaceSiteWindowless_QueryInterface,
1739 InPlaceSiteWindowless_AddRef,
1740 InPlaceSiteWindowless_Release,
1741 InPlaceSiteWindowless_GetWindow,
1742 InPlaceSiteWindowless_ContextSensitiveHelp,
1743 InPlaceSiteWindowless_CanInPlaceActivate,
1744 InPlaceSiteWindowless_OnInPlaceActivate,
1745 InPlaceSiteWindowless_OnUIActivate,
1746 InPlaceSiteWindowless_GetWindowContext,
1747 InPlaceSiteWindowless_Scroll,
1748 InPlaceSiteWindowless_OnUIDeactivate,
1749 InPlaceSiteWindowless_OnInPlaceDeactivate,
1750 InPlaceSiteWindowless_DiscardUndoState,
1751 InPlaceSiteWindowless_DeactivateAndUndo,
1752 InPlaceSiteWindowless_OnPosRectChange,
1753 InPlaceSiteWindowless_OnInPlaceActivateEx,
1754 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
1755 InPlaceSiteWindowless_RequestUIActivate,
1756 InPlaceSiteWindowless_CanWindowlessActivate,
1757 InPlaceSiteWindowless_GetCapture,
1758 InPlaceSiteWindowless_SetCapture,
1759 InPlaceSiteWindowless_GetFocus,
1760 InPlaceSiteWindowless_SetFocus,
1761 InPlaceSiteWindowless_GetDC,
1762 InPlaceSiteWindowless_ReleaseDC,
1763 InPlaceSiteWindowless_InvalidateRect,
1764 InPlaceSiteWindowless_InvalidateRgn,
1765 InPlaceSiteWindowless_ScrollRect,
1766 InPlaceSiteWindowless_AdjustRect,
1767 InPlaceSiteWindowless_OnDefWindowMessage
1770 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
1772 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1774 return QueryInterface(riid, ppv);
1777 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1782 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1787 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1789 ok(0, "unexpected call\n");
1793 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1796 ok(0, "unexpected call\n");
1800 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1802 CHECK_EXPECT(GetContainer);
1803 ok(ppContainer != NULL, "ppContainer = NULL\n");
1804 *ppContainer = &OleContainer;
1808 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1810 ok(0, "unexpected call\n");
1814 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1816 ok(0, "unexpected call\n");
1820 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1822 ok(0, "unexpected call\n");
1826 static const IOleClientSiteVtbl ClientSiteVtbl = {
1827 ClientSite_QueryInterface,
1830 ClientSite_SaveObject,
1831 ClientSite_GetMoniker,
1832 ClientSite_GetContainer,
1833 ClientSite_ShowObject,
1834 ClientSite_OnShowWindow,
1835 ClientSite_RequestNewObjectLayout
1838 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1840 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
1842 return QueryInterface(riid, ppv);
1845 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
1850 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
1857 CallUIActivate_None,
1858 CallUIActivate_ActivateMe,
1859 CallUIActivate_AfterShow,
1862 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
1863 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
1865 IOleDocument *document;
1868 CHECK_EXPECT(ActivateMe);
1869 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
1871 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
1872 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
1874 if(SUCCEEDED(hres)) {
1875 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
1876 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
1878 if(SUCCEEDED(hres)) {
1879 IOleInPlaceActiveObject *activeobj = NULL;
1880 IOleInPlaceSite *inplacesite = NULL;
1881 HWND tmp_hwnd = NULL;
1882 static RECT rect = {0,0,400,500};
1884 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1885 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1886 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
1887 inplacesite, &InPlaceSiteWindowless);
1889 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
1890 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
1892 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1893 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1894 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
1895 inplacesite, &InPlaceSiteWindowless);
1897 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
1898 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
1901 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1902 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1903 ok(hwnd == NULL, "hwnd=%p, expeted NULL\n", hwnd);
1906 if(call_UIActivate == CallUIActivate_ActivateMe) {
1907 SET_EXPECT(CanInPlaceActivate);
1908 SET_EXPECT(GetWindowContext);
1909 SET_EXPECT(GetWindow);
1911 SET_EXPECT(OnInPlaceActivateEx);
1913 SET_EXPECT(OnInPlaceActivate);
1914 SET_EXPECT(SetStatusText);
1915 SET_EXPECT(Exec_SETPROGRESSMAX);
1916 SET_EXPECT(Exec_SETPROGRESSPOS);
1917 SET_EXPECT(OnUIActivate);
1918 SET_EXPECT(SetActiveObject);
1920 expect_status_text = NULL;
1922 hres = IOleDocumentView_UIActivate(view, TRUE);
1923 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1925 CHECK_CALLED(CanInPlaceActivate);
1926 CHECK_CALLED(GetWindowContext);
1927 CHECK_CALLED(GetWindow);
1929 CHECK_CALLED(OnInPlaceActivateEx);
1931 CHECK_CALLED(OnInPlaceActivate);
1932 CHECK_CALLED(SetStatusText);
1933 CHECK_CALLED(Exec_SETPROGRESSMAX);
1934 CHECK_CALLED(Exec_SETPROGRESSPOS);
1935 CHECK_CALLED(OnUIActivate);
1936 CHECK_CALLED(SetActiveObject);
1937 CHECK_CALLED(ShowUI);
1940 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1941 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1942 ok(hwnd != NULL, "hwnd == NULL\n");
1944 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
1947 hres = IOleDocumentView_UIActivate(view, TRUE);
1948 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1951 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
1952 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1953 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
1957 hres = IOleDocumentView_SetRect(view, &rect);
1958 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
1960 if(call_UIActivate == CallUIActivate_ActivateMe) {
1961 hres = IOleDocumentView_Show(view, TRUE);
1962 ok(hres == S_OK, "Show failed: %08x\n", hres);
1964 SET_EXPECT(CanInPlaceActivate);
1965 SET_EXPECT(GetWindowContext);
1966 SET_EXPECT(GetWindow);
1968 SET_EXPECT(OnInPlaceActivateEx);
1970 SET_EXPECT(OnInPlaceActivate);
1971 SET_EXPECT(SetStatusText);
1972 SET_EXPECT(Exec_SETPROGRESSMAX);
1973 SET_EXPECT(Exec_SETPROGRESSPOS);
1974 SET_EXPECT(OnUIActivate);
1975 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
1977 hres = IOleDocumentView_Show(view, TRUE);
1979 win_skip("Show failed\n");
1981 IOleInPlaceActiveObject_Release(activeobj);
1982 IOleDocument_Release(document);
1986 ok(hres == S_OK, "Show failed: %08x\n", hres);
1988 CHECK_CALLED(CanInPlaceActivate);
1989 CHECK_CALLED(GetWindowContext);
1990 CHECK_CALLED(GetWindow);
1992 CHECK_CALLED(OnInPlaceActivateEx);
1994 CHECK_CALLED(OnInPlaceActivate);
1995 CHECK_CALLED(SetStatusText);
1996 CHECK_CALLED(Exec_SETPROGRESSMAX);
1997 CHECK_CALLED(Exec_SETPROGRESSPOS);
2000 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2001 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2002 ok(hwnd != NULL, "hwnd == NULL\n");
2004 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2008 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2011 IOleInPlaceActiveObject_Release(activeobj);
2014 IOleDocument_Release(document);
2020 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2021 DocumentSite_QueryInterface,
2022 DocumentSite_AddRef,
2023 DocumentSite_Release,
2024 DocumentSite_ActivateMe
2027 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2029 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2031 return QueryInterface(riid, ppv);
2034 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2039 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2044 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2046 ok(0, "unexpected call\n");
2050 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2052 ok(0, "unexpected call\n");
2056 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2058 ok(0, "unexpected call\n");
2062 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2063 POINTF *pPtfContainer, DWORD dwFlags)
2065 ok(0, "unexpected call\n");
2069 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2070 MSG *pMsg, DWORD grfModifiers)
2072 ok(0, "unexpected call\n");
2076 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2079 CHECK_EXPECT(OnFocus_TRUE);
2081 CHECK_EXPECT2(OnFocus_FALSE);
2085 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2087 ok(0, "unexpected call\n");
2091 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2092 OleControlSite_QueryInterface,
2093 OleControlSite_AddRef,
2094 OleControlSite_Release,
2095 OleControlSite_OnControlInfoChanged,
2096 OleControlSite_LockInPlaceActive,
2097 OleControlSite_GetExtendedControl,
2098 OleControlSite_TransformCoords,
2099 OleControlSite_TranslateAccelerator,
2100 OleControlSite_OnFocus,
2101 OleControlSite_ShowPropertyFrame
2104 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2106 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2108 return QueryInterface(riid, ppv);
2111 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2116 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2121 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2122 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2124 ok(0, "unexpected call\n");
2128 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2130 CHECK_EXPECT(GetHostInfo);
2131 ok(pInfo != NULL, "pInfo=NULL\n");
2133 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2134 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2135 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2136 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2137 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2138 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2139 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2140 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2145 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2146 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2147 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2149 CHECK_EXPECT(ShowUI);
2152 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2154 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2155 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2156 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2157 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2158 if (expect_InPlaceUIWindow_SetActiveObject_active)
2159 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2161 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2166 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2168 CHECK_EXPECT(HideUI);
2172 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2174 CHECK_EXPECT(UpdateUI);
2178 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2181 CHECK_EXPECT2(EnableModeless_TRUE);
2183 CHECK_EXPECT2(EnableModeless_FALSE);
2187 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2189 ok(0, "unexpected call\n");
2193 static BOOL expect_OnFrameWindowActivate_fActivate;
2194 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2196 CHECK_EXPECT2(OnFrameWindowActivate);
2197 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2201 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2202 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2204 ok(0, "unexpected call\n");
2208 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2209 const GUID *pguidCmdGroup, DWORD nCmdID)
2211 ok(0, "unexpected call\n");
2215 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2216 LPOLESTR *pchKey, DWORD dw)
2218 CHECK_EXPECT(GetOptionKeyPath);
2219 ok(pchKey != NULL, "pchKey = NULL\n");
2220 ok(!dw, "dw=%d, expected 0\n", dw);
2222 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2226 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2227 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2229 CHECK_EXPECT(GetDropTarget);
2234 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2236 CHECK_EXPECT(GetExternal);
2237 *ppDispatch = &External;
2241 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2242 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2244 CHECK_EXPECT(TranslateUrl);
2245 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2246 ok(!strcmp_wa(pchURLIn, "about:blank"), "pchURLIn = %s\n", wine_dbgstr_w(pchURLIn));
2247 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2248 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2253 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2254 IDataObject **ppPORet)
2256 ok(0, "unexpected call\n");
2260 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2261 LPOLESTR *pchKey, DWORD dw)
2263 CHECK_EXPECT(GetOverrideKeyPath);
2264 ok(pchKey != NULL, "pchKey = NULL\n");
2266 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2267 ok(!dw, "dw=%d, xepected 0\n", dw);
2271 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2272 DocHostUIHandler_QueryInterface,
2273 DocHostUIHandler_AddRef,
2274 DocHostUIHandler_Release,
2275 DocHostUIHandler_ShowContextMenu,
2276 DocHostUIHandler_GetHostInfo,
2277 DocHostUIHandler_ShowUI,
2278 DocHostUIHandler_HideUI,
2279 DocHostUIHandler_UpdateUI,
2280 DocHostUIHandler_EnableModeless,
2281 DocHostUIHandler_OnDocWindowActivate,
2282 DocHostUIHandler_OnFrameWindowActivate,
2283 DocHostUIHandler_ResizeBorder,
2284 DocHostUIHandler_TranslateAccelerator,
2285 DocHostUIHandler_GetOptionKeyPath,
2286 DocHostUIHandler_GetDropTarget,
2287 DocHostUIHandler_GetExternal,
2288 DocHostUIHandler_TranslateUrl,
2289 DocHostUIHandler_FilterDataObject,
2290 DocHostUIHandler_GetOverrideKeyPath
2293 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2295 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2296 REFIID riid, void **ppv)
2298 return QueryInterface(riid, ppv);
2301 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2306 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2311 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2312 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2314 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2315 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2316 ok(!pCmdText, "pCmdText != NULL\n");
2318 switch(prgCmds[0].cmdID) {
2319 case OLECMDID_SETPROGRESSTEXT:
2320 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2321 prgCmds[0].cmdf = OLECMDF_ENABLED;
2324 CHECK_EXPECT(QueryStatus_OPEN);
2325 prgCmds[0].cmdf = 0;
2328 CHECK_EXPECT(QueryStatus_NEW);
2329 prgCmds[0].cmdf = 0;
2332 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2338 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2339 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2341 if(!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2342 test_readyState(NULL);
2344 if(!pguidCmdGroup) {
2346 case OLECMDID_SETPROGRESSMAX:
2347 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2348 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2349 ok(pvaIn != NULL, "pvaIn == NULL\n");
2351 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2352 if(load_state == LD_NO)
2353 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2355 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2357 case OLECMDID_SETPROGRESSPOS:
2358 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2359 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2360 ok(pvaIn != NULL, "pvaIn == NULL\n");
2362 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2363 if(load_state == LD_NO)
2364 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2366 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2368 case OLECMDID_HTTPEQUIV_DONE:
2369 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2370 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2371 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2372 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2373 readystate_set_loading = FALSE;
2374 readystate_set_interactive = FALSE;
2375 load_state = LD_COMPLETE;
2377 case OLECMDID_SETDOWNLOADSTATE:
2378 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2379 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2380 ok(pvaIn != NULL, "pvaIn == NULL\n");
2381 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2383 switch(V_I4(pvaIn)) {
2385 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2386 load_state = LD_INTERACTIVE;
2389 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2390 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2393 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2397 case OLECMDID_UPDATECOMMANDS:
2398 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2399 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2400 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2401 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2403 case OLECMDID_SETTITLE:
2404 CHECK_EXPECT2(Exec_SETTITLE);
2405 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2406 ok(pvaIn != NULL, "pvaIn == NULL\n");
2407 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2408 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2409 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2411 case OLECMDID_HTTPEQUIV:
2412 CHECK_EXPECT2(Exec_HTTPEQUIV);
2413 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2414 ok(pvaIn != NULL, "pvaIn == NULL\n");
2415 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2416 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2417 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2418 test_readyState(NULL);
2421 ok(0, "unexpected command %d\n", nCmdID);
2426 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2427 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2431 CHECK_EXPECT2(Exec_ShellDocView_37);
2433 if(load_from_stream)
2434 test_GetCurMoniker(doc_unk, NULL, about_blank_url);
2436 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2438 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2439 ok(pvaIn != NULL, "pvaIn == NULL\n");
2441 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2442 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2446 CHECK_EXPECT2(Exec_ShellDocView_84);
2448 ok(pvaIn == NULL, "pvaIn != NULL\n");
2449 ok(pvaOut != NULL, "pvaOut == NULL\n");
2451 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2456 CHECK_EXPECT2(Exec_ShellDocView_103);
2458 ok(pvaIn == NULL, "pvaIn != NULL\n");
2459 ok(pvaOut == NULL, "pvaOut != NULL\n");
2464 CHECK_EXPECT2(Exec_ShellDocView_105);
2466 ok(pvaIn != NULL, "pvaIn == NULL\n");
2467 ok(pvaOut == NULL, "pvaOut != NULL\n");
2472 CHECK_EXPECT2(Exec_ShellDocView_140);
2474 ok(pvaIn == NULL, "pvaIn != NULL\n");
2475 ok(pvaOut == NULL, "pvaOut != NULL\n");
2480 ok(0, "unexpected command %d\n", nCmdID);
2485 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2486 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2489 case IDM_PARSECOMPLETE:
2490 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2491 ok(pvaIn == NULL, "pvaIn != NULL\n");
2492 ok(pvaOut == NULL, "pvaOut != NULL\n");
2495 ok(0, "unexpected command %d\n", nCmdID);
2499 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup))
2500 return E_FAIL; /* TODO */
2502 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2503 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2507 CHECK_EXPECT2(Exec_Explorer_69);
2508 ok(pvaIn == NULL, "pvaIn != NULL\n");
2509 ok(pvaOut != NULL, "pvaOut == NULL\n");
2512 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2517 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2519 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2520 SET_EXPECT(SetStatusText);
2521 ok(pvaIn == NULL, "pvaIn != NULL\n");
2522 ok(pvaOut == NULL, "pvaOut != NULL\n");
2524 case OLECMDID_SHOWSCRIPTERROR:
2528 ok(0, "unexpected command %d\n", nCmdID);
2533 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2537 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2538 OleCommandTarget_QueryInterface,
2539 OleCommandTarget_AddRef,
2540 OleCommandTarget_Release,
2541 OleCommandTarget_QueryStatus,
2542 OleCommandTarget_Exec
2545 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2547 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2549 return QueryInterface(riid, ppv);
2552 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2553 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2554 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2556 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2557 ok(pDispParams != NULL, "pDispParams == NULL\n");
2558 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2559 ok(puArgErr != NULL, "puArgErr == NULL\n");
2560 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2561 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2562 test_readyState(NULL);
2564 switch(dispIdMember) {
2565 case DISPID_AMBIENT_USERMODE:
2566 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2567 V_VT(pVarResult) = VT_BOOL;
2568 V_BOOL(pVarResult) = VARIANT_TRUE;
2570 case DISPID_AMBIENT_DLCONTROL:
2571 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2573 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2574 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2576 case DISPID_AMBIENT_SILENT:
2577 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2578 V_VT(pVarResult) = VT_BOOL;
2579 V_BOOL(pVarResult) = VARIANT_FALSE;
2581 case DISPID_AMBIENT_USERAGENT:
2582 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2584 case DISPID_AMBIENT_PALETTE:
2585 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2589 ok(0, "unexpected dispid %d\n", dispIdMember);
2593 static IDispatchVtbl DispatchVtbl = {
2594 Dispatch_QueryInterface,
2597 Dispatch_GetTypeInfoCount,
2598 Dispatch_GetTypeInfo,
2599 Dispatch_GetIDsOfNames,
2603 static IDispatch Dispatch = { &DispatchVtbl };
2605 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
2606 REFIID riid, void **ppv)
2608 return QueryInterface(riid, ppv);
2611 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
2616 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
2621 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
2622 REFIID riid, void **ppv)
2625 * Services used by HTMLDocument:
2628 * IInternetSecurityManager
2630 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2633 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2634 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2635 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2637 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2638 * IElementBehaviorFactory
2639 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2649 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
2650 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
2655 return E_NOINTERFACE;
2658 static const IServiceProviderVtbl ServiceProviderVtbl = {
2659 ServiceProvider_QueryInterface,
2660 ServiceProvider_AddRef,
2661 ServiceProvider_Release,
2662 ServiceProvider_QueryService
2665 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
2667 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface,
2668 REFIID riid, void **ppv)
2670 return QueryInterface(riid, ppv);
2673 static ULONG WINAPI AdviseSink_AddRef(IAdviseSink *iface)
2678 static ULONG WINAPI AdviseSink_Release(IAdviseSink *iface)
2683 static void WINAPI AdviseSink_OnDataChange(IAdviseSink *iface,
2684 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
2686 ok(0, "unexpected call\n");
2689 static void WINAPI AdviseSink_OnViewChange(IAdviseSink *iface,
2690 DWORD dwAspect, LONG lindex)
2692 ok(0, "unexpected call\n");
2695 static void WINAPI AdviseSink_OnRename(IAdviseSink *iface, IMoniker *pmk)
2697 ok(0, "unexpected call\n");
2700 static void WINAPI AdviseSink_OnSave(IAdviseSink *iface)
2702 ok(0, "unexpected call\n");
2705 static void WINAPI AdviseSink_OnClose(IAdviseSink *iface)
2707 CHECK_EXPECT(Advise_Close);
2710 static const IAdviseSinkVtbl AdviseSinkVtbl = {
2711 AdviseSink_QueryInterface,
2714 AdviseSink_OnDataChange,
2715 AdviseSink_OnViewChange,
2716 AdviseSink_OnRename,
2721 static IAdviseSink AdviseSink = { &AdviseSinkVtbl };
2723 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2724 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2725 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2726 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
2727 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
2729 static HRESULT QueryInterface(REFIID riid, void **ppv)
2733 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
2735 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
2736 *ppv = &DocumentSite;
2737 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
2738 *ppv = &DocHostUIHandler;
2739 else if(IsEqualGUID(&IID_IOleContainer, riid))
2740 *ppv = &OleContainer;
2741 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
2742 *ppv = &InPlaceSiteWindowless;
2743 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
2744 *ppv = &OleCommandTarget;
2745 else if(IsEqualGUID(&IID_IDispatch, riid))
2747 else if(IsEqualGUID(&IID_IServiceProvider, riid))
2748 *ppv = &ServiceProvider;
2749 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
2750 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
2751 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
2752 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
2753 else if(IsEqualGUID(&IID_IOleControlSite, riid))
2754 *ppv = &OleControlSite;
2755 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2756 return E_NOINTERFACE; /* TODO */
2757 else if(IsEqualGUID(&IID_IProxyManager, riid))
2758 return E_NOINTERFACE; /* ? */
2759 else if(IsEqualGUID(&IID_unk1, riid))
2760 return E_NOINTERFACE; /* HTMLWindow2 ? */
2761 else if(IsEqualGUID(&IID_IThumbnailView, riid))
2762 return E_NOINTERFACE; /* ? */
2763 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
2764 return E_NOINTERFACE; /* ? */
2765 else if(IsEqualGUID(&IID_unk4, riid))
2766 return E_NOINTERFACE; /* ? */
2767 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
2768 return E_NOINTERFACE; /* ? */
2770 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
2774 return E_NOINTERFACE;
2777 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2779 return DefWindowProc(hwnd, msg, wParam, lParam);
2782 static void test_doscroll(IUnknown *unk)
2784 IHTMLDocument3 *doc;
2785 IHTMLElement2 *elem2;
2790 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
2791 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
2795 hres = IHTMLDocument3_get_documentElement(doc, &elem);
2796 IHTMLDocument3_Release(doc);
2797 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
2798 switch(load_state) {
2801 ok(!elem, "elem != NULL\n");
2804 case LD_INTERACTIVE:
2806 ok(elem != NULL, "elem == NULL\n");
2811 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2812 IHTMLElement_Release(elem);
2813 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2816 V_BSTR(&v) = a2bstr("left");
2817 hres = IHTMLElement2_doScroll(elem2, v);
2818 SysFreeString(V_BSTR(&v));
2819 IHTMLElement2_Release(elem2);
2821 if(inplace_deactivated)
2822 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
2823 else if(load_state == LD_COMPLETE)
2824 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
2826 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
2829 static void _test_readyState(unsigned line, IUnknown *unk)
2831 IHTMLDocument2 *htmldoc;
2832 DISPPARAMS dispparams;
2838 static const LPCSTR expected_state[] = {
2850 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
2851 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2855 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
2856 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
2858 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
2859 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
2861 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
2862 load_state = LD_INTERACTIVE;
2865 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
2866 wine_dbgstr_w(state), load_state);
2867 SysFreeString(state);
2869 hres = IHTMLDocument2_get_body(htmldoc, &elem);
2870 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
2872 IHTMLElement2 *elem2;
2875 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2876 IHTMLElement_Release(elem);
2877 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2879 hres = IHTMLElement2_get_readyState(elem2, &var);
2880 IHTMLElement2_Release(elem2);
2881 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2882 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
2883 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
2886 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
2889 dispparams.cArgs = 0;
2890 dispparams.cNamedArgs = 0;
2891 dispparams.rgdispidNamedArgs = NULL;
2892 dispparams.rgvarg = NULL;
2896 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
2897 &dispparams, &out, NULL, NULL);
2898 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
2900 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
2901 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
2903 test_doscroll((IUnknown*)htmldoc);
2905 IHTMLDocument2_Release(htmldoc);
2908 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
2910 IConnectionPointContainer *tmp_container = NULL;
2911 IConnectionPoint *cp;
2915 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2916 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2920 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
2921 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
2922 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
2924 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
2925 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
2927 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
2928 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
2929 ok(tmp_container == container, "container != tmp_container\n");
2931 IConnectionPointContainer_Release(tmp_container);
2933 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
2934 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
2936 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2939 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
2940 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2943 IConnectionPoint_Release(cp);
2946 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
2948 IConnectionPointContainer *container;
2951 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
2952 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2956 test_ConnectionPoint(container, &IID_IDispatch);
2957 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
2958 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
2959 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
2961 IConnectionPointContainer_Release(container);
2964 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
2968 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
2970 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
2972 test_readyState((IUnknown*)persist);
2976 CreateBindCtx(0, &bind);
2977 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
2978 (IUnknown*)&ClientSite);
2981 SET_EXPECT(GetDisplayName);
2982 if(!set_clientsite) {
2983 SET_EXPECT(Invoke_AMBIENT_USERMODE);
2984 SET_EXPECT(GetHostInfo);
2985 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
2986 SET_EXPECT(Invoke_AMBIENT_SILENT);
2987 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2988 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
2989 SET_EXPECT(Invoke_AMBIENT_PALETTE);
2990 SET_EXPECT(GetOptionKeyPath);
2991 SET_EXPECT(GetOverrideKeyPath);
2992 SET_EXPECT(GetWindow);
2993 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
2994 SET_EXPECT(Exec_SETPROGRESSMAX);
2995 SET_EXPECT(Exec_SETPROGRESSPOS);
2996 SET_EXPECT(Exec_ShellDocView_37);
2998 if(!container_locked) {
2999 SET_EXPECT(GetContainer);
3000 SET_EXPECT(LockContainer);
3002 SET_EXPECT(OnChanged_READYSTATE);
3003 SET_EXPECT(Exec_ShellDocView_84);
3004 SET_EXPECT(IsSystemMoniker);
3006 SET_EXPECT(BindToStorage);
3007 SET_EXPECT(SetActiveObject);
3008 if(set_clientsite) {
3009 SET_EXPECT(Invoke_AMBIENT_SILENT);
3010 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3011 SET_EXPECT(Exec_ShellDocView_37);
3013 load_state = LD_DOLOAD;
3014 expect_LockContainer_fLock = TRUE;
3015 readystate_set_loading = TRUE;
3017 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
3018 ok(hres == S_OK, "Load failed: %08x\n", hres);
3021 CHECK_CALLED(GetDisplayName);
3022 if(!set_clientsite) {
3023 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3024 CHECK_CALLED(GetHostInfo);
3025 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3026 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3027 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3028 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3029 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3030 CHECK_CALLED(GetOptionKeyPath);
3031 CHECK_CALLED(GetOverrideKeyPath);
3032 CHECK_CALLED(GetWindow);
3033 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3034 CHECK_CALLED(Exec_SETPROGRESSMAX);
3035 CHECK_CALLED(Exec_SETPROGRESSPOS);
3036 CHECK_CALLED(Exec_ShellDocView_37);
3038 if(!container_locked) {
3039 CHECK_CALLED(GetContainer);
3040 CHECK_CALLED(LockContainer);
3041 container_locked = TRUE;
3043 CHECK_CALLED(OnChanged_READYSTATE);
3044 SET_CALLED(IsSystemMoniker); /* IE7 */
3045 SET_CALLED(Exec_ShellDocView_84);
3047 CHECK_CALLED(BindToStorage);
3048 SET_CALLED(SetActiveObject); /* FIXME */
3049 if(set_clientsite) {
3050 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3051 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3052 CHECK_CALLED(Exec_ShellDocView_37);
3055 set_clientsite = container_locked = TRUE;
3057 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
3059 IBindCtx_Release(bind);
3061 test_readyState((IUnknown*)persist);
3064 #define DWL_VERBDONE 0x0001
3065 #define DWL_CSS 0x0002
3066 #define DWL_TRYCSS 0x0004
3067 #define DWL_HTTP 0x0008
3068 #define DWL_EMPTY 0x0010
3070 static void test_download(DWORD flags)
3075 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
3076 ok(hwnd != NULL, "Could not find hidden window\n");
3078 test_readyState(NULL);
3080 if(flags & (DWL_VERBDONE|DWL_HTTP))
3081 SET_EXPECT(Exec_SETPROGRESSMAX);
3082 if((flags & DWL_VERBDONE) && !load_from_stream)
3083 SET_EXPECT(GetHostInfo);
3084 SET_EXPECT(SetStatusText);
3085 if(!(flags & DWL_EMPTY))
3086 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
3087 SET_EXPECT(GetDropTarget);
3088 if(flags & DWL_TRYCSS)
3089 SET_EXPECT(Exec_ShellDocView_84);
3090 if(flags & DWL_CSS) {
3091 SET_EXPECT(CreateInstance);
3093 SET_EXPECT(LockRequest);
3094 SET_EXPECT(Terminate);
3095 SET_EXPECT(Protocol_Read);
3096 SET_EXPECT(UnlockRequest);
3098 SET_EXPECT(Exec_Explorer_69);
3099 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
3100 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
3101 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
3102 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
3103 if(doc_mon != &Moniker) {
3104 SET_EXPECT(OnChanged_1012);
3105 SET_EXPECT(Exec_HTTPEQUIV);
3106 SET_EXPECT(Exec_SETTITLE);
3108 SET_EXPECT(OnChanged_1005);
3109 SET_EXPECT(OnChanged_READYSTATE);
3110 SET_EXPECT(Exec_SETPROGRESSPOS);
3111 if(!(flags & DWL_EMPTY))
3112 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
3113 SET_EXPECT(Exec_ShellDocView_103);
3114 SET_EXPECT(Exec_ShellDocView_105);
3115 SET_EXPECT(Exec_ShellDocView_140);
3116 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
3117 SET_EXPECT(Exec_HTTPEQUIV_DONE);
3118 SET_EXPECT(SetStatusText);
3119 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
3121 while(!called_Exec_HTTPEQUIV_DONE && GetMessage(&msg, NULL, 0, 0)) {
3122 TranslateMessage(&msg);
3123 DispatchMessage(&msg);
3126 if(flags & DWL_VERBDONE)
3127 CHECK_CALLED(Exec_SETPROGRESSMAX);
3128 if(flags & DWL_HTTP)
3129 SET_CALLED(Exec_SETPROGRESSMAX);
3130 if((flags & DWL_VERBDONE) && !load_from_stream)
3131 CHECK_CALLED(GetHostInfo);
3132 CHECK_CALLED(SetStatusText);
3133 if(!(flags & DWL_EMPTY))
3134 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
3135 CHECK_CALLED(GetDropTarget);
3136 if(flags & DWL_TRYCSS)
3137 SET_CALLED(Exec_ShellDocView_84);
3138 if(flags & DWL_CSS) {
3139 CHECK_CALLED(CreateInstance);
3140 CHECK_CALLED(Start);
3141 CHECK_CALLED(LockRequest);
3142 CHECK_CALLED(Terminate);
3143 CHECK_CALLED(Protocol_Read);
3144 CHECK_CALLED(UnlockRequest);
3146 SET_CALLED(Exec_Explorer_69);
3147 SET_CALLED(EnableModeless_TRUE); /* IE7 */
3148 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
3149 SET_CALLED(EnableModeless_FALSE); /* IE7 */
3150 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
3151 if(doc_mon != &Moniker) todo_wine {
3152 CHECK_CALLED(OnChanged_1012);
3153 CHECK_CALLED(Exec_HTTPEQUIV);
3154 CHECK_CALLED(Exec_SETTITLE);
3156 CHECK_CALLED(OnChanged_1005);
3157 CHECK_CALLED(OnChanged_READYSTATE);
3158 CHECK_CALLED(Exec_SETPROGRESSPOS);
3159 if(!(flags & DWL_EMPTY))
3160 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
3161 SET_CALLED(Exec_ShellDocView_103);
3162 SET_CALLED(Exec_ShellDocView_105);
3163 SET_CALLED(Exec_ShellDocView_140);
3164 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
3165 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
3166 SET_CALLED(SetStatusText);
3168 load_state = LD_COMPLETE;
3170 test_readyState(NULL);
3173 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
3175 IPersistMoniker *persist_mon;
3176 IPersistFile *persist_file;
3180 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
3181 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
3182 if(SUCCEEDED(hres)) {
3183 hres = IPersist_GetClassID(persist_file, NULL);
3184 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
3186 hres = IPersist_GetClassID(persist_file, &guid);
3187 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
3188 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
3190 IPersist_Release(persist_file);
3193 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
3194 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
3195 if(SUCCEEDED(hres)) {
3196 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
3197 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
3199 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
3200 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
3201 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
3203 if(load_state == LD_DOLOAD)
3204 test_Load(persist_mon, mon);
3206 test_readyState((IUnknown*)doc);
3208 IPersistMoniker_Release(persist_mon);
3212 static void test_put_href(IHTMLDocument2 *doc)
3214 IHTMLLocation *location;
3219 hres = IHTMLDocument2_get_location(doc, &location);
3220 ok(hres == S_OK, "get_location failed: %08x\n", hres);
3221 ok(location != NULL, "location == NULL\n");
3223 SET_EXPECT(TranslateUrl);
3224 SET_EXPECT(Navigate);
3225 str = a2bstr("about:blank");
3226 hres = IHTMLLocation_put_href(location, str);
3228 ok(hres == S_OK, "put_href failed: %08x\n", hres);
3229 CHECK_CALLED(TranslateUrl);
3230 CHECK_CALLED(Navigate);
3232 IHTMLLocation_Release(location);
3235 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
3237 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
3238 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
3239 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
3240 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
3241 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
3242 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
3243 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
3244 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
3245 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
3246 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
3247 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
3248 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
3249 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
3250 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
3251 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
3252 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
3253 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
3254 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
3255 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
3256 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
3258 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
3259 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
3261 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
3263 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
3265 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
3266 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
3268 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
3269 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
3271 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
3273 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
3274 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
3277 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3278 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
3280 IOleCommandTarget *cmdtrg;
3281 OLECMD olecmd = {cmdid, 0};
3284 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3285 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3289 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
3290 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
3292 IOleCommandTarget_Release(cmdtrg);
3294 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
3295 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
3298 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
3300 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
3302 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
3303 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
3304 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
3305 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
3306 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
3307 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
3308 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
3309 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
3310 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
3311 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
3312 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
3313 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
3314 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
3315 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
3316 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
3317 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
3320 static void test_OleCommandTarget(IHTMLDocument2 *doc)
3322 IOleCommandTarget *cmdtrg;
3323 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
3327 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
3328 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3332 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3333 cmds[i].cmdID = i+1;
3334 cmds[i].cmdf = 0xf0f0;
3337 SET_EXPECT(QueryStatus_OPEN);
3338 SET_EXPECT(QueryStatus_NEW);
3339 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
3340 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3341 CHECK_CALLED(QueryStatus_OPEN);
3342 CHECK_CALLED(QueryStatus_NEW);
3344 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3345 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
3346 if(i+1 == OLECMDID_FIND)
3348 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
3349 i+1, cmds[i].cmdf, expect_cmds[i+1]);
3352 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
3353 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
3355 IOleCommandTarget_Release(cmdtrg);
3358 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
3360 IOleCommandTarget *cmdtrg;
3365 {OLECMDID_OPEN, 0xf0f0},
3366 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
3369 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
3370 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
3374 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
3375 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3377 SET_EXPECT(QueryStatus_OPEN);
3378 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
3379 CHECK_CALLED(QueryStatus_OPEN);
3381 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3382 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3383 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
3384 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
3385 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
3386 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
3387 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
3389 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
3390 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
3391 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
3393 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3394 if(!expect_cmds[i]) {
3395 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
3396 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3397 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3398 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3402 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
3403 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3404 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3405 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3407 IOleCommandTarget_Release(cmdtrg);
3410 static void test_exec_onunload(IHTMLDocument2 *doc)
3412 IOleCommandTarget *cmdtrg;
3416 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
3417 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3421 memset(&var, 0x0a, sizeof(var));
3422 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3423 OLECMDEXECOPT_DODEFAULT, NULL, &var);
3424 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3425 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
3426 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
3428 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3429 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3430 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3432 IOleCommandTarget_Release(cmdtrg);
3435 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
3437 IOleCommandTarget *cmdtrg;
3440 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3441 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3448 load_state = LD_DOLOAD;
3451 SET_EXPECT(GetClassID);
3452 SET_EXPECT(SetStatusText);
3453 SET_EXPECT(Exec_ShellDocView_37);
3454 SET_EXPECT(GetHostInfo);
3456 SET_EXPECT(GetDisplayName);
3457 SET_EXPECT(Invoke_AMBIENT_SILENT);
3458 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3459 SET_EXPECT(OnChanged_READYSTATE);
3460 SET_EXPECT(IsSystemMoniker);
3461 SET_EXPECT(Exec_ShellDocView_84);
3463 SET_EXPECT(BindToStorage);
3464 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3467 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3469 expect_status_text = NULL;
3470 readystate_set_loading = TRUE;
3472 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3473 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3474 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3477 CHECK_CALLED(GetClassID);
3478 CHECK_CALLED(SetStatusText);
3479 CHECK_CALLED(Exec_ShellDocView_37);
3480 CHECK_CALLED(GetHostInfo);
3482 CHECK_CALLED(GetDisplayName);
3483 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3484 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3485 CHECK_CALLED(OnChanged_READYSTATE);
3486 SET_CALLED(IsSystemMoniker); /* IE7 */
3487 SET_CALLED(Exec_ShellDocView_84);
3489 CHECK_CALLED(BindToStorage);
3490 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3491 CHECK_CALLED(HideUI);
3492 CHECK_CALLED(ShowUI);
3493 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3495 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
3497 IOleCommandTarget_Release(cmdtrg);
3499 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3500 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3501 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3504 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
3506 IOleCommandTarget *cmdtrg;
3507 VARIANT *in = NULL, _in, *out = NULL, _out;
3510 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3511 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
3518 V_BSTR(in) = SysAllocString(name);
3524 V_I4(out) = 0xdeadbeef;
3527 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
3528 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
3534 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
3535 if(V_VT(out) == VT_BSTR) {
3537 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
3538 "unexpected fontname %s\n", wine_dbgstr_w(name));
3540 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
3545 IOleCommandTarget_Release(cmdtrg);
3548 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
3550 IOleCommandTarget *cmdtrg;
3553 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3554 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3558 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
3559 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3560 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3562 IOleCommandTarget_Release(cmdtrg);
3565 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
3567 IPersistStreamInit *perinit;
3568 IPersistMoniker *permon;
3569 IPersistFile *perfile;
3572 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
3573 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
3574 if(SUCCEEDED(hres)) {
3575 hres = IPersistStreamInit_IsDirty(perinit);
3576 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3577 IPersistStreamInit_Release(perinit);
3580 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
3581 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
3582 if(SUCCEEDED(hres)) {
3583 hres = IPersistMoniker_IsDirty(permon);
3584 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3585 IPersistMoniker_Release(permon);
3588 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
3589 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
3590 if(SUCCEEDED(hres)) {
3591 hres = IPersistFile_IsDirty(perfile);
3592 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3593 IPersistFile_Release(perfile);
3597 static HWND create_container_window(void)
3599 static const WCHAR wszHTMLDocumentTest[] =
3600 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3601 static WNDCLASSEXW wndclass = {
3602 sizeof(WNDCLASSEXW),
3605 0, 0, NULL, NULL, NULL, NULL, NULL,
3606 wszHTMLDocumentTest,
3610 RegisterClassExW(&wndclass);
3611 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
3612 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
3613 515, 530, NULL, NULL, NULL, NULL);
3616 static void test_DoVerb(IOleObject *oleobj)
3618 RECT rect = {0,0,500,500};
3621 if(!container_locked) {
3622 SET_EXPECT(GetContainer);
3623 SET_EXPECT(LockContainer);
3625 SET_EXPECT(ActivateMe);
3626 expect_LockContainer_fLock = TRUE;
3628 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
3629 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
3631 if(!container_locked) {
3632 CHECK_CALLED(GetContainer);
3633 CHECK_CALLED(LockContainer);
3634 container_locked = TRUE;
3636 CHECK_CALLED(ActivateMe);
3639 #define CLIENTSITE_EXPECTPATH 0x00000001
3640 #define CLIENTSITE_SETNULL 0x00000002
3641 #define CLIENTSITE_DONTSET 0x00000004
3643 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
3645 IOleClientSite *clientsite;
3648 if(flags & CLIENTSITE_SETNULL) {
3649 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3650 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
3652 hres = IOleObject_SetClientSite(oleobj, NULL);
3653 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3655 set_clientsite = FALSE;
3658 if(flags & CLIENTSITE_DONTSET)
3661 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3662 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3663 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
3664 clientsite, set_clientsite ? &ClientSite : NULL);
3666 if(!set_clientsite) {
3667 SET_EXPECT(GetHostInfo);
3668 if(flags & CLIENTSITE_EXPECTPATH) {
3669 SET_EXPECT(GetOptionKeyPath);
3670 SET_EXPECT(GetOverrideKeyPath);
3672 SET_EXPECT(GetWindow);
3673 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3674 SET_EXPECT(Exec_SETPROGRESSMAX);
3675 SET_EXPECT(Exec_SETPROGRESSPOS);
3676 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3677 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3678 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3679 SET_EXPECT(Invoke_AMBIENT_SILENT);
3680 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3681 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3683 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3684 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3686 CHECK_CALLED(GetHostInfo);
3687 if(flags & CLIENTSITE_EXPECTPATH) {
3688 CHECK_CALLED(GetOptionKeyPath);
3689 CHECK_CALLED(GetOverrideKeyPath);
3691 CHECK_CALLED(GetWindow);
3692 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3693 CHECK_CALLED(Exec_SETPROGRESSMAX);
3694 CHECK_CALLED(Exec_SETPROGRESSPOS);
3695 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3696 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3697 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3698 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3699 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3700 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3702 set_clientsite = TRUE;
3705 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3706 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3708 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3709 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3710 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
3713 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
3715 IOleControl *control = NULL;
3718 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
3719 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3723 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3724 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
3725 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3726 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3728 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3729 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
3730 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3731 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3733 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3734 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3735 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
3736 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3737 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3738 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3740 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3741 SET_EXPECT(Invoke_AMBIENT_SILENT);
3742 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
3743 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3744 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3745 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3747 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3748 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
3749 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3750 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3752 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3753 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3754 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3755 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3757 IOleControl_Release(control);
3762 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
3764 IOleControl *control = NULL;
3767 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
3768 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3772 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3773 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
3775 IOleControl_Release(control);
3778 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
3780 IOleObject *oleobj = NULL;
3783 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
3784 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3788 SET_EXPECT(GetContainer);
3789 SET_EXPECT(LockContainer);
3790 expect_LockContainer_fLock = FALSE;
3791 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
3792 ok(hres == S_OK, "Close failed: %08x\n", hres);
3793 CHECK_CALLED(GetContainer);
3794 CHECK_CALLED(LockContainer);
3795 container_locked = FALSE;
3798 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
3800 IOleObject_Release(oleobj);
3803 static void test_Advise(IHTMLDocument2 *doc)
3805 IOleObject *oleobj = NULL;
3806 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
3810 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
3811 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3815 hres = IOleObject_Unadvise(oleobj, 0);
3816 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
3818 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
3819 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
3820 ok(enum_advise == NULL, "enum_advise != NULL\n");
3823 hres = IOleObject_Advise(oleobj, NULL, &conn);
3824 /* Old IE returns S_OK and sets conn to 1 */
3825 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
3826 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
3828 hres = IOleObject_Advise(oleobj, &AdviseSink, NULL);
3829 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
3831 hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
3832 ok(hres == S_OK, "Advise returned: %08x\n", hres);
3833 ok(conn == 1, "conn = %d\n", conn);
3835 hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
3836 ok(hres == S_OK, "Advise returned: %08x\n", hres);
3837 ok(conn == 2, "conn = %d\n", conn);
3839 hres = IOleObject_Unadvise(oleobj, 1);
3840 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
3842 hres = IOleObject_Unadvise(oleobj, 1);
3843 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
3845 hres = IOleObject_Unadvise(oleobj, 2);
3846 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
3848 IOleObject_Release(oleobj);
3851 static void test_OnFrameWindowActivate(IUnknown *unk)
3853 IOleInPlaceActiveObject *inplaceact;
3856 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
3857 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
3861 if(set_clientsite) {
3862 expect_OnFrameWindowActivate_fActivate = TRUE;
3863 SET_EXPECT(OnFrameWindowActivate);
3864 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3865 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3866 CHECK_CALLED(OnFrameWindowActivate);
3868 SET_EXPECT(OnFrameWindowActivate);
3869 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3870 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3871 CHECK_CALLED(OnFrameWindowActivate);
3873 expect_OnFrameWindowActivate_fActivate = FALSE;
3874 SET_EXPECT(OnFrameWindowActivate);
3875 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3876 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3877 CHECK_CALLED(OnFrameWindowActivate);
3879 expect_OnFrameWindowActivate_fActivate = TRUE;
3880 SET_EXPECT(OnFrameWindowActivate);
3881 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3882 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3883 CHECK_CALLED(OnFrameWindowActivate);
3885 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3886 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3888 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3889 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3892 IOleInPlaceActiveObject_Release(inplaceact);
3895 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
3897 IOleInPlaceObjectWindowless *windowlessobj = NULL;
3900 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
3901 (void**)&windowlessobj);
3902 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
3907 SET_EXPECT(OnFocus_FALSE);
3909 SET_EXPECT(OnInPlaceDeactivateEx);
3911 SET_EXPECT(OnInPlaceDeactivate);
3913 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
3914 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
3916 CHECK_CALLED(OnFocus_FALSE);
3918 CHECK_CALLED(OnInPlaceDeactivateEx);
3920 CHECK_CALLED(OnInPlaceDeactivate);
3923 IOleInPlaceObjectWindowless_Release(windowlessobj);
3926 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
3928 IOleObject *oleobj = NULL;
3929 IOleDocumentView *docview;
3936 IOleDocumentView_Release(view);
3939 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
3940 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3942 hres = IOleObject_GetUserClassID(oleobj, NULL);
3943 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
3945 hres = IOleObject_GetUserClassID(oleobj, &guid);
3946 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
3947 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
3949 test_OnFrameWindowActivate((IUnknown*)doc);
3951 test_ClientSite(oleobj, flags);
3952 test_InPlaceDeactivate(doc, FALSE);
3953 test_DoVerb(oleobj);
3955 if(call_UIActivate == CallUIActivate_AfterShow) {
3956 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
3957 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
3959 SET_EXPECT(OnFocus_TRUE);
3960 SET_EXPECT(SetActiveObject);
3962 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3963 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3964 expect_status_text = NULL;
3966 hres = IOleDocumentView_UIActivate(docview, TRUE);
3967 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
3969 CHECK_CALLED(OnFocus_TRUE);
3970 CHECK_CALLED(SetActiveObject);
3971 CHECK_CALLED(ShowUI);
3972 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3973 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3975 IOleDocumentView_Release(docview);
3978 IOleObject_Release(oleobj);
3980 test_OnFrameWindowActivate((IUnknown*)doc);
3983 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
3985 IOleInPlaceActiveObject *activeobject = NULL;
3989 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
3990 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
3994 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
3996 if(expect_success) {
3997 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
3998 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
4000 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
4001 ok(IsWindow(hwnd), "hwnd is destroyed\n");
4004 IOleInPlaceActiveObject_Release(activeobject);
4007 static void test_CloseView(void)
4009 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
4015 hres = IOleDocumentView_Show(view, FALSE);
4016 ok(hres == S_OK, "Show failed: %08x\n", hres);
4018 hres = IOleDocumentView_CloseView(view, 0);
4019 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
4021 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
4022 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
4024 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
4025 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
4026 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
4029 static void test_UIDeactivate(void)
4033 if(call_UIActivate == CallUIActivate_AfterShow) {
4034 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4036 if(call_UIActivate != CallUIActivate_None) {
4037 SET_EXPECT(SetActiveObject_null);
4039 SET_EXPECT(OnUIDeactivate);
4042 hres = IOleDocumentView_UIActivate(view, FALSE);
4043 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
4045 if(call_UIActivate != CallUIActivate_None) {
4046 CHECK_CALLED(SetActiveObject_null);
4047 CHECK_CALLED(HideUI);
4048 CHECK_CALLED(OnUIDeactivate);
4050 if(call_UIActivate == CallUIActivate_AfterShow) {
4051 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4055 static void test_Hide(void)
4062 hres = IOleDocumentView_Show(view, FALSE);
4063 ok(hres == S_OK, "Show failed: %08x\n", hres);
4066 static HRESULT create_document(IHTMLDocument2 **doc)
4068 IHTMLDocument5 *doc5;
4071 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
4072 &IID_IHTMLDocument2, (void**)doc);
4073 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
4077 hres = IHTMLDocument2_QueryInterface(*doc, &IID_IHTMLDocument5, (void**)&doc5);
4078 if(SUCCEEDED(hres)) {
4079 IHTMLDocument5_Release(doc5);
4081 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
4082 IHTMLDocument2_Release(*doc);
4088 static void test_Navigate(IHTMLDocument2 *doc)
4090 IHlinkTarget *hlink;
4093 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
4094 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
4096 SET_EXPECT(ActivateMe);
4097 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
4098 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
4099 CHECK_CALLED(ActivateMe);
4101 IHlinkTarget_Release(hlink);
4104 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
4106 IDispatch *external;
4107 IHTMLWindow2 *htmlwin;
4110 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
4111 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4114 SET_EXPECT(GetExternal);
4115 external = (void*)0xdeadbeef;
4116 hres = IHTMLWindow2_get_external(htmlwin, &external);
4118 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
4119 CHECK_CALLED(GetExternal);
4120 ok(external != NULL, "external == NULL\n");
4122 ok(hres == S_OK, "get_external failed: %08x\n", hres);
4123 ok(external == NULL, "external != NULL\n");
4126 IHTMLWindow2_Release(htmlwin);
4129 static void test_StreamLoad(IHTMLDocument2 *doc)
4131 IPersistStreamInit *init;
4134 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
4135 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
4139 SET_EXPECT(Invoke_AMBIENT_SILENT);
4140 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4141 SET_EXPECT(Exec_ShellDocView_37);
4142 SET_EXPECT(OnChanged_READYSTATE);
4144 readystate_set_loading = TRUE;
4146 hres = IPersistStreamInit_Load(init, &Stream);
4147 ok(hres == S_OK, "Load failed: %08x\n", hres);
4149 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4150 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4151 CHECK_CALLED(Exec_ShellDocView_37);
4152 CHECK_CALLED(OnChanged_READYSTATE);
4155 test_timer(EXPECT_SETTITLE);
4156 test_GetCurMoniker((IUnknown*)doc, NULL, about_blank_url);
4158 IPersistStreamInit_Release(init);
4161 static void test_StreamInitNew(IHTMLDocument2 *doc)
4163 IPersistStreamInit *init;
4166 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
4167 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
4171 SET_EXPECT(Invoke_AMBIENT_SILENT);
4172 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4173 SET_EXPECT(Exec_ShellDocView_37);
4174 SET_EXPECT(OnChanged_READYSTATE);
4175 readystate_set_loading = TRUE;
4177 hres = IPersistStreamInit_InitNew(init);
4178 ok(hres == S_OK, "Load failed: %08x\n", hres);
4180 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4181 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4182 CHECK_CALLED(Exec_ShellDocView_37);
4183 CHECK_CALLED(OnChanged_READYSTATE);
4185 test_timer(EXPECT_SETTITLE);
4186 test_GetCurMoniker((IUnknown*)doc, NULL, about_blank_url);
4188 IPersistStreamInit_Release(init);
4191 static void test_QueryInterface(IHTMLDocument2 *doc)
4196 static const IID IID_UndocumentedScriptIface =
4197 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
4199 qi = (void*)0xdeadbeef;
4200 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
4201 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4202 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
4204 qi = (void*)0xdeadbeef;
4205 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
4206 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4207 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
4209 qi = (void*)0xdeadbeef;
4210 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
4211 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4212 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
4214 qi = (void*)0xdeadbeef;
4215 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
4216 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4217 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
4219 qi = (void*)0xdeadbeef;
4220 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
4221 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4222 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
4224 qi = (void*)0xdeadbeef;
4225 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
4226 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
4227 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
4230 static void init_test(enum load_state_t ls) {
4232 hwnd = last_hwnd = NULL;
4233 set_clientsite = FALSE;
4234 load_from_stream = FALSE;
4235 call_UIActivate = CallUIActivate_None;
4241 inplace_deactivated = FALSE;
4244 static void test_HTMLDocument(BOOL do_load)
4246 IHTMLDocument2 *doc;
4250 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
4252 init_test(do_load ? LD_DOLOAD : LD_NO);
4254 hres = create_document(&doc);
4257 doc_unk = (IUnknown*)doc;
4259 test_QueryInterface(doc);
4261 test_IsDirty(doc, S_FALSE);
4262 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4263 test_external(doc, FALSE);
4264 test_ConnectionPointContainer(doc);
4265 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
4266 test_Persist(doc, &Moniker);
4268 test_OnAmbientPropertyChange2(doc);
4270 test_Activate(doc, CLIENTSITE_EXPECTPATH);
4273 test_download(DWL_CSS|DWL_TRYCSS);
4274 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
4277 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4278 test_OleCommandTarget_fail(doc);
4279 test_OleCommandTarget(doc);
4280 test_OnAmbientPropertyChange(doc);
4281 test_Window(doc, TRUE);
4282 test_external(doc, TRUE);
4284 test_UIDeactivate();
4285 test_OleCommandTarget(doc);
4286 test_Window(doc, TRUE);
4287 test_InPlaceDeactivate(doc, TRUE);
4289 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4290 * MSHTML. It doesn't with Wine. */
4292 test_Window(doc, FALSE);
4294 test_InPlaceDeactivate(doc, FALSE);
4296 test_Close(doc, FALSE);
4298 /* Activate HTMLDocument again */
4299 test_Activate(doc, CLIENTSITE_SETNULL);
4300 test_Window(doc, TRUE);
4301 test_OleCommandTarget(doc);
4302 test_UIDeactivate();
4303 test_InPlaceDeactivate(doc, TRUE);
4304 test_Close(doc, FALSE);
4306 /* Activate HTMLDocument again, this time without UIActivate */
4307 call_UIActivate = CallUIActivate_None;
4308 test_Activate(doc, CLIENTSITE_SETNULL);
4309 test_Window(doc, TRUE);
4311 test_UIDeactivate();
4312 test_InPlaceDeactivate(doc, TRUE);
4315 test_Close(doc, TRUE);
4316 test_OnAmbientPropertyChange2(doc);
4317 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
4320 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4321 call_UIActivate = CallUIActivate_AfterShow;
4322 test_Activate(doc, 0);
4323 test_Window(doc, TRUE);
4324 test_OleCommandTarget(doc);
4325 test_UIDeactivate();
4326 test_InPlaceDeactivate(doc, TRUE);
4327 test_Close(doc, FALSE);
4328 call_UIActivate = CallUIActivate_None;
4332 IOleDocumentView_Release(view);
4335 ok(IsWindow(hwnd), "hwnd is destroyed\n");
4337 ref = IHTMLDocument2_Release(doc);
4338 ok(ref == 0, "ref=%d, expected 0\n", ref);
4340 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
4343 static void test_HTMLDocument_hlink(void)
4345 IHTMLDocument2 *doc;
4349 trace("Testing HTMLDocument (hlink)...\n");
4351 init_test(LD_DOLOAD);
4354 hres = create_document(&doc);
4357 doc_unk = (IUnknown*)doc;
4359 test_ConnectionPointContainer(doc);
4360 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
4361 test_Persist(doc, &Moniker);
4364 IUnknown_Release(doc);
4368 test_download(DWL_CSS|DWL_TRYCSS);
4370 test_IsDirty(doc, S_FALSE);
4371 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4373 test_exec_onunload(doc);
4374 test_Window(doc, TRUE);
4375 test_InPlaceDeactivate(doc, TRUE);
4376 test_Close(doc, FALSE);
4377 test_IsDirty(doc, S_FALSE);
4378 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
4381 IOleDocumentView_Release(view);
4384 ref = IHTMLDocument2_Release(doc);
4385 ok(ref == 0, "ref=%d, expected 0\n", ref);
4388 static void test_cookies(IHTMLDocument2 *doc)
4396 hres = IHTMLDocument2_get_cookie(doc, &str);
4397 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4399 size = sizeof(buf)/sizeof(WCHAR);
4400 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4401 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4402 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
4406 str = a2bstr("test=testval");
4407 hres = IHTMLDocument2_put_cookie(doc, str);
4408 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
4411 hres = IHTMLDocument2_get_cookie(doc, &str2);
4412 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4413 ok(str2 != NULL, "cookie = NULL\n");
4414 size = sizeof(buf)/sizeof(WCHAR);
4415 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4416 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4417 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
4418 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
4420 SysFreeString(str2);
4422 str = a2bstr("test=testval2");
4423 hres = IHTMLDocument2_put_cookie(doc, str);
4424 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
4427 hres = IHTMLDocument2_get_cookie(doc, &str2);
4428 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4429 ok(str2 != NULL, "cookie = NULL\n");
4430 size = sizeof(buf)/sizeof(WCHAR);
4431 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4432 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4433 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
4434 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
4436 SysFreeString(str2);
4439 static void test_HTMLDocument_http(void)
4442 IHTMLDocument2 *doc;
4446 trace("Testing HTMLDocument (http)...\n");
4448 init_test(LD_DOLOAD);
4451 hres = create_document(&doc);
4454 doc_unk = (IUnknown*)doc;
4456 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
4457 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
4459 test_ConnectionPointContainer(doc);
4460 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
4461 test_Persist(doc, http_mon);
4464 IUnknown_Release(doc);
4468 if (winetest_interactive || ! is_ie_hardened())
4469 test_download(DWL_HTTP);
4471 win_skip("IE running in Enhanced Security Configuration\n");
4474 test_IsDirty(doc, S_FALSE);
4475 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4479 test_InPlaceDeactivate(doc, TRUE);
4480 test_Close(doc, FALSE);
4481 test_IsDirty(doc, S_FALSE);
4482 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
4485 IOleDocumentView_Release(view);
4488 ref = IHTMLDocument2_Release(doc);
4489 ok(!ref, "ref=%d, expected 0\n", ref);
4491 ref = IMoniker_Release(http_mon);
4492 ok(!ref, "ref=%d, expected 0\n", ref);
4495 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
4497 IServiceProvider *sp;
4501 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
4502 ok(hres == S_OK, "QueryService returned %08x\n", hres);
4504 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
4506 IHlinkFrame_Release(hf);
4508 ok(hres == (success?S_OK:E_NOINTERFACE), "QueryService returned %08x, expected %08x\n", hres, success?S_OK:E_NOINTERFACE);
4510 IServiceProvider_Release(sp);
4513 static void test_HTMLDocument_StreamLoad(void)
4515 IHTMLDocument2 *doc;
4521 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4523 init_test(LD_DOLOAD);
4524 load_from_stream = TRUE;
4526 hres = create_document(&doc);
4529 doc_unk = (IUnknown*)doc;
4531 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4532 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4534 hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
4535 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4537 test_readyState((IUnknown*)doc);
4538 test_IsDirty(doc, S_FALSE);
4539 test_ConnectionPointContainer(doc);
4540 test_QueryService(doc, FALSE);
4541 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4542 test_QueryService(doc, TRUE);
4543 test_DoVerb(oleobj);
4544 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4546 IOleObject_Release(oleobj);
4548 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
4549 test_StreamLoad(doc);
4550 test_download(DWL_VERBDONE|DWL_TRYCSS);
4551 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4553 test_UIDeactivate();
4554 test_InPlaceDeactivate(doc, TRUE);
4555 SET_EXPECT(Advise_Close);
4556 test_Close(doc, FALSE);
4557 CHECK_CALLED(Advise_Close);
4558 test_IsDirty(doc, S_FALSE);
4561 IOleDocumentView_Release(view);
4566 ref = IHTMLDocument2_Release(doc);
4567 ok(ref == 0, "ref=%d, expected 0\n", ref);
4570 static void test_HTMLDocument_StreamInitNew(void)
4572 IHTMLDocument2 *doc;
4578 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4580 init_test(LD_DOLOAD);
4581 load_from_stream = TRUE;
4583 hres = create_document(&doc);
4586 doc_unk = (IUnknown*)doc;
4588 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4589 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4591 hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
4592 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4594 test_readyState((IUnknown*)doc);
4595 test_IsDirty(doc, S_FALSE);
4596 test_ConnectionPointContainer(doc);
4597 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4598 test_DoVerb(oleobj);
4599 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4601 IOleObject_Release(oleobj);
4603 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
4604 test_StreamInitNew(doc);
4605 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
4606 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4608 test_UIDeactivate();
4609 test_InPlaceDeactivate(doc, TRUE);
4610 SET_EXPECT(Advise_Close);
4611 test_Close(doc, FALSE);
4612 CHECK_CALLED(Advise_Close);
4613 test_IsDirty(doc, S_FALSE);
4616 IOleDocumentView_Release(view);
4621 ref = IHTMLDocument2_Release(doc);
4622 ok(ref == 0, "ref=%d, expected 0\n", ref);
4625 static void test_edit_uiactivate(IOleObject *oleobj)
4627 IOleDocumentView *docview;
4630 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
4631 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
4633 SET_EXPECT(OnFocus_TRUE);
4634 SET_EXPECT(SetActiveObject);
4636 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4637 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4638 expect_status_text = NULL;
4640 hres = IOleDocumentView_UIActivate(docview, TRUE);
4641 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
4643 CHECK_CALLED(OnFocus_TRUE);
4644 CHECK_CALLED(SetActiveObject);
4645 CHECK_CALLED(ShowUI);
4646 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4647 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4649 IOleDocumentView_Release(docview);
4652 static void test_editing_mode(BOOL do_load)
4654 IHTMLDocument2 *doc;
4661 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
4663 init_test(do_load ? LD_DOLOAD : LD_NO);
4664 call_UIActivate = CallUIActivate_AfterShow;
4666 hres = create_document(&doc);
4669 unk = doc_unk = (IUnknown*)doc;
4671 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4672 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4674 hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
4675 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4677 test_readyState((IUnknown*)doc);
4678 test_ConnectionPointContainer(doc);
4679 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4680 test_DoVerb(oleobj);
4681 test_edit_uiactivate(oleobj);
4683 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4685 test_Persist(doc, &Moniker);
4686 stream_read = protocol_read = 0;
4687 test_exec_editmode(unk, do_load);
4688 test_UIDeactivate();
4689 call_UIActivate = CallUIActivate_None;
4690 IOleObject_Release(oleobj);
4692 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
4693 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
4695 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
4696 test_timer(EXPECT_UPDATEUI);
4697 SET_CALLED(SetStatusText);
4699 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4702 test_exec_fontname(unk, NULL, wszTimesNewRoman);
4703 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
4704 test_timer(EXPECT_UPDATEUI);
4705 test_exec_fontname(unk, NULL, wszArial);
4707 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
4708 test_timer(EXPECT_UPDATEUI);
4709 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4710 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4712 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
4713 test_timer(EXPECT_UPDATEUI);
4714 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4715 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4716 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
4717 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4719 test_exec_noargs(unk, IDM_HORIZONTALLINE);
4720 test_timer(EXPECT_UPDATEUI);
4721 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
4722 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4725 test_UIDeactivate();
4726 test_InPlaceDeactivate(doc, TRUE);
4727 SET_EXPECT(Advise_Close);
4728 test_Close(doc, FALSE);
4729 CHECK_CALLED(Advise_Close);
4732 IOleDocumentView_Release(view);
4736 ref = IUnknown_Release(unk);
4737 ok(ref == 0, "ref=%d, expected 0\n", ref);
4740 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
4742 IHTMLDocument2 *doc;
4744 IOleInPlaceSite *inplacesite;
4748 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
4750 init_test(do_load ? LD_DOLOAD : LD_NO);
4752 hres = create_document(&doc);
4755 doc_unk = (IUnknown*)doc;
4760 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4761 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
4763 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
4764 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
4766 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4767 SET_EXPECT(GetHostInfo);
4768 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4769 SET_EXPECT(Invoke_AMBIENT_SILENT);
4770 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4771 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4772 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4773 SET_EXPECT(GetOptionKeyPath);
4774 SET_EXPECT(GetOverrideKeyPath);
4775 SET_EXPECT(GetWindow);
4776 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4777 SET_EXPECT(Exec_SETPROGRESSMAX);
4778 SET_EXPECT(Exec_SETPROGRESSPOS);
4780 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4781 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4783 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4784 CHECK_CALLED(GetHostInfo);
4785 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4786 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4787 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4788 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4789 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4790 CHECK_CALLED(GetOptionKeyPath);
4791 CHECK_CALLED(GetOverrideKeyPath);
4792 CHECK_CALLED(GetWindow);
4793 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4794 CHECK_CALLED(Exec_SETPROGRESSMAX);
4795 CHECK_CALLED(Exec_SETPROGRESSPOS);
4797 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
4798 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
4799 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
4801 SET_EXPECT(GetContainer);
4802 SET_EXPECT(LockContainer);
4803 SET_EXPECT(CanInPlaceActivate);
4804 SET_EXPECT(GetWindowContext);
4805 SET_EXPECT(GetWindow);
4807 SET_EXPECT(OnInPlaceActivateEx);
4808 SET_EXPECT(RequestUIActivate);
4811 SET_EXPECT(OnInPlaceActivate);
4812 SET_EXPECT(OnUIActivate);
4813 SET_EXPECT(SetStatusText);
4814 SET_EXPECT(Exec_SETPROGRESSMAX);
4815 SET_EXPECT(Exec_SETPROGRESSPOS);
4817 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4818 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4819 SET_EXPECT(OnFocus_TRUE);
4820 SET_EXPECT(SetActiveObject);
4821 expect_LockContainer_fLock = TRUE;
4823 hres = IOleDocumentView_UIActivate(view, TRUE);
4824 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
4826 CHECK_CALLED(GetContainer);
4827 CHECK_CALLED(LockContainer);
4828 CHECK_CALLED(CanInPlaceActivate);
4829 CHECK_CALLED(GetWindowContext);
4830 CHECK_CALLED(GetWindow);
4832 CHECK_CALLED(OnInPlaceActivateEx);
4833 SET_EXPECT(RequestUIActivate);
4836 CHECK_CALLED(OnInPlaceActivate);
4837 CHECK_CALLED(OnUIActivate);
4838 CHECK_CALLED(SetStatusText);
4839 CHECK_CALLED(Exec_SETPROGRESSMAX);
4840 CHECK_CALLED(Exec_SETPROGRESSPOS);
4841 CHECK_CALLED(ShowUI);
4842 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4843 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4844 CHECK_CALLED(OnFocus_TRUE);
4845 CHECK_CALLED(SetActiveObject);
4846 container_locked = TRUE;
4848 SET_EXPECT(SetActiveObject_null);
4849 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4851 SET_EXPECT(OnUIDeactivate);
4853 hres = IOleDocumentView_UIActivate(view, FALSE);
4854 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
4856 CHECK_CALLED(SetActiveObject_null);
4857 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4858 CHECK_CALLED(HideUI);
4859 CHECK_CALLED(OnUIDeactivate);
4861 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
4862 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
4863 ok(inplacesite != NULL, "inplacesite = NULL\n");
4864 IOleInPlaceSite_Release(inplacesite);
4866 SET_EXPECT(OnFocus_FALSE);
4868 SET_EXPECT(OnInPlaceDeactivateEx);
4870 SET_EXPECT(OnInPlaceDeactivate);
4874 CHECK_CALLED(OnFocus_FALSE);
4876 CHECK_CALLED(OnInPlaceDeactivateEx);
4878 CHECK_CALLED(OnInPlaceDeactivate);
4880 test_Close(doc, TRUE);
4882 IOleObject_Release(oleobj);
4883 IOleDocumentView_Release(view);
4886 ref = IHTMLDocument2_Release(doc);
4887 ok(ref == 0, "ref=%d, expected 0\n", ref);
4890 static void register_protocol(void)
4892 IInternetSession *session;
4895 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
4897 hres = CoInternetGetSession(0, &session, 0);
4898 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
4900 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
4901 wsz_winetest, 0, NULL, 0);
4902 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
4904 IInternetSession_Release(session);
4907 static void test_HTMLDoc_ISupportErrorInfo(void)
4909 IHTMLDocument2 *doc;
4911 ISupportErrorInfo *sinfo;
4914 hres = create_document(&doc);
4918 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
4919 ok(hres == S_OK, "got %x\n", hres);
4920 ok(sinfo != NULL, "got %p\n", sinfo);
4923 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
4924 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
4925 IUnknown_Release(sinfo);
4928 ref = IHTMLDocument2_Release(doc);
4929 ok(ref == 0, "ref=%d, expected 0\n", ref);
4932 static void test_IPersistHistory(void)
4934 IHTMLDocument2 *doc;
4937 IPersistHistory *phist;
4939 hres = create_document(&doc);
4943 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
4944 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
4946 IPersistHistory_Release(phist);
4948 ref = IHTMLDocument2_Release(doc);
4949 ok(ref == 0, "ref=%d, expected 0\n", ref);
4955 container_hwnd = create_container_window();
4956 register_protocol();
4958 test_HTMLDocument_hlink();
4960 test_HTMLDocument(FALSE);
4961 test_HTMLDocument(TRUE);
4962 test_HTMLDocument_StreamLoad();
4963 test_HTMLDocument_StreamInitNew();
4964 test_editing_mode(FALSE);
4965 test_editing_mode(TRUE);
4966 test_HTMLDocument_http();
4967 test_UIActivate(FALSE, FALSE, FALSE);
4968 test_UIActivate(FALSE, TRUE, FALSE);
4969 test_UIActivate(FALSE, TRUE, TRUE);
4970 test_UIActivate(TRUE, FALSE, FALSE);
4971 test_UIActivate(TRUE, TRUE, FALSE);
4972 test_UIActivate(TRUE, TRUE, TRUE);
4974 test_HTMLDoc_ISupportErrorInfo();
4975 test_IPersistHistory();
4977 DestroyWindow(container_hwnd);