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>
32 #include "docobjectservice.h"
41 #include "shdeprecated.h"
44 #include "mshtml_test.h"
46 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
47 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
48 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
56 #define SET_CALLED(func) \
57 called_ ## func = TRUE
59 #define CHECK_EXPECT2(func) \
61 ok(expect_ ##func, "unexpected call " #func "\n"); \
62 called_ ## func = TRUE; \
65 #define CHECK_EXPECT(func) \
67 CHECK_EXPECT2(func); \
68 expect_ ## func = FALSE; \
71 #define CHECK_CALLED(func) \
73 ok(called_ ## func, "expected " #func "\n"); \
74 expect_ ## func = called_ ## func = FALSE; \
77 #define CHECK_CALLED_BROKEN(func) \
79 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
80 expect_ ## func = called_ ## func = FALSE; \
83 static IOleDocumentView *view = NULL;
84 static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
86 DEFINE_EXPECT(LockContainer);
87 DEFINE_EXPECT(SetActiveObject);
88 DEFINE_EXPECT(SetActiveObject_null);
89 DEFINE_EXPECT(GetWindow);
90 DEFINE_EXPECT(CanInPlaceActivate);
91 DEFINE_EXPECT(OnInPlaceActivate);
92 DEFINE_EXPECT(OnInPlaceActivateEx);
93 DEFINE_EXPECT(OnUIActivate);
94 DEFINE_EXPECT(GetWindowContext);
95 DEFINE_EXPECT(OnUIDeactivate);
96 DEFINE_EXPECT(OnInPlaceDeactivate);
97 DEFINE_EXPECT(OnInPlaceDeactivateEx);
98 DEFINE_EXPECT(GetContainer);
99 DEFINE_EXPECT(ShowUI);
100 DEFINE_EXPECT(ActivateMe);
101 DEFINE_EXPECT(GetHostInfo);
102 DEFINE_EXPECT(HideUI);
103 DEFINE_EXPECT(GetOptionKeyPath);
104 DEFINE_EXPECT(GetOverrideKeyPath);
105 DEFINE_EXPECT(SetStatusText);
106 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
107 DEFINE_EXPECT(QueryStatus_OPEN);
108 DEFINE_EXPECT(QueryStatus_NEW);
109 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
110 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
111 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
112 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
113 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
114 DEFINE_EXPECT(Exec_ShellDocView_37);
115 DEFINE_EXPECT(Exec_ShellDocView_63);
116 DEFINE_EXPECT(Exec_ShellDocView_67);
117 DEFINE_EXPECT(Exec_ShellDocView_84);
118 DEFINE_EXPECT(Exec_ShellDocView_103);
119 DEFINE_EXPECT(Exec_ShellDocView_105);
120 DEFINE_EXPECT(Exec_ShellDocView_140);
121 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
122 DEFINE_EXPECT(Exec_SETTITLE);
123 DEFINE_EXPECT(Exec_HTTPEQUIV);
124 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
125 DEFINE_EXPECT(Exec_Explorer_69);
126 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
127 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
128 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
129 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
130 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
131 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
132 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
133 DEFINE_EXPECT(GetDropTarget);
134 DEFINE_EXPECT(UpdateUI);
135 DEFINE_EXPECT(Navigate);
136 DEFINE_EXPECT(OnFrameWindowActivate);
137 DEFINE_EXPECT(OnChanged_READYSTATE);
138 DEFINE_EXPECT(OnChanged_1005);
139 DEFINE_EXPECT(OnChanged_1012);
140 DEFINE_EXPECT(GetDisplayName);
141 DEFINE_EXPECT(BindToStorage);
142 DEFINE_EXPECT(IsSystemMoniker);
143 DEFINE_EXPECT(GetBindResult);
144 DEFINE_EXPECT(GetClassID);
145 DEFINE_EXPECT(Abort);
147 DEFINE_EXPECT(CreateInstance);
148 DEFINE_EXPECT(Start);
149 DEFINE_EXPECT(Terminate);
150 DEFINE_EXPECT(Protocol_Read);
151 DEFINE_EXPECT(LockRequest);
152 DEFINE_EXPECT(UnlockRequest);
153 DEFINE_EXPECT(OnFocus_TRUE);
154 DEFINE_EXPECT(OnFocus_FALSE);
155 DEFINE_EXPECT(RequestUIActivate);
156 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
157 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
158 DEFINE_EXPECT(GetExternal);
159 DEFINE_EXPECT(EnableModeless_TRUE);
160 DEFINE_EXPECT(EnableModeless_FALSE);
161 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
162 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
163 DEFINE_EXPECT(Frame_GetWindow);
164 DEFINE_EXPECT(TranslateUrl);
165 DEFINE_EXPECT(Advise_Close);
166 DEFINE_EXPECT(OnViewChange);
167 DEFINE_EXPECT(EvaluateNewWindow);
168 DEFINE_EXPECT(GetTravelLog);
169 DEFINE_EXPECT(UpdateBackForwardState);
170 DEFINE_EXPECT(FireNavigateComplete2);
171 DEFINE_EXPECT(FireDocumentComplete);
172 DEFINE_EXPECT(GetPendingUrl);
173 DEFINE_EXPECT(ActiveElementChanged);
174 DEFINE_EXPECT(IsErrorUrl);
176 static IUnknown *doc_unk;
177 static IMoniker *doc_mon;
178 static BOOL expect_LockContainer_fLock;
179 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
180 static BOOL ipsex, ipsw;
181 static BOOL set_clientsite, container_locked;
182 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
183 static BOOL editmode = FALSE;
184 static BOOL inplace_deactivated, open_call;
185 static DWORD status_code = HTTP_STATUS_OK;
186 static BOOL asynchronous_binding = FALSE;
187 static int stream_read, protocol_read;
188 static enum load_state_t {
197 static LPCOLESTR expect_status_text = NULL;
198 static const char *nav_url;
200 static const char html_page[] =
202 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
206 static const char css_data[] = "body {color: red}";
208 static const WCHAR http_urlW[] =
209 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
211 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
213 #define DOCHOST_DOCCANNAVIGATE 0
214 #define WM_CONTINUE_BINDING (WM_APP+1)
216 static HRESULT QueryInterface(REFIID riid, void **ppv);
217 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
219 #define test_readyState(u) _test_readyState(__LINE__,u)
220 static void _test_readyState(unsigned,IUnknown*);
222 static const WCHAR wszTimesNewRoman[] =
223 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
224 static const WCHAR wszArial[] =
225 {'A','r','i','a','l',0};
227 static const char *debugstr_guid(REFIID riid)
234 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
235 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
236 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
237 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
242 static int strcmp_wa(LPCWSTR strw, const char *stra)
245 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
246 return lstrcmpA(stra, buf);
249 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
253 const WCHAR *p1 = str, *p2 = sub;
254 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
255 if (!*p2) return str;
261 static BSTR a2bstr(const char *str)
266 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
267 ret = SysAllocStringLen(NULL, len);
268 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
273 static BOOL is_english(void)
275 return PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_ENGLISH
276 && PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
279 #define EXPECT_UPDATEUI 1
280 #define EXPECT_SETTITLE 2
282 static void test_timer(DWORD flags)
284 BOOL *b = &called_Exec_SETTITLE;
287 if(flags & EXPECT_UPDATEUI) {
288 SET_EXPECT(UpdateUI);
289 SET_EXPECT(Exec_UPDATECOMMANDS);
290 b = &called_UpdateUI;
292 if(flags & EXPECT_SETTITLE)
293 SET_EXPECT(Exec_SETTITLE);
295 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
296 TranslateMessage(&msg);
297 DispatchMessage(&msg);
300 if(flags & EXPECT_UPDATEUI) {
301 CHECK_CALLED(UpdateUI);
302 CHECK_CALLED(Exec_UPDATECOMMANDS);
304 if(flags & EXPECT_SETTITLE)
305 CHECK_CALLED(Exec_SETTITLE);
308 static IMoniker Moniker;
310 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
311 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
314 IPersistMoniker *permon;
315 IMoniker *mon = (void*)0xdeadbeef;
316 BSTR doc_url = (void*)0xdeadbeef;
322 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
323 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
327 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
328 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
330 hres = IHTMLDocument2_get_URL(doc, &doc_url);
331 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
333 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
334 IPersistMoniker_Release(permon);
338 BOOL exb = expect_GetDisplayName;
339 BOOL clb = called_GetDisplayName;
341 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
342 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
345 SET_EXPECT(GetDisplayName);
346 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
347 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
349 CHECK_CALLED(GetDisplayName);
350 expect_GetDisplayName = exb;
351 called_GetDisplayName = clb;
353 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
358 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
360 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
361 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
363 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
364 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
368 ok_(__FILE__,line)(hres == E_UNEXPECTED,
369 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
370 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
371 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
374 SysFreeString(doc_url);
375 IHTMLDocument_Release(doc);
376 if(mon && mon != (void*)0xdeadbeef)
377 IMoniker_Release(mon);
380 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
382 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
386 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
391 if(IsEqualGUID(&IID_IProxyManager, riid))
392 return E_NOINTERFACE; /* TODO */
393 if(IsEqualGUID(&IID_IDispatchEx, riid))
394 return E_NOINTERFACE; /* TODO */
395 if(IsEqualGUID(&IID_External_unk, riid))
396 return E_NOINTERFACE; /* TODO */
398 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
399 return E_NOINTERFACE;
402 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
407 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
412 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
414 ok(0, "unexpected call\n");
418 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
421 ok(0, "unexpected call\n");
425 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
426 UINT cNames, LCID lcid, DISPID *rgDispId)
428 ok(0, "unexpected call\n");
432 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
433 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
434 EXCEPINFO *pExcepInfo, UINT *puArgErr)
436 ok(0, "unexpected call\n");
440 static const IDispatchVtbl ExternalVtbl = {
441 External_QueryInterface,
444 Dispatch_GetTypeInfoCount,
445 Dispatch_GetTypeInfo,
446 Dispatch_GetIDsOfNames,
450 static IDispatch External = { &ExternalVtbl };
452 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
454 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
460 return E_NOINTERFACE;
463 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
468 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
473 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
474 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
475 DWORD grfPI, HANDLE_PTR dwReserved)
481 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
482 static const WCHAR empty_str = {0};
486 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
487 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
488 ok(!grfPI, "grfPI = %x\n", grfPI);
489 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
491 memset(&bindinfo, 0, sizeof(bindinfo));
492 bindinfo.cbSize = sizeof(bindinfo);
493 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
494 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
495 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
496 "bindf = %x\n", bindf);
498 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
499 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
500 /* TODO: test stgmedData */
501 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
502 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
503 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
504 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
505 ok(bindinfo.dwOptions == 0x80000 ||
506 bindinfo.dwOptions == 0x4080000, /* win2k3 */
507 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
508 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
509 /* TODO: test dwCodePage */
510 /* TODO: test securityAttributes */
511 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
512 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
513 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
515 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
516 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
517 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
519 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
520 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
522 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
524 hres = IInternetProtocolSink_ReportData(pOIProtSink,
525 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
526 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
528 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
529 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
534 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
535 PROTOCOLDATA *pProtocolData)
537 ok(0, "unexpected call\n");
541 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
544 ok(0, "unexpected call\n");
548 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
550 CHECK_EXPECT(Terminate);
554 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
556 ok(0, "unexpected call\n");
560 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
562 ok(0, "unexpected call\n");
566 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
567 ULONG cb, ULONG *pcbRead)
569 CHECK_EXPECT2(Protocol_Read);
571 ok(pv != NULL, "pv == NULL\n");
572 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
573 ok(pcbRead != NULL, "pcbRead == NULL\n");
574 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
579 protocol_read += *pcbRead = sizeof(css_data)-1;
580 memcpy(pv, css_data, sizeof(css_data)-1);
584 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
585 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
587 ok(0, "unexpected call\n");
591 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
593 CHECK_EXPECT(LockRequest);
597 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
599 CHECK_EXPECT(UnlockRequest);
603 static const IInternetProtocolVtbl ProtocolVtbl = {
604 Protocol_QueryInterface,
615 Protocol_LockRequest,
616 Protocol_UnlockRequest
619 static IInternetProtocol Protocol = { &ProtocolVtbl };
621 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
623 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
624 ok(0, "unexpected call\n");
625 return E_NOINTERFACE;
628 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
633 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
638 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
639 REFIID riid, void **ppv)
641 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
642 return E_NOINTERFACE;
644 CHECK_EXPECT(CreateInstance);
645 ok(ppv != NULL, "ppv == NULL\n");
651 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
653 ok(0, "unexpected call\n");
657 static const IClassFactoryVtbl ClassFactoryVtbl = {
658 ClassFactory_QueryInterface,
660 ClassFactory_Release,
661 ClassFactory_CreateInstance,
662 ClassFactory_LockServer
665 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
667 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
669 ok(0, "unexpected call\n");
673 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
678 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
683 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
684 IHlinkBrowseContext *pihlbc)
686 ok(0, "unexpected call\n");
690 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
691 IHlinkBrowseContext **ppihlbc)
693 ok(0, "unexpected call\n");
697 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
698 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
702 CHECK_EXPECT(Navigate);
704 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
705 ok(pbc != NULL, "pbc == NULL\n");
706 ok(pibsc != NULL, "pubsc == NULL\n");
707 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
710 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
711 LPWSTR location = (LPWSTR)0xdeadbeef;
713 IMoniker *mon = NULL;
714 DWORD site_data = 0xdeadbeef;
716 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
718 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
719 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
721 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
722 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
723 ok(location == NULL, "location = %p\n", location);
724 ok(mon != NULL, "mon == NULL\n");
726 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
727 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
728 ok(site == NULL, "site = %p\n, expected NULL\n", site);
729 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
735 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
736 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
738 ok(0, "unexpected call\n");
742 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
743 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
745 ok(0, "unexpected call\n");
749 static const IHlinkFrameVtbl HlinkFrameVtbl = {
750 HlinkFrame_QueryInterface,
753 HlinkFrame_SetBrowseContext,
754 HlinkFrame_GetBrowseContext,
756 HlinkFrame_OnNavigate,
757 HlinkFrame_UpdateHlink
760 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
762 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
764 ok(0, "unexpected call\n");
765 return E_NOINTERFACE;
768 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
773 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
778 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
779 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
780 DWORD dwUserActionTime)
782 CHECK_EXPECT(EvaluateNewWindow);
784 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
785 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
786 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
787 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
788 ok(!fReplace, "fReplace = %x\n", fReplace);
789 ok(dwFlags == NWMF_FIRST, "dwFlags = %x\n", dwFlags);
790 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
795 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
796 NewWindowManager_QueryInterface,
797 NewWindowManager_AddRef,
798 NewWindowManager_Release,
799 NewWindowManager_EvaluateNewWindow
802 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
804 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
805 REFIID riid, void**ppv)
807 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
812 ok(0, "unexpected call\n");
813 return E_NOINTERFACE;
816 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
821 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
826 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
829 case DISPID_READYSTATE:
830 CHECK_EXPECT2(OnChanged_READYSTATE);
832 if(!readystate_set_interactive)
833 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
834 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
835 ? OLECMDF_ENABLED : 0));
837 if(readystate_set_loading) {
838 readystate_set_loading = FALSE;
839 load_state = LD_LOADING;
841 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
842 test_readyState(NULL);
845 CHECK_EXPECT(OnChanged_1005);
847 test_readyState(NULL);
848 readystate_set_interactive = (load_state != LD_INTERACTIVE);
851 CHECK_EXPECT(OnChanged_1012);
864 ok(0, "unexpected id %d\n", dispID);
868 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
870 ok(0, "unexpected call\n");
874 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
875 PropertyNotifySink_QueryInterface,
876 PropertyNotifySink_AddRef,
877 PropertyNotifySink_Release,
878 PropertyNotifySink_OnChanged,
879 PropertyNotifySink_OnRequestEdit
882 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
884 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
886 ok(0, "unexpected call\n");
887 return E_NOINTERFACE;
890 static ULONG WINAPI Stream_AddRef(IStream *iface)
895 static ULONG WINAPI Stream_Release(IStream *iface)
900 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
901 ULONG cb, ULONG *pcbRead)
904 ok(pv != NULL, "pv == NULL\n");
905 ok(cb > sizeof(html_page), "cb = %d\n", cb);
906 ok(pcbRead != NULL, "pcbRead == NULL\n");
907 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
912 memcpy(pv, html_page, sizeof(html_page)-1);
913 stream_read += *pcbRead = sizeof(html_page)-1;
917 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
918 ULONG cb, ULONG *pcbWritten)
920 ok(0, "unexpected call\n");
924 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
925 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
927 ok(0, "unexpected call\n");
931 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
933 ok(0, "unexpected call\n");
937 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
938 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
940 ok(0, "unexpected call\n");
944 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
946 ok(0, "unexpected call\n");
950 static HRESULT WINAPI Stream_Revert(IStream *iface)
952 ok(0, "unexpected call\n");
956 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
957 ULARGE_INTEGER cb, DWORD dwLockType)
959 ok(0, "unexpected call\n");
963 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
964 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
966 ok(0, "unexpected call\n");
970 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
973 ok(0, "unexpected call\n");
977 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
979 ok(0, "unexpected call\n");
983 static const IStreamVtbl StreamVtbl = {
984 Stream_QueryInterface,
1000 static IStream Stream = { &StreamVtbl };
1002 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1003 IWinInetHttpInfo* This,
1007 ok(0, "unexpected call\n");
1008 return E_NOINTERFACE;
1011 static ULONG WINAPI WinInetHttpInfo_AddRef(
1012 IWinInetHttpInfo* This)
1017 static ULONG WINAPI WinInetHttpInfo_Release(
1018 IWinInetHttpInfo* This)
1023 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1024 IWinInetHttpInfo* This,
1029 return E_NOTIMPL; /* TODO */
1032 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1033 IWinInetHttpInfo* This,
1040 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1042 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1043 ok(pBuffer != NULL, "pBuffer == NULL\n");
1044 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1045 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1046 *((DWORD*)pBuffer) = status_code;
1050 return E_NOTIMPL; /* TODO */
1053 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1054 WinInetHttpInfo_QueryInterface,
1055 WinInetHttpInfo_AddRef,
1056 WinInetHttpInfo_Release,
1057 WinInetHttpInfo_QueryOption,
1058 WinInetHttpInfo_QueryInfo
1061 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1063 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1065 if(IsEqualGUID(&IID_IUnknown, riid)) {
1070 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1071 *ppv = &WinInetHttpInfo;
1075 ok(0, "unexpected call\n");
1076 return E_NOINTERFACE;
1079 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1084 static ULONG WINAPI Binding_Release(IBinding *iface)
1089 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1091 CHECK_EXPECT(Abort);
1092 if(asynchronous_binding)
1093 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1097 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1099 ok(0, "unexpected call\n");
1103 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1105 ok(0, "unexpected call\n");
1109 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1111 ok(0, "unexpected call\n");
1115 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1117 ok(0, "unexpected call\n");
1121 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1122 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1124 CHECK_EXPECT(GetBindResult);
1128 static const IBindingVtbl BindingVtbl = {
1129 Binding_QueryInterface,
1135 Binding_SetPriority,
1136 Binding_GetPriority,
1137 Binding_GetBindResult
1140 static IBinding Binding = { &BindingVtbl };
1142 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1143 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1145 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1149 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1150 return E_NOINTERFACE; /* TODO */
1151 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1152 return E_NOINTERFACE; /* TODO */
1154 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1155 return E_NOINTERFACE;
1158 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1163 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1168 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1170 CHECK_EXPECT(GetClassID);
1171 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1175 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1177 ok(0, "unexpected call\n");
1181 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1183 ok(0, "unexpected call\n");
1187 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1189 ok(0, "unexpected call\n");
1193 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1195 ok(0, "unexpected call\n");
1199 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1200 REFIID riidResult, void **ppvResult)
1202 ok(0, "unexpected call\n");
1206 static void continue_binding(IBindStatusCallback *callback)
1208 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1209 STGMEDIUM stgmedium;
1212 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1214 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1216 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1218 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1219 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1220 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1221 if(status_code != HTTP_STATUS_OK) {
1222 CHECK_CALLED_BROKEN(IsErrorUrl);
1223 SET_EXPECT(IsErrorUrl);
1227 stgmedium.tymed = TYMED_ISTREAM;
1228 U(stgmedium).pstm = &Stream;
1229 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1230 hres = IBindStatusCallback_OnDataAvailable(callback,
1231 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1232 sizeof(html_page)-1, &formatetc, &stgmedium);
1233 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1236 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1237 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1238 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1240 SET_EXPECT(GetBindResult);
1241 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1242 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1243 SET_CALLED(GetBindResult); /* IE7 */
1245 IBindStatusCallback_Release(callback);
1248 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1249 REFIID riid, void **ppv)
1251 IBindStatusCallback *callback = NULL;
1256 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1258 CHECK_EXPECT(BindToStorage);
1260 load_state = LD_LOADING;
1262 ok(pbc != NULL, "pbc == NULL\n");
1263 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1264 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1265 ok(ppv != NULL, "ppv == NULL\n");
1266 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1268 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1269 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1270 ok(callback != NULL, "callback == NULL\n");
1272 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1273 bindinfo.cbSize = sizeof(bindinfo);
1275 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1276 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1277 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1278 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1279 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1280 /* TODO: test stgmedData */
1281 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1282 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1283 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1284 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1285 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1286 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1287 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1288 /* TODO: test dwCodePage */
1289 /* TODO: test securityAttributes */
1290 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1291 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1292 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1294 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1295 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1297 if(asynchronous_binding) {
1298 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1299 return MK_S_ASYNCHRONOUS;
1302 continue_binding(callback);
1306 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1307 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1309 ok(0, "unexpected call\n");
1313 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1314 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1316 ok(0, "unexpected call\n");
1320 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1322 ok(0, "unexpected call\n");
1326 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1328 ok(0, "unexpected call\n");
1332 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1334 ok(0, "unexpected call\n");
1338 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1339 IMoniker *pmkNewlyRunning)
1341 ok(0, "unexpected call\n");
1345 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1346 IMoniker *pmkToLeft, FILETIME *pFileTime)
1348 ok(0, "unexpected call\n");
1352 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1354 ok(0, "unexpected call\n");
1358 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1359 IMoniker **ppmkPrefix)
1361 ok(0, "unexpected call\n");
1365 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1366 IMoniker **pmkRelPath)
1368 ok(0, "unexpected call\n");
1372 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1373 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1375 CHECK_EXPECT2(GetDisplayName);
1377 /* ok(pbc != NULL, "pbc == NULL\n"); */
1378 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1379 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1381 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1382 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1387 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1388 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1390 ok(0, "unexpected call\n");
1394 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1396 CHECK_EXPECT(IsSystemMoniker);
1400 static const IMonikerVtbl MonikerVtbl = {
1401 Moniker_QueryInterface,
1409 Moniker_BindToObject,
1410 Moniker_BindToStorage,
1412 Moniker_ComposeWith,
1417 Moniker_GetTimeOfLastChange,
1419 Moniker_CommonPrefixWith,
1420 Moniker_RelativePathTo,
1421 Moniker_GetDisplayName,
1422 Moniker_ParseDisplayName,
1423 Moniker_IsSystemMoniker
1426 static IMoniker Moniker = { &MonikerVtbl };
1428 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1430 return QueryInterface(riid, ppv);
1433 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1438 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1443 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1444 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1446 ok(0, "unexpected call\n");
1450 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1451 IEnumUnknown **ppenum)
1453 ok(0, "unexpected call\n");
1457 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1459 CHECK_EXPECT(LockContainer);
1460 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1464 static const IOleContainerVtbl OleContainerVtbl = {
1465 OleContainer_QueryInterface,
1466 OleContainer_AddRef,
1467 OleContainer_Release,
1468 OleContainer_ParseDisplayName,
1469 OleContainer_EnumObjects,
1470 OleContainer_LockContainer
1473 static IOleContainer OleContainer = { &OleContainerVtbl };
1475 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1477 return QueryInterface(riid, ppv);
1480 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1485 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1490 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1492 ok(0, "unexpected call\n");
1496 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1499 ok(0, "unexpected call\n");
1503 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1505 CHECK_EXPECT(GetContainer);
1506 ok(ppContainer != NULL, "ppContainer = NULL\n");
1507 *ppContainer = &OleContainer;
1511 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1513 ok(0, "unexpected call\n");
1517 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1519 ok(0, "unexpected call\n");
1523 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1525 ok(0, "unexpected call\n");
1529 static const IOleClientSiteVtbl ClientSiteVtbl = {
1530 ClientSite_QueryInterface,
1533 ClientSite_SaveObject,
1534 ClientSite_GetMoniker,
1535 ClientSite_GetContainer,
1536 ClientSite_ShowObject,
1537 ClientSite_OnShowWindow,
1538 ClientSite_RequestNewObjectLayout
1541 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1543 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1545 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1547 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1548 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1551 return E_NOINTERFACE;
1554 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1559 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1564 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1566 CHECK_EXPECT(Frame_GetWindow);
1570 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1572 ok(0, "unexpected call\n");
1576 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1578 ok(0, "unexpected call\n");
1582 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1583 LPCBORDERWIDTHS pborderwidths)
1585 ok(0, "unexpected call\n");
1589 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1590 LPCBORDERWIDTHS pborderwidths)
1592 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1596 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1597 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1599 static const WCHAR wszHTML_Document[] =
1600 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1602 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1604 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1605 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1606 if(pActiveObject && is_english())
1607 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1610 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1611 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1613 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1617 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1618 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1620 static const WCHAR wszHTML_Document[] =
1621 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1624 CHECK_EXPECT2(SetActiveObject);
1626 if(pActiveObject && is_english())
1627 ok(!lstrcmpW(wszHTML_Document, pszObjName), "pszObjName != \"HTML Document\"\n");
1629 CHECK_EXPECT(SetActiveObject_null);
1631 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1632 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1638 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1639 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1641 ok(0, "unexpected call\n");
1645 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1646 HOLEMENU holemenu, HWND hwndActiveObject)
1648 ok(0, "unexpected call\n");
1652 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1654 ok(0, "unexpected call\n");
1658 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1660 CHECK_EXPECT2(SetStatusText);
1661 if(!expect_status_text)
1662 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1666 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1669 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1671 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1675 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1677 ok(0, "unexpected call\n");
1681 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1682 InPlaceFrame_QueryInterface,
1683 InPlaceFrame_AddRef,
1684 InPlaceFrame_Release,
1685 InPlaceFrame_GetWindow,
1686 InPlaceFrame_ContextSensitiveHelp,
1687 InPlaceFrame_GetBorder,
1688 InPlaceFrame_RequestBorderSpace,
1689 InPlaceFrame_SetBorderSpace,
1690 InPlaceFrame_SetActiveObject,
1691 InPlaceFrame_InsertMenus,
1692 InPlaceFrame_SetMenu,
1693 InPlaceFrame_RemoveMenus,
1694 InPlaceFrame_SetStatusText,
1695 InPlaceFrame_EnableModeless,
1696 InPlaceFrame_TranslateAccelerator
1699 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1701 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1702 InPlaceFrame_QueryInterface,
1703 InPlaceFrame_AddRef,
1704 InPlaceFrame_Release,
1705 InPlaceFrame_GetWindow,
1706 InPlaceFrame_ContextSensitiveHelp,
1707 InPlaceFrame_GetBorder,
1708 InPlaceFrame_RequestBorderSpace,
1709 InPlaceFrame_SetBorderSpace,
1710 InPlaceUIWindow_SetActiveObject,
1713 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1715 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1717 return QueryInterface(riid, ppv);
1720 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1725 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1730 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1731 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1733 IOleClientSite *client_site;
1734 IOleObject *ole_obj;
1737 CHECK_EXPECT2(GetWindow);
1738 ok(phwnd != NULL, "phwnd = NULL\n");
1739 *phwnd = container_hwnd;
1741 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1742 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1744 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1745 IOleObject_Release(ole_obj);
1746 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1747 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1748 IOleClientSite_Release(client_site);
1753 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1754 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1756 ok(0, "unexpected call\n");
1760 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1761 IOleInPlaceSiteWindowless *iface)
1763 CHECK_EXPECT(CanInPlaceActivate);
1767 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1768 IOleInPlaceSiteWindowless *iface)
1770 CHECK_EXPECT(OnInPlaceActivate);
1771 inplace_deactivated = FALSE;
1775 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1776 IOleInPlaceSiteWindowless *iface)
1778 CHECK_EXPECT(OnUIActivate);
1782 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1783 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1784 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1785 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1787 static const RECT rect = {0,0,500,500};
1789 CHECK_EXPECT(GetWindowContext);
1791 ok(ppFrame != NULL, "ppFrame = NULL\n");
1793 *ppFrame = &InPlaceFrame;
1794 ok(ppDoc != NULL, "ppDoc = NULL\n");
1796 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1797 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1799 memcpy(lprcPosRect, &rect, sizeof(RECT));
1800 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1802 memcpy(lprcClipRect, &rect, sizeof(RECT));
1803 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1805 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1806 lpFrameInfo->fMDIApp = FALSE;
1807 lpFrameInfo->hwndFrame = container_hwnd;
1808 lpFrameInfo->haccel = NULL;
1809 lpFrameInfo->cAccelEntries = 0;
1815 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1816 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1818 ok(0, "unexpected call\n");
1822 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1823 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1825 CHECK_EXPECT(OnUIDeactivate);
1826 ok(!fUndoable, "fUndoable = TRUE\n");
1830 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1831 IOleInPlaceSiteWindowless *iface)
1833 CHECK_EXPECT(OnInPlaceDeactivate);
1834 inplace_deactivated = TRUE;
1838 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1839 IOleInPlaceSiteWindowless *iface)
1841 ok(0, "unexpected call\n");
1845 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1846 IOleInPlaceSiteWindowless *iface)
1848 ok(0, "unexpected call\n");
1852 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1853 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1855 ok(0, "unexpected call\n");
1859 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1860 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1862 CHECK_EXPECT(OnInPlaceActivateEx);
1864 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1865 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1866 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1871 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1872 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1874 CHECK_EXPECT(OnInPlaceDeactivateEx);
1876 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1881 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1882 IOleInPlaceSiteWindowless *iface)
1884 CHECK_EXPECT2(RequestUIActivate);
1888 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1889 IOleInPlaceSiteWindowless *iface)
1891 ok(0, "unexpected call\n");
1895 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1896 IOleInPlaceSiteWindowless *iface)
1898 ok(0, "unexpected call\n");
1902 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1903 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1905 ok(0, "unexpected call\n");
1909 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1910 IOleInPlaceSiteWindowless *iface)
1912 ok(0, "unexpected call\n");
1916 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
1917 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
1919 ok(0, "unexpected call\n");
1923 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
1924 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
1925 DWORD grfFlags, HDC *phDC)
1927 ok(0, "unexpected call\n");
1931 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
1932 IOleInPlaceSiteWindowless *iface, HDC hDC)
1934 ok(0, "unexpected call\n");
1938 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
1939 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
1941 ok(0, "unexpected call\n");
1945 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
1946 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
1948 ok(0, "unexpected call\n");
1952 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
1953 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
1954 LPCRECT pRectScroll, LPCRECT pRectClip)
1956 ok(0, "unexpected call\n");
1960 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
1961 IOleInPlaceSiteWindowless *iface, LPRECT prc)
1963 ok(0, "unexpected call\n");
1967 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
1968 IOleInPlaceSiteWindowless *iface, UINT msg,
1969 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
1971 ok(0, "unexpected call\n");
1975 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
1976 InPlaceSiteWindowless_QueryInterface,
1977 InPlaceSiteWindowless_AddRef,
1978 InPlaceSiteWindowless_Release,
1979 InPlaceSiteWindowless_GetWindow,
1980 InPlaceSiteWindowless_ContextSensitiveHelp,
1981 InPlaceSiteWindowless_CanInPlaceActivate,
1982 InPlaceSiteWindowless_OnInPlaceActivate,
1983 InPlaceSiteWindowless_OnUIActivate,
1984 InPlaceSiteWindowless_GetWindowContext,
1985 InPlaceSiteWindowless_Scroll,
1986 InPlaceSiteWindowless_OnUIDeactivate,
1987 InPlaceSiteWindowless_OnInPlaceDeactivate,
1988 InPlaceSiteWindowless_DiscardUndoState,
1989 InPlaceSiteWindowless_DeactivateAndUndo,
1990 InPlaceSiteWindowless_OnPosRectChange,
1991 InPlaceSiteWindowless_OnInPlaceActivateEx,
1992 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
1993 InPlaceSiteWindowless_RequestUIActivate,
1994 InPlaceSiteWindowless_CanWindowlessActivate,
1995 InPlaceSiteWindowless_GetCapture,
1996 InPlaceSiteWindowless_SetCapture,
1997 InPlaceSiteWindowless_GetFocus,
1998 InPlaceSiteWindowless_SetFocus,
1999 InPlaceSiteWindowless_GetDC,
2000 InPlaceSiteWindowless_ReleaseDC,
2001 InPlaceSiteWindowless_InvalidateRect,
2002 InPlaceSiteWindowless_InvalidateRgn,
2003 InPlaceSiteWindowless_ScrollRect,
2004 InPlaceSiteWindowless_AdjustRect,
2005 InPlaceSiteWindowless_OnDefWindowMessage
2008 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2010 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2012 return QueryInterface(riid, ppv);
2015 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2020 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2027 CallUIActivate_None,
2028 CallUIActivate_ActivateMe,
2029 CallUIActivate_AfterShow,
2032 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2033 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2035 IOleDocument *document;
2038 CHECK_EXPECT(ActivateMe);
2039 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2041 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2042 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2044 if(SUCCEEDED(hres)) {
2045 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2046 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2048 if(SUCCEEDED(hres)) {
2049 IOleInPlaceActiveObject *activeobj = NULL;
2050 IOleInPlaceSite *inplacesite = NULL;
2051 HWND tmp_hwnd = NULL;
2052 static RECT rect = {0,0,400,500};
2054 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2055 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2056 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2057 inplacesite, &InPlaceSiteWindowless);
2059 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2060 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2062 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2063 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2064 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2065 inplacesite, &InPlaceSiteWindowless);
2067 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2068 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2071 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2072 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2073 ok(hwnd == NULL, "hwnd=%p, expeted NULL\n", hwnd);
2076 if(call_UIActivate == CallUIActivate_ActivateMe) {
2077 SET_EXPECT(CanInPlaceActivate);
2078 SET_EXPECT(GetWindowContext);
2079 SET_EXPECT(GetWindow);
2081 SET_EXPECT(OnInPlaceActivateEx);
2083 SET_EXPECT(OnInPlaceActivate);
2084 SET_EXPECT(SetStatusText);
2085 SET_EXPECT(Exec_SETPROGRESSMAX);
2086 SET_EXPECT(Exec_SETPROGRESSPOS);
2087 SET_EXPECT(OnUIActivate);
2088 SET_EXPECT(SetActiveObject);
2090 expect_status_text = NULL;
2092 hres = IOleDocumentView_UIActivate(view, TRUE);
2093 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2095 CHECK_CALLED(CanInPlaceActivate);
2096 CHECK_CALLED(GetWindowContext);
2097 CHECK_CALLED(GetWindow);
2099 CHECK_CALLED(OnInPlaceActivateEx);
2101 CHECK_CALLED(OnInPlaceActivate);
2102 CHECK_CALLED(SetStatusText);
2103 CHECK_CALLED(Exec_SETPROGRESSMAX);
2104 CHECK_CALLED(Exec_SETPROGRESSPOS);
2105 CHECK_CALLED(OnUIActivate);
2106 CHECK_CALLED(SetActiveObject);
2107 CHECK_CALLED(ShowUI);
2110 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2111 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2112 ok(hwnd != NULL, "hwnd == NULL\n");
2114 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2117 hres = IOleDocumentView_UIActivate(view, TRUE);
2118 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2121 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2122 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2123 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
2127 hres = IOleDocumentView_SetRect(view, &rect);
2128 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2130 if(call_UIActivate == CallUIActivate_ActivateMe) {
2131 hres = IOleDocumentView_Show(view, TRUE);
2132 ok(hres == S_OK, "Show failed: %08x\n", hres);
2134 SET_EXPECT(CanInPlaceActivate);
2135 SET_EXPECT(GetWindowContext);
2136 SET_EXPECT(GetWindow);
2138 SET_EXPECT(OnInPlaceActivateEx);
2140 SET_EXPECT(OnInPlaceActivate);
2141 SET_EXPECT(SetStatusText);
2142 SET_EXPECT(Exec_SETPROGRESSMAX);
2143 SET_EXPECT(Exec_SETPROGRESSPOS);
2144 SET_EXPECT(OnUIActivate);
2145 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2147 hres = IOleDocumentView_Show(view, TRUE);
2148 ok(hres == S_OK, "Show failed: %08x\n", hres);
2150 CHECK_CALLED(CanInPlaceActivate);
2151 CHECK_CALLED(GetWindowContext);
2152 CHECK_CALLED(GetWindow);
2154 CHECK_CALLED(OnInPlaceActivateEx);
2156 CHECK_CALLED(OnInPlaceActivate);
2157 CHECK_CALLED(SetStatusText);
2158 CHECK_CALLED(Exec_SETPROGRESSMAX);
2159 CHECK_CALLED(Exec_SETPROGRESSPOS);
2162 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2163 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2164 ok(hwnd != NULL, "hwnd == NULL\n");
2166 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2170 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2173 IOleInPlaceActiveObject_Release(activeobj);
2176 IOleDocument_Release(document);
2182 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2183 DocumentSite_QueryInterface,
2184 DocumentSite_AddRef,
2185 DocumentSite_Release,
2186 DocumentSite_ActivateMe
2189 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2191 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2193 return QueryInterface(riid, ppv);
2196 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2201 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2206 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2208 ok(0, "unexpected call\n");
2212 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2214 ok(0, "unexpected call\n");
2218 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2220 ok(0, "unexpected call\n");
2224 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2225 POINTF *pPtfContainer, DWORD dwFlags)
2227 ok(0, "unexpected call\n");
2231 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2232 MSG *pMsg, DWORD grfModifiers)
2234 ok(0, "unexpected call\n");
2238 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2241 CHECK_EXPECT(OnFocus_TRUE);
2243 CHECK_EXPECT2(OnFocus_FALSE);
2247 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2249 ok(0, "unexpected call\n");
2253 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2254 OleControlSite_QueryInterface,
2255 OleControlSite_AddRef,
2256 OleControlSite_Release,
2257 OleControlSite_OnControlInfoChanged,
2258 OleControlSite_LockInPlaceActive,
2259 OleControlSite_GetExtendedControl,
2260 OleControlSite_TransformCoords,
2261 OleControlSite_TranslateAccelerator,
2262 OleControlSite_OnFocus,
2263 OleControlSite_ShowPropertyFrame
2266 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2268 static IDocHostUIHandler2 *expect_uihandler_iface;
2270 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2272 return QueryInterface(riid, ppv);
2275 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2280 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2285 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2286 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2288 ok(0, "unexpected call\n");
2289 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2293 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2295 CHECK_EXPECT(GetHostInfo);
2296 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2297 ok(pInfo != NULL, "pInfo=NULL\n");
2299 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2300 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2301 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2302 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2303 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2304 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2305 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2306 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2311 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2312 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2313 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2315 CHECK_EXPECT(ShowUI);
2316 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2319 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2321 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2322 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2323 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2324 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2325 if (expect_InPlaceUIWindow_SetActiveObject_active)
2326 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2328 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2333 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2335 CHECK_EXPECT(HideUI);
2336 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2340 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2342 CHECK_EXPECT(UpdateUI);
2343 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2347 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2349 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2351 CHECK_EXPECT2(EnableModeless_TRUE);
2353 CHECK_EXPECT2(EnableModeless_FALSE);
2357 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2359 ok(0, "unexpected call\n");
2360 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2364 static BOOL expect_OnFrameWindowActivate_fActivate;
2365 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2367 CHECK_EXPECT2(OnFrameWindowActivate);
2368 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2369 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2373 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2374 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2376 ok(0, "unexpected call\n");
2380 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2381 const GUID *pguidCmdGroup, DWORD nCmdID)
2383 ok(0, "unexpected call\n");
2384 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2388 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2389 LPOLESTR *pchKey, DWORD dw)
2391 CHECK_EXPECT(GetOptionKeyPath);
2392 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2393 ok(pchKey != NULL, "pchKey = NULL\n");
2394 ok(!dw, "dw=%d, expected 0\n", dw);
2396 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2400 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2401 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2403 CHECK_EXPECT(GetDropTarget);
2404 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2409 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2411 CHECK_EXPECT(GetExternal);
2412 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2413 *ppDispatch = &External;
2417 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2418 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2420 CHECK_EXPECT(TranslateUrl);
2421 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2422 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2423 ok(!strcmp_wa(pchURLIn, nav_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_url);
2424 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2425 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2430 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2431 IDataObject **ppPORet)
2433 ok(0, "unexpected call\n");
2434 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2438 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2439 LPOLESTR *pchKey, DWORD dw)
2441 CHECK_EXPECT(GetOverrideKeyPath);
2442 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2443 ok(pchKey != NULL, "pchKey = NULL\n");
2445 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2446 ok(!dw, "dw=%d, xepected 0\n", dw);
2450 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2451 DocHostUIHandler_QueryInterface,
2452 DocHostUIHandler_AddRef,
2453 DocHostUIHandler_Release,
2454 DocHostUIHandler_ShowContextMenu,
2455 DocHostUIHandler_GetHostInfo,
2456 DocHostUIHandler_ShowUI,
2457 DocHostUIHandler_HideUI,
2458 DocHostUIHandler_UpdateUI,
2459 DocHostUIHandler_EnableModeless,
2460 DocHostUIHandler_OnDocWindowActivate,
2461 DocHostUIHandler_OnFrameWindowActivate,
2462 DocHostUIHandler_ResizeBorder,
2463 DocHostUIHandler_TranslateAccelerator,
2464 DocHostUIHandler_GetOptionKeyPath,
2465 DocHostUIHandler_GetDropTarget,
2466 DocHostUIHandler_GetExternal,
2467 DocHostUIHandler_TranslateUrl,
2468 DocHostUIHandler_FilterDataObject,
2469 DocHostUIHandler_GetOverrideKeyPath
2472 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2474 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2476 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2481 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2482 return E_NOINTERFACE;
2484 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2485 return E_NOINTERFACE; /* TODO */
2487 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2488 return E_NOINTERFACE;
2491 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2492 CustomDocHostUIHandler_QueryInterface,
2493 DocHostUIHandler_AddRef,
2494 DocHostUIHandler_Release,
2495 DocHostUIHandler_ShowContextMenu,
2496 DocHostUIHandler_GetHostInfo,
2497 DocHostUIHandler_ShowUI,
2498 DocHostUIHandler_HideUI,
2499 DocHostUIHandler_UpdateUI,
2500 DocHostUIHandler_EnableModeless,
2501 DocHostUIHandler_OnDocWindowActivate,
2502 DocHostUIHandler_OnFrameWindowActivate,
2503 DocHostUIHandler_ResizeBorder,
2504 DocHostUIHandler_TranslateAccelerator,
2505 DocHostUIHandler_GetOptionKeyPath,
2506 DocHostUIHandler_GetDropTarget,
2507 DocHostUIHandler_GetExternal,
2508 DocHostUIHandler_TranslateUrl,
2509 DocHostUIHandler_FilterDataObject,
2510 DocHostUIHandler_GetOverrideKeyPath
2513 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2515 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2516 REFIID riid, void **ppv)
2518 return QueryInterface(riid, ppv);
2521 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2526 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2531 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2532 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2534 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2535 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2536 ok(!pCmdText, "pCmdText != NULL\n");
2538 switch(prgCmds[0].cmdID) {
2539 case OLECMDID_SETPROGRESSTEXT:
2540 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2541 prgCmds[0].cmdf = OLECMDF_ENABLED;
2544 CHECK_EXPECT(QueryStatus_OPEN);
2545 prgCmds[0].cmdf = 0;
2548 CHECK_EXPECT(QueryStatus_NEW);
2549 prgCmds[0].cmdf = 0;
2552 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2558 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2559 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2561 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2562 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2563 test_readyState(NULL);
2565 if(!pguidCmdGroup) {
2567 case OLECMDID_SETPROGRESSMAX:
2568 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2569 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2570 ok(pvaIn != NULL, "pvaIn == NULL\n");
2572 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2573 if(load_state == LD_NO)
2574 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2576 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2578 case OLECMDID_SETPROGRESSPOS:
2579 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2580 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2581 ok(pvaIn != NULL, "pvaIn == NULL\n");
2583 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2584 if(load_state == LD_NO)
2585 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2587 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2589 case OLECMDID_HTTPEQUIV_DONE:
2590 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2591 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2592 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2593 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2594 readystate_set_loading = FALSE;
2595 readystate_set_interactive = FALSE;
2596 load_state = LD_COMPLETE;
2598 case OLECMDID_SETDOWNLOADSTATE:
2599 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2600 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2601 ok(pvaIn != NULL, "pvaIn == NULL\n");
2602 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2604 switch(V_I4(pvaIn)) {
2606 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2607 load_state = LD_INTERACTIVE;
2610 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2611 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2614 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2618 case OLECMDID_UPDATECOMMANDS:
2619 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2620 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2621 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2622 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2624 case OLECMDID_SETTITLE:
2625 CHECK_EXPECT2(Exec_SETTITLE);
2626 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2627 ok(pvaIn != NULL, "pvaIn == NULL\n");
2628 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2629 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2630 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2632 case OLECMDID_HTTPEQUIV:
2633 CHECK_EXPECT2(Exec_HTTPEQUIV);
2634 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2635 ok(pvaIn != NULL, "pvaIn == NULL\n");
2636 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2637 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2638 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2639 test_readyState(NULL);
2641 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2642 return E_FAIL; /* FIXME */
2644 ok(0, "unexpected command %d\n", nCmdID);
2649 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2650 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2654 CHECK_EXPECT2(Exec_ShellDocView_37);
2657 test_GetCurMoniker(doc_unk, NULL, nav_url);
2658 else if(load_from_stream)
2659 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2661 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2663 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2664 ok(pvaIn != NULL, "pvaIn == NULL\n");
2666 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2667 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2672 IHTMLPrivateWindow *priv_window;
2675 CHECK_EXPECT(Exec_ShellDocView_63);
2676 ok(pvaIn != NULL, "pvaIn == NULL\n");
2677 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2678 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2679 ok(pvaOut != NULL, "pvaOut == NULL\n");
2680 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2682 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2683 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2685 IHTMLPrivateWindow_Release(priv_window);
2687 load_state = LD_LOADING;
2688 return S_OK; /* TODO */
2692 CHECK_EXPECT(Exec_ShellDocView_67);
2693 ok(pvaIn != NULL, "pvaIn == NULL\n");
2694 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2695 ok(!strcmp_wa(V_BSTR(pvaIn), nav_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_url);
2696 ok(pvaOut != NULL, "pvaOut == NULL\n");
2697 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2698 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2699 load_state = LD_DOLOAD;
2703 CHECK_EXPECT2(Exec_ShellDocView_84);
2705 ok(pvaIn == NULL, "pvaIn != NULL\n");
2706 ok(pvaOut != NULL, "pvaOut == NULL\n");
2708 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2713 CHECK_EXPECT2(Exec_ShellDocView_103);
2715 ok(pvaIn == NULL, "pvaIn != NULL\n");
2716 ok(pvaOut == NULL, "pvaOut != NULL\n");
2721 CHECK_EXPECT2(Exec_ShellDocView_105);
2723 ok(pvaIn != NULL, "pvaIn == NULL\n");
2724 ok(pvaOut == NULL, "pvaOut != NULL\n");
2729 CHECK_EXPECT2(Exec_ShellDocView_140);
2731 ok(pvaIn == NULL, "pvaIn != NULL\n");
2732 ok(pvaOut == NULL, "pvaOut != NULL\n");
2737 ok(0, "unexpected command %d\n", nCmdID);
2742 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2743 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2746 case IDM_PARSECOMPLETE:
2747 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2748 ok(pvaIn == NULL, "pvaIn != NULL\n");
2749 ok(pvaOut == NULL, "pvaOut != NULL\n");
2752 ok(0, "unexpected command %d\n", nCmdID);
2756 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2758 case DOCHOST_DOCCANNAVIGATE:
2759 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2760 ok(pvaIn != NULL, "pvaIn == NULL\n");
2761 ok(pvaOut == NULL, "pvaOut != NULL\n");
2762 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2763 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2772 ok(pvaIn != NULL, "pvaIn == NULL\n");
2773 ok(pvaOut != NULL, "pvaOut != NULL\n");
2774 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2775 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2776 sa = V_ARRAY(pvaIn);
2778 dim = SafeArrayGetDim(sa);
2779 ok(dim == 1, "dim = %d\n", dim);
2780 hres = SafeArrayGetLBound(sa, 1, &ind);
2781 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2782 ok(ind == 0, "Lower bound = %d\n", ind);
2783 hres = SafeArrayGetUBound(sa, 1, &ind);
2784 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2785 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2788 SafeArrayGetElement(sa, &ind, &var);
2789 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2790 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2793 SafeArrayGetElement(sa, &ind, &var);
2794 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2795 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2798 SafeArrayGetElement(sa, &ind, &var);
2799 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2802 SafeArrayGetElement(sa, &ind, &var);
2803 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2806 SafeArrayGetElement(sa, &ind, &var);
2807 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2808 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2811 SafeArrayGetElement(sa, &ind, &var);
2812 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2813 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2817 return E_FAIL; /* TODO */
2821 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2822 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2826 CHECK_EXPECT2(Exec_Explorer_69);
2827 ok(pvaIn == NULL, "pvaIn != NULL\n");
2828 ok(pvaOut != NULL, "pvaOut == NULL\n");
2831 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2836 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2838 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2839 SET_EXPECT(SetStatusText);
2840 ok(pvaIn == NULL, "pvaIn != NULL\n");
2841 ok(pvaOut == NULL, "pvaOut != NULL\n");
2843 case OLECMDID_SHOWSCRIPTERROR:
2847 ok(0, "unexpected command %d\n", nCmdID);
2852 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2856 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2857 OleCommandTarget_QueryInterface,
2858 OleCommandTarget_AddRef,
2859 OleCommandTarget_Release,
2860 OleCommandTarget_QueryStatus,
2861 OleCommandTarget_Exec
2864 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2866 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2868 return QueryInterface(riid, ppv);
2871 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2872 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2873 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2875 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2876 ok(pDispParams != NULL, "pDispParams == NULL\n");
2877 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2878 ok(puArgErr != NULL, "puArgErr == NULL\n");
2879 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2880 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2881 test_readyState(NULL);
2883 switch(dispIdMember) {
2884 case DISPID_AMBIENT_USERMODE:
2885 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2886 V_VT(pVarResult) = VT_BOOL;
2887 V_BOOL(pVarResult) = VARIANT_TRUE;
2889 case DISPID_AMBIENT_DLCONTROL:
2890 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2892 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2893 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2895 case DISPID_AMBIENT_SILENT:
2896 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2897 V_VT(pVarResult) = VT_BOOL;
2898 V_BOOL(pVarResult) = VARIANT_FALSE;
2900 case DISPID_AMBIENT_USERAGENT:
2901 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2903 case DISPID_AMBIENT_PALETTE:
2904 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2908 ok(0, "unexpected dispid %d\n", dispIdMember);
2912 static const IDispatchVtbl DispatchVtbl = {
2913 Dispatch_QueryInterface,
2916 Dispatch_GetTypeInfoCount,
2917 Dispatch_GetTypeInfo,
2918 Dispatch_GetIDsOfNames,
2922 static IDispatch Dispatch = { &DispatchVtbl };
2924 static HRESULT WINAPI DocObjectService_QueryInterface(
2925 IDocObjectService* This,
2929 /* F62D9369-75EF-4578-8856-232802C76468 (ITridentService2) */
2933 static ULONG WINAPI DocObjectService_AddRef(
2934 IDocObjectService* This)
2939 static ULONG WINAPI DocObjectService_Release(
2940 IDocObjectService* This)
2945 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
2946 IDocObjectService* This,
2947 IDispatch *pDispatch,
2950 LPCWSTR lpszFrameName,
2953 LPCWSTR lpszHeaders,
2957 ok(0, "unexpected call\n");
2961 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
2962 IDocObjectService* This,
2963 IHTMLWindow2 *pHTMLWindow2,
2966 CHECK_EXPECT(FireNavigateComplete2);
2970 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
2971 IDocObjectService* This)
2973 ok(0, "unexpected call\n");
2977 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
2978 IDocObjectService* This)
2980 ok(0, "unexpected call\n");
2984 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
2985 IDocObjectService* This,
2986 IHTMLWindow2 *pHTMLWindow,
2989 CHECK_EXPECT(FireDocumentComplete);
2993 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
2994 IDocObjectService* This,
2995 IHTMLWindow2 *pHTMLWindow)
2997 ok(0, "unexpected call\n");
3001 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3002 IDocObjectService* This,
3003 BSTR *pbstrPendingUrl)
3005 CHECK_EXPECT(GetPendingUrl);
3009 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3010 IDocObjectService* This,
3011 IHTMLElement *pHTMLElement)
3013 CHECK_EXPECT(ActiveElementChanged);
3017 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3018 IDocObjectService* This,
3021 ok(0, "unexpected call\n");
3025 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3026 IDocObjectService* This,
3030 CHECK_EXPECT(IsErrorUrl);
3035 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3036 DocObjectService_QueryInterface,
3037 DocObjectService_AddRef,
3038 DocObjectService_Release,
3039 DocObjectService_FireBeforeNavigate2,
3040 DocObjectService_FireNavigateComplete2,
3041 DocObjectService_FireDownloadBegin,
3042 DocObjectService_FireDownloadComplete,
3043 DocObjectService_FireDocumentComplete,
3044 DocObjectService_UpdateDesktopComponent,
3045 DocObjectService_GetPendingUrl,
3046 DocObjectService_ActiveElementChanged,
3047 DocObjectService_GetUrlSearchComponent,
3048 DocObjectService_IsErrorUrl
3051 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3053 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3055 static HRESULT WINAPI BrowserService_QueryInterface(
3056 IBrowserService* This,
3062 if(IsEqualGUID(&IID_IShellBrowser, riid))
3063 return E_NOINTERFACE; /* TODO */
3065 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3066 *ppvObject = &DocObjectService;
3070 if(IsEqualGUID(&IID_ITabBrowserService, riid))
3071 return E_NOINTERFACE; /* TODO */
3073 ok(0, "unexpected call\n");
3074 return E_NOINTERFACE;
3077 static ULONG WINAPI BrowserService_AddRef(
3078 IBrowserService* This)
3083 static ULONG WINAPI BrowserService_Release(
3084 IBrowserService* This)
3089 static HRESULT WINAPI BrowserService_GetParentSite(
3090 IBrowserService* This,
3091 IOleInPlaceSite **ppipsite)
3093 ok(0, "unexpected call\n");
3097 static HRESULT WINAPI BrowserService_SetTitle(
3098 IBrowserService* This,
3102 ok(0, "unexpected call\n");
3106 static HRESULT WINAPI BrowserService_GetTitle(
3107 IBrowserService* This,
3112 ok(0, "unexpected call\n");
3116 static HRESULT WINAPI BrowserService_GetOleObject(
3117 IBrowserService* This,
3118 IOleObject **ppobjv)
3120 ok(0, "unexpected call\n");
3124 static HRESULT WINAPI BrowserService_GetTravelLog(
3125 IBrowserService* This,
3128 CHECK_EXPECT(GetTravelLog);
3132 static HRESULT WINAPI BrowserService_ShowControlWindow(
3133 IBrowserService* This,
3137 ok(0, "unexpected call\n");
3141 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3142 IBrowserService* This,
3146 ok(0, "unexpected call\n");
3150 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3151 IBrowserService* This,
3152 PCIDLIST_ABSOLUTE pidl,
3156 ok(0, "unexpected call\n");
3160 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3161 IBrowserService* This,
3164 PIDLIST_ABSOLUTE *ppidlOut)
3166 ok(0, "unexpected call\n");
3170 static HRESULT WINAPI BrowserService_DisplayParseError(
3171 IBrowserService* This,
3175 ok(0, "unexpected call\n");
3179 static HRESULT WINAPI BrowserService_NavigateToPidl(
3180 IBrowserService* This,
3181 PCIDLIST_ABSOLUTE pidl,
3184 ok(0, "unexpected call\n");
3188 static HRESULT WINAPI BrowserService_SetNavigateState(
3189 IBrowserService* This,
3192 ok(0, "unexpected call\n");
3196 static HRESULT WINAPI BrowserService_GetNavigateState(
3197 IBrowserService* This,
3200 ok(0, "unexpected call\n");
3204 static HRESULT WINAPI BrowserService_NotifyRedirect(
3205 IBrowserService* This,
3207 PCIDLIST_ABSOLUTE pidl,
3210 ok(0, "unexpected call\n");
3214 static HRESULT WINAPI BrowserService_UpdateWindowList(
3215 IBrowserService* This)
3217 ok(0, "unexpected call\n");
3221 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3222 IBrowserService* This)
3224 CHECK_EXPECT(UpdateBackForwardState);
3228 static HRESULT WINAPI BrowserService_SetFlags(
3229 IBrowserService* This,
3233 ok(0, "unexpected call\n");
3237 static HRESULT WINAPI BrowserService_GetFlags(
3238 IBrowserService* This,
3241 ok(0, "unexpected call\n");
3245 static HRESULT WINAPI BrowserService_CanNavigateNow(
3246 IBrowserService* This)
3248 ok(0, "unexpected call\n");
3252 static HRESULT WINAPI BrowserService_GetPidl(
3253 IBrowserService* This,
3254 PIDLIST_ABSOLUTE *ppidl)
3256 ok(0, "unexpected call\n");
3260 static HRESULT WINAPI BrowserService_SetReferrer(
3261 IBrowserService* This,
3262 PCIDLIST_ABSOLUTE pidl)
3264 ok(0, "unexpected call\n");
3268 static DWORD WINAPI BrowserService_GetBrowserIndex(
3269 IBrowserService* This)
3271 ok(0, "unexpected call\n");
3275 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3276 IBrowserService* This,
3280 ok(0, "unexpected call\n");
3284 static HRESULT WINAPI BrowserService_GetHistoryObject(
3285 IBrowserService* This,
3290 ok(0, "unexpected call\n");
3294 static HRESULT WINAPI BrowserService_SetHistoryObject(
3295 IBrowserService* This,
3297 BOOL fIsLocalAnchor)
3299 ok(0, "unexpected call\n");
3303 static HRESULT WINAPI BrowserService_CacheOLEServer(
3304 IBrowserService* This,
3307 ok(0, "unexpected call\n");
3311 static HRESULT WINAPI BrowserService_GetSetCodePage(
3312 IBrowserService* This,
3316 ok(0, "unexpected call\n");
3320 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3321 IBrowserService* This,
3325 VARIANT *pvarargOut)
3327 ok(0, "unexpected call\n");
3331 static HRESULT WINAPI BrowserService_GetPalette(
3332 IBrowserService* This,
3335 ok(0, "unexpected call\n");
3339 static HRESULT WINAPI BrowserService_RegisterWindow(
3340 IBrowserService* This,
3341 BOOL fForceRegister,
3344 ok(0, "unexpected call\n");
3348 static IBrowserServiceVtbl BrowserServiceVtbl = {
3349 BrowserService_QueryInterface,
3350 BrowserService_AddRef,
3351 BrowserService_Release,
3352 BrowserService_GetParentSite,
3353 BrowserService_SetTitle,
3354 BrowserService_GetTitle,
3355 BrowserService_GetOleObject,
3356 BrowserService_GetTravelLog,
3357 BrowserService_ShowControlWindow,
3358 BrowserService_IsControlWindowShown,
3359 BrowserService_IEGetDisplayName,
3360 BrowserService_IEParseDisplayName,
3361 BrowserService_DisplayParseError,
3362 BrowserService_NavigateToPidl,
3363 BrowserService_SetNavigateState,
3364 BrowserService_GetNavigateState,
3365 BrowserService_NotifyRedirect,
3366 BrowserService_UpdateWindowList,
3367 BrowserService_UpdateBackForwardState,
3368 BrowserService_SetFlags,
3369 BrowserService_GetFlags,
3370 BrowserService_CanNavigateNow,
3371 BrowserService_GetPidl,
3372 BrowserService_SetReferrer,
3373 BrowserService_GetBrowserIndex,
3374 BrowserService_GetBrowserByIndex,
3375 BrowserService_GetHistoryObject,
3376 BrowserService_SetHistoryObject,
3377 BrowserService_CacheOLEServer,
3378 BrowserService_GetSetCodePage,
3379 BrowserService_OnHttpEquiv,
3380 BrowserService_GetPalette,
3381 BrowserService_RegisterWindow
3384 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3386 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
3387 REFIID riid, void **ppv)
3389 return QueryInterface(riid, ppv);
3392 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
3397 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
3402 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
3403 REFIID riid, void **ppv)
3406 * Services used by HTMLDocument:
3409 * IInternetSecurityManager
3411 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
3414 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
3415 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
3416 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
3418 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
3419 * IElementBehaviorFactory
3420 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
3430 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
3431 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
3436 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
3437 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
3438 *ppv = &NewWindowManager;
3442 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
3443 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
3444 *ppv = &BrowserService;
3448 return E_NOINTERFACE;
3451 static const IServiceProviderVtbl ServiceProviderVtbl = {
3452 ServiceProvider_QueryInterface,
3453 ServiceProvider_AddRef,
3454 ServiceProvider_Release,
3455 ServiceProvider_QueryService
3458 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
3460 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
3461 REFIID riid, void **ppv)
3463 return QueryInterface(riid, ppv);
3466 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
3471 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
3476 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
3477 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
3479 ok(0, "unexpected call\n");
3482 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
3483 DWORD dwAspect, LONG lindex)
3485 ok(0, "unexpected call\n");
3488 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
3490 ok(0, "unexpected call\n");
3493 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
3495 ok(0, "unexpected call\n");
3498 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
3500 ok(0, "unexpected call\n");
3503 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
3505 ok(0, "unexpected call\n");
3508 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
3510 CHECK_EXPECT(Advise_Close);
3513 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
3514 AdviseSink_QueryInterface,
3517 AdviseSink_OnDataChange,
3518 AdviseSink_OnViewChange,
3519 AdviseSink_OnRename,
3521 ObjectAdviseSink_OnClose,
3522 AdviseSinkEx_OnViewStatusChange
3525 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
3527 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
3528 REFIID riid, void **ppv)
3530 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
3535 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3537 return E_NOINTERFACE;
3540 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
3541 DWORD dwAspect, LONG lindex)
3543 CHECK_EXPECT2(OnViewChange);
3545 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
3546 ok(lindex == -1, "lindex = %d\n", lindex);
3549 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
3550 ViewAdviseSink_QueryInterface,
3553 AdviseSink_OnDataChange,
3554 ViewAdviseSink_OnViewChange,
3555 AdviseSink_OnRename,
3558 AdviseSinkEx_OnViewStatusChange
3561 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
3563 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
3564 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
3565 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
3566 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
3567 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
3569 static HRESULT QueryInterface(REFIID riid, void **ppv)
3573 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
3575 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
3576 *ppv = &DocumentSite;
3577 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
3578 *ppv = &DocHostUIHandler;
3579 else if(IsEqualGUID(&IID_IOleContainer, riid))
3580 *ppv = &OleContainer;
3581 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
3582 *ppv = &InPlaceSiteWindowless;
3583 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
3584 *ppv = &OleCommandTarget;
3585 else if(IsEqualGUID(&IID_IDispatch, riid))
3587 else if(IsEqualGUID(&IID_IServiceProvider, riid))
3588 *ppv = &ServiceProvider;
3589 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
3590 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
3591 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
3592 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
3593 else if(IsEqualGUID(&IID_IOleControlSite, riid))
3594 *ppv = &OleControlSite;
3595 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
3596 return E_NOINTERFACE; /* TODO */
3597 else if(IsEqualGUID(&IID_IProxyManager, riid))
3598 return E_NOINTERFACE; /* ? */
3599 else if(IsEqualGUID(&IID_unk1, riid))
3600 return E_NOINTERFACE; /* HTMLWindow2 ? */
3601 else if(IsEqualGUID(&IID_IThumbnailView, riid))
3602 return E_NOINTERFACE; /* ? */
3603 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
3604 return E_NOINTERFACE; /* ? */
3605 else if(IsEqualGUID(&IID_unk4, riid))
3606 return E_NOINTERFACE; /* ? */
3607 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
3608 return E_NOINTERFACE; /* ? */
3610 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3614 return E_NOINTERFACE;
3617 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3619 if(msg == WM_CONTINUE_BINDING) {
3620 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
3621 continue_binding(callback);
3624 return DefWindowProc(hwnd, msg, wParam, lParam);
3627 static void test_doscroll(IUnknown *unk)
3629 IHTMLDocument3 *doc;
3630 IHTMLElement2 *elem2;
3635 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
3636 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
3640 hres = IHTMLDocument3_get_documentElement(doc, &elem);
3641 IHTMLDocument3_Release(doc);
3642 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
3643 switch(load_state) {
3647 ok(!elem, "elem != NULL\n");
3650 case LD_INTERACTIVE:
3652 ok(elem != NULL, "elem == NULL\n");
3657 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3658 IHTMLElement_Release(elem);
3659 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3662 V_BSTR(&v) = a2bstr("left");
3663 hres = IHTMLElement2_doScroll(elem2, v);
3664 SysFreeString(V_BSTR(&v));
3665 IHTMLElement2_Release(elem2);
3667 if(inplace_deactivated)
3668 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
3669 else if(load_state == LD_COMPLETE)
3670 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
3672 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
3675 static void _test_readyState(unsigned line, IUnknown *unk)
3677 IHTMLDocument2 *htmldoc;
3678 DISPPARAMS dispparams;
3684 static const LPCSTR expected_state[] = {
3699 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
3700 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3704 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
3705 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
3707 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
3708 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
3710 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
3711 load_state = LD_INTERACTIVE;
3714 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
3715 wine_dbgstr_w(state), load_state);
3716 SysFreeString(state);
3718 hres = IHTMLDocument2_get_body(htmldoc, &elem);
3719 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
3721 IHTMLElement2 *elem2;
3724 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3725 IHTMLElement_Release(elem);
3726 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3728 hres = IHTMLElement2_get_readyState(elem2, &var);
3729 IHTMLElement2_Release(elem2);
3730 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3731 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
3732 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
3735 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
3738 dispparams.cArgs = 0;
3739 dispparams.cNamedArgs = 0;
3740 dispparams.rgdispidNamedArgs = NULL;
3741 dispparams.rgvarg = NULL;
3745 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
3746 &dispparams, &out, NULL, NULL);
3747 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
3749 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
3750 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
3752 test_doscroll((IUnknown*)htmldoc);
3754 IHTMLDocument2_Release(htmldoc);
3757 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
3762 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
3763 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
3765 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
3766 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
3768 IViewObject_Release(view);
3771 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
3773 IConnectionPointContainer *tmp_container = NULL;
3774 IConnectionPoint *cp;
3778 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3779 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3783 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
3784 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
3785 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
3787 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
3788 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
3790 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
3791 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
3792 ok(tmp_container == container, "container != tmp_container\n");
3794 IConnectionPointContainer_Release(tmp_container);
3796 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
3797 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
3799 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3802 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
3803 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3806 IConnectionPoint_Release(cp);
3809 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
3811 IConnectionPointContainer *container;
3814 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
3815 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3819 test_ConnectionPoint(container, &IID_IDispatch);
3820 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
3821 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
3822 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
3824 IConnectionPointContainer_Release(container);
3827 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
3829 ICustomDoc *custom_doc;
3832 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
3833 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
3835 expect_uihandler_iface = uihandler;
3837 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
3838 ICustomDoc_Release(custom_doc);
3839 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
3842 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
3846 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
3848 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
3850 test_readyState((IUnknown*)persist);
3854 CreateBindCtx(0, &bind);
3855 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
3856 (IUnknown*)&ClientSite);
3859 SET_EXPECT(GetDisplayName);
3860 if(!set_clientsite) {
3861 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3862 SET_EXPECT(GetHostInfo);
3863 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3864 SET_EXPECT(Invoke_AMBIENT_SILENT);
3865 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3866 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3867 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3868 SET_EXPECT(GetOptionKeyPath);
3869 SET_EXPECT(GetOverrideKeyPath);
3870 SET_EXPECT(GetWindow);
3871 SET_EXPECT(Exec_DOCCANNAVIGATE);
3872 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3873 SET_EXPECT(Exec_SETPROGRESSMAX);
3874 SET_EXPECT(Exec_SETPROGRESSPOS);
3875 SET_EXPECT(Exec_ShellDocView_37);
3877 if(!container_locked) {
3878 SET_EXPECT(GetContainer);
3879 SET_EXPECT(LockContainer);
3881 SET_EXPECT(OnChanged_READYSTATE);
3882 SET_EXPECT(Exec_ShellDocView_84);
3883 SET_EXPECT(IsSystemMoniker);
3885 SET_EXPECT(BindToStorage);
3886 SET_EXPECT(SetActiveObject);
3887 if(set_clientsite) {
3888 SET_EXPECT(Invoke_AMBIENT_SILENT);
3889 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3890 SET_EXPECT(Exec_ShellDocView_37);
3891 SET_EXPECT(IsErrorUrl);
3894 SET_EXPECT(GetTravelLog);
3895 SET_EXPECT(GetPendingUrl);
3896 load_state = LD_DOLOAD;
3897 expect_LockContainer_fLock = TRUE;
3898 readystate_set_loading = TRUE;
3900 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
3901 ok(hres == S_OK, "Load failed: %08x\n", hres);
3904 CHECK_CALLED(GetDisplayName);
3905 if(!set_clientsite) {
3906 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
3907 CHECK_CALLED(GetHostInfo);
3908 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
3909 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3910 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3911 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
3912 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
3913 CHECK_CALLED(GetOptionKeyPath);
3914 CHECK_CALLED(GetOverrideKeyPath);
3915 CHECK_CALLED(GetWindow);
3916 CHECK_CALLED(Exec_DOCCANNAVIGATE);
3917 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
3918 CHECK_CALLED(Exec_SETPROGRESSMAX);
3919 CHECK_CALLED(Exec_SETPROGRESSPOS);
3920 CHECK_CALLED(Exec_ShellDocView_37);
3922 if(!container_locked) {
3923 CHECK_CALLED(GetContainer);
3924 CHECK_CALLED(LockContainer);
3925 container_locked = TRUE;
3927 CHECK_CALLED(OnChanged_READYSTATE);
3928 SET_CALLED(IsSystemMoniker); /* IE7 */
3929 SET_CALLED(Exec_ShellDocView_84);
3931 CHECK_CALLED(BindToStorage);
3932 SET_CALLED(SetActiveObject); /* FIXME */
3933 if(set_clientsite) {
3934 CHECK_CALLED(Invoke_AMBIENT_SILENT);
3935 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3936 CHECK_CALLED(Exec_ShellDocView_37);
3937 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
3940 todo_wine CHECK_CALLED(GetTravelLog);
3941 todo_wine CHECK_CALLED(GetPendingUrl);
3943 set_clientsite = container_locked = TRUE;
3945 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
3947 IBindCtx_Release(bind);
3949 test_readyState((IUnknown*)persist);
3952 #define DWL_VERBDONE 0x0001
3953 #define DWL_CSS 0x0002
3954 #define DWL_TRYCSS 0x0004
3955 #define DWL_HTTP 0x0008
3956 #define DWL_EMPTY 0x0010
3958 static void test_download(DWORD flags)
3963 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
3964 ok(hwnd != NULL, "Could not find hidden window\n");
3966 test_readyState(NULL);
3968 if(flags & (DWL_VERBDONE|DWL_HTTP))
3969 SET_EXPECT(Exec_SETPROGRESSMAX);
3970 if((flags & DWL_VERBDONE) && !load_from_stream)
3971 SET_EXPECT(GetHostInfo);
3972 SET_EXPECT(SetStatusText);
3973 if(!(flags & DWL_EMPTY))
3974 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
3975 SET_EXPECT(OnViewChange);
3976 SET_EXPECT(GetDropTarget);
3977 if(flags & DWL_TRYCSS)
3978 SET_EXPECT(Exec_ShellDocView_84);
3979 if(flags & DWL_CSS) {
3980 SET_EXPECT(CreateInstance);
3982 SET_EXPECT(LockRequest);
3983 SET_EXPECT(Terminate);
3984 SET_EXPECT(Protocol_Read);
3985 SET_EXPECT(UnlockRequest);
3987 SET_EXPECT(Exec_Explorer_69);
3988 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
3989 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
3990 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
3991 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
3993 SET_EXPECT(Exec_ShellDocView_37);
3994 if(flags & DWL_HTTP) {
3995 SET_EXPECT(OnChanged_1012);
3996 SET_EXPECT(Exec_HTTPEQUIV);
3997 SET_EXPECT(Exec_SETTITLE);
3999 SET_EXPECT(OnChanged_1005);
4000 SET_EXPECT(OnChanged_READYSTATE);
4001 SET_EXPECT(Exec_SETPROGRESSPOS);
4002 if(!(flags & DWL_EMPTY))
4003 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
4004 SET_EXPECT(Exec_ShellDocView_103);
4005 SET_EXPECT(Exec_ShellDocView_105);
4006 SET_EXPECT(Exec_ShellDocView_140);
4007 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
4008 SET_EXPECT(Exec_HTTPEQUIV_DONE);
4009 SET_EXPECT(SetStatusText);
4011 SET_EXPECT(UpdateUI);
4012 SET_EXPECT(Exec_UPDATECOMMANDS);
4013 SET_EXPECT(Exec_SETTITLE);
4014 SET_EXPECT(UpdateBackForwardState);
4016 if(!editmode && !(flags & DWL_EMPTY))
4017 SET_EXPECT(FireNavigateComplete2);
4019 SET_EXPECT(FireDocumentComplete);
4020 SET_EXPECT(ActiveElementChanged);
4021 SET_EXPECT(IsErrorUrl);
4022 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
4024 while(!called_Exec_HTTPEQUIV_DONE && GetMessage(&msg, NULL, 0, 0)) {
4025 TranslateMessage(&msg);
4026 DispatchMessage(&msg);
4029 if(flags & DWL_VERBDONE)
4030 CHECK_CALLED(Exec_SETPROGRESSMAX);
4031 if(flags & DWL_HTTP)
4032 SET_CALLED(Exec_SETPROGRESSMAX);
4033 if((flags & DWL_VERBDONE) && !load_from_stream) {
4035 todo_wine CHECK_CALLED(GetHostInfo);
4037 CHECK_CALLED(GetHostInfo);
4039 CHECK_CALLED(SetStatusText);
4040 if(!(flags & DWL_EMPTY))
4041 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
4042 CHECK_CALLED(OnViewChange);
4043 SET_CALLED(GetDropTarget);
4044 if(flags & DWL_TRYCSS)
4045 SET_CALLED(Exec_ShellDocView_84);
4046 if(flags & DWL_CSS) {
4047 CHECK_CALLED(CreateInstance);
4048 CHECK_CALLED(Start);
4049 CHECK_CALLED(LockRequest);
4050 CHECK_CALLED(Terminate);
4051 CHECK_CALLED(Protocol_Read);
4052 CHECK_CALLED(UnlockRequest);
4054 SET_CALLED(Exec_Explorer_69);
4055 SET_CALLED(EnableModeless_TRUE); /* IE7 */
4056 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
4057 SET_CALLED(EnableModeless_FALSE); /* IE7 */
4058 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
4060 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
4061 if(flags & DWL_HTTP) todo_wine {
4062 CHECK_CALLED(OnChanged_1012);
4063 CHECK_CALLED(Exec_HTTPEQUIV);
4064 CHECK_CALLED(Exec_SETTITLE);
4066 CHECK_CALLED(OnChanged_1005);
4067 CHECK_CALLED(OnChanged_READYSTATE);
4068 CHECK_CALLED(Exec_SETPROGRESSPOS);
4069 if(!(flags & DWL_EMPTY))
4070 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
4071 SET_CALLED(Exec_ShellDocView_103);
4072 SET_CALLED(Exec_ShellDocView_105);
4073 SET_CALLED(Exec_ShellDocView_140);
4074 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
4075 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
4076 SET_CALLED(SetStatusText);
4077 if(nav_url) { /* avoiding race, FIXME: find better way */
4078 SET_CALLED(UpdateUI);
4079 SET_CALLED(Exec_UPDATECOMMANDS);
4080 SET_CALLED(Exec_SETTITLE);
4081 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
4083 if(!editmode && !(flags & DWL_EMPTY))
4084 todo_wine CHECK_CALLED(FireNavigateComplete2);
4086 CHECK_CALLED(FireDocumentComplete);
4087 todo_wine CHECK_CALLED(ActiveElementChanged);
4088 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4090 load_state = LD_COMPLETE;
4092 test_readyState(NULL);
4095 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
4097 IPersistMoniker *persist_mon;
4098 IPersistFile *persist_file;
4102 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
4103 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
4104 if(SUCCEEDED(hres)) {
4105 hres = IPersist_GetClassID(persist_file, NULL);
4106 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4108 hres = IPersist_GetClassID(persist_file, &guid);
4109 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4110 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4112 IPersist_Release(persist_file);
4115 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
4116 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
4117 if(SUCCEEDED(hres)) {
4118 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
4119 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4121 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
4122 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4123 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4125 if(load_state == LD_DOLOAD)
4126 test_Load(persist_mon, mon);
4128 test_readyState((IUnknown*)doc);
4130 IPersistMoniker_Release(persist_mon);
4134 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace)
4136 IHTMLPrivateWindow *priv_window;
4137 IHTMLWindow2 *window;
4138 IHTMLLocation *location;
4144 hres = IHTMLDocument2_get_location(doc, &location);
4145 ok(hres == S_OK, "get_location failed: %08x\n", hres);
4146 ok(location != NULL, "location == NULL\n");
4148 nav_url = use_replace ? "about:replace" : "about:blank";
4150 str = a2bstr(nav_url);
4151 SET_EXPECT(TranslateUrl);
4152 SET_EXPECT(Navigate);
4154 hres = IHTMLLocation_replace(location, str);
4155 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4157 hres = IHTMLLocation_put_href(location, str);
4158 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4160 CHECK_CALLED(TranslateUrl);
4161 CHECK_CALLED(Navigate);
4163 IHTMLLocation_Release(location);
4165 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4166 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4168 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
4169 IHTMLWindow2_Release(window);
4170 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
4172 readystate_set_loading = TRUE;
4173 SET_EXPECT(TranslateUrl);
4174 SET_EXPECT(Exec_ShellDocView_67);
4175 SET_EXPECT(Invoke_AMBIENT_SILENT);
4176 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4177 SET_EXPECT(OnChanged_READYSTATE);
4178 SET_EXPECT(Exec_ShellDocView_63);
4181 V_VT(&vempty) = VT_EMPTY;
4182 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
4183 SysFreeString(str2);
4184 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
4186 CHECK_CALLED(TranslateUrl);
4187 CHECK_CALLED(Exec_ShellDocView_67);
4188 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4189 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4190 SET_CALLED(OnChanged_READYSTATE); /* not always called */
4191 CHECK_CALLED(Exec_ShellDocView_63);
4194 test_GetCurMoniker(doc_unk, doc_mon, NULL);
4197 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4198 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4199 ok(!strcmp_wa(str2, use_replace?"about:blank":"http://www.winehq.org/"),
4200 "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4201 SysFreeString(str2);
4203 test_download(DWL_VERBDONE);
4205 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4206 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4207 ok(!lstrcmpW(str2, str), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4208 SysFreeString(str2);
4210 IHTMLPrivateWindow_Release(priv_window);
4213 static void test_open_window(IHTMLDocument2 *doc)
4215 IHTMLWindow2 *window, *new_window;
4219 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4220 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4222 url = a2bstr(nav_url = "about:blank");
4223 name = a2bstr("test");
4224 new_window = (void*)0xdeadbeef;
4228 SET_EXPECT(TranslateUrl);
4229 SET_EXPECT(EvaluateNewWindow);
4231 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
4234 SysFreeString(name);
4237 CHECK_CALLED(TranslateUrl);
4239 if(!called_EvaluateNewWindow) {
4241 win_skip("INewWindowManager not supported\n");
4242 if(SUCCEEDED(hres) && new_window)
4243 IHTMLWindow2_Release(new_window);
4244 IHTMLWindow2_Release(window);
4249 CHECK_CALLED(EvaluateNewWindow);
4252 ok(hres == S_OK, "open failed: %08x\n", hres);
4254 ok(new_window == NULL, "new_window != NULL\n");
4256 IHTMLWindow2_Release(window);
4259 static void test_clear(IHTMLDocument2 *doc)
4263 hres = IHTMLDocument2_clear(doc);
4264 ok(hres == S_OK, "clear failed: %08x\n", hres);
4267 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
4269 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
4270 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
4271 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
4272 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
4273 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
4274 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
4275 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
4276 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
4277 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
4278 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
4279 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
4280 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
4281 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
4282 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
4283 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
4284 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
4285 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
4286 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
4287 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
4288 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
4290 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
4291 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
4293 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
4295 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
4297 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
4298 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
4300 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
4301 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
4303 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
4305 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
4306 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
4309 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
4310 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
4312 IOleCommandTarget *cmdtrg;
4313 OLECMD olecmd = {cmdid, 0};
4316 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4317 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4321 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
4322 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
4324 IOleCommandTarget_Release(cmdtrg);
4326 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
4327 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
4330 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
4332 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
4334 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
4335 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
4336 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
4337 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
4338 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
4339 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
4340 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
4341 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
4342 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
4343 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
4344 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
4345 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
4346 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
4347 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
4348 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
4349 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
4352 static void test_OleCommandTarget(IHTMLDocument2 *doc)
4354 IOleCommandTarget *cmdtrg;
4355 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
4359 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4360 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4364 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4365 cmds[i].cmdID = i+1;
4366 cmds[i].cmdf = 0xf0f0;
4369 SET_EXPECT(QueryStatus_OPEN);
4370 SET_EXPECT(QueryStatus_NEW);
4371 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
4372 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4373 CHECK_CALLED(QueryStatus_OPEN);
4374 CHECK_CALLED(QueryStatus_NEW);
4376 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4377 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
4378 if(i+1 == OLECMDID_FIND)
4380 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
4381 i+1, cmds[i].cmdf, expect_cmds[i+1]);
4384 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
4385 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
4387 IOleCommandTarget_Release(cmdtrg);
4390 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
4392 IOleCommandTarget *cmdtrg;
4397 {OLECMDID_OPEN, 0xf0f0},
4398 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
4401 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4402 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
4406 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
4407 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4409 SET_EXPECT(QueryStatus_OPEN);
4410 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
4411 CHECK_CALLED(QueryStatus_OPEN);
4413 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4414 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4415 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
4416 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
4417 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
4418 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
4419 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
4421 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
4422 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
4423 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
4425 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4426 if(!expect_cmds[i]) {
4427 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
4428 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4429 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4430 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4434 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
4435 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4436 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4437 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4439 IOleCommandTarget_Release(cmdtrg);
4442 static void test_exec_onunload(IHTMLDocument2 *doc)
4444 IOleCommandTarget *cmdtrg;
4448 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4449 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4453 memset(&var, 0x0a, sizeof(var));
4454 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4455 OLECMDEXECOPT_DODEFAULT, NULL, &var);
4456 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4457 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
4458 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
4460 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4461 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4462 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4464 IOleCommandTarget_Release(cmdtrg);
4467 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
4469 IOleCommandTarget *cmdtrg;
4472 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4473 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4480 load_state = LD_DOLOAD;
4483 SET_EXPECT(GetClassID);
4484 SET_EXPECT(SetStatusText);
4485 SET_EXPECT(Exec_ShellDocView_37);
4486 SET_EXPECT(GetHostInfo);
4488 SET_EXPECT(GetDisplayName);
4489 SET_EXPECT(Invoke_AMBIENT_SILENT);
4490 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4491 SET_EXPECT(OnChanged_READYSTATE);
4492 SET_EXPECT(IsSystemMoniker);
4493 SET_EXPECT(Exec_ShellDocView_84);
4495 SET_EXPECT(BindToStorage);
4496 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4499 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4501 expect_status_text = NULL;
4502 readystate_set_loading = TRUE;
4504 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4505 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4506 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4509 CHECK_CALLED(GetClassID);
4510 CHECK_CALLED(SetStatusText);
4511 CHECK_CALLED(Exec_ShellDocView_37);
4512 CHECK_CALLED(GetHostInfo);
4514 CHECK_CALLED(GetDisplayName);
4515 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4516 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4517 CHECK_CALLED(OnChanged_READYSTATE);
4518 SET_CALLED(IsSystemMoniker); /* IE7 */
4519 SET_CALLED(Exec_ShellDocView_84);
4521 CHECK_CALLED(BindToStorage);
4522 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4523 CHECK_CALLED(HideUI);
4524 CHECK_CALLED(ShowUI);
4525 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4527 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
4529 IOleCommandTarget_Release(cmdtrg);
4531 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4532 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4533 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4536 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
4538 IOleCommandTarget *cmdtrg;
4539 VARIANT *in = NULL, _in, *out = NULL, _out;
4542 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4543 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
4550 V_BSTR(in) = SysAllocString(name);
4556 V_I4(out) = 0xdeadbeef;
4559 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
4560 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
4566 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
4567 if(V_VT(out) == VT_BSTR) {
4569 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
4570 "unexpected fontname %s\n", wine_dbgstr_w(name));
4572 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
4577 IOleCommandTarget_Release(cmdtrg);
4580 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
4582 IOleCommandTarget *cmdtrg;
4585 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4586 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4590 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
4591 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4592 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4594 IOleCommandTarget_Release(cmdtrg);
4597 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
4599 IPersistStreamInit *perinit;
4600 IPersistMoniker *permon;
4601 IPersistFile *perfile;
4604 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
4605 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
4606 if(SUCCEEDED(hres)) {
4607 hres = IPersistStreamInit_IsDirty(perinit);
4608 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4609 IPersistStreamInit_Release(perinit);
4612 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
4613 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
4614 if(SUCCEEDED(hres)) {
4615 hres = IPersistMoniker_IsDirty(permon);
4616 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4617 IPersistMoniker_Release(permon);
4620 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
4621 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
4622 if(SUCCEEDED(hres)) {
4623 hres = IPersistFile_IsDirty(perfile);
4624 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4625 IPersistFile_Release(perfile);
4629 static HWND create_container_window(void)
4631 static const WCHAR wszHTMLDocumentTest[] =
4632 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
4633 static WNDCLASSEXW wndclass = {
4634 sizeof(WNDCLASSEXW),
4637 0, 0, NULL, NULL, NULL, NULL, NULL,
4638 wszHTMLDocumentTest,
4642 RegisterClassExW(&wndclass);
4643 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
4644 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
4645 515, 530, NULL, NULL, NULL, NULL);
4648 static void test_DoVerb(IOleObject *oleobj)
4650 RECT rect = {0,0,500,500};
4653 if(!container_locked) {
4654 SET_EXPECT(GetContainer);
4655 SET_EXPECT(LockContainer);
4657 SET_EXPECT(ActivateMe);
4658 expect_LockContainer_fLock = TRUE;
4660 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
4661 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
4663 if(!container_locked) {
4664 CHECK_CALLED(GetContainer);
4665 CHECK_CALLED(LockContainer);
4666 container_locked = TRUE;
4668 CHECK_CALLED(ActivateMe);
4671 #define CLIENTSITE_EXPECTPATH 0x00000001
4672 #define CLIENTSITE_SETNULL 0x00000002
4673 #define CLIENTSITE_DONTSET 0x00000004
4675 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
4677 IOleClientSite *clientsite;
4680 if(flags & CLIENTSITE_SETNULL) {
4681 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4682 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4684 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
4686 ok(!clientsite, "clientsite != NULL\n");
4688 hres = IOleObject_SetClientSite(oleobj, NULL);
4689 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4691 set_clientsite = FALSE;
4694 if(flags & CLIENTSITE_DONTSET)
4697 if(!expect_uihandler_iface)
4698 expect_uihandler_iface = &DocHostUIHandler;
4700 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4701 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4702 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
4703 clientsite, set_clientsite ? &ClientSite : NULL);
4705 if(!set_clientsite) {
4706 if(expect_uihandler_iface)
4707 SET_EXPECT(GetHostInfo);
4708 if(flags & CLIENTSITE_EXPECTPATH) {
4709 SET_EXPECT(GetOptionKeyPath);
4710 SET_EXPECT(GetOverrideKeyPath);
4712 SET_EXPECT(GetWindow);
4713 if(flags & CLIENTSITE_EXPECTPATH)
4714 SET_EXPECT(Exec_DOCCANNAVIGATE);
4715 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4716 SET_EXPECT(Exec_SETPROGRESSMAX);
4717 SET_EXPECT(Exec_SETPROGRESSPOS);
4718 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4719 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4720 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4721 SET_EXPECT(Invoke_AMBIENT_SILENT);
4722 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4723 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4724 SET_EXPECT(GetTravelLog);
4726 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4727 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4729 if(expect_uihandler_iface)
4730 CHECK_CALLED(GetHostInfo);
4731 if(flags & CLIENTSITE_EXPECTPATH) {
4732 CHECK_CALLED(GetOptionKeyPath);
4733 CHECK_CALLED(GetOverrideKeyPath);
4735 CHECK_CALLED(GetWindow);
4736 if(flags & CLIENTSITE_EXPECTPATH)
4737 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4738 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4739 CHECK_CALLED(Exec_SETPROGRESSMAX);
4740 CHECK_CALLED(Exec_SETPROGRESSPOS);
4741 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4742 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4743 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4744 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4745 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4746 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4747 todo_wine CHECK_CALLED(GetTravelLog);
4749 set_clientsite = TRUE;
4752 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4753 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4755 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4756 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4757 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
4760 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
4762 IOleControl *control = NULL;
4765 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
4766 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
4770 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4771 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
4772 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4773 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4775 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4776 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
4777 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4778 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4780 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4781 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4782 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
4783 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4784 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4785 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4787 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4788 SET_EXPECT(Invoke_AMBIENT_SILENT);
4789 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
4790 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4791 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4792 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4794 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4795 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
4796 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4797 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4799 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4800 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
4801 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4802 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4804 IOleControl_Release(control);
4809 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
4811 IOleControl *control = NULL;
4814 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
4815 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
4819 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
4820 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
4822 IOleControl_Release(control);
4825 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
4827 IOleObject *oleobj = NULL;
4830 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4831 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
4835 SET_EXPECT(GetContainer);
4836 SET_EXPECT(LockContainer);
4837 expect_LockContainer_fLock = FALSE;
4838 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
4839 ok(hres == S_OK, "Close failed: %08x\n", hres);
4840 CHECK_CALLED(GetContainer);
4841 CHECK_CALLED(LockContainer);
4842 container_locked = FALSE;
4845 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
4847 IOleObject_Release(oleobj);
4850 static void test_Advise(IHTMLDocument2 *doc)
4852 IOleObject *oleobj = NULL;
4853 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
4857 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4858 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
4862 hres = IOleObject_Unadvise(oleobj, 0);
4863 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
4865 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
4866 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
4867 ok(enum_advise == NULL, "enum_advise != NULL\n");
4870 hres = IOleObject_Advise(oleobj, NULL, &conn);
4871 /* Old IE returns S_OK and sets conn to 1 */
4872 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
4873 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
4875 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
4876 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
4878 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
4879 ok(hres == S_OK, "Advise returned: %08x\n", hres);
4880 ok(conn == 1, "conn = %d\n", conn);
4882 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
4883 ok(hres == S_OK, "Advise returned: %08x\n", hres);
4884 ok(conn == 2, "conn = %d\n", conn);
4886 hres = IOleObject_Unadvise(oleobj, 1);
4887 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
4889 hres = IOleObject_Unadvise(oleobj, 1);
4890 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
4892 hres = IOleObject_Unadvise(oleobj, 2);
4893 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
4895 IOleObject_Release(oleobj);
4898 static void test_OnFrameWindowActivate(IUnknown *unk)
4900 IOleInPlaceActiveObject *inplaceact;
4903 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
4904 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
4908 if(set_clientsite) {
4909 expect_OnFrameWindowActivate_fActivate = TRUE;
4910 SET_EXPECT(OnFrameWindowActivate);
4911 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
4912 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4913 CHECK_CALLED(OnFrameWindowActivate);
4915 SET_EXPECT(OnFrameWindowActivate);
4916 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
4917 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4918 CHECK_CALLED(OnFrameWindowActivate);
4920 expect_OnFrameWindowActivate_fActivate = FALSE;
4921 SET_EXPECT(OnFrameWindowActivate);
4922 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
4923 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4924 CHECK_CALLED(OnFrameWindowActivate);
4926 expect_OnFrameWindowActivate_fActivate = TRUE;
4927 SET_EXPECT(OnFrameWindowActivate);
4928 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
4929 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4930 CHECK_CALLED(OnFrameWindowActivate);
4932 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
4933 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4935 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
4936 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
4939 IOleInPlaceActiveObject_Release(inplaceact);
4942 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
4944 IOleInPlaceObjectWindowless *windowlessobj = NULL;
4947 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
4948 (void**)&windowlessobj);
4949 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
4954 SET_EXPECT(OnFocus_FALSE);
4956 SET_EXPECT(OnInPlaceDeactivateEx);
4958 SET_EXPECT(OnInPlaceDeactivate);
4960 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
4961 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
4963 CHECK_CALLED(OnFocus_FALSE);
4965 CHECK_CALLED(OnInPlaceDeactivateEx);
4967 CHECK_CALLED(OnInPlaceDeactivate);
4970 IOleInPlaceObjectWindowless_Release(windowlessobj);
4973 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
4975 IOleObject *oleobj = NULL;
4976 IOleDocumentView *docview;
4983 IOleDocumentView_Release(view);
4986 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4987 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
4989 hres = IOleObject_GetUserClassID(oleobj, NULL);
4990 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
4992 hres = IOleObject_GetUserClassID(oleobj, &guid);
4993 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
4994 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
4996 test_OnFrameWindowActivate((IUnknown*)doc);
4998 test_ClientSite(oleobj, flags);
4999 test_InPlaceDeactivate(doc, FALSE);
5000 test_DoVerb(oleobj);
5002 if(call_UIActivate == CallUIActivate_AfterShow) {
5003 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5004 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5006 SET_EXPECT(OnFocus_TRUE);
5007 SET_EXPECT(SetActiveObject);
5009 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5010 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5011 expect_status_text = NULL;
5013 hres = IOleDocumentView_UIActivate(docview, TRUE);
5014 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5016 CHECK_CALLED(OnFocus_TRUE);
5017 CHECK_CALLED(SetActiveObject);
5018 CHECK_CALLED(ShowUI);
5019 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5020 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5022 IOleDocumentView_Release(docview);
5025 IOleObject_Release(oleobj);
5027 test_OnFrameWindowActivate((IUnknown*)doc);
5030 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
5032 IOleInPlaceActiveObject *activeobject = NULL;
5036 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
5037 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
5041 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
5043 if(expect_success) {
5044 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
5045 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
5047 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
5048 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5051 IOleInPlaceActiveObject_Release(activeobject);
5054 static void test_CloseView(void)
5056 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
5062 hres = IOleDocumentView_Show(view, FALSE);
5063 ok(hres == S_OK, "Show failed: %08x\n", hres);
5065 hres = IOleDocumentView_CloseView(view, 0);
5066 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
5068 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
5069 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5071 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
5072 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5073 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
5076 static void test_UIDeactivate(void)
5080 if(call_UIActivate == CallUIActivate_AfterShow) {
5081 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5083 if(call_UIActivate != CallUIActivate_None) {
5084 SET_EXPECT(SetActiveObject_null);
5086 SET_EXPECT(OnUIDeactivate);
5089 hres = IOleDocumentView_UIActivate(view, FALSE);
5090 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
5092 if(call_UIActivate != CallUIActivate_None) {
5093 CHECK_CALLED(SetActiveObject_null);
5094 CHECK_CALLED(HideUI);
5095 CHECK_CALLED(OnUIDeactivate);
5097 if(call_UIActivate == CallUIActivate_AfterShow) {
5098 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5102 static void test_Hide(void)
5109 hres = IOleDocumentView_Show(view, FALSE);
5110 ok(hres == S_OK, "Show failed: %08x\n", hres);
5113 static IHTMLDocument2 *create_document(void)
5115 IHTMLDocument2 *doc;
5118 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
5119 &IID_IHTMLDocument2, (void**)&doc);
5120 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
5127 static void release_document(IHTMLDocument2 *doc)
5133 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
5134 * To workaround it, we release it via IUnknown iface */
5135 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
5136 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
5138 IHTMLDocument2_Release(doc);
5139 ref = IUnknown_Release(unk);
5140 ok(!ref, "ref = %d\n", ref);
5143 static void test_Navigate(IHTMLDocument2 *doc)
5145 IHlinkTarget *hlink;
5148 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
5149 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
5151 SET_EXPECT(ActivateMe);
5152 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
5153 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
5154 CHECK_CALLED(ActivateMe);
5156 IHlinkTarget_Release(hlink);
5159 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
5161 IDispatch *external;
5162 IHTMLWindow2 *htmlwin;
5165 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
5166 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5169 SET_EXPECT(GetExternal);
5170 external = (void*)0xdeadbeef;
5171 hres = IHTMLWindow2_get_external(htmlwin, &external);
5173 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
5174 CHECK_CALLED(GetExternal);
5175 ok(external != NULL, "external == NULL\n");
5177 ok(hres == S_OK, "get_external failed: %08x\n", hres);
5178 ok(external == NULL, "external != NULL\n");
5181 IHTMLWindow2_Release(htmlwin);
5184 static void test_StreamLoad(IHTMLDocument2 *doc)
5186 IPersistStreamInit *init;
5189 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5190 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5194 SET_EXPECT(Invoke_AMBIENT_SILENT);
5195 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5196 SET_EXPECT(Exec_ShellDocView_37);
5197 SET_EXPECT(OnChanged_READYSTATE);
5199 SET_EXPECT(GetPendingUrl);
5200 readystate_set_loading = TRUE;
5202 hres = IPersistStreamInit_Load(init, &Stream);
5203 ok(hres == S_OK, "Load failed: %08x\n", hres);
5205 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5206 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5207 CHECK_CALLED(Exec_ShellDocView_37);
5208 CHECK_CALLED(OnChanged_READYSTATE);
5210 todo_wine CHECK_CALLED(GetPendingUrl);
5212 test_timer(EXPECT_SETTITLE);
5213 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5215 IPersistStreamInit_Release(init);
5218 static void test_StreamInitNew(IHTMLDocument2 *doc)
5220 IPersistStreamInit *init;
5223 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5224 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5228 SET_EXPECT(Invoke_AMBIENT_SILENT);
5229 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5230 SET_EXPECT(Exec_ShellDocView_37);
5231 SET_EXPECT(OnChanged_READYSTATE);
5232 SET_EXPECT(GetPendingUrl);
5233 readystate_set_loading = TRUE;
5235 hres = IPersistStreamInit_InitNew(init);
5236 ok(hres == S_OK, "Load failed: %08x\n", hres);
5238 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5239 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5240 CHECK_CALLED(Exec_ShellDocView_37);
5241 CHECK_CALLED(OnChanged_READYSTATE);
5242 todo_wine CHECK_CALLED(GetPendingUrl);
5244 test_timer(EXPECT_SETTITLE);
5245 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5247 IPersistStreamInit_Release(init);
5250 static void test_QueryInterface(IHTMLDocument2 *doc)
5255 static const IID IID_UndocumentedScriptIface =
5256 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
5258 qi = (void*)0xdeadbeef;
5259 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
5260 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5261 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
5263 qi = (void*)0xdeadbeef;
5264 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
5265 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5266 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5268 qi = (void*)0xdeadbeef;
5269 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
5270 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5271 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5273 qi = (void*)0xdeadbeef;
5274 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
5275 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5276 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5278 qi = (void*)0xdeadbeef;
5279 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
5280 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5281 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5283 qi = (void*)0xdeadbeef;
5284 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
5285 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5286 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5288 qi = (void*)0xdeadbeef;
5289 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
5290 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5291 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5293 qi = (void*)0xdeadbeef;
5294 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
5295 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5296 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5298 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
5299 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
5300 ok(qi != (IUnknown*)doc, "disp == doc\n");
5301 IUnknown_Release(qi);
5304 static void init_test(enum load_state_t ls) {
5306 hwnd = last_hwnd = NULL;
5307 set_clientsite = FALSE;
5308 load_from_stream = FALSE;
5309 call_UIActivate = CallUIActivate_None;
5316 inplace_deactivated = FALSE;
5317 expect_uihandler_iface = &DocHostUIHandler;
5320 static void test_HTMLDocument(BOOL do_load)
5322 IHTMLDocument2 *doc;
5324 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
5326 init_test(do_load ? LD_DOLOAD : LD_NO);
5328 doc = create_document();
5329 doc_unk = (IUnknown*)doc;
5331 test_QueryInterface(doc);
5333 test_IsDirty(doc, S_FALSE);
5334 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5335 test_external(doc, FALSE);
5336 test_ViewAdviseSink(doc);
5337 test_ConnectionPointContainer(doc);
5338 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5339 test_Persist(doc, &Moniker);
5341 test_OnAmbientPropertyChange2(doc);
5343 test_Activate(doc, CLIENTSITE_EXPECTPATH);
5346 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5347 test_download(DWL_CSS|DWL_TRYCSS);
5348 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5351 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5352 test_OleCommandTarget_fail(doc);
5353 test_OleCommandTarget(doc);
5354 test_OnAmbientPropertyChange(doc);
5355 test_Window(doc, TRUE);
5356 test_external(doc, TRUE);
5358 test_UIDeactivate();
5359 test_OleCommandTarget(doc);
5360 test_Window(doc, TRUE);
5361 test_InPlaceDeactivate(doc, TRUE);
5363 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
5364 * MSHTML. It doesn't with Wine. */
5366 test_Window(doc, FALSE);
5368 test_InPlaceDeactivate(doc, FALSE);
5370 test_Close(doc, FALSE);
5372 /* Activate HTMLDocument again */
5373 test_Activate(doc, CLIENTSITE_SETNULL);
5374 test_Window(doc, TRUE);
5375 test_OleCommandTarget(doc);
5376 test_UIDeactivate();
5377 test_InPlaceDeactivate(doc, TRUE);
5378 test_Close(doc, FALSE);
5380 /* Activate HTMLDocument again, this time without UIActivate */
5381 call_UIActivate = CallUIActivate_None;
5382 test_Activate(doc, CLIENTSITE_SETNULL);
5383 test_Window(doc, TRUE);
5385 test_external(doc, TRUE);
5386 set_custom_uihandler(doc, NULL);
5387 test_external(doc, FALSE);
5389 test_UIDeactivate();
5390 test_InPlaceDeactivate(doc, TRUE);
5393 test_Close(doc, TRUE);
5394 test_OnAmbientPropertyChange2(doc);
5395 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
5398 /* Activate HTMLDocument again, calling UIActivate after showing the window */
5399 call_UIActivate = CallUIActivate_AfterShow;
5400 test_Activate(doc, 0);
5401 test_Window(doc, TRUE);
5402 test_OleCommandTarget(doc);
5403 test_UIDeactivate();
5404 test_InPlaceDeactivate(doc, TRUE);
5405 test_Close(doc, FALSE);
5406 call_UIActivate = CallUIActivate_None;
5410 IOleDocumentView_Release(view);
5413 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5414 release_document(doc);
5415 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
5418 static void test_HTMLDocument_hlink(DWORD status)
5420 IHTMLDocument2 *doc;
5422 trace("Testing HTMLDocument (hlink)...\n");
5424 init_test(LD_DOLOAD);
5427 doc = create_document();
5428 doc_unk = (IUnknown*)doc;
5430 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5431 test_ViewAdviseSink(doc);
5432 test_ConnectionPointContainer(doc);
5433 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5434 test_Persist(doc, &Moniker);
5437 status_code = status;
5438 test_download(DWL_CSS|DWL_TRYCSS);
5439 status_code = HTTP_STATUS_OK;
5441 test_IsDirty(doc, S_FALSE);
5442 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5444 test_exec_onunload(doc);
5445 test_Window(doc, TRUE);
5446 test_InPlaceDeactivate(doc, TRUE);
5447 test_Close(doc, FALSE);
5448 test_IsDirty(doc, S_FALSE);
5449 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5451 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5454 IOleDocumentView_Release(view);
5457 release_document(doc);
5460 static void test_cookies(IHTMLDocument2 *doc)
5468 hres = IHTMLDocument2_get_cookie(doc, &str);
5469 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5471 size = sizeof(buf)/sizeof(WCHAR);
5472 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5473 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5474 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
5478 str = a2bstr("test=testval");
5479 hres = IHTMLDocument2_put_cookie(doc, str);
5480 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5483 hres = IHTMLDocument2_get_cookie(doc, &str2);
5484 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5485 ok(str2 != NULL, "cookie = NULL\n");
5486 size = sizeof(buf)/sizeof(WCHAR);
5487 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5488 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5489 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5490 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5492 SysFreeString(str2);
5494 str = a2bstr("test=testval2");
5495 hres = IHTMLDocument2_put_cookie(doc, str);
5496 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5499 hres = IHTMLDocument2_get_cookie(doc, &str2);
5500 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5501 ok(str2 != NULL, "cookie = NULL\n");
5502 size = sizeof(buf)/sizeof(WCHAR);
5503 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5504 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5505 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5506 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5508 SysFreeString(str2);
5511 static void test_HTMLDocument_http(void)
5514 IHTMLDocument2 *doc;
5518 trace("Testing HTMLDocument (http)...\n");
5520 if(!winetest_interactive && is_ie_hardened()) {
5521 win_skip("IE running in Enhanced Security Configuration\n");
5525 init_test(LD_DOLOAD);
5528 doc = create_document();
5529 doc_unk = (IUnknown*)doc;
5531 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
5532 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
5534 test_ViewAdviseSink(doc);
5535 test_ConnectionPointContainer(doc);
5536 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5537 test_Persist(doc, http_mon);
5539 test_download(DWL_HTTP);
5541 test_IsDirty(doc, S_FALSE);
5542 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5543 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
5545 test_put_href(doc, FALSE);
5546 test_put_href(doc, TRUE);
5547 test_open_window(doc);
5549 test_InPlaceDeactivate(doc, TRUE);
5550 test_Close(doc, FALSE);
5551 test_IsDirty(doc, S_FALSE);
5552 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
5555 IOleDocumentView_Release(view);
5558 release_document(doc);
5560 ref = IMoniker_Release(http_mon);
5561 ok(!ref, "ref=%d, expected 0\n", ref);
5564 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
5566 IHTMLWindow2 *window, *sp_window;
5567 IServiceProvider *sp;
5571 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
5572 ok(hres == S_OK, "QueryService returned %08x\n", hres);
5574 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5576 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
5577 IServiceProvider_Release(sp);
5581 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5582 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5583 IHlinkFrame_Release(hf);
5585 IServiceProvider_Release(sp);
5587 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5588 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5590 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
5591 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
5593 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
5594 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
5595 /* FIXME: test returned window */
5596 IHTMLWindow2_Release(sp_window);
5598 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5599 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5600 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5601 IHlinkFrame_Release(hf);
5603 IServiceProvider_Release(sp);
5604 IHTMLWindow2_Release(window);
5607 static void test_HTMLDocument_StreamLoad(void)
5609 IHTMLDocument2 *doc;
5614 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
5616 init_test(LD_DOLOAD);
5617 load_from_stream = TRUE;
5619 doc = create_document();
5620 doc_unk = (IUnknown*)doc;
5622 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5623 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5625 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5626 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5628 test_readyState((IUnknown*)doc);
5629 test_IsDirty(doc, S_FALSE);
5630 test_ViewAdviseSink(doc);
5631 test_ConnectionPointContainer(doc);
5632 test_QueryService(doc, FALSE);
5633 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5634 test_QueryService(doc, TRUE);
5635 test_DoVerb(oleobj);
5636 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5638 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5639 test_StreamLoad(doc);
5640 test_download(DWL_VERBDONE|DWL_TRYCSS);
5641 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5643 test_UIDeactivate();
5644 test_InPlaceDeactivate(doc, TRUE);
5645 SET_EXPECT(Advise_Close);
5646 test_Close(doc, TRUE);
5647 CHECK_CALLED(Advise_Close);
5648 test_external(doc, FALSE);
5649 test_IsDirty(doc, S_FALSE);
5651 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5652 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
5653 test_external(doc, TRUE);
5654 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5655 test_external(doc, TRUE);
5656 set_custom_uihandler(doc, NULL);
5657 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5659 IOleObject_Release(oleobj);
5661 IOleDocumentView_Release(view);
5665 release_document(doc);
5668 static void test_HTMLDocument_StreamInitNew(void)
5670 IHTMLDocument2 *doc;
5675 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
5677 init_test(LD_DOLOAD);
5678 load_from_stream = TRUE;
5680 doc = create_document();
5681 doc_unk = (IUnknown*)doc;
5683 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5684 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5686 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5687 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5689 test_readyState((IUnknown*)doc);
5690 test_IsDirty(doc, S_FALSE);
5691 test_ViewAdviseSink(doc);
5692 test_ConnectionPointContainer(doc);
5693 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5694 test_DoVerb(oleobj);
5695 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5697 IOleObject_Release(oleobj);
5699 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5700 test_StreamInitNew(doc);
5701 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
5702 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5704 test_UIDeactivate();
5705 test_InPlaceDeactivate(doc, TRUE);
5706 SET_EXPECT(Advise_Close);
5707 test_Close(doc, FALSE);
5708 CHECK_CALLED(Advise_Close);
5709 test_IsDirty(doc, S_FALSE);
5712 IOleDocumentView_Release(view);
5716 release_document(doc);
5719 static void test_edit_uiactivate(IOleObject *oleobj)
5721 IOleDocumentView *docview;
5724 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5725 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5727 SET_EXPECT(OnFocus_TRUE);
5728 SET_EXPECT(SetActiveObject);
5730 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5731 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5732 expect_status_text = NULL;
5734 hres = IOleDocumentView_UIActivate(docview, TRUE);
5735 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5737 CHECK_CALLED(OnFocus_TRUE);
5738 CHECK_CALLED(SetActiveObject);
5739 CHECK_CALLED(ShowUI);
5740 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5741 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5743 IOleDocumentView_Release(docview);
5746 static void test_editing_mode(BOOL do_load)
5748 IHTMLDocument2 *doc;
5754 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
5756 init_test(do_load ? LD_DOLOAD : LD_NO);
5757 call_UIActivate = CallUIActivate_AfterShow;
5759 doc = create_document();
5760 unk = doc_unk = (IUnknown*)doc;
5762 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5763 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5765 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5766 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5768 test_readyState((IUnknown*)doc);
5769 test_ViewAdviseSink(doc);
5770 test_ConnectionPointContainer(doc);
5771 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5772 test_DoVerb(oleobj);
5773 test_edit_uiactivate(oleobj);
5775 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5777 test_Persist(doc, &Moniker);
5778 stream_read = protocol_read = 0;
5779 test_exec_editmode(unk, do_load);
5780 test_UIDeactivate();
5781 call_UIActivate = CallUIActivate_None;
5782 IOleObject_Release(oleobj);
5784 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5785 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
5787 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
5788 test_timer(EXPECT_UPDATEUI);
5789 SET_CALLED(SetStatusText);
5791 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5794 test_exec_fontname(unk, NULL, wszTimesNewRoman);
5795 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
5796 test_timer(EXPECT_UPDATEUI);
5797 test_exec_fontname(unk, NULL, wszArial);
5799 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
5800 test_timer(EXPECT_UPDATEUI);
5801 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
5802 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
5804 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
5805 test_timer(EXPECT_UPDATEUI);
5806 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
5807 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5808 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
5809 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
5811 test_exec_noargs(unk, IDM_HORIZONTALLINE);
5812 test_timer(EXPECT_UPDATEUI);
5813 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
5814 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5817 test_UIDeactivate();
5818 test_InPlaceDeactivate(doc, TRUE);
5819 SET_EXPECT(Advise_Close);
5820 test_Close(doc, FALSE);
5821 CHECK_CALLED(Advise_Close);
5824 IOleDocumentView_Release(view);
5828 release_document(doc);
5831 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
5833 IHTMLDocument2 *doc;
5835 IOleInPlaceSite *inplacesite;
5838 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
5840 init_test(do_load ? LD_DOLOAD : LD_NO);
5842 doc = create_document();
5843 doc_unk = (IUnknown*)doc;
5848 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5849 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5851 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
5852 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
5854 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5855 SET_EXPECT(GetHostInfo);
5856 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5857 SET_EXPECT(Invoke_AMBIENT_SILENT);
5858 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5859 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5860 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5861 SET_EXPECT(GetOptionKeyPath);
5862 SET_EXPECT(GetOverrideKeyPath);
5863 SET_EXPECT(GetWindow);
5864 SET_EXPECT(Exec_DOCCANNAVIGATE);
5865 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
5866 SET_EXPECT(Exec_SETPROGRESSMAX);
5867 SET_EXPECT(Exec_SETPROGRESSPOS);
5868 SET_EXPECT(GetTravelLog);
5870 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5871 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5872 set_clientsite = TRUE;
5874 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5875 CHECK_CALLED(GetHostInfo);
5876 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5877 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5878 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5879 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5880 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
5881 CHECK_CALLED(GetOptionKeyPath);
5882 CHECK_CALLED(GetOverrideKeyPath);
5883 CHECK_CALLED(GetWindow);
5884 CHECK_CALLED(Exec_DOCCANNAVIGATE);
5885 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
5886 CHECK_CALLED(Exec_SETPROGRESSMAX);
5887 CHECK_CALLED(Exec_SETPROGRESSPOS);
5888 todo_wine CHECK_CALLED(GetTravelLog);
5890 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
5891 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
5892 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
5894 SET_EXPECT(GetContainer);
5895 SET_EXPECT(LockContainer);
5896 SET_EXPECT(CanInPlaceActivate);
5897 SET_EXPECT(GetWindowContext);
5898 SET_EXPECT(GetWindow);
5900 SET_EXPECT(OnInPlaceActivateEx);
5901 SET_EXPECT(RequestUIActivate);
5904 SET_EXPECT(OnInPlaceActivate);
5905 SET_EXPECT(OnUIActivate);
5906 SET_EXPECT(SetStatusText);
5907 SET_EXPECT(Exec_SETPROGRESSMAX);
5908 SET_EXPECT(Exec_SETPROGRESSPOS);
5910 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5911 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5912 SET_EXPECT(OnFocus_TRUE);
5913 SET_EXPECT(SetActiveObject);
5914 expect_LockContainer_fLock = TRUE;
5916 hres = IOleDocumentView_UIActivate(view, TRUE);
5917 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
5919 CHECK_CALLED(GetContainer);
5920 CHECK_CALLED(LockContainer);
5921 CHECK_CALLED(CanInPlaceActivate);
5922 CHECK_CALLED(GetWindowContext);
5923 CHECK_CALLED(GetWindow);
5925 CHECK_CALLED(OnInPlaceActivateEx);
5926 SET_EXPECT(RequestUIActivate);
5929 CHECK_CALLED(OnInPlaceActivate);
5930 CHECK_CALLED(OnUIActivate);
5931 CHECK_CALLED(SetStatusText);
5932 CHECK_CALLED(Exec_SETPROGRESSMAX);
5933 CHECK_CALLED(Exec_SETPROGRESSPOS);
5934 CHECK_CALLED(ShowUI);
5935 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5936 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5937 CHECK_CALLED(OnFocus_TRUE);
5938 CHECK_CALLED(SetActiveObject);
5939 container_locked = TRUE;
5941 SET_EXPECT(SetActiveObject_null);
5942 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5944 SET_EXPECT(OnUIDeactivate);
5946 hres = IOleDocumentView_UIActivate(view, FALSE);
5947 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
5949 CHECK_CALLED(SetActiveObject_null);
5950 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5951 CHECK_CALLED(HideUI);
5952 CHECK_CALLED(OnUIDeactivate);
5954 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
5955 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
5956 ok(inplacesite != NULL, "inplacesite = NULL\n");
5957 IOleInPlaceSite_Release(inplacesite);
5959 SET_EXPECT(OnFocus_FALSE);
5961 SET_EXPECT(OnInPlaceDeactivateEx);
5963 SET_EXPECT(OnInPlaceDeactivate);
5967 CHECK_CALLED(OnFocus_FALSE);
5969 CHECK_CALLED(OnInPlaceDeactivateEx);
5971 CHECK_CALLED(OnInPlaceDeactivate);
5973 test_Close(doc, TRUE);
5975 IOleObject_Release(oleobj);
5976 IOleDocumentView_Release(view);
5979 release_document(doc);
5982 static void register_protocol(void)
5984 IInternetSession *session;
5987 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
5989 hres = CoInternetGetSession(0, &session, 0);
5990 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
5992 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
5993 wsz_winetest, 0, NULL, 0);
5994 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
5996 IInternetSession_Release(session);
5999 static void test_HTMLDoc_ISupportErrorInfo(void)
6001 IHTMLDocument2 *doc;
6003 ISupportErrorInfo *sinfo;
6005 doc = create_document();
6007 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
6008 ok(hres == S_OK, "got %x\n", hres);
6009 ok(sinfo != NULL, "got %p\n", sinfo);
6012 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
6013 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
6014 IUnknown_Release(sinfo);
6017 release_document(doc);
6020 static void test_IPersistHistory(void)
6022 IHTMLDocument2 *doc;
6024 IPersistHistory *phist;
6026 doc = create_document();
6028 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
6029 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
6031 IPersistHistory_Release(phist);
6033 release_document(doc);
6036 static BOOL check_ie(void)
6038 IHTMLDocument2 *doc;
6039 IHTMLDocument5 *doc5;
6042 doc = create_document();
6046 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
6048 IHTMLDocument5_Release(doc5);
6050 release_document(doc);
6051 return SUCCEEDED(hres);
6060 win_skip("Too old IE\n");
6064 container_hwnd = create_container_window();
6065 register_protocol();
6067 asynchronous_binding = TRUE;
6068 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
6070 asynchronous_binding = FALSE;
6071 test_HTMLDocument_hlink(HTTP_STATUS_OK);
6072 test_HTMLDocument(FALSE);
6073 test_HTMLDocument(TRUE);
6074 test_HTMLDocument_StreamLoad();
6075 test_HTMLDocument_StreamInitNew();
6076 test_editing_mode(FALSE);
6077 test_editing_mode(TRUE);
6078 test_HTMLDocument_http();
6079 test_UIActivate(FALSE, FALSE, FALSE);
6080 test_UIActivate(FALSE, TRUE, FALSE);
6081 test_UIActivate(FALSE, TRUE, TRUE);
6082 test_UIActivate(TRUE, FALSE, FALSE);
6083 test_UIActivate(TRUE, TRUE, FALSE);
6084 test_UIActivate(TRUE, TRUE, TRUE);
6085 test_HTMLDoc_ISupportErrorInfo();
6086 test_IPersistHistory();
6088 DestroyWindow(container_hwnd);