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);
154 static IUnknown *doc_unk;
155 static IMoniker *doc_mon;
156 static BOOL expect_LockContainer_fLock;
157 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
159 static BOOL set_clientsite = FALSE, container_locked = FALSE;
160 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
161 static BOOL editmode = FALSE, show_failed;
162 static BOOL inplace_deactivated;
163 static int stream_read, protocol_read;
164 static enum load_state_t {
173 static LPCOLESTR expect_status_text = NULL;
175 static const char html_page[] =
177 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
181 static const char css_data[] = "body {color: red}";
183 static const WCHAR http_urlW[] =
184 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
186 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
187 static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
189 static HRESULT QueryInterface(REFIID riid, void **ppv);
190 static void test_MSHTML_QueryStatus(IUnknown*,DWORD);
192 #define test_readyState(u) _test_readyState(__LINE__,u)
193 static void _test_readyState(unsigned,IUnknown*);
195 static const WCHAR wszTimesNewRoman[] =
196 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
197 static const WCHAR wszArial[] =
198 {'A','r','i','a','l',0};
200 static const char *debugstr_guid(REFIID riid)
204 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
205 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
206 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
207 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
212 static int strcmp_wa(LPCWSTR strw, const char *stra)
215 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
216 return lstrcmpA(stra, buf);
219 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
223 const WCHAR *p1 = str, *p2 = sub;
224 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
225 if (!*p2) return str;
231 static BSTR a2bstr(const char *str)
236 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
237 ret = SysAllocStringLen(NULL, len);
238 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
243 static BOOL is_english(void)
245 return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
246 && PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
249 #define EXPECT_UPDATEUI 1
250 #define EXPECT_SETTITLE 2
252 static void test_timer(DWORD flags)
254 BOOL *b = &called_Exec_SETTITLE;
257 if(flags & EXPECT_UPDATEUI) {
258 SET_EXPECT(UpdateUI);
259 SET_EXPECT(Exec_UPDATECOMMANDS);
260 b = &called_UpdateUI;
262 if(flags & EXPECT_SETTITLE)
263 SET_EXPECT(Exec_SETTITLE);
265 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
266 TranslateMessage(&msg);
267 DispatchMessage(&msg);
270 if(flags & EXPECT_UPDATEUI) {
271 CHECK_CALLED(UpdateUI);
272 CHECK_CALLED(Exec_UPDATECOMMANDS);
274 if(flags & EXPECT_SETTITLE)
275 CHECK_CALLED(Exec_SETTITLE);
278 static IMoniker Moniker;
280 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
281 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, LPCWSTR exurl)
284 IPersistMoniker *permon;
285 IMoniker *mon = (void*)0xdeadbeef;
286 BSTR doc_url = (void*)0xdeadbeef;
289 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
290 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
294 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
295 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
297 hres = IHTMLDocument2_get_URL(doc, &doc_url);
298 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
300 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
301 IPersistMoniker_Release(permon);
305 BOOL exb = expect_GetDisplayName;
306 BOOL clb = called_GetDisplayName;
308 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
309 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
312 SET_EXPECT(GetDisplayName);
313 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
314 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
316 CHECK_CALLED(GetDisplayName);
317 expect_GetDisplayName = exb;
318 called_GetDisplayName = clb;
320 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
325 ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
327 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
328 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
330 ok(!lstrcmpW(url, exurl), "unexpected url\n");
331 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
335 ok(hres == E_UNEXPECTED,
336 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
337 ok(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
338 ok(!lstrcmpW(doc_url, about_blank_url), "doc_url is not about:blank\n");
341 SysFreeString(doc_url);
342 IHTMLDocument_Release(doc);
343 if(mon && mon != (void*)0xdeadbeef)
344 IMoniker_Release(mon);
347 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
349 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
353 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
358 if(IsEqualGUID(&IID_IProxyManager, riid))
359 return E_NOINTERFACE; /* TODO */
360 if(IsEqualGUID(&IID_IDispatchEx, riid))
361 return E_NOINTERFACE; /* TODO */
362 if(IsEqualGUID(&IID_External_unk, riid))
363 return E_NOINTERFACE; /* TODO */
365 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
366 return E_NOINTERFACE;
369 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
374 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
379 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
381 ok(0, "unexpected call\n");
385 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
388 ok(0, "unexpected call\n");
392 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
393 UINT cNames, LCID lcid, DISPID *rgDispId)
395 ok(0, "unexpected call\n");
399 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
400 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
401 EXCEPINFO *pExcepInfo, UINT *puArgErr)
403 ok(0, "unexpected call\n");
407 static const IDispatchVtbl ExternalVtbl = {
408 External_QueryInterface,
411 Dispatch_GetTypeInfoCount,
412 Dispatch_GetTypeInfo,
413 Dispatch_GetIDsOfNames,
417 static IDispatch External = { &ExternalVtbl };
419 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
421 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
427 return E_NOINTERFACE;
430 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
435 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
440 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
441 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
442 DWORD grfPI, HANDLE_PTR dwReserved)
448 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
449 static const WCHAR empty_str = {0};
453 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
454 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
455 ok(!grfPI, "grfPI = %x\n", grfPI);
456 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
458 memset(&bindinfo, 0, sizeof(bindinfo));
459 bindinfo.cbSize = sizeof(bindinfo);
460 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
461 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
462 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
463 "bindf = %x\n", bindf);
465 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
466 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
467 /* TODO: test stgmedData */
468 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
469 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
470 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
471 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
472 ok(bindinfo.dwOptions == 0x80000 ||
473 bindinfo.dwOptions == 0x4080000, /* win2k3 */
474 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
475 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
476 /* TODO: test dwCodePage */
477 /* TODO: test securityAttributes */
478 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
479 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
480 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
482 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
483 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
484 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
486 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
487 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
489 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
491 hres = IInternetProtocolSink_ReportData(pOIProtSink,
492 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
493 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
495 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
496 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
501 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
502 PROTOCOLDATA *pProtocolData)
504 ok(0, "unexpected call\n");
508 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
511 ok(0, "unexpected call\n");
515 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
517 CHECK_EXPECT(Terminate);
521 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
523 ok(0, "unexpected call\n");
527 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
529 ok(0, "unexpected call\n");
533 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
534 ULONG cb, ULONG *pcbRead)
536 CHECK_EXPECT2(Protocol_Read);
538 ok(pv != NULL, "pv == NULL\n");
539 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
540 ok(pcbRead != NULL, "pcbRead == NULL\n");
541 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
546 protocol_read += *pcbRead = sizeof(css_data)-1;
547 memcpy(pv, css_data, sizeof(css_data)-1);
551 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
552 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
554 ok(0, "unexpected call\n");
558 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
560 CHECK_EXPECT(LockRequest);
564 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
566 CHECK_EXPECT(UnlockRequest);
570 static const IInternetProtocolVtbl ProtocolVtbl = {
571 Protocol_QueryInterface,
582 Protocol_LockRequest,
583 Protocol_UnlockRequest
586 static IInternetProtocol Protocol = { &ProtocolVtbl };
588 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
590 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
591 ok(0, "unexpected call\n");
592 return E_NOINTERFACE;
595 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
600 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
605 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
606 REFIID riid, void **ppv)
608 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
609 return E_NOINTERFACE;
611 CHECK_EXPECT(CreateInstance);
612 ok(ppv != NULL, "ppv == NULL\n");
618 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
620 ok(0, "unexpected call\n");
624 static const IClassFactoryVtbl ClassFactoryVtbl = {
625 ClassFactory_QueryInterface,
627 ClassFactory_Release,
628 ClassFactory_CreateInstance,
629 ClassFactory_LockServer
632 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
634 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
636 ok(0, "unexpected call\n");
640 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
645 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
650 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
651 IHlinkBrowseContext *pihlbc)
653 ok(0, "unexpected call\n");
657 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
658 IHlinkBrowseContext **ppihlbc)
660 ok(0, "unexpected call\n");
664 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
665 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
669 CHECK_EXPECT(Navigate);
671 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
672 ok(pbc != NULL, "pbc == NULL\n");
673 ok(pibsc != NULL, "pubsc == NULL\n");
674 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
677 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
678 LPWSTR location = (LPWSTR)0xdeadbeef;
680 IMoniker *mon = NULL;
681 DWORD site_data = 0xdeadbeef;
683 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
685 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
686 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
688 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
689 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
690 ok(location == NULL, "location = %p\n", location);
691 ok(mon != NULL, "mon == NULL\n");
693 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
694 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
695 ok(site == NULL, "site = %p\n, expected NULL\n", site);
697 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
703 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
704 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
706 ok(0, "unexpected call\n");
710 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
711 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
713 ok(0, "unexpected call\n");
717 static const IHlinkFrameVtbl HlinkFrameVtbl = {
718 HlinkFrame_QueryInterface,
721 HlinkFrame_SetBrowseContext,
722 HlinkFrame_GetBrowseContext,
724 HlinkFrame_OnNavigate,
725 HlinkFrame_UpdateHlink
728 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
730 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
731 REFIID riid, void**ppv)
733 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
738 ok(0, "unexpected call\n");
739 return E_NOINTERFACE;
742 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
747 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
752 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
755 case DISPID_READYSTATE:
756 CHECK_EXPECT2(OnChanged_READYSTATE);
758 if(readystate_set_interactive) {
759 readystate_set_interactive = FALSE;
760 load_state = LD_INTERACTIVE;
763 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
764 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
765 ? OLECMDF_ENABLED : 0));
767 if(readystate_set_loading) {
768 readystate_set_loading = FALSE;
769 load_state = LD_LOADING;
771 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
772 test_readyState(NULL);
775 CHECK_EXPECT(OnChanged_1005);
777 test_readyState(NULL);
778 readystate_set_interactive = (load_state != LD_INTERACTIVE);
781 CHECK_EXPECT(OnChanged_1012);
790 ok(0, "unexpected id %d\n", dispID);
794 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
796 ok(0, "unexpected call\n");
800 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
801 PropertyNotifySink_QueryInterface,
802 PropertyNotifySink_AddRef,
803 PropertyNotifySink_Release,
804 PropertyNotifySink_OnChanged,
805 PropertyNotifySink_OnRequestEdit
808 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
810 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
812 ok(0, "unexpected call\n");
813 return E_NOINTERFACE;
816 static ULONG WINAPI Stream_AddRef(IStream *iface)
821 static ULONG WINAPI Stream_Release(IStream *iface)
826 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
827 ULONG cb, ULONG *pcbRead)
830 ok(pv != NULL, "pv == NULL\n");
831 ok(cb > sizeof(html_page), "cb = %d\n", cb);
832 ok(pcbRead != NULL, "pcbRead == NULL\n");
833 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
838 memcpy(pv, html_page, sizeof(html_page)-1);
839 stream_read += *pcbRead = sizeof(html_page)-1;
843 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
844 ULONG cb, ULONG *pcbWritten)
846 ok(0, "unexpected call\n");
850 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
851 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
853 ok(0, "unexpected call\n");
857 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
859 ok(0, "unexpected call\n");
863 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
864 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
866 ok(0, "unexpected call\n");
870 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
872 ok(0, "unexpected call\n");
876 static HRESULT WINAPI Stream_Revert(IStream *iface)
878 ok(0, "unexpected call\n");
882 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
883 ULARGE_INTEGER cb, DWORD dwLockType)
885 ok(0, "unexpected call\n");
889 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
890 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
892 ok(0, "unexpected call\n");
896 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
899 ok(0, "unexpected call\n");
903 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
905 ok(0, "unexpected call\n");
909 static const IStreamVtbl StreamVtbl = {
910 Stream_QueryInterface,
926 static IStream Stream = { &StreamVtbl };
928 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
930 if(IsEqualGUID(&IID_IWinInetHttpInfo, riid))
931 return E_NOINTERFACE; /* TODO */
933 if(IsEqualGUID(&IID_IWinInetInfo, riid))
934 return E_NOINTERFACE; /* TODO */
936 ok(0, "unexpected call\n");
937 return E_NOINTERFACE;
940 static ULONG WINAPI Binding_AddRef(IBinding *iface)
945 static ULONG WINAPI Binding_Release(IBinding *iface)
950 static HRESULT WINAPI Binding_Abort(IBinding *iface)
956 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
958 ok(0, "unexpected call\n");
962 static HRESULT WINAPI Binding_Resume(IBinding *iface)
964 ok(0, "unexpected call\n");
968 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
970 ok(0, "unexpected call\n");
974 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
976 ok(0, "unexpected call\n");
980 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
981 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
983 CHECK_EXPECT(GetBindResult);
987 static const IBindingVtbl BindingVtbl = {
988 Binding_QueryInterface,
996 Binding_GetBindResult
999 static IBinding Binding = { &BindingVtbl };
1001 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1002 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1004 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1008 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1009 return E_NOINTERFACE; /* TODO */
1010 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1011 return E_NOINTERFACE; /* TODO */
1013 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1014 return E_NOINTERFACE;
1017 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1022 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1027 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1029 CHECK_EXPECT(GetClassID);
1030 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1034 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1036 ok(0, "unexpected call\n");
1040 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1042 ok(0, "unexpected call\n");
1046 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1048 ok(0, "unexpected call\n");
1052 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1054 ok(0, "unexpected call\n");
1058 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1059 REFIID riidResult, void **ppvResult)
1061 ok(0, "unexpected call\n");
1065 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1066 REFIID riid, void **ppv)
1068 IBindStatusCallback *callback = NULL;
1069 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1070 STGMEDIUM stgmedium;
1075 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1076 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1078 CHECK_EXPECT(BindToStorage);
1080 load_state = LD_LOADING;
1082 ok(pbc != NULL, "pbc == NULL\n");
1083 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1084 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1085 ok(ppv != NULL, "ppv == NULL\n");
1086 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1088 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1089 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1090 ok(callback != NULL, "callback == NULL\n");
1092 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1093 bindinfo.cbSize = sizeof(bindinfo);
1095 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1096 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1097 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1098 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1099 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1100 /* TODO: test stgmedData */
1101 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1102 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1103 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1104 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1105 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1106 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1107 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1108 /* TODO: test dwCodePage */
1109 /* TODO: test securityAttributes */
1110 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1111 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1112 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1114 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1115 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1117 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1119 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1121 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1122 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1123 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1126 stgmedium.tymed = TYMED_ISTREAM;
1127 U(stgmedium).pstm = &Stream;
1128 stgmedium.pUnkForRelease = (IUnknown*)iface;
1129 hres = IBindStatusCallback_OnDataAvailable(callback,
1130 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1131 sizeof(html_page)-1, &formatetc, &stgmedium);
1132 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1135 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1136 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1137 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1139 SET_EXPECT(GetBindResult);
1140 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1141 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1142 SET_CALLED(GetBindResult); /* IE7 */
1144 IBindStatusCallback_Release(callback);
1149 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1150 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1152 ok(0, "unexpected call\n");
1156 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1157 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1159 ok(0, "unexpected call\n");
1163 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1165 ok(0, "unexpected call\n");
1169 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1171 ok(0, "unexpected call\n");
1175 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1177 ok(0, "unexpected call\n");
1181 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1182 IMoniker *pmkNewlyRunning)
1184 ok(0, "unexpected call\n");
1188 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1189 IMoniker *pmkToLeft, FILETIME *pFileTime)
1191 ok(0, "unexpected call\n");
1195 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1197 ok(0, "unexpected call\n");
1201 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1202 IMoniker **ppmkPrefix)
1204 ok(0, "unexpected call\n");
1208 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1209 IMoniker **pmkRelPath)
1211 ok(0, "unexpected call\n");
1215 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1216 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1218 CHECK_EXPECT2(GetDisplayName);
1220 /* ok(pbc != NULL, "pbc == NULL\n"); */
1221 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1222 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1224 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1225 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1230 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1231 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1233 ok(0, "unexpected call\n");
1237 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1239 CHECK_EXPECT(IsSystemMoniker);
1243 static const IMonikerVtbl MonikerVtbl = {
1244 Moniker_QueryInterface,
1252 Moniker_BindToObject,
1253 Moniker_BindToStorage,
1255 Moniker_ComposeWith,
1260 Moniker_GetTimeOfLastChange,
1262 Moniker_CommonPrefixWith,
1263 Moniker_RelativePathTo,
1264 Moniker_GetDisplayName,
1265 Moniker_ParseDisplayName,
1266 Moniker_IsSystemMoniker
1269 static IMoniker Moniker = { &MonikerVtbl };
1271 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1273 return QueryInterface(riid, ppv);
1276 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1281 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1286 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1287 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1289 ok(0, "unexpected call\n");
1293 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1294 IEnumUnknown **ppenum)
1296 ok(0, "unexpected call\n");
1300 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1302 CHECK_EXPECT(LockContainer);
1303 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1307 static const IOleContainerVtbl OleContainerVtbl = {
1308 OleContainer_QueryInterface,
1309 OleContainer_AddRef,
1310 OleContainer_Release,
1311 OleContainer_ParseDisplayName,
1312 OleContainer_EnumObjects,
1313 OleContainer_LockContainer
1316 static IOleContainer OleContainer = { &OleContainerVtbl };
1318 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1320 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1322 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1323 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1326 return E_NOINTERFACE;
1329 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1334 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1339 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1341 CHECK_EXPECT(Frame_GetWindow);
1345 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1347 ok(0, "unexpected call\n");
1351 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1353 ok(0, "unexpected call\n");
1357 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1358 LPCBORDERWIDTHS pborderwidths)
1360 ok(0, "unexpected call\n");
1364 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1365 LPCBORDERWIDTHS pborderwidths)
1367 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1371 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1372 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1374 static const WCHAR wszHTML_Document[] =
1375 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1377 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1379 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1380 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1381 if(pActiveObject && is_english())
1382 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1385 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1386 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1388 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1392 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1393 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1395 static const WCHAR wszHTML_Document[] =
1396 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1399 CHECK_EXPECT2(SetActiveObject);
1401 if(pActiveObject && is_english())
1402 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1404 CHECK_EXPECT(SetActiveObject_null);
1406 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1407 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1413 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1414 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1416 ok(0, "unexpected call\n");
1420 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1421 HOLEMENU holemenu, HWND hwndActiveObject)
1423 ok(0, "unexpected call\n");
1427 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1429 ok(0, "unexpected call\n");
1433 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1435 CHECK_EXPECT2(SetStatusText);
1436 if(!expect_status_text)
1437 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1441 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1444 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1446 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1450 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1452 ok(0, "unexpected call\n");
1456 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1457 InPlaceFrame_QueryInterface,
1458 InPlaceFrame_AddRef,
1459 InPlaceFrame_Release,
1460 InPlaceFrame_GetWindow,
1461 InPlaceFrame_ContextSensitiveHelp,
1462 InPlaceFrame_GetBorder,
1463 InPlaceFrame_RequestBorderSpace,
1464 InPlaceFrame_SetBorderSpace,
1465 InPlaceFrame_SetActiveObject,
1466 InPlaceFrame_InsertMenus,
1467 InPlaceFrame_SetMenu,
1468 InPlaceFrame_RemoveMenus,
1469 InPlaceFrame_SetStatusText,
1470 InPlaceFrame_EnableModeless,
1471 InPlaceFrame_TranslateAccelerator
1474 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1476 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1477 InPlaceFrame_QueryInterface,
1478 InPlaceFrame_AddRef,
1479 InPlaceFrame_Release,
1480 InPlaceFrame_GetWindow,
1481 InPlaceFrame_ContextSensitiveHelp,
1482 InPlaceFrame_GetBorder,
1483 InPlaceFrame_RequestBorderSpace,
1484 InPlaceFrame_SetBorderSpace,
1485 InPlaceUIWindow_SetActiveObject,
1488 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1490 static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSiteEx *iface, REFIID riid, void **ppv)
1492 return QueryInterface(riid, ppv);
1495 static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSiteEx *iface)
1500 static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSiteEx *iface)
1505 static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSiteEx *iface, HWND *phwnd)
1507 CHECK_EXPECT2(GetWindow);
1508 ok(phwnd != NULL, "phwnd = NULL\n");
1509 *phwnd = container_hwnd;
1513 static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx *iface, BOOL fEnterMode)
1515 ok(0, "unexpected call\n");
1519 static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx *iface)
1521 CHECK_EXPECT(CanInPlaceActivate);
1525 static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx *iface)
1527 CHECK_EXPECT(OnInPlaceActivate);
1528 inplace_deactivated = FALSE;
1532 static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSiteEx *iface)
1534 CHECK_EXPECT(OnUIActivate);
1538 static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
1539 IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1540 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1542 static const RECT rect = {0,0,500,500};
1544 CHECK_EXPECT(GetWindowContext);
1546 ok(ppFrame != NULL, "ppFrame = NULL\n");
1548 *ppFrame = &InPlaceFrame;
1549 ok(ppDoc != NULL, "ppDoc = NULL\n");
1551 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1552 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1554 memcpy(lprcPosRect, &rect, sizeof(RECT));
1555 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1557 memcpy(lprcClipRect, &rect, sizeof(RECT));
1558 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1560 lpFrameInfo->cb = sizeof(*lpFrameInfo);
1561 lpFrameInfo->fMDIApp = FALSE;
1562 lpFrameInfo->hwndFrame = container_hwnd;
1563 lpFrameInfo->haccel = NULL;
1564 lpFrameInfo->cAccelEntries = 0;
1570 static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSiteEx *iface, SIZE scrollExtant)
1572 ok(0, "unexpected call\n");
1576 static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx *iface, BOOL fUndoable)
1578 CHECK_EXPECT(OnUIDeactivate);
1579 ok(!fUndoable, "fUndoable = TRUE\n");
1583 static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface)
1585 CHECK_EXPECT(OnInPlaceDeactivate);
1586 inplace_deactivated = TRUE;
1590 static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSiteEx *iface)
1592 ok(0, "unexpected call\n");
1596 static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx *iface)
1598 ok(0, "unexpected call\n");
1602 static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSiteEx *iface, LPCRECT lprcPosRect)
1604 ok(0, "unexpected call\n");
1608 static HRESULT WINAPI InPlaceSiteEx_OnInPlaceActivateEx(IOleInPlaceSiteEx *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1610 CHECK_EXPECT(OnInPlaceActivateEx);
1612 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1613 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1614 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1619 static HRESULT WINAPI InPlaceSiteEx_OnInPlaceDeactivateEx(IOleInPlaceSiteEx *iface, BOOL fNoRedraw)
1621 CHECK_EXPECT(OnInPlaceDeactivateEx);
1623 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1628 static HRESULT WINAPI InPlaceSiteEx_RequestUIActivate(IOleInPlaceSiteEx *iface)
1630 CHECK_EXPECT(RequestUIActivate);
1634 static const IOleInPlaceSiteExVtbl InPlaceSiteVtbl = {
1635 InPlaceSite_QueryInterface,
1637 InPlaceSite_Release,
1638 InPlaceSite_GetWindow,
1639 InPlaceSite_ContextSensitiveHelp,
1640 InPlaceSite_CanInPlaceActivate,
1641 InPlaceSite_OnInPlaceActivate,
1642 InPlaceSite_OnUIActivate,
1643 InPlaceSite_GetWindowContext,
1645 InPlaceSite_OnUIDeactivate,
1646 InPlaceSite_OnInPlaceDeactivate,
1647 InPlaceSite_DiscardUndoState,
1648 InPlaceSite_DeactivateAndUndo,
1649 InPlaceSite_OnPosRectChange,
1650 InPlaceSiteEx_OnInPlaceActivateEx,
1651 InPlaceSiteEx_OnInPlaceDeactivateEx,
1652 InPlaceSiteEx_RequestUIActivate
1655 static IOleInPlaceSiteEx InPlaceSiteEx = { &InPlaceSiteVtbl };
1657 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1659 return QueryInterface(riid, ppv);
1662 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1667 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1672 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1674 ok(0, "unexpected call\n");
1678 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1681 ok(0, "unexpected call\n");
1685 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1687 CHECK_EXPECT(GetContainer);
1688 ok(ppContainer != NULL, "ppContainer = NULL\n");
1689 *ppContainer = &OleContainer;
1693 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1695 ok(0, "unexpected call\n");
1699 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1701 ok(0, "unexpected call\n");
1705 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1707 ok(0, "unexpected call\n");
1711 static const IOleClientSiteVtbl ClientSiteVtbl = {
1712 ClientSite_QueryInterface,
1715 ClientSite_SaveObject,
1716 ClientSite_GetMoniker,
1717 ClientSite_GetContainer,
1718 ClientSite_ShowObject,
1719 ClientSite_OnShowWindow,
1720 ClientSite_RequestNewObjectLayout
1723 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1725 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
1727 return QueryInterface(riid, ppv);
1730 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
1735 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
1742 CallUIActivate_None,
1743 CallUIActivate_ActivateMe,
1744 CallUIActivate_AfterShow,
1747 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
1748 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
1750 IOleDocument *document;
1753 CHECK_EXPECT(ActivateMe);
1754 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
1756 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
1757 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
1759 if(SUCCEEDED(hres)) {
1760 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteEx, NULL, 0, &view);
1761 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
1763 if(SUCCEEDED(hres)) {
1764 IOleInPlaceActiveObject *activeobj = NULL;
1765 IOleInPlaceSite *inplacesite = NULL;
1766 HWND tmp_hwnd = NULL;
1767 static RECT rect = {0,0,400,500};
1769 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1770 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1771 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteEx, "inplacesite=%p, expected %p\n",
1772 inplacesite, &InPlaceSiteEx);
1774 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteEx);
1775 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
1777 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
1778 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
1779 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteEx, "inplacesite=%p, expected %p\n",
1780 inplacesite, &InPlaceSiteEx);
1782 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
1783 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
1786 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1787 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1788 ok(hwnd == NULL, "hwnd=%p, expeted NULL\n", hwnd);
1791 if(call_UIActivate == CallUIActivate_ActivateMe) {
1792 SET_EXPECT(CanInPlaceActivate);
1793 SET_EXPECT(GetWindowContext);
1794 SET_EXPECT(GetWindow);
1796 SET_EXPECT(OnInPlaceActivateEx);
1798 SET_EXPECT(OnInPlaceActivate);
1799 SET_EXPECT(SetStatusText);
1800 SET_EXPECT(Exec_SETPROGRESSMAX);
1801 SET_EXPECT(Exec_SETPROGRESSPOS);
1802 SET_EXPECT(OnUIActivate);
1803 SET_EXPECT(SetActiveObject);
1805 expect_status_text = NULL;
1807 hres = IOleDocumentView_UIActivate(view, TRUE);
1808 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1810 CHECK_CALLED(CanInPlaceActivate);
1811 CHECK_CALLED(GetWindowContext);
1812 CHECK_CALLED(GetWindow);
1814 CHECK_CALLED(OnInPlaceActivateEx);
1816 CHECK_CALLED(OnInPlaceActivate);
1817 CHECK_CALLED(SetStatusText);
1818 CHECK_CALLED(Exec_SETPROGRESSMAX);
1819 CHECK_CALLED(Exec_SETPROGRESSPOS);
1820 CHECK_CALLED(OnUIActivate);
1821 CHECK_CALLED(SetActiveObject);
1822 CHECK_CALLED(ShowUI);
1825 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1826 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1827 ok(hwnd != NULL, "hwnd == NULL\n");
1829 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
1832 hres = IOleDocumentView_UIActivate(view, TRUE);
1833 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
1836 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
1837 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1838 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
1842 hres = IOleDocumentView_SetRect(view, &rect);
1843 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
1845 if(call_UIActivate == CallUIActivate_ActivateMe) {
1846 hres = IOleDocumentView_Show(view, TRUE);
1847 ok(hres == S_OK, "Show failed: %08x\n", hres);
1849 SET_EXPECT(CanInPlaceActivate);
1850 SET_EXPECT(GetWindowContext);
1851 SET_EXPECT(GetWindow);
1853 SET_EXPECT(OnInPlaceActivateEx);
1855 SET_EXPECT(OnInPlaceActivate);
1856 SET_EXPECT(SetStatusText);
1857 SET_EXPECT(Exec_SETPROGRESSMAX);
1858 SET_EXPECT(Exec_SETPROGRESSPOS);
1859 SET_EXPECT(OnUIActivate);
1860 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
1862 hres = IOleDocumentView_Show(view, TRUE);
1864 win_skip("Show failed\n");
1866 IOleInPlaceActiveObject_Release(activeobj);
1867 IOleDocument_Release(document);
1871 ok(hres == S_OK, "Show failed: %08x\n", hres);
1873 CHECK_CALLED(CanInPlaceActivate);
1874 CHECK_CALLED(GetWindowContext);
1875 CHECK_CALLED(GetWindow);
1877 CHECK_CALLED(OnInPlaceActivateEx);
1879 CHECK_CALLED(OnInPlaceActivate);
1880 CHECK_CALLED(SetStatusText);
1881 CHECK_CALLED(Exec_SETPROGRESSMAX);
1882 CHECK_CALLED(Exec_SETPROGRESSPOS);
1885 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
1886 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
1887 ok(hwnd != NULL, "hwnd == NULL\n");
1889 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
1893 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
1896 IOleInPlaceActiveObject_Release(activeobj);
1899 IOleDocument_Release(document);
1905 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
1906 DocumentSite_QueryInterface,
1907 DocumentSite_AddRef,
1908 DocumentSite_Release,
1909 DocumentSite_ActivateMe
1912 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
1914 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
1916 return QueryInterface(riid, ppv);
1919 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
1924 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
1929 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
1931 ok(0, "unexpected call\n");
1935 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
1937 ok(0, "unexpected call\n");
1941 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
1943 ok(0, "unexpected call\n");
1947 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
1948 POINTF *pPtfContainer, DWORD dwFlags)
1950 ok(0, "unexpected call\n");
1954 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
1955 MSG *pMsg, DWORD grfModifiers)
1957 ok(0, "unexpected call\n");
1961 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
1964 CHECK_EXPECT(OnFocus_TRUE);
1966 CHECK_EXPECT2(OnFocus_FALSE);
1970 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
1972 ok(0, "unexpected call\n");
1976 static const IOleControlSiteVtbl OleControlSiteVtbl = {
1977 OleControlSite_QueryInterface,
1978 OleControlSite_AddRef,
1979 OleControlSite_Release,
1980 OleControlSite_OnControlInfoChanged,
1981 OleControlSite_LockInPlaceActive,
1982 OleControlSite_GetExtendedControl,
1983 OleControlSite_TransformCoords,
1984 OleControlSite_TranslateAccelerator,
1985 OleControlSite_OnFocus,
1986 OleControlSite_ShowPropertyFrame
1989 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
1991 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
1993 return QueryInterface(riid, ppv);
1996 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2001 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2006 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2007 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2009 ok(0, "unexpected call\n");
2013 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2015 CHECK_EXPECT(GetHostInfo);
2016 ok(pInfo != NULL, "pInfo=NULL\n");
2018 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2019 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2020 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2021 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2022 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2023 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2024 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2025 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2030 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2031 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2032 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2034 CHECK_EXPECT(ShowUI);
2037 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2039 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2040 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2041 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2042 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2043 if (expect_InPlaceUIWindow_SetActiveObject_active)
2044 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2046 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2051 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2053 CHECK_EXPECT(HideUI);
2057 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2059 CHECK_EXPECT(UpdateUI);
2063 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2066 CHECK_EXPECT2(EnableModeless_TRUE);
2068 CHECK_EXPECT2(EnableModeless_FALSE);
2072 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2074 ok(0, "unexpected call\n");
2078 static BOOL expect_OnFrameWindowActivate_fActivate;
2079 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2081 CHECK_EXPECT2(OnFrameWindowActivate);
2082 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2086 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2087 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2089 ok(0, "unexpected call\n");
2093 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2094 const GUID *pguidCmdGroup, DWORD nCmdID)
2096 ok(0, "unexpected call\n");
2100 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2101 LPOLESTR *pchKey, DWORD dw)
2103 CHECK_EXPECT(GetOptionKeyPath);
2104 ok(pchKey != NULL, "pchKey = NULL\n");
2105 ok(!dw, "dw=%d, expected 0\n", dw);
2107 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2111 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2112 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2114 CHECK_EXPECT(GetDropTarget);
2119 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2121 CHECK_EXPECT(GetExternal);
2122 *ppDispatch = &External;
2126 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2127 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2129 CHECK_EXPECT(TranslateUrl);
2130 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2131 ok(!strcmp_wa(pchURLIn, "about:blank"), "pchURLIn = %s\n", wine_dbgstr_w(pchURLIn));
2132 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2133 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2138 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2139 IDataObject **ppPORet)
2141 ok(0, "unexpected call\n");
2145 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2146 LPOLESTR *pchKey, DWORD dw)
2148 CHECK_EXPECT(GetOverrideKeyPath);
2149 ok(pchKey != NULL, "pchKey = NULL\n");
2151 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2152 ok(!dw, "dw=%d, xepected 0\n", dw);
2156 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2157 DocHostUIHandler_QueryInterface,
2158 DocHostUIHandler_AddRef,
2159 DocHostUIHandler_Release,
2160 DocHostUIHandler_ShowContextMenu,
2161 DocHostUIHandler_GetHostInfo,
2162 DocHostUIHandler_ShowUI,
2163 DocHostUIHandler_HideUI,
2164 DocHostUIHandler_UpdateUI,
2165 DocHostUIHandler_EnableModeless,
2166 DocHostUIHandler_OnDocWindowActivate,
2167 DocHostUIHandler_OnFrameWindowActivate,
2168 DocHostUIHandler_ResizeBorder,
2169 DocHostUIHandler_TranslateAccelerator,
2170 DocHostUIHandler_GetOptionKeyPath,
2171 DocHostUIHandler_GetDropTarget,
2172 DocHostUIHandler_GetExternal,
2173 DocHostUIHandler_TranslateUrl,
2174 DocHostUIHandler_FilterDataObject,
2175 DocHostUIHandler_GetOverrideKeyPath
2178 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2180 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2181 REFIID riid, void **ppv)
2183 return QueryInterface(riid, ppv);
2186 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2191 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2196 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2197 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2199 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2200 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2201 ok(!pCmdText, "pCmdText != NULL\n");
2203 switch(prgCmds[0].cmdID) {
2204 case OLECMDID_SETPROGRESSTEXT:
2205 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2206 prgCmds[0].cmdf = OLECMDF_ENABLED;
2209 CHECK_EXPECT(QueryStatus_OPEN);
2210 prgCmds[0].cmdf = 0;
2213 CHECK_EXPECT(QueryStatus_NEW);
2214 prgCmds[0].cmdf = 0;
2217 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2223 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2224 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2226 if(!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2227 test_readyState(NULL);
2229 if(!pguidCmdGroup) {
2231 case OLECMDID_SETPROGRESSMAX:
2232 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2233 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2234 ok(pvaIn != NULL, "pvaIn == NULL\n");
2236 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2237 if(load_state == LD_NO)
2238 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2240 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2242 case OLECMDID_SETPROGRESSPOS:
2243 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2244 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2245 ok(pvaIn != NULL, "pvaIn == NULL\n");
2247 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2248 if(load_state == LD_NO)
2249 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2251 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2253 case OLECMDID_HTTPEQUIV_DONE:
2254 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2255 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2256 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2257 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2258 load_state = LD_COMPLETE;
2260 case OLECMDID_SETDOWNLOADSTATE:
2261 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2262 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2263 ok(pvaIn != NULL, "pvaIn == NULL\n");
2264 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2266 switch(V_I4(pvaIn)) {
2268 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2269 load_state = LD_INTERACTIVE;
2272 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2273 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2276 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2280 case OLECMDID_UPDATECOMMANDS:
2281 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2282 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2283 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2284 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2286 case OLECMDID_SETTITLE:
2287 CHECK_EXPECT2(Exec_SETTITLE);
2288 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2289 ok(pvaIn != NULL, "pvaIn == NULL\n");
2290 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2291 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2292 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2294 case OLECMDID_HTTPEQUIV:
2295 CHECK_EXPECT2(Exec_HTTPEQUIV);
2296 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2297 ok(pvaIn != NULL, "pvaIn == NULL\n");
2298 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2299 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2300 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2301 test_readyState(NULL);
2304 ok(0, "unexpected command %d\n", nCmdID);
2309 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2310 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2314 CHECK_EXPECT2(Exec_ShellDocView_37);
2316 if(load_from_stream)
2317 test_GetCurMoniker(doc_unk, NULL, about_blank_url);
2319 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2321 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2322 ok(pvaIn != NULL, "pvaIn == NULL\n");
2324 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2325 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2329 CHECK_EXPECT2(Exec_ShellDocView_84);
2331 ok(pvaIn == NULL, "pvaIn != NULL\n");
2332 ok(pvaOut != NULL, "pvaOut == NULL\n");
2334 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2339 CHECK_EXPECT2(Exec_ShellDocView_103);
2341 ok(pvaIn == NULL, "pvaIn != NULL\n");
2342 ok(pvaOut == NULL, "pvaOut != NULL\n");
2347 CHECK_EXPECT2(Exec_ShellDocView_105);
2349 ok(pvaIn != NULL, "pvaIn == NULL\n");
2350 ok(pvaOut == NULL, "pvaOut != NULL\n");
2355 CHECK_EXPECT2(Exec_ShellDocView_140);
2357 ok(pvaIn == NULL, "pvaIn != NULL\n");
2358 ok(pvaOut == NULL, "pvaOut != NULL\n");
2363 ok(0, "unexpected command %d\n", nCmdID);
2368 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2369 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2372 case IDM_PARSECOMPLETE:
2373 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2374 ok(pvaIn == NULL, "pvaIn != NULL\n");
2375 ok(pvaOut == NULL, "pvaOut != NULL\n");
2378 ok(0, "unexpected command %d\n", nCmdID);
2382 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup))
2383 return E_FAIL; /* TODO */
2385 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2386 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2390 CHECK_EXPECT2(Exec_Explorer_69);
2391 ok(pvaIn == NULL, "pvaIn != NULL\n");
2392 ok(pvaOut != NULL, "pvaOut == NULL\n");
2395 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2400 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2402 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2403 SET_EXPECT(SetStatusText);
2404 ok(pvaIn == NULL, "pvaIn != NULL\n");
2405 ok(pvaOut == NULL, "pvaOut != NULL\n");
2407 case OLECMDID_SHOWSCRIPTERROR:
2411 ok(0, "unexpected command %d\n", nCmdID);
2416 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2420 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2421 OleCommandTarget_QueryInterface,
2422 OleCommandTarget_AddRef,
2423 OleCommandTarget_Release,
2424 OleCommandTarget_QueryStatus,
2425 OleCommandTarget_Exec
2428 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2430 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2432 return QueryInterface(riid, ppv);
2435 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2436 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2437 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2439 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2440 ok(pDispParams != NULL, "pDispParams == NULL\n");
2441 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2442 ok(puArgErr != NULL, "puArgErr == NULL\n");
2443 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2444 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2445 test_readyState(NULL);
2447 switch(dispIdMember) {
2448 case DISPID_AMBIENT_USERMODE:
2449 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2450 V_VT(pVarResult) = VT_BOOL;
2451 V_BOOL(pVarResult) = VARIANT_TRUE;
2453 case DISPID_AMBIENT_DLCONTROL:
2454 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2456 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2457 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2459 case DISPID_AMBIENT_SILENT:
2460 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2461 V_VT(pVarResult) = VT_BOOL;
2462 V_BOOL(pVarResult) = VARIANT_FALSE;
2464 case DISPID_AMBIENT_USERAGENT:
2465 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2467 case DISPID_AMBIENT_PALETTE:
2468 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2472 ok(0, "unexpected dispid %d\n", dispIdMember);
2476 static IDispatchVtbl DispatchVtbl = {
2477 Dispatch_QueryInterface,
2480 Dispatch_GetTypeInfoCount,
2481 Dispatch_GetTypeInfo,
2482 Dispatch_GetIDsOfNames,
2486 static IDispatch Dispatch = { &DispatchVtbl };
2488 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
2489 REFIID riid, void **ppv)
2491 return QueryInterface(riid, ppv);
2494 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
2499 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
2504 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
2505 REFIID riid, void **ppv)
2508 * Services used by HTMLDocument:
2511 * IInternetSecurityManager
2513 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
2516 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
2517 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
2518 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
2520 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
2521 * IElementBehaviorFactory
2522 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
2532 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
2533 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
2538 return E_NOINTERFACE;
2541 static const IServiceProviderVtbl ServiceProviderVtbl = {
2542 ServiceProvider_QueryInterface,
2543 ServiceProvider_AddRef,
2544 ServiceProvider_Release,
2545 ServiceProvider_QueryService
2548 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
2550 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
2551 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
2552 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
2553 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
2554 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
2556 static HRESULT QueryInterface(REFIID riid, void **ppv)
2560 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
2562 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
2563 *ppv = &DocumentSite;
2564 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
2565 *ppv = &DocHostUIHandler;
2566 else if(IsEqualGUID(&IID_IOleContainer, riid))
2567 *ppv = &OleContainer;
2568 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
2569 *ppv = &InPlaceSiteEx;
2570 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
2571 *ppv = &OleCommandTarget;
2572 else if(IsEqualGUID(&IID_IDispatch, riid))
2574 else if(IsEqualGUID(&IID_IServiceProvider, riid))
2575 *ppv = &ServiceProvider;
2576 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
2577 *ppv = ipsex ? &InPlaceSiteEx : NULL;
2578 else if(IsEqualGUID(&IID_IOleControlSite, riid))
2579 *ppv = &OleControlSite;
2580 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2581 return E_NOINTERFACE; /* TODO */
2582 else if(IsEqualGUID(&IID_IProxyManager, riid))
2583 return E_NOINTERFACE; /* ? */
2584 else if(IsEqualGUID(&IID_unk1, riid))
2585 return E_NOINTERFACE; /* HTMLWindow2 ? */
2586 else if(IsEqualGUID(&IID_IThumbnailView, riid))
2587 return E_NOINTERFACE; /* ? */
2588 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
2589 return E_NOINTERFACE; /* ? */
2590 else if(IsEqualGUID(&IID_unk4, riid))
2591 return E_NOINTERFACE; /* ? */
2592 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
2593 return E_NOINTERFACE; /* ? */
2595 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
2599 return E_NOINTERFACE;
2602 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2604 return DefWindowProc(hwnd, msg, wParam, lParam);
2607 static void test_doscroll(IUnknown *unk)
2609 IHTMLDocument3 *doc;
2610 IHTMLElement2 *elem2;
2615 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
2616 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
2620 hres = IHTMLDocument3_get_documentElement(doc, &elem);
2621 IHTMLDocument3_Release(doc);
2622 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
2623 switch(load_state) {
2626 ok(!elem, "elem != NULL\n");
2629 case LD_INTERACTIVE:
2631 ok(elem != NULL, "elem == NULL\n");
2636 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2637 IHTMLElement_Release(elem);
2638 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2641 V_BSTR(&v) = a2bstr("left");
2642 hres = IHTMLElement2_doScroll(elem2, v);
2643 SysFreeString(V_BSTR(&v));
2644 IHTMLElement2_Release(elem2);
2646 if(inplace_deactivated)
2647 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
2648 else if(load_state == LD_COMPLETE)
2649 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
2651 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
2654 static void _test_readyState(unsigned line, IUnknown *unk)
2656 IHTMLDocument2 *htmldoc;
2657 DISPPARAMS dispparams;
2663 static const LPCSTR expected_state[] = {
2675 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
2676 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2680 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
2681 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
2683 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
2684 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
2686 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
2687 load_state = LD_INTERACTIVE;
2690 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
2691 wine_dbgstr_w(state), load_state);
2692 SysFreeString(state);
2694 hres = IHTMLDocument2_get_body(htmldoc, &elem);
2695 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
2697 IHTMLElement2 *elem2;
2700 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
2701 IHTMLElement_Release(elem);
2702 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
2704 hres = IHTMLElement2_get_readyState(elem2, &var);
2705 IHTMLElement2_Release(elem2);
2706 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2707 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
2708 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
2711 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
2714 dispparams.cArgs = 0;
2715 dispparams.cNamedArgs = 0;
2716 dispparams.rgdispidNamedArgs = NULL;
2717 dispparams.rgvarg = NULL;
2721 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
2722 &dispparams, &out, NULL, NULL);
2723 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
2725 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
2726 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
2728 test_doscroll((IUnknown*)htmldoc);
2730 IHTMLDocument2_Release(htmldoc);
2733 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
2735 IConnectionPointContainer *tmp_container = NULL;
2736 IConnectionPoint *cp;
2740 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
2741 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
2745 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
2746 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
2747 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
2749 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
2750 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
2752 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
2753 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
2754 ok(tmp_container == container, "container != tmp_container\n");
2756 IConnectionPointContainer_Release(tmp_container);
2758 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
2759 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
2761 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
2764 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
2765 ok(hres == S_OK, "Advise failed: %08x\n", hres);
2768 IConnectionPoint_Release(cp);
2771 static void test_ConnectionPointContainer(IUnknown *unk)
2773 IConnectionPointContainer *container;
2776 hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
2777 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
2781 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
2782 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
2783 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
2785 IConnectionPointContainer_Release(container);
2788 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
2792 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
2794 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
2796 test_readyState((IUnknown*)persist);
2800 CreateBindCtx(0, &bind);
2801 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
2802 (IUnknown*)&ClientSite);
2805 SET_EXPECT(GetDisplayName);
2806 if(!set_clientsite) {
2807 SET_EXPECT(Invoke_AMBIENT_USERMODE);
2808 SET_EXPECT(GetHostInfo);
2809 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
2810 SET_EXPECT(Invoke_AMBIENT_SILENT);
2811 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2812 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
2813 SET_EXPECT(Invoke_AMBIENT_PALETTE);
2814 SET_EXPECT(GetOptionKeyPath);
2815 SET_EXPECT(GetOverrideKeyPath);
2816 SET_EXPECT(GetWindow);
2817 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
2818 SET_EXPECT(Exec_SETPROGRESSMAX);
2819 SET_EXPECT(Exec_SETPROGRESSPOS);
2820 SET_EXPECT(Exec_ShellDocView_37);
2822 if(!container_locked) {
2823 SET_EXPECT(GetContainer);
2824 SET_EXPECT(LockContainer);
2826 SET_EXPECT(OnChanged_READYSTATE);
2827 SET_EXPECT(Exec_ShellDocView_84);
2828 SET_EXPECT(IsSystemMoniker);
2830 SET_EXPECT(BindToStorage);
2831 SET_EXPECT(SetActiveObject);
2832 if(set_clientsite) {
2833 SET_EXPECT(Invoke_AMBIENT_SILENT);
2834 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2835 SET_EXPECT(Exec_ShellDocView_37);
2837 load_state = LD_DOLOAD;
2838 expect_LockContainer_fLock = TRUE;
2839 readystate_set_loading = TRUE;
2841 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
2842 ok(hres == S_OK, "Load failed: %08x\n", hres);
2845 CHECK_CALLED(GetDisplayName);
2846 if(!set_clientsite) {
2847 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
2848 CHECK_CALLED(GetHostInfo);
2849 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
2850 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2851 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2852 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
2853 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
2854 CHECK_CALLED(GetOptionKeyPath);
2855 CHECK_CALLED(GetOverrideKeyPath);
2856 CHECK_CALLED(GetWindow);
2857 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
2858 CHECK_CALLED(Exec_SETPROGRESSMAX);
2859 CHECK_CALLED(Exec_SETPROGRESSPOS);
2860 CHECK_CALLED(Exec_ShellDocView_37);
2862 if(!container_locked) {
2863 CHECK_CALLED(GetContainer);
2864 CHECK_CALLED(LockContainer);
2865 container_locked = TRUE;
2867 CHECK_CALLED(OnChanged_READYSTATE);
2868 SET_CALLED(IsSystemMoniker); /* IE7 */
2869 SET_CALLED(Exec_ShellDocView_84);
2871 CHECK_CALLED(BindToStorage);
2872 SET_CALLED(SetActiveObject); /* FIXME */
2873 if(set_clientsite) {
2874 CHECK_CALLED(Invoke_AMBIENT_SILENT);
2875 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2876 CHECK_CALLED(Exec_ShellDocView_37);
2879 set_clientsite = container_locked = TRUE;
2881 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
2883 IBindCtx_Release(bind);
2885 test_readyState((IUnknown*)persist);
2888 #define DWL_VERBDONE 0x0001
2889 #define DWL_CSS 0x0002
2890 #define DWL_TRYCSS 0x0004
2891 #define DWL_HTTP 0x0008
2893 static void test_download(DWORD flags)
2898 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
2899 ok(hwnd != NULL, "Could not find hidden window\n");
2901 test_readyState(NULL);
2903 if(flags & (DWL_VERBDONE|DWL_HTTP))
2904 SET_EXPECT(Exec_SETPROGRESSMAX);
2905 if((flags & DWL_VERBDONE) && !load_from_stream)
2906 SET_EXPECT(GetHostInfo);
2907 SET_EXPECT(SetStatusText);
2908 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
2909 SET_EXPECT(GetDropTarget);
2910 if(flags & DWL_TRYCSS)
2911 SET_EXPECT(Exec_ShellDocView_84);
2912 if(flags & DWL_CSS) {
2913 SET_EXPECT(CreateInstance);
2915 SET_EXPECT(LockRequest);
2916 SET_EXPECT(Terminate);
2917 SET_EXPECT(Protocol_Read);
2918 SET_EXPECT(UnlockRequest);
2920 SET_EXPECT(Exec_Explorer_69);
2921 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
2922 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
2923 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
2924 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
2925 if(doc_mon != &Moniker) {
2926 SET_EXPECT(OnChanged_1012);
2927 SET_EXPECT(Exec_HTTPEQUIV);
2928 SET_EXPECT(Exec_SETTITLE);
2930 SET_EXPECT(OnChanged_1005);
2931 SET_EXPECT(OnChanged_READYSTATE);
2932 SET_EXPECT(Exec_SETPROGRESSPOS);
2933 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
2934 SET_EXPECT(Exec_ShellDocView_103);
2935 SET_EXPECT(Exec_ShellDocView_105);
2936 SET_EXPECT(Exec_ShellDocView_140);
2937 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2938 SET_EXPECT(Exec_HTTPEQUIV_DONE);
2939 SET_EXPECT(SetStatusText);
2940 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
2942 while(!called_Exec_HTTPEQUIV_DONE && GetMessage(&msg, NULL, 0, 0)) {
2943 TranslateMessage(&msg);
2944 DispatchMessage(&msg);
2947 if(flags & DWL_VERBDONE)
2948 CHECK_CALLED(Exec_SETPROGRESSMAX);
2949 if(flags & DWL_HTTP)
2950 SET_CALLED(Exec_SETPROGRESSMAX);
2951 if((flags & DWL_VERBDONE) && !load_from_stream)
2952 CHECK_CALLED(GetHostInfo);
2953 CHECK_CALLED(SetStatusText);
2954 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
2955 CHECK_CALLED(GetDropTarget);
2956 if(flags & DWL_TRYCSS)
2957 SET_CALLED(Exec_ShellDocView_84);
2958 if(flags & DWL_CSS) {
2959 CHECK_CALLED(CreateInstance);
2960 CHECK_CALLED(Start);
2961 CHECK_CALLED(LockRequest);
2962 CHECK_CALLED(Terminate);
2963 CHECK_CALLED(Protocol_Read);
2964 CHECK_CALLED(UnlockRequest);
2966 SET_CALLED(Exec_Explorer_69);
2967 SET_CALLED(EnableModeless_TRUE); /* IE7 */
2968 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
2969 SET_CALLED(EnableModeless_FALSE); /* IE7 */
2970 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
2971 if(doc_mon != &Moniker) todo_wine {
2972 CHECK_CALLED(OnChanged_1012);
2973 CHECK_CALLED(Exec_HTTPEQUIV);
2974 CHECK_CALLED(Exec_SETTITLE);
2976 CHECK_CALLED(OnChanged_1005);
2977 CHECK_CALLED(OnChanged_READYSTATE);
2978 CHECK_CALLED(Exec_SETPROGRESSPOS);
2979 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
2980 SET_CALLED(Exec_ShellDocView_103);
2981 SET_CALLED(Exec_ShellDocView_105);
2982 SET_CALLED(Exec_ShellDocView_140);
2983 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
2984 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
2985 SET_CALLED(SetStatusText);
2987 load_state = LD_COMPLETE;
2989 test_readyState(NULL);
2992 static void test_Persist(IUnknown *unk, IMoniker *mon)
2994 IPersistMoniker *persist_mon;
2995 IPersistFile *persist_file;
2999 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&persist_file);
3000 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
3001 if(SUCCEEDED(hres)) {
3002 hres = IPersist_GetClassID(persist_file, NULL);
3003 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
3005 hres = IPersist_GetClassID(persist_file, &guid);
3006 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
3007 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
3009 IPersist_Release(persist_file);
3012 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&persist_mon);
3013 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
3014 if(SUCCEEDED(hres)) {
3015 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
3016 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
3018 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
3019 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
3020 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
3022 if(load_state == LD_DOLOAD)
3023 test_Load(persist_mon, mon);
3025 test_readyState(unk);
3027 IPersistMoniker_Release(persist_mon);
3031 static void test_put_href(IUnknown *unk)
3033 IHTMLLocation *location;
3034 IHTMLDocument2 *doc;
3038 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3039 ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
3042 hres = IHTMLDocument2_get_location(doc, &location);
3043 IHTMLDocument2_Release(doc);
3044 ok(hres == S_OK, "get_location failed: %08x\n", hres);
3045 ok(location != NULL, "location == NULL\n");
3047 SET_EXPECT(TranslateUrl);
3048 SET_EXPECT(Navigate);
3049 str = a2bstr("about:blank");
3050 hres = IHTMLLocation_put_href(location, str);
3052 ok(hres == S_OK, "put_href failed: %08x\n", hres);
3053 CHECK_CALLED(TranslateUrl);
3054 CHECK_CALLED(Navigate);
3056 IHTMLLocation_Release(location);
3059 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
3061 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
3062 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
3063 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
3064 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
3065 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
3066 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
3067 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
3068 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
3069 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
3070 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
3071 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
3072 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
3073 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
3074 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
3075 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
3076 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
3077 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
3078 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
3079 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
3080 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
3082 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
3083 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
3085 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
3087 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
3089 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
3090 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
3092 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
3093 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
3095 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
3097 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
3098 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
3101 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
3102 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
3104 IOleCommandTarget *cmdtrg;
3105 OLECMD olecmd = {cmdid, 0};
3108 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3109 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3113 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
3114 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
3116 IOleCommandTarget_Release(cmdtrg);
3118 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
3119 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
3122 static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
3127 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
3128 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
3129 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
3130 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
3131 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
3132 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
3133 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
3134 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
3135 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
3136 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
3137 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
3138 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
3139 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
3140 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
3141 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
3142 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
3145 static void test_OleCommandTarget(IUnknown *unk)
3147 IOleCommandTarget *cmdtrg;
3148 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
3152 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3153 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
3157 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3158 cmds[i].cmdID = i+1;
3159 cmds[i].cmdf = 0xf0f0;
3162 SET_EXPECT(QueryStatus_OPEN);
3163 SET_EXPECT(QueryStatus_NEW);
3164 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
3165 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3166 CHECK_CALLED(QueryStatus_OPEN);
3167 CHECK_CALLED(QueryStatus_NEW);
3169 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3170 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
3171 if(i+1 == OLECMDID_FIND)
3173 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
3174 i+1, cmds[i].cmdf, expect_cmds[i+1]);
3177 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
3178 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
3180 IOleCommandTarget_Release(cmdtrg);
3183 static void test_OleCommandTarget_fail(IUnknown *unk)
3185 IOleCommandTarget *cmdtrg;
3190 {OLECMDID_OPEN, 0xf0f0},
3191 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
3194 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3195 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
3199 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
3200 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
3202 SET_EXPECT(QueryStatus_OPEN);
3203 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
3204 CHECK_CALLED(QueryStatus_OPEN);
3206 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3207 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3208 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
3209 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
3210 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
3211 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
3212 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
3214 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
3215 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
3216 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
3218 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
3219 if(!expect_cmds[i]) {
3220 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
3221 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3222 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3223 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3227 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
3228 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3229 ok(hres == OLECMDERR_E_NOTSUPPORTED,
3230 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
3232 IOleCommandTarget_Release(cmdtrg);
3235 static void test_exec_onunload(IUnknown *unk)
3237 IOleCommandTarget *cmdtrg;
3241 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3242 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3246 memset(&var, 0x0a, sizeof(var));
3247 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3248 OLECMDEXECOPT_DODEFAULT, NULL, &var);
3249 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3250 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
3251 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
3253 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
3254 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3255 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
3257 IOleCommandTarget_Release(cmdtrg);
3260 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
3262 IOleCommandTarget *cmdtrg;
3265 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3266 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3273 load_state = LD_DOLOAD;
3276 SET_EXPECT(GetClassID);
3277 SET_EXPECT(SetStatusText);
3278 SET_EXPECT(Exec_ShellDocView_37);
3279 SET_EXPECT(GetHostInfo);
3281 SET_EXPECT(GetDisplayName);
3282 SET_EXPECT(Invoke_AMBIENT_SILENT);
3283 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3284 SET_EXPECT(OnChanged_READYSTATE);
3285 SET_EXPECT(IsSystemMoniker);
3286 SET_EXPECT(Exec_ShellDocView_84);
3288 SET_EXPECT(BindToStorage);
3289 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3292 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3294 expect_status_text = NULL;
3295 readystate_set_loading = TRUE;
3297 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3298 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3299 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3302 CHECK_CALLED(GetClassID);
3303 CHECK_CALLED(SetStatusText);
3304 CHECK_CALLED(Exec_ShellDocView_37);
3305 CHECK_CALLED(GetHostInfo);
3307 CHECK_CALLED(GetDisplayName);
3308 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3309 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3310 CHECK_CALLED(OnChanged_READYSTATE);
3311 SET_CALLED(IsSystemMoniker); /* IE7 */
3312 SET_CALLED(Exec_ShellDocView_84);
3314 CHECK_CALLED(BindToStorage);
3315 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3316 CHECK_CALLED(HideUI);
3317 CHECK_CALLED(ShowUI);
3318 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3320 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
3322 IOleCommandTarget_Release(cmdtrg);
3324 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
3325 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3326 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3329 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
3331 IOleCommandTarget *cmdtrg;
3332 VARIANT *in = NULL, _in, *out = NULL, _out;
3335 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3336 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
3343 V_BSTR(in) = SysAllocString(name);
3349 V_I4(out) = 0xdeadbeef;
3352 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
3353 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
3359 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
3360 if(V_VT(out) == VT_BSTR) {
3362 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
3363 "unexpected fontname %s\n", wine_dbgstr_w(name));
3365 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
3370 IOleCommandTarget_Release(cmdtrg);
3373 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
3375 IOleCommandTarget *cmdtrg;
3378 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
3379 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
3383 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
3384 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
3385 ok(hres == S_OK, "Exec failed: %08x\n", hres);
3387 IOleCommandTarget_Release(cmdtrg);
3390 static void test_IsDirty(IUnknown *unk, HRESULT exhres)
3392 IPersistStreamInit *perinit;
3393 IPersistMoniker *permon;
3394 IPersistFile *perfile;
3397 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&perinit);
3398 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
3399 if(SUCCEEDED(hres)) {
3400 hres = IPersistStreamInit_IsDirty(perinit);
3401 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3402 IPersistStreamInit_Release(perinit);
3405 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
3406 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
3407 if(SUCCEEDED(hres)) {
3408 hres = IPersistMoniker_IsDirty(permon);
3409 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3410 IPersistMoniker_Release(permon);
3413 hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&perfile);
3414 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
3415 if(SUCCEEDED(hres)) {
3416 hres = IPersistFile_IsDirty(perfile);
3417 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
3418 IPersistFile_Release(perfile);
3422 static HWND create_container_window(void)
3424 static const WCHAR wszHTMLDocumentTest[] =
3425 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
3426 static WNDCLASSEXW wndclass = {
3427 sizeof(WNDCLASSEXW),
3430 0, 0, NULL, NULL, NULL, NULL, NULL,
3431 wszHTMLDocumentTest,
3435 RegisterClassExW(&wndclass);
3436 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
3437 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
3438 515, 530, NULL, NULL, NULL, NULL);
3441 static void test_DoVerb(IOleObject *oleobj)
3443 RECT rect = {0,0,500,500};
3446 if(!container_locked) {
3447 SET_EXPECT(GetContainer);
3448 SET_EXPECT(LockContainer);
3450 SET_EXPECT(ActivateMe);
3451 expect_LockContainer_fLock = TRUE;
3453 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
3454 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
3456 if(!container_locked) {
3457 CHECK_CALLED(GetContainer);
3458 CHECK_CALLED(LockContainer);
3459 container_locked = TRUE;
3461 CHECK_CALLED(ActivateMe);
3464 #define CLIENTSITE_EXPECTPATH 0x00000001
3465 #define CLIENTSITE_SETNULL 0x00000002
3466 #define CLIENTSITE_DONTSET 0x00000004
3468 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
3470 IOleClientSite *clientsite;
3473 if(flags & CLIENTSITE_SETNULL) {
3474 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3475 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
3477 hres = IOleObject_SetClientSite(oleobj, NULL);
3478 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3480 set_clientsite = FALSE;
3483 if(flags & CLIENTSITE_DONTSET)
3486 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3487 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3488 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
3489 clientsite, set_clientsite ? &ClientSite : NULL);
3491 if(!set_clientsite) {
3492 SET_EXPECT(GetHostInfo);
3493 if(flags & CLIENTSITE_EXPECTPATH) {
3494 SET_EXPECT(GetOptionKeyPath);
3495 SET_EXPECT(GetOverrideKeyPath);
3497 SET_EXPECT(GetWindow);
3498 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3499 SET_EXPECT(Exec_SETPROGRESSMAX);
3500 SET_EXPECT(Exec_SETPROGRESSPOS);
3501 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3502 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3503 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3504 SET_EXPECT(Invoke_AMBIENT_SILENT);
3505 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3506 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3508 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3509 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3511 CHECK_CALLED(GetHostInfo);
3512 if(flags & CLIENTSITE_EXPECTPATH) {
3513 CHECK_CALLED(GetOptionKeyPath);
3514 CHECK_CALLED(GetOverrideKeyPath);
3516 CHECK_CALLED(GetWindow);
3517 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3518 CHECK_CALLED(Exec_SETPROGRESSMAX);
3519 CHECK_CALLED(Exec_SETPROGRESSPOS);
3520 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3521 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3522 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3523 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3524 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3525 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3527 set_clientsite = TRUE;
3530 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
3531 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
3533 hres = IOleObject_GetClientSite(oleobj, &clientsite);
3534 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
3535 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
3538 static void test_OnAmbientPropertyChange(IUnknown *unk)
3540 IOleControl *control = NULL;
3543 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3544 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3548 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3549 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
3550 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3551 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3553 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3554 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
3555 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3556 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3558 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3559 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3560 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
3561 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3562 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3563 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3565 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3566 SET_EXPECT(Invoke_AMBIENT_SILENT);
3567 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
3568 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3569 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3570 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3572 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3573 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
3574 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3575 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3577 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3578 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3579 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
3580 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3582 IOleControl_Release(control);
3587 static void test_OnAmbientPropertyChange2(IUnknown *unk)
3589 IOleControl *control = NULL;
3592 hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
3593 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
3597 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
3598 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
3600 IOleControl_Release(control);
3603 static void test_Close(IUnknown *unk, BOOL set_client)
3605 IOleObject *oleobj = NULL;
3608 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3609 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3613 SET_EXPECT(GetContainer);
3614 SET_EXPECT(LockContainer);
3615 expect_LockContainer_fLock = FALSE;
3616 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
3617 ok(hres == S_OK, "Close failed: %08x\n", hres);
3618 CHECK_CALLED(GetContainer);
3619 CHECK_CALLED(LockContainer);
3620 container_locked = FALSE;
3623 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
3625 IOleObject_Release(oleobj);
3628 static void test_OnFrameWindowActivate(IUnknown *unk)
3630 IOleInPlaceActiveObject *inplaceact;
3633 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
3634 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
3638 if(set_clientsite) {
3639 expect_OnFrameWindowActivate_fActivate = TRUE;
3640 SET_EXPECT(OnFrameWindowActivate);
3641 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3642 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3643 CHECK_CALLED(OnFrameWindowActivate);
3645 SET_EXPECT(OnFrameWindowActivate);
3646 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3647 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3648 CHECK_CALLED(OnFrameWindowActivate);
3650 expect_OnFrameWindowActivate_fActivate = FALSE;
3651 SET_EXPECT(OnFrameWindowActivate);
3652 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3653 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3654 CHECK_CALLED(OnFrameWindowActivate);
3656 expect_OnFrameWindowActivate_fActivate = TRUE;
3657 SET_EXPECT(OnFrameWindowActivate);
3658 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3659 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3660 CHECK_CALLED(OnFrameWindowActivate);
3662 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
3663 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3665 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
3666 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
3669 IOleInPlaceActiveObject_Release(inplaceact);
3672 static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
3674 IOleInPlaceObjectWindowless *windowlessobj = NULL;
3677 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObjectWindowless,
3678 (void**)&windowlessobj);
3679 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
3684 SET_EXPECT(OnFocus_FALSE);
3686 SET_EXPECT(OnInPlaceDeactivateEx);
3688 SET_EXPECT(OnInPlaceDeactivate);
3690 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
3691 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
3693 CHECK_CALLED(OnFocus_FALSE);
3695 CHECK_CALLED(OnInPlaceDeactivateEx);
3697 CHECK_CALLED(OnInPlaceDeactivate);
3700 IOleInPlaceObjectWindowless_Release(windowlessobj);
3703 static void test_Activate(IUnknown *unk, DWORD flags)
3705 IOleObject *oleobj = NULL;
3706 IOleDocumentView *docview;
3713 IOleDocumentView_Release(view);
3716 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
3717 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
3719 hres = IOleObject_GetUserClassID(oleobj, NULL);
3720 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
3722 hres = IOleObject_GetUserClassID(oleobj, &guid);
3723 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
3724 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
3726 test_OnFrameWindowActivate(unk);
3728 test_ClientSite(oleobj, flags);
3729 test_InPlaceDeactivate(unk, FALSE);
3730 test_DoVerb(oleobj);
3732 if(call_UIActivate == CallUIActivate_AfterShow) {
3733 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
3734 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
3736 SET_EXPECT(OnFocus_TRUE);
3737 SET_EXPECT(SetActiveObject);
3739 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3740 SET_EXPECT(InPlaceFrame_SetBorderSpace);
3741 expect_status_text = NULL;
3743 hres = IOleDocumentView_UIActivate(docview, TRUE);
3744 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
3746 CHECK_CALLED(OnFocus_TRUE);
3747 CHECK_CALLED(SetActiveObject);
3748 CHECK_CALLED(ShowUI);
3749 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3750 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
3752 IOleDocumentView_Release(docview);
3755 IOleObject_Release(oleobj);
3757 test_OnFrameWindowActivate(unk);
3760 static void test_Window(IUnknown *unk, BOOL expect_success)
3762 IOleInPlaceActiveObject *activeobject = NULL;
3766 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
3767 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
3771 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
3773 if(expect_success) {
3774 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
3775 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
3777 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
3778 ok(IsWindow(hwnd), "hwnd is destroyed\n");
3781 IOleInPlaceActiveObject_Release(activeobject);
3784 static void test_CloseView(void)
3786 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
3792 hres = IOleDocumentView_Show(view, FALSE);
3793 ok(hres == S_OK, "Show failed: %08x\n", hres);
3795 hres = IOleDocumentView_CloseView(view, 0);
3796 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
3798 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
3799 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3801 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
3802 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
3803 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
3806 static void test_UIDeactivate(void)
3810 if(call_UIActivate == CallUIActivate_AfterShow) {
3811 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
3813 if(call_UIActivate != CallUIActivate_None) {
3814 SET_EXPECT(SetActiveObject_null);
3816 SET_EXPECT(OnUIDeactivate);
3819 hres = IOleDocumentView_UIActivate(view, FALSE);
3820 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
3822 if(call_UIActivate != CallUIActivate_None) {
3823 CHECK_CALLED(SetActiveObject_null);
3824 CHECK_CALLED(HideUI);
3825 CHECK_CALLED(OnUIDeactivate);
3827 if(call_UIActivate == CallUIActivate_AfterShow) {
3828 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
3832 static void test_Hide(void)
3839 hres = IOleDocumentView_Show(view, FALSE);
3840 ok(hres == S_OK, "Show failed: %08x\n", hres);
3843 static HRESULT create_document(IUnknown **unk)
3845 IHTMLDocument5 *doc5;
3848 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
3849 &IID_IUnknown, (void**)unk);
3850 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
3854 hres = IUnknown_QueryInterface(*unk, &IID_IHTMLDocument5, (void**)&doc5);
3855 if(SUCCEEDED(hres)) {
3856 IHTMLDocument5_Release(doc5);
3858 win_skip("Could not get IHTMLDocument5, probably too old IE\n");
3859 IUnknown_Release(*unk);
3865 static void test_Navigate(IUnknown *unk)
3867 IHlinkTarget *hlink;
3870 hres = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&hlink);
3871 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
3873 SET_EXPECT(ActivateMe);
3874 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
3875 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
3876 CHECK_CALLED(ActivateMe);
3878 IHlinkTarget_Release(hlink);
3881 static void test_external(IUnknown *unk, BOOL initialized)
3883 IDispatch *external;
3884 IHTMLDocument2 *doc;
3885 IHTMLWindow2 *htmlwin;
3888 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
3889 ok(hres == S_OK, "QueryInterface(IID_IHTMLWindow2) failed: %08x\n", hres);
3891 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
3892 IHTMLDocument2_Release(doc);
3893 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
3896 SET_EXPECT(GetExternal);
3897 external = (void*)0xdeadbeef;
3898 hres = IHTMLWindow2_get_external(htmlwin, &external);
3900 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
3901 CHECK_CALLED(GetExternal);
3902 ok(external != NULL, "external == NULL\n");
3904 ok(hres == S_OK, "get_external failed: %08x\n", hres);
3905 ok(external == NULL, "external != NULL\n");
3908 IHTMLWindow2_Release(htmlwin);
3911 static void test_StreamLoad(IUnknown *unk)
3913 IPersistStreamInit *init;
3916 hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
3917 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
3921 SET_EXPECT(Invoke_AMBIENT_SILENT);
3922 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3923 SET_EXPECT(Exec_ShellDocView_37);
3924 SET_EXPECT(OnChanged_READYSTATE);
3926 readystate_set_loading = TRUE;
3928 hres = IPersistStreamInit_Load(init, &Stream);
3929 ok(hres == S_OK, "Load failed: %08x\n", hres);
3931 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3932 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3933 CHECK_CALLED(Exec_ShellDocView_37);
3934 CHECK_CALLED(OnChanged_READYSTATE);
3937 test_timer(EXPECT_SETTITLE);
3938 test_GetCurMoniker(unk, NULL, about_blank_url);
3940 IPersistStreamInit_Release(init);
3943 static void test_QueryInterface(IUnknown *unk)
3948 static const IID IID_UndocumentedScriptIface =
3949 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
3951 qi = (void*)0xdeadbeef;
3952 hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&qi);
3953 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3954 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
3956 qi = (void*)0xdeadbeef;
3957 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&qi);
3958 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3959 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3961 qi = (void*)0xdeadbeef;
3962 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode2, (void**)&qi);
3963 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3964 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3966 qi = (void*)0xdeadbeef;
3967 hres = IUnknown_QueryInterface(unk, &IID_IPersistPropertyBag, (void**)&qi);
3968 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3969 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3971 qi = (void*)0xdeadbeef;
3972 hres = IUnknown_QueryInterface(unk, &IID_UndocumentedScriptIface, (void**)&qi);
3973 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3974 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3976 qi = (void*)0xdeadbeef;
3977 hres = IUnknown_QueryInterface(unk, &IID_IMarshal, (void**)&qi);
3978 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
3979 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
3982 static void init_test(enum load_state_t ls) {
3984 hwnd = last_hwnd = NULL;
3985 set_clientsite = FALSE;
3986 load_from_stream = FALSE;
3987 call_UIActivate = CallUIActivate_None;
3993 inplace_deactivated = FALSE;
3996 static void test_HTMLDocument(BOOL do_load)
4002 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
4004 init_test(do_load ? LD_DOLOAD : LD_NO);
4006 hres = create_document(&unk);
4011 test_QueryInterface(unk);
4012 test_IsDirty(unk, S_FALSE);
4013 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4014 test_external(unk, FALSE);
4015 test_ConnectionPointContainer(unk);
4016 test_GetCurMoniker(unk, NULL, NULL);
4017 test_Persist(unk, &Moniker);
4019 test_OnAmbientPropertyChange2(unk);
4021 test_Activate(unk, CLIENTSITE_EXPECTPATH);
4024 test_download(DWL_CSS|DWL_TRYCSS);
4025 test_GetCurMoniker(unk, &Moniker, NULL);
4028 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4029 test_OleCommandTarget_fail(unk);
4030 test_OleCommandTarget(unk);
4031 test_OnAmbientPropertyChange(unk);
4032 test_Window(unk, TRUE);
4033 test_external(unk, TRUE);
4035 test_UIDeactivate();
4036 test_OleCommandTarget(unk);
4037 test_Window(unk, TRUE);
4038 test_InPlaceDeactivate(unk, TRUE);
4040 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
4041 * MSHTML. It doesn't with Wine. */
4043 test_Window(unk, FALSE);
4045 test_InPlaceDeactivate(unk, FALSE);
4047 test_Close(unk, FALSE);
4049 /* Activate HTMLDocument again */
4050 test_Activate(unk, CLIENTSITE_SETNULL);
4051 test_Window(unk, TRUE);
4052 test_OleCommandTarget(unk);
4053 test_UIDeactivate();
4054 test_InPlaceDeactivate(unk, TRUE);
4055 test_Close(unk, FALSE);
4057 /* Activate HTMLDocument again, this time without UIActivate */
4058 call_UIActivate = CallUIActivate_None;
4059 test_Activate(unk, CLIENTSITE_SETNULL);
4060 test_Window(unk, TRUE);
4062 test_UIDeactivate();
4063 test_InPlaceDeactivate(unk, TRUE);
4066 test_Close(unk, TRUE);
4067 test_OnAmbientPropertyChange2(unk);
4068 test_GetCurMoniker(unk, do_load ? &Moniker : NULL, NULL);
4071 /* Activate HTMLDocument again, calling UIActivate after showing the window */
4072 call_UIActivate = CallUIActivate_AfterShow;
4073 test_Activate(unk, 0);
4074 test_Window(unk, TRUE);
4075 test_OleCommandTarget(unk);
4076 test_UIDeactivate();
4077 test_InPlaceDeactivate(unk, TRUE);
4078 test_Close(unk, FALSE);
4079 call_UIActivate = CallUIActivate_None;
4083 IOleDocumentView_Release(view);
4086 ok(IsWindow(hwnd), "hwnd is destroyed\n");
4088 ref = IUnknown_Release(unk);
4089 ok(ref == 0, "ref=%d, expected 0\n", ref);
4091 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
4094 static void test_HTMLDocument_hlink(void)
4100 trace("Testing HTMLDocument (hlink)...\n");
4102 init_test(LD_DOLOAD);
4105 hres = create_document(&unk);
4110 test_ConnectionPointContainer(unk);
4111 test_GetCurMoniker(unk, NULL, NULL);
4112 test_Persist(unk, &Moniker);
4115 IUnknown_Release(unk);
4119 test_download(DWL_CSS|DWL_TRYCSS);
4121 test_IsDirty(unk, S_FALSE);
4122 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4124 test_exec_onunload(unk);
4125 test_Window(unk, TRUE);
4126 test_InPlaceDeactivate(unk, TRUE);
4127 test_Close(unk, FALSE);
4128 test_IsDirty(unk, S_FALSE);
4129 test_GetCurMoniker(unk, &Moniker, NULL);
4132 IOleDocumentView_Release(view);
4135 ref = IUnknown_Release(unk);
4136 ok(ref == 0, "ref=%d, expected 0\n", ref);
4139 static void test_cookies(IUnknown *unk)
4142 IHTMLDocument2 *doc;
4148 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
4149 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
4151 hres = IHTMLDocument2_get_cookie(doc, &str);
4152 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4154 size = sizeof(buf)/sizeof(WCHAR);
4155 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4156 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4157 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
4161 str = a2bstr("test=testval");
4162 hres = IHTMLDocument2_put_cookie(doc, str);
4163 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
4166 hres = IHTMLDocument2_get_cookie(doc, &str2);
4167 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4168 ok(str2 != NULL, "cookie = NULL\n");
4169 size = sizeof(buf)/sizeof(WCHAR);
4170 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4171 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4172 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
4173 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
4175 SysFreeString(str2);
4177 str = a2bstr("test=testval2");
4178 hres = IHTMLDocument2_put_cookie(doc, str);
4179 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
4182 hres = IHTMLDocument2_get_cookie(doc, &str2);
4183 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
4184 ok(str2 != NULL, "cookie = NULL\n");
4185 size = sizeof(buf)/sizeof(WCHAR);
4186 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
4187 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
4188 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
4189 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
4191 SysFreeString(str2);
4193 IHTMLDocument2_Release(doc);
4196 static void test_HTMLDocument_http(void)
4203 trace("Testing HTMLDocument (http)...\n");
4205 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
4206 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
4208 init_test(LD_DOLOAD);
4211 hres = create_document(&unk);
4216 test_ConnectionPointContainer(unk);
4217 test_GetCurMoniker(unk, NULL, NULL);
4218 test_Persist(unk, http_mon);
4221 IUnknown_Release(unk);
4225 if (winetest_interactive || ! is_ie_hardened())
4226 test_download(DWL_HTTP);
4228 win_skip("IE running in Enhanced Security Configuration\n");
4231 test_IsDirty(unk, S_FALSE);
4232 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4236 test_InPlaceDeactivate(unk, TRUE);
4237 test_Close(unk, FALSE);
4238 test_IsDirty(unk, S_FALSE);
4239 test_GetCurMoniker(unk, http_mon, NULL);
4242 IOleDocumentView_Release(view);
4245 ref = IUnknown_Release(unk);
4246 ok(!ref, "ref=%d, expected 0\n", ref);
4248 ref = IMoniker_Release(http_mon);
4249 ok(!ref, "ref=%d, expected 0\n", ref);
4252 static void test_HTMLDocument_StreamLoad(void)
4259 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
4261 init_test(LD_DOLOAD);
4262 load_from_stream = TRUE;
4264 hres = create_document(&unk);
4269 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4270 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4272 test_readyState(unk);
4273 test_IsDirty(unk, S_FALSE);
4274 test_ConnectionPointContainer(unk);
4275 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4276 test_DoVerb(oleobj);
4277 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4279 IOleObject_Release(oleobj);
4281 test_GetCurMoniker(unk, NULL, NULL);
4282 test_StreamLoad(unk);
4283 test_download(DWL_VERBDONE|DWL_TRYCSS);
4284 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4286 test_UIDeactivate();
4287 test_InPlaceDeactivate(unk, TRUE);
4288 test_Close(unk, FALSE);
4289 test_IsDirty(unk, S_FALSE);
4292 IOleDocumentView_Release(view);
4297 ref = IUnknown_Release(unk);
4298 ok(ref == 0, "ref=%d, expected 0\n", ref);
4301 static void test_edit_uiactivate(IOleObject *oleobj)
4303 IOleDocumentView *docview;
4306 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
4307 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
4309 SET_EXPECT(OnFocus_TRUE);
4310 SET_EXPECT(SetActiveObject);
4312 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4313 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4314 expect_status_text = NULL;
4316 hres = IOleDocumentView_UIActivate(docview, TRUE);
4317 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
4319 CHECK_CALLED(OnFocus_TRUE);
4320 CHECK_CALLED(SetActiveObject);
4321 CHECK_CALLED(ShowUI);
4322 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4323 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4325 IOleDocumentView_Release(docview);
4328 static void test_editing_mode(BOOL do_load)
4335 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
4337 init_test(do_load ? LD_DOLOAD : LD_NO);
4338 call_UIActivate = CallUIActivate_AfterShow;
4340 hres = create_document(&unk);
4345 hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
4346 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
4348 test_readyState(unk);
4349 test_ConnectionPointContainer(unk);
4350 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
4351 test_DoVerb(oleobj);
4352 test_edit_uiactivate(oleobj);
4354 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4356 test_Persist(unk, &Moniker);
4357 stream_read = protocol_read = 0;
4358 test_exec_editmode(unk, do_load);
4359 test_UIDeactivate();
4360 call_UIActivate = CallUIActivate_None;
4361 IOleObject_Release(oleobj);
4363 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
4364 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
4366 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
4367 test_timer(EXPECT_UPDATEUI);
4368 SET_CALLED(SetStatusText);
4370 test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4373 test_exec_fontname(unk, NULL, wszTimesNewRoman);
4374 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
4375 test_timer(EXPECT_UPDATEUI);
4376 test_exec_fontname(unk, NULL, wszArial);
4378 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
4379 test_timer(EXPECT_UPDATEUI);
4380 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4381 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4383 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
4384 test_timer(EXPECT_UPDATEUI);
4385 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
4386 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4387 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
4388 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
4390 test_exec_noargs(unk, IDM_HORIZONTALLINE);
4391 test_timer(EXPECT_UPDATEUI);
4392 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
4393 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
4396 test_UIDeactivate();
4397 test_InPlaceDeactivate(unk, TRUE);
4398 test_Close(unk, FALSE);
4401 IOleDocumentView_Release(view);
4405 ref = IUnknown_Release(unk);
4406 ok(ref == 0, "ref=%d, expected 0\n", ref);
4409 static void register_protocol(void)
4411 IInternetSession *session;
4414 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
4416 hres = CoInternetGetSession(0, &session, 0);
4417 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
4419 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
4420 wsz_winetest, 0, NULL, 0);
4421 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
4423 IInternetSession_Release(session);
4426 static void test_HTMLDoc_ISupportErrorInfo(void)
4430 ISupportErrorInfo *sinfo;
4433 hres = create_document(&unk);
4437 hres = IUnknown_QueryInterface(unk, &IID_ISupportErrorInfo, (void**)&sinfo);
4438 ok(hres == S_OK, "got %x\n", hres);
4439 ok(sinfo != NULL, "got %p\n", sinfo);
4442 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
4443 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
4444 IUnknown_Release(sinfo);
4447 ref = IUnknown_Release(unk);
4448 ok(ref == 0, "ref=%d, expected 0\n", ref);
4451 static void test_IPersistHistory(void)
4456 IPersistHistory *phist;
4458 hres = create_document(&unk);
4462 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&phist);
4463 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
4465 IPersistHistory_Release(phist);
4467 ref = IUnknown_Release(unk);
4468 ok(ref == 0, "ref=%d, expected 0\n", ref);
4474 container_hwnd = create_container_window();
4475 register_protocol();
4477 test_HTMLDocument_hlink();
4479 test_HTMLDocument(FALSE);
4480 test_HTMLDocument(TRUE);
4481 test_HTMLDocument_StreamLoad();
4482 test_editing_mode(FALSE);
4483 test_editing_mode(TRUE);
4484 test_HTMLDocument_http();
4486 test_HTMLDoc_ISupportErrorInfo();
4487 test_IPersistHistory();
4489 DestroyWindow(container_hwnd);