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"
46 #include "mshtml_test.h"
48 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
49 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
50 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
51 DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
53 #define DEFINE_EXPECT(func) \
54 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
56 #define SET_EXPECT(func) \
57 expect_ ## func = TRUE
59 #define SET_CALLED(func) \
60 called_ ## func = TRUE
62 #define CHECK_EXPECT2(func) \
64 ok(expect_ ##func, "unexpected call " #func "\n"); \
65 called_ ## func = TRUE; \
68 #define CHECK_EXPECT(func) \
70 CHECK_EXPECT2(func); \
71 expect_ ## func = FALSE; \
74 #define CHECK_CALLED(func) \
76 ok(called_ ## func, "expected " #func "\n"); \
77 expect_ ## func = called_ ## func = FALSE; \
80 #define CHECK_NOT_CALLED(func) \
82 ok(!called_ ## func, "unexpected " #func "\n"); \
83 expect_ ## func = called_ ## func = FALSE; \
86 #define CHECK_CALLED_BROKEN(func) \
88 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
89 expect_ ## func = called_ ## func = FALSE; \
92 #define CLEAR_CALLED(func) \
93 expect_ ## func = called_ ## func = FALSE
95 static IOleDocumentView *view = NULL;
96 static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
98 DEFINE_EXPECT(LockContainer);
99 DEFINE_EXPECT(SetActiveObject);
100 DEFINE_EXPECT(SetActiveObject_null);
101 DEFINE_EXPECT(GetWindow);
102 DEFINE_EXPECT(CanInPlaceActivate);
103 DEFINE_EXPECT(OnInPlaceActivate);
104 DEFINE_EXPECT(OnInPlaceActivateEx);
105 DEFINE_EXPECT(OnUIActivate);
106 DEFINE_EXPECT(GetWindowContext);
107 DEFINE_EXPECT(OnUIDeactivate);
108 DEFINE_EXPECT(OnInPlaceDeactivate);
109 DEFINE_EXPECT(OnInPlaceDeactivateEx);
110 DEFINE_EXPECT(GetContainer);
111 DEFINE_EXPECT(ShowUI);
112 DEFINE_EXPECT(ActivateMe);
113 DEFINE_EXPECT(GetHostInfo);
114 DEFINE_EXPECT(HideUI);
115 DEFINE_EXPECT(GetOptionKeyPath);
116 DEFINE_EXPECT(GetOverrideKeyPath);
117 DEFINE_EXPECT(SetStatusText);
118 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
119 DEFINE_EXPECT(QueryStatus_OPEN);
120 DEFINE_EXPECT(QueryStatus_NEW);
121 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
122 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
123 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
124 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
125 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
126 DEFINE_EXPECT(Exec_ShellDocView_37);
127 DEFINE_EXPECT(Exec_ShellDocView_63);
128 DEFINE_EXPECT(Exec_ShellDocView_67);
129 DEFINE_EXPECT(Exec_ShellDocView_84);
130 DEFINE_EXPECT(Exec_ShellDocView_103);
131 DEFINE_EXPECT(Exec_ShellDocView_105);
132 DEFINE_EXPECT(Exec_ShellDocView_140);
133 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
134 DEFINE_EXPECT(Exec_SETTITLE);
135 DEFINE_EXPECT(Exec_HTTPEQUIV);
136 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
137 DEFINE_EXPECT(Exec_Explorer_38);
138 DEFINE_EXPECT(Exec_Explorer_69);
139 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
140 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
141 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
142 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
143 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
144 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
145 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
146 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive);
147 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading);
148 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete);
149 DEFINE_EXPECT(GetDropTarget);
150 DEFINE_EXPECT(UpdateUI);
151 DEFINE_EXPECT(Navigate);
152 DEFINE_EXPECT(OnFrameWindowActivate);
153 DEFINE_EXPECT(OnChanged_READYSTATE);
154 DEFINE_EXPECT(OnChanged_1005);
155 DEFINE_EXPECT(OnChanged_1012);
156 DEFINE_EXPECT(GetDisplayName);
157 DEFINE_EXPECT(BindToStorage);
158 DEFINE_EXPECT(IsSystemMoniker);
159 DEFINE_EXPECT(GetBindResult);
160 DEFINE_EXPECT(GetClassID);
161 DEFINE_EXPECT(Abort);
163 DEFINE_EXPECT(CreateInstance);
164 DEFINE_EXPECT(Start);
165 DEFINE_EXPECT(Terminate);
166 DEFINE_EXPECT(Protocol_Read);
167 DEFINE_EXPECT(LockRequest);
168 DEFINE_EXPECT(UnlockRequest);
169 DEFINE_EXPECT(OnFocus_TRUE);
170 DEFINE_EXPECT(OnFocus_FALSE);
171 DEFINE_EXPECT(RequestUIActivate);
172 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
173 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
174 DEFINE_EXPECT(GetExternal);
175 DEFINE_EXPECT(EnableModeless_TRUE);
176 DEFINE_EXPECT(EnableModeless_FALSE);
177 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
178 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
179 DEFINE_EXPECT(Frame_GetWindow);
180 DEFINE_EXPECT(TranslateUrl);
181 DEFINE_EXPECT(Advise_Close);
182 DEFINE_EXPECT(OnViewChange);
183 DEFINE_EXPECT(EvaluateNewWindow);
184 DEFINE_EXPECT(GetTravelLog);
185 DEFINE_EXPECT(UpdateBackForwardState);
186 DEFINE_EXPECT(FireBeforeNavigate2);
187 DEFINE_EXPECT(FireNavigateComplete2);
188 DEFINE_EXPECT(FireDocumentComplete);
189 DEFINE_EXPECT(GetPendingUrl);
190 DEFINE_EXPECT(ActiveElementChanged);
191 DEFINE_EXPECT(IsErrorUrl);
192 DEFINE_EXPECT(get_LocationURL);
194 static IUnknown *doc_unk;
195 static IMoniker *doc_mon;
196 static BOOL expect_LockContainer_fLock;
197 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
198 static BOOL ipsex, ipsw;
199 static BOOL set_clientsite, container_locked;
200 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
201 static BOOL editmode = FALSE, ignore_external_qi;
202 static BOOL inplace_deactivated, open_call;
203 static BOOL complete, loading_js, loading_hash;
204 static DWORD status_code = HTTP_STATUS_OK;
205 static BOOL asynchronous_binding = FALSE;
206 static BOOL support_wbapp, allow_new_window;
207 static int stream_read, protocol_read;
208 static enum load_state_t {
217 static LPCOLESTR expect_status_text = NULL;
218 static const char *nav_url, *nav_serv_url, *prev_url;
220 static const char html_page[] =
222 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
223 "<body><div>test</div></body>"
226 static const char css_data[] = "body {color: red; margin: 0}";
228 static const WCHAR http_urlW[] =
229 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
231 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
233 #define DOCHOST_DOCCANNAVIGATE 0
234 #define WM_CONTINUE_BINDING (WM_APP+1)
236 static HRESULT QueryInterface(REFIID riid, void **ppv);
237 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
239 #define test_readyState(u) _test_readyState(__LINE__,u)
240 static void _test_readyState(unsigned,IUnknown*);
242 static const WCHAR wszTimesNewRoman[] =
243 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
244 static const WCHAR wszArial[] =
245 {'A','r','i','a','l',0};
247 static const char *debugstr_guid(REFIID riid)
254 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
255 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
256 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
257 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
262 static int strcmp_wa(LPCWSTR strw, const char *stra)
265 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
266 return lstrcmpA(stra, buf);
269 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
273 const WCHAR *p1 = str, *p2 = sub;
274 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
275 if (!*p2) return str;
281 static BSTR a2bstr(const char *str)
286 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
287 ret = SysAllocStringLen(NULL, len);
288 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
293 /* Returns true if the user interface is in English. Note that this does not
294 * presume of the formatting of dates, numbers, etc.
296 static BOOL is_lang_english(void)
298 static HMODULE hkernel32 = NULL;
299 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
300 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
304 hkernel32 = GetModuleHandleA("kernel32.dll");
305 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
306 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
308 if (pGetThreadUILanguage)
309 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
310 if (pGetUserDefaultUILanguage)
311 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
313 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
316 static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
318 IUnknown *unk1, *unk2;
323 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
324 IUnknown_Release(unk1);
325 IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
326 IUnknown_Release(unk2);
331 #define EXPECT_UPDATEUI 1
332 #define EXPECT_SETTITLE 2
334 static void test_timer(DWORD flags)
336 BOOL *b = &called_Exec_SETTITLE;
339 if(flags & EXPECT_UPDATEUI) {
340 SET_EXPECT(UpdateUI);
341 SET_EXPECT(Exec_UPDATECOMMANDS);
342 b = &called_UpdateUI;
344 if(flags & EXPECT_SETTITLE)
345 SET_EXPECT(Exec_SETTITLE);
347 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
348 TranslateMessage(&msg);
349 DispatchMessage(&msg);
352 if(flags & EXPECT_UPDATEUI) {
353 CHECK_CALLED(UpdateUI);
354 CHECK_CALLED(Exec_UPDATECOMMANDS);
356 if(flags & EXPECT_SETTITLE)
357 CHECK_CALLED(Exec_SETTITLE);
360 static IMoniker Moniker;
362 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
363 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
366 IPersistMoniker *permon;
367 IMoniker *mon = (void*)0xdeadbeef;
368 BSTR doc_url = (void*)0xdeadbeef;
374 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
375 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
379 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
380 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
382 hres = IHTMLDocument2_get_URL(doc, &doc_url);
383 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
385 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
386 IPersistMoniker_Release(permon);
390 BOOL exb = expect_GetDisplayName;
391 BOOL clb = called_GetDisplayName;
393 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
394 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
397 SET_EXPECT(GetDisplayName);
398 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
399 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
401 CHECK_CALLED(GetDisplayName);
402 expect_GetDisplayName = exb;
403 called_GetDisplayName = clb;
406 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
408 ok(!strcmp_wa(url, nav_serv_url), "url = %s, expected %s\n", wine_dbgstr_w(url), nav_serv_url);
413 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
415 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
416 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
418 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
419 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
423 ok_(__FILE__,line)(hres == E_UNEXPECTED,
424 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
425 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
426 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
429 SysFreeString(doc_url);
430 IHTMLDocument_Release(doc);
431 if(mon && mon != (void*)0xdeadbeef)
432 IMoniker_Release(mon);
435 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
436 static void _test_current_url(unsigned line, IUnknown *unk, const char *exurl)
442 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
443 ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
445 hres = IHTMLDocument2_get_URL(doc, &url);
446 ok_(__FILE__,line)(hres == S_OK, "get_URL failed: %08x\n", hres);
447 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url), exurl);
450 IHTMLDocument2_Release(doc);
453 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
455 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
459 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
464 if(IsEqualGUID(&IID_IProxyManager, riid))
465 return E_NOINTERFACE; /* TODO */
466 if(IsEqualGUID(&IID_IDispatchEx, riid))
467 return E_NOINTERFACE; /* TODO */
468 if(IsEqualGUID(&IID_External_unk, riid))
469 return E_NOINTERFACE; /* TODO */
471 if(!ignore_external_qi)
472 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
473 return E_NOINTERFACE;
476 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
481 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
486 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
488 ok(0, "unexpected call\n");
492 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
495 ok(0, "unexpected call\n");
499 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
500 UINT cNames, LCID lcid, DISPID *rgDispId)
502 ok(0, "unexpected call\n");
506 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
507 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
508 EXCEPINFO *pExcepInfo, UINT *puArgErr)
510 ok(0, "unexpected call\n");
514 static const IDispatchVtbl ExternalVtbl = {
515 External_QueryInterface,
518 Dispatch_GetTypeInfoCount,
519 Dispatch_GetTypeInfo,
520 Dispatch_GetIDsOfNames,
524 static IDispatch External = { &ExternalVtbl };
526 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
528 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
534 return E_NOINTERFACE;
537 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
542 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
547 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
548 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
549 DWORD grfPI, HANDLE_PTR dwReserved)
555 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
556 static const WCHAR empty_str = {0};
560 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
561 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
562 ok(!grfPI, "grfPI = %x\n", grfPI);
563 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
565 memset(&bindinfo, 0, sizeof(bindinfo));
566 bindinfo.cbSize = sizeof(bindinfo);
567 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
568 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
569 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
570 "bindf = %x\n", bindf);
572 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
573 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
574 /* TODO: test stgmedData */
575 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
576 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
577 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
578 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
579 ok(bindinfo.dwOptions == 0x80000 ||
580 bindinfo.dwOptions == 0x4080000, /* win2k3 */
581 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
582 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
583 /* TODO: test dwCodePage */
584 /* TODO: test securityAttributes */
585 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
586 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
587 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
589 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
590 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
591 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
593 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
594 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
596 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
598 hres = IInternetProtocolSink_ReportData(pOIProtSink,
599 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
600 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
602 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
603 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
608 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
609 PROTOCOLDATA *pProtocolData)
611 ok(0, "unexpected call\n");
615 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
618 ok(0, "unexpected call\n");
622 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
624 CHECK_EXPECT(Terminate);
628 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
630 ok(0, "unexpected call\n");
634 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
636 ok(0, "unexpected call\n");
640 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
641 ULONG cb, ULONG *pcbRead)
643 CHECK_EXPECT2(Protocol_Read);
645 ok(pv != NULL, "pv == NULL\n");
646 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
647 ok(pcbRead != NULL, "pcbRead == NULL\n");
648 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
653 protocol_read += *pcbRead = sizeof(css_data)-1;
654 memcpy(pv, css_data, sizeof(css_data)-1);
658 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
659 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
661 ok(0, "unexpected call\n");
665 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
667 CHECK_EXPECT(LockRequest);
671 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
673 CHECK_EXPECT(UnlockRequest);
677 static const IInternetProtocolVtbl ProtocolVtbl = {
678 Protocol_QueryInterface,
689 Protocol_LockRequest,
690 Protocol_UnlockRequest
693 static IInternetProtocol Protocol = { &ProtocolVtbl };
695 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
697 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
698 ok(0, "unexpected call\n");
699 return E_NOINTERFACE;
702 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
707 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
712 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
713 REFIID riid, void **ppv)
715 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
716 return E_NOINTERFACE;
718 CHECK_EXPECT(CreateInstance);
719 ok(ppv != NULL, "ppv == NULL\n");
725 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
727 ok(0, "unexpected call\n");
731 static const IClassFactoryVtbl ClassFactoryVtbl = {
732 ClassFactory_QueryInterface,
734 ClassFactory_Release,
735 ClassFactory_CreateInstance,
736 ClassFactory_LockServer
739 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
741 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
743 ok(0, "unexpected call\n");
747 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
752 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
757 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
758 IHlinkBrowseContext *pihlbc)
760 ok(0, "unexpected call\n");
764 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
765 IHlinkBrowseContext **ppihlbc)
767 ok(0, "unexpected call\n");
771 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
772 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
776 CHECK_EXPECT(Navigate);
778 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
779 ok(pbc != NULL, "pbc == NULL\n");
780 ok(pibsc != NULL, "pubsc == NULL\n");
781 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
784 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
785 LPWSTR location = (LPWSTR)0xdeadbeef;
787 IMoniker *mon = NULL;
788 DWORD site_data = 0xdeadbeef;
790 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
791 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
792 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
794 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
795 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
796 ok(location == NULL, "location = %p\n", location);
797 ok(mon != NULL, "mon == NULL\n");
799 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &location);
800 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
801 ok(!strcmp_wa(location, nav_url), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location), nav_url);
802 CoTaskMemFree(location);
803 IMoniker_Release(mon);
805 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
806 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
807 ok(site == NULL, "site = %p\n, expected NULL\n", site);
808 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
814 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
815 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
817 ok(0, "unexpected call\n");
821 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
822 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
824 ok(0, "unexpected call\n");
828 static const IHlinkFrameVtbl HlinkFrameVtbl = {
829 HlinkFrame_QueryInterface,
832 HlinkFrame_SetBrowseContext,
833 HlinkFrame_GetBrowseContext,
835 HlinkFrame_OnNavigate,
836 HlinkFrame_UpdateHlink
839 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
841 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
843 ok(0, "unexpected call\n");
844 return E_NOINTERFACE;
847 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
852 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
857 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
858 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
859 DWORD dwUserActionTime)
861 CHECK_EXPECT(EvaluateNewWindow);
863 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
864 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
865 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
866 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
867 ok(!fReplace, "fReplace = %x\n", fReplace);
868 ok(dwFlags == (allow_new_window ? 0 : NWMF_FIRST), "dwFlags = %x\n", dwFlags);
869 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
871 return allow_new_window ? S_OK : E_FAIL;
874 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
875 NewWindowManager_QueryInterface,
876 NewWindowManager_AddRef,
877 NewWindowManager_Release,
878 NewWindowManager_EvaluateNewWindow
881 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
883 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
884 REFIID riid, void**ppv)
886 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
891 ok(0, "unexpected call\n");
892 return E_NOINTERFACE;
895 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
900 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
905 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
908 case DISPID_READYSTATE:
909 CHECK_EXPECT2(OnChanged_READYSTATE);
911 if(!readystate_set_interactive)
912 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
913 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
914 ? OLECMDF_ENABLED : 0));
916 if(readystate_set_loading) {
917 readystate_set_loading = FALSE;
918 load_state = LD_LOADING;
920 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
921 test_readyState(NULL);
924 CHECK_EXPECT(OnChanged_1005);
926 test_readyState(NULL);
927 readystate_set_interactive = (load_state != LD_INTERACTIVE);
930 CHECK_EXPECT(OnChanged_1012);
945 ok(0, "unexpected id %d\n", dispID);
949 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
951 ok(0, "unexpected call\n");
955 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
956 PropertyNotifySink_QueryInterface,
957 PropertyNotifySink_AddRef,
958 PropertyNotifySink_Release,
959 PropertyNotifySink_OnChanged,
960 PropertyNotifySink_OnRequestEdit
963 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
965 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
967 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
972 ok(0, "unexpected call %s\n", debugstr_guid(riid));
974 return E_NOINTERFACE;
977 static ULONG WINAPI Stream_AddRef(IStream *iface)
982 static ULONG WINAPI Stream_Release(IStream *iface)
987 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
988 ULONG cb, ULONG *pcbRead)
991 ok(pv != NULL, "pv == NULL\n");
992 ok(cb > sizeof(html_page), "cb = %d\n", cb);
993 ok(pcbRead != NULL, "pcbRead == NULL\n");
994 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
999 memcpy(pv, html_page, sizeof(html_page)-1);
1000 stream_read += *pcbRead = sizeof(html_page)-1;
1004 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
1005 ULONG cb, ULONG *pcbWritten)
1007 ok(0, "unexpected call\n");
1011 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
1012 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1014 ok(0, "unexpected call\n");
1018 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
1020 ok(0, "unexpected call\n");
1024 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
1025 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
1027 ok(0, "unexpected call\n");
1031 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
1033 ok(0, "unexpected call\n");
1037 static HRESULT WINAPI Stream_Revert(IStream *iface)
1039 ok(0, "unexpected call\n");
1043 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1044 ULARGE_INTEGER cb, DWORD dwLockType)
1046 ok(0, "unexpected call\n");
1050 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1051 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1053 ok(0, "unexpected call\n");
1057 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1060 ok(0, "unexpected call\n");
1064 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1066 ok(0, "unexpected call\n");
1070 static const IStreamVtbl StreamVtbl = {
1071 Stream_QueryInterface,
1082 Stream_UnlockRegion,
1087 static IStream Stream = { &StreamVtbl };
1089 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1090 IWinInetHttpInfo* This,
1094 ok(0, "unexpected call\n");
1095 return E_NOINTERFACE;
1098 static ULONG WINAPI WinInetHttpInfo_AddRef(
1099 IWinInetHttpInfo* This)
1104 static ULONG WINAPI WinInetHttpInfo_Release(
1105 IWinInetHttpInfo* This)
1110 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1111 IWinInetHttpInfo* This,
1116 return E_NOTIMPL; /* TODO */
1119 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1120 IWinInetHttpInfo* This,
1127 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1129 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1130 ok(pBuffer != NULL, "pBuffer == NULL\n");
1131 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1132 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1133 *((DWORD*)pBuffer) = status_code;
1137 return E_NOTIMPL; /* TODO */
1140 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1141 WinInetHttpInfo_QueryInterface,
1142 WinInetHttpInfo_AddRef,
1143 WinInetHttpInfo_Release,
1144 WinInetHttpInfo_QueryOption,
1145 WinInetHttpInfo_QueryInfo
1148 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1150 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1152 if(IsEqualGUID(&IID_IUnknown, riid)) {
1157 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1158 *ppv = &WinInetHttpInfo;
1162 ok(0, "unexpected call\n");
1163 return E_NOINTERFACE;
1166 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1171 static ULONG WINAPI Binding_Release(IBinding *iface)
1176 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1178 CHECK_EXPECT(Abort);
1179 if(asynchronous_binding)
1180 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1184 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1186 ok(0, "unexpected call\n");
1190 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1192 ok(0, "unexpected call\n");
1196 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1198 ok(0, "unexpected call\n");
1202 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1204 ok(0, "unexpected call\n");
1208 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1209 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1211 CHECK_EXPECT(GetBindResult);
1215 static const IBindingVtbl BindingVtbl = {
1216 Binding_QueryInterface,
1222 Binding_SetPriority,
1223 Binding_GetPriority,
1224 Binding_GetBindResult
1227 static IBinding Binding = { &BindingVtbl };
1229 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1230 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1232 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1236 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1237 return E_NOINTERFACE; /* TODO */
1238 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1239 return E_NOINTERFACE; /* TODO */
1241 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1242 return E_NOINTERFACE;
1245 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1250 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1255 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1257 CHECK_EXPECT(GetClassID);
1258 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1262 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1264 ok(0, "unexpected call\n");
1268 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1270 ok(0, "unexpected call\n");
1274 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1276 ok(0, "unexpected call\n");
1280 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1282 ok(0, "unexpected call\n");
1286 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1287 REFIID riidResult, void **ppvResult)
1289 ok(0, "unexpected call\n");
1293 static void continue_binding(IBindStatusCallback *callback)
1295 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1296 STGMEDIUM stgmedium;
1299 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1301 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1303 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1305 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1306 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1307 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1308 if(status_code != HTTP_STATUS_OK) {
1309 CHECK_CALLED_BROKEN(IsErrorUrl);
1310 SET_EXPECT(IsErrorUrl);
1314 stgmedium.tymed = TYMED_ISTREAM;
1315 U(stgmedium).pstm = &Stream;
1316 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1317 hres = IBindStatusCallback_OnDataAvailable(callback,
1318 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1319 sizeof(html_page)-1, &formatetc, &stgmedium);
1320 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1323 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1324 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1325 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1327 SET_EXPECT(GetBindResult);
1328 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1329 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1330 CLEAR_CALLED(GetBindResult); /* IE7 */
1332 IBindStatusCallback_Release(callback);
1335 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1336 REFIID riid, void **ppv)
1338 IBindStatusCallback *callback = NULL;
1343 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1345 CHECK_EXPECT(BindToStorage);
1347 load_state = LD_LOADING;
1349 ok(pbc != NULL, "pbc == NULL\n");
1350 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1351 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1352 ok(ppv != NULL, "ppv == NULL\n");
1353 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1355 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1356 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1357 ok(callback != NULL, "callback == NULL\n");
1359 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1360 bindinfo.cbSize = sizeof(bindinfo);
1362 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1363 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1364 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1365 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1366 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1367 /* TODO: test stgmedData */
1368 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1369 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1370 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1371 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1372 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1373 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1374 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1375 /* TODO: test dwCodePage */
1376 /* TODO: test securityAttributes */
1377 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1378 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1379 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1381 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1382 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1384 if(asynchronous_binding) {
1385 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1386 return MK_S_ASYNCHRONOUS;
1389 continue_binding(callback);
1393 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1394 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1396 ok(0, "unexpected call\n");
1400 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1401 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1403 ok(0, "unexpected call\n");
1407 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1409 ok(0, "unexpected call\n");
1413 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1415 ok(0, "unexpected call\n");
1419 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1421 ok(0, "unexpected call\n");
1425 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1426 IMoniker *pmkNewlyRunning)
1428 ok(0, "unexpected call\n");
1432 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1433 IMoniker *pmkToLeft, FILETIME *pFileTime)
1435 ok(0, "unexpected call\n");
1439 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1441 ok(0, "unexpected call\n");
1445 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1446 IMoniker **ppmkPrefix)
1448 ok(0, "unexpected call\n");
1452 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1453 IMoniker **pmkRelPath)
1455 ok(0, "unexpected call\n");
1459 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1460 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1462 CHECK_EXPECT2(GetDisplayName);
1464 /* ok(pbc != NULL, "pbc == NULL\n"); */
1465 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1466 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1468 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1469 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1474 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1475 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1477 ok(0, "unexpected call\n");
1481 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1483 CHECK_EXPECT(IsSystemMoniker);
1487 static const IMonikerVtbl MonikerVtbl = {
1488 Moniker_QueryInterface,
1496 Moniker_BindToObject,
1497 Moniker_BindToStorage,
1499 Moniker_ComposeWith,
1504 Moniker_GetTimeOfLastChange,
1506 Moniker_CommonPrefixWith,
1507 Moniker_RelativePathTo,
1508 Moniker_GetDisplayName,
1509 Moniker_ParseDisplayName,
1510 Moniker_IsSystemMoniker
1513 static IMoniker Moniker = { &MonikerVtbl };
1515 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1517 return QueryInterface(riid, ppv);
1520 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1525 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1530 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1531 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1533 ok(0, "unexpected call\n");
1537 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1538 IEnumUnknown **ppenum)
1540 ok(0, "unexpected call\n");
1544 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1546 CHECK_EXPECT(LockContainer);
1547 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1551 static const IOleContainerVtbl OleContainerVtbl = {
1552 OleContainer_QueryInterface,
1553 OleContainer_AddRef,
1554 OleContainer_Release,
1555 OleContainer_ParseDisplayName,
1556 OleContainer_EnumObjects,
1557 OleContainer_LockContainer
1560 static IOleContainer OleContainer = { &OleContainerVtbl };
1562 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1564 return QueryInterface(riid, ppv);
1567 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1572 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1577 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1579 ok(0, "unexpected call\n");
1583 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1586 ok(0, "unexpected call\n");
1590 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1592 CHECK_EXPECT(GetContainer);
1593 ok(ppContainer != NULL, "ppContainer = NULL\n");
1594 *ppContainer = &OleContainer;
1598 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1600 ok(0, "unexpected call\n");
1604 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1606 ok(0, "unexpected call\n");
1610 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1612 ok(0, "unexpected call\n");
1616 static const IOleClientSiteVtbl ClientSiteVtbl = {
1617 ClientSite_QueryInterface,
1620 ClientSite_SaveObject,
1621 ClientSite_GetMoniker,
1622 ClientSite_GetContainer,
1623 ClientSite_ShowObject,
1624 ClientSite_OnShowWindow,
1625 ClientSite_RequestNewObjectLayout
1628 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1630 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1632 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1634 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1635 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1638 return E_NOINTERFACE;
1641 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1646 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1651 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1653 CHECK_EXPECT(Frame_GetWindow);
1657 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1659 ok(0, "unexpected call\n");
1663 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1665 ok(0, "unexpected call\n");
1669 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1670 LPCBORDERWIDTHS pborderwidths)
1672 ok(0, "unexpected call\n");
1676 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1677 LPCBORDERWIDTHS pborderwidths)
1679 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1683 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1684 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1686 static const WCHAR wszHTML_Document[] =
1687 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1689 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1691 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1692 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1693 if(pActiveObject && is_lang_english())
1694 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1697 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1698 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1700 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1704 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1705 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1707 static const WCHAR wszHTML_Document[] =
1708 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1711 CHECK_EXPECT2(SetActiveObject);
1713 if(pActiveObject && is_lang_english())
1714 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1716 CHECK_EXPECT(SetActiveObject_null);
1718 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1719 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1725 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1726 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1728 ok(0, "unexpected call\n");
1732 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1733 HOLEMENU holemenu, HWND hwndActiveObject)
1735 ok(0, "unexpected call\n");
1739 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1741 ok(0, "unexpected call\n");
1745 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1747 CHECK_EXPECT2(SetStatusText);
1748 if(!expect_status_text)
1749 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1753 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1756 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1758 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1762 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1764 ok(0, "unexpected call\n");
1768 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1769 InPlaceFrame_QueryInterface,
1770 InPlaceFrame_AddRef,
1771 InPlaceFrame_Release,
1772 InPlaceFrame_GetWindow,
1773 InPlaceFrame_ContextSensitiveHelp,
1774 InPlaceFrame_GetBorder,
1775 InPlaceFrame_RequestBorderSpace,
1776 InPlaceFrame_SetBorderSpace,
1777 InPlaceFrame_SetActiveObject,
1778 InPlaceFrame_InsertMenus,
1779 InPlaceFrame_SetMenu,
1780 InPlaceFrame_RemoveMenus,
1781 InPlaceFrame_SetStatusText,
1782 InPlaceFrame_EnableModeless,
1783 InPlaceFrame_TranslateAccelerator
1786 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1788 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1789 InPlaceFrame_QueryInterface,
1790 InPlaceFrame_AddRef,
1791 InPlaceFrame_Release,
1792 InPlaceFrame_GetWindow,
1793 InPlaceFrame_ContextSensitiveHelp,
1794 InPlaceFrame_GetBorder,
1795 InPlaceFrame_RequestBorderSpace,
1796 InPlaceFrame_SetBorderSpace,
1797 InPlaceUIWindow_SetActiveObject,
1800 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1802 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1804 return QueryInterface(riid, ppv);
1807 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1812 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1817 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1818 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1820 IOleClientSite *client_site;
1821 IOleObject *ole_obj;
1824 CHECK_EXPECT2(GetWindow);
1825 ok(phwnd != NULL, "phwnd = NULL\n");
1826 *phwnd = container_hwnd;
1828 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1829 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1831 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1832 IOleObject_Release(ole_obj);
1833 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1834 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1835 IOleClientSite_Release(client_site);
1840 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1841 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1843 ok(0, "unexpected call\n");
1847 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1848 IOleInPlaceSiteWindowless *iface)
1850 CHECK_EXPECT(CanInPlaceActivate);
1854 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1855 IOleInPlaceSiteWindowless *iface)
1857 CHECK_EXPECT(OnInPlaceActivate);
1858 inplace_deactivated = FALSE;
1862 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1863 IOleInPlaceSiteWindowless *iface)
1865 CHECK_EXPECT(OnUIActivate);
1869 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1870 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1871 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1872 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1874 static const RECT rect = {0,0,500,500};
1876 CHECK_EXPECT(GetWindowContext);
1878 ok(ppFrame != NULL, "ppFrame = NULL\n");
1880 *ppFrame = &InPlaceFrame;
1881 ok(ppDoc != NULL, "ppDoc = NULL\n");
1883 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1884 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1886 memcpy(lprcPosRect, &rect, sizeof(RECT));
1887 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1889 memcpy(lprcClipRect, &rect, sizeof(RECT));
1890 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1892 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1893 lpFrameInfo->fMDIApp = FALSE;
1894 lpFrameInfo->hwndFrame = container_hwnd;
1895 lpFrameInfo->haccel = NULL;
1896 lpFrameInfo->cAccelEntries = 0;
1902 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1903 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1905 ok(0, "unexpected call\n");
1909 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1910 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1912 CHECK_EXPECT(OnUIDeactivate);
1913 ok(!fUndoable, "fUndoable = TRUE\n");
1917 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1918 IOleInPlaceSiteWindowless *iface)
1920 CHECK_EXPECT(OnInPlaceDeactivate);
1921 inplace_deactivated = TRUE;
1925 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1926 IOleInPlaceSiteWindowless *iface)
1928 ok(0, "unexpected call\n");
1932 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1933 IOleInPlaceSiteWindowless *iface)
1935 ok(0, "unexpected call\n");
1939 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1940 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1942 ok(0, "unexpected call\n");
1946 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1947 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1949 CHECK_EXPECT(OnInPlaceActivateEx);
1951 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1952 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1953 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1958 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1959 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1961 CHECK_EXPECT(OnInPlaceDeactivateEx);
1963 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1968 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1969 IOleInPlaceSiteWindowless *iface)
1971 CHECK_EXPECT2(RequestUIActivate);
1975 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1976 IOleInPlaceSiteWindowless *iface)
1978 ok(0, "unexpected call\n");
1982 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1983 IOleInPlaceSiteWindowless *iface)
1985 ok(0, "unexpected call\n");
1989 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1990 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1992 ok(0, "unexpected call\n");
1996 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1997 IOleInPlaceSiteWindowless *iface)
1999 ok(0, "unexpected call\n");
2003 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
2004 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
2006 ok(0, "unexpected call\n");
2010 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
2011 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
2012 DWORD grfFlags, HDC *phDC)
2014 ok(0, "unexpected call\n");
2018 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
2019 IOleInPlaceSiteWindowless *iface, HDC hDC)
2021 ok(0, "unexpected call\n");
2025 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
2026 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
2028 ok(0, "unexpected call\n");
2032 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
2033 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
2035 ok(0, "unexpected call\n");
2039 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2040 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2041 LPCRECT pRectScroll, LPCRECT pRectClip)
2043 ok(0, "unexpected call\n");
2047 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2048 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2050 ok(0, "unexpected call\n");
2054 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2055 IOleInPlaceSiteWindowless *iface, UINT msg,
2056 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2058 ok(0, "unexpected call\n");
2062 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2063 InPlaceSiteWindowless_QueryInterface,
2064 InPlaceSiteWindowless_AddRef,
2065 InPlaceSiteWindowless_Release,
2066 InPlaceSiteWindowless_GetWindow,
2067 InPlaceSiteWindowless_ContextSensitiveHelp,
2068 InPlaceSiteWindowless_CanInPlaceActivate,
2069 InPlaceSiteWindowless_OnInPlaceActivate,
2070 InPlaceSiteWindowless_OnUIActivate,
2071 InPlaceSiteWindowless_GetWindowContext,
2072 InPlaceSiteWindowless_Scroll,
2073 InPlaceSiteWindowless_OnUIDeactivate,
2074 InPlaceSiteWindowless_OnInPlaceDeactivate,
2075 InPlaceSiteWindowless_DiscardUndoState,
2076 InPlaceSiteWindowless_DeactivateAndUndo,
2077 InPlaceSiteWindowless_OnPosRectChange,
2078 InPlaceSiteWindowless_OnInPlaceActivateEx,
2079 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2080 InPlaceSiteWindowless_RequestUIActivate,
2081 InPlaceSiteWindowless_CanWindowlessActivate,
2082 InPlaceSiteWindowless_GetCapture,
2083 InPlaceSiteWindowless_SetCapture,
2084 InPlaceSiteWindowless_GetFocus,
2085 InPlaceSiteWindowless_SetFocus,
2086 InPlaceSiteWindowless_GetDC,
2087 InPlaceSiteWindowless_ReleaseDC,
2088 InPlaceSiteWindowless_InvalidateRect,
2089 InPlaceSiteWindowless_InvalidateRgn,
2090 InPlaceSiteWindowless_ScrollRect,
2091 InPlaceSiteWindowless_AdjustRect,
2092 InPlaceSiteWindowless_OnDefWindowMessage
2095 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2097 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2099 return QueryInterface(riid, ppv);
2102 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2107 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2114 CallUIActivate_None,
2115 CallUIActivate_ActivateMe,
2116 CallUIActivate_AfterShow,
2119 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2120 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2122 IOleDocument *document;
2125 CHECK_EXPECT(ActivateMe);
2126 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2128 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2129 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2131 if(SUCCEEDED(hres)) {
2132 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2133 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2135 if(SUCCEEDED(hres)) {
2136 IOleInPlaceActiveObject *activeobj = NULL;
2137 IOleInPlaceSite *inplacesite = NULL;
2138 HWND tmp_hwnd = NULL;
2139 static RECT rect = {0,0,400,500};
2141 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2142 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2143 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2144 inplacesite, &InPlaceSiteWindowless);
2146 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2147 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2149 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2150 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2151 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2152 inplacesite, &InPlaceSiteWindowless);
2154 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2155 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2158 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2159 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2160 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2163 if(call_UIActivate == CallUIActivate_ActivateMe) {
2164 SET_EXPECT(CanInPlaceActivate);
2165 SET_EXPECT(GetWindowContext);
2166 SET_EXPECT(GetWindow);
2168 SET_EXPECT(OnInPlaceActivateEx);
2170 SET_EXPECT(OnInPlaceActivate);
2171 SET_EXPECT(SetStatusText);
2172 SET_EXPECT(Exec_SETPROGRESSMAX);
2173 SET_EXPECT(Exec_SETPROGRESSPOS);
2174 SET_EXPECT(OnUIActivate);
2175 SET_EXPECT(SetActiveObject);
2177 expect_status_text = NULL;
2179 hres = IOleDocumentView_UIActivate(view, TRUE);
2180 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2182 CHECK_CALLED(CanInPlaceActivate);
2183 CHECK_CALLED(GetWindowContext);
2184 CHECK_CALLED(GetWindow);
2186 CHECK_CALLED(OnInPlaceActivateEx);
2188 CHECK_CALLED(OnInPlaceActivate);
2189 CHECK_CALLED(SetStatusText);
2190 CHECK_CALLED(Exec_SETPROGRESSMAX);
2191 CHECK_CALLED(Exec_SETPROGRESSPOS);
2192 CHECK_CALLED(OnUIActivate);
2193 CHECK_CALLED(SetActiveObject);
2194 CHECK_CALLED(ShowUI);
2197 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2198 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2199 ok(hwnd != NULL, "hwnd == NULL\n");
2201 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2204 hres = IOleDocumentView_UIActivate(view, TRUE);
2205 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2208 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2209 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2210 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
2214 hres = IOleDocumentView_SetRect(view, &rect);
2215 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2217 if(call_UIActivate == CallUIActivate_ActivateMe) {
2218 hres = IOleDocumentView_Show(view, TRUE);
2219 ok(hres == S_OK, "Show failed: %08x\n", hres);
2221 SET_EXPECT(CanInPlaceActivate);
2222 SET_EXPECT(GetWindowContext);
2223 SET_EXPECT(GetWindow);
2225 SET_EXPECT(OnInPlaceActivateEx);
2227 SET_EXPECT(OnInPlaceActivate);
2228 SET_EXPECT(SetStatusText);
2229 SET_EXPECT(Exec_SETPROGRESSMAX);
2230 SET_EXPECT(Exec_SETPROGRESSPOS);
2231 SET_EXPECT(OnUIActivate);
2232 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2234 hres = IOleDocumentView_Show(view, TRUE);
2235 ok(hres == S_OK, "Show failed: %08x\n", hres);
2237 CHECK_CALLED(CanInPlaceActivate);
2238 CHECK_CALLED(GetWindowContext);
2239 CHECK_CALLED(GetWindow);
2241 CHECK_CALLED(OnInPlaceActivateEx);
2243 CHECK_CALLED(OnInPlaceActivate);
2244 CHECK_CALLED(SetStatusText);
2245 CHECK_CALLED(Exec_SETPROGRESSMAX);
2246 CHECK_CALLED(Exec_SETPROGRESSPOS);
2249 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2250 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2251 ok(hwnd != NULL, "hwnd == NULL\n");
2253 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2257 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2260 IOleInPlaceActiveObject_Release(activeobj);
2263 IOleDocument_Release(document);
2269 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2270 DocumentSite_QueryInterface,
2271 DocumentSite_AddRef,
2272 DocumentSite_Release,
2273 DocumentSite_ActivateMe
2276 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2278 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2280 return QueryInterface(riid, ppv);
2283 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2288 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2293 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2295 ok(0, "unexpected call\n");
2299 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2301 ok(0, "unexpected call\n");
2305 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2307 ok(0, "unexpected call\n");
2311 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2312 POINTF *pPtfContainer, DWORD dwFlags)
2314 ok(0, "unexpected call\n");
2318 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2319 MSG *pMsg, DWORD grfModifiers)
2321 ok(0, "unexpected call\n");
2325 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2328 CHECK_EXPECT(OnFocus_TRUE);
2330 CHECK_EXPECT2(OnFocus_FALSE);
2334 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2336 ok(0, "unexpected call\n");
2340 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2341 OleControlSite_QueryInterface,
2342 OleControlSite_AddRef,
2343 OleControlSite_Release,
2344 OleControlSite_OnControlInfoChanged,
2345 OleControlSite_LockInPlaceActive,
2346 OleControlSite_GetExtendedControl,
2347 OleControlSite_TransformCoords,
2348 OleControlSite_TranslateAccelerator,
2349 OleControlSite_OnFocus,
2350 OleControlSite_ShowPropertyFrame
2353 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2355 static IDocHostUIHandler2 *expect_uihandler_iface;
2357 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2359 return QueryInterface(riid, ppv);
2362 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2367 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2372 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2373 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2375 ok(0, "unexpected call\n");
2376 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2380 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2382 CHECK_EXPECT(GetHostInfo);
2383 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2384 ok(pInfo != NULL, "pInfo=NULL\n");
2386 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2387 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2388 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2389 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2390 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2391 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2392 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2393 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2398 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2399 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2400 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2402 CHECK_EXPECT(ShowUI);
2403 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2406 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2408 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2409 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2410 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2411 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2412 if (expect_InPlaceUIWindow_SetActiveObject_active)
2413 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2415 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2420 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2422 CHECK_EXPECT(HideUI);
2423 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2427 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2429 CHECK_EXPECT(UpdateUI);
2430 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2434 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2436 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2438 CHECK_EXPECT2(EnableModeless_TRUE);
2440 CHECK_EXPECT2(EnableModeless_FALSE);
2444 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2446 ok(0, "unexpected call\n");
2447 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2451 static BOOL expect_OnFrameWindowActivate_fActivate;
2452 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2454 CHECK_EXPECT2(OnFrameWindowActivate);
2455 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2456 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2460 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2461 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2463 ok(0, "unexpected call\n");
2467 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2468 const GUID *pguidCmdGroup, DWORD nCmdID)
2470 ok(0, "unexpected call\n");
2471 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2475 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2476 LPOLESTR *pchKey, DWORD dw)
2478 CHECK_EXPECT(GetOptionKeyPath);
2479 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2480 ok(pchKey != NULL, "pchKey = NULL\n");
2481 ok(!dw, "dw=%d, expected 0\n", dw);
2483 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2487 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2488 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2490 CHECK_EXPECT(GetDropTarget);
2491 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2496 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2498 CHECK_EXPECT(GetExternal);
2499 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2500 *ppDispatch = &External;
2504 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2505 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2507 CHECK_EXPECT(TranslateUrl);
2508 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2509 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2511 ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2513 todo_wine ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2514 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2515 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2520 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2521 IDataObject **ppPORet)
2523 ok(0, "unexpected call\n");
2524 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2528 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2529 LPOLESTR *pchKey, DWORD dw)
2531 CHECK_EXPECT(GetOverrideKeyPath);
2532 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2533 ok(pchKey != NULL, "pchKey = NULL\n");
2535 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2536 ok(!dw, "dw=%d, xepected 0\n", dw);
2540 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2541 DocHostUIHandler_QueryInterface,
2542 DocHostUIHandler_AddRef,
2543 DocHostUIHandler_Release,
2544 DocHostUIHandler_ShowContextMenu,
2545 DocHostUIHandler_GetHostInfo,
2546 DocHostUIHandler_ShowUI,
2547 DocHostUIHandler_HideUI,
2548 DocHostUIHandler_UpdateUI,
2549 DocHostUIHandler_EnableModeless,
2550 DocHostUIHandler_OnDocWindowActivate,
2551 DocHostUIHandler_OnFrameWindowActivate,
2552 DocHostUIHandler_ResizeBorder,
2553 DocHostUIHandler_TranslateAccelerator,
2554 DocHostUIHandler_GetOptionKeyPath,
2555 DocHostUIHandler_GetDropTarget,
2556 DocHostUIHandler_GetExternal,
2557 DocHostUIHandler_TranslateUrl,
2558 DocHostUIHandler_FilterDataObject,
2559 DocHostUIHandler_GetOverrideKeyPath
2562 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2564 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2566 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2571 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2572 return E_NOINTERFACE;
2574 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2575 return E_NOINTERFACE; /* TODO */
2577 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2578 return E_NOINTERFACE;
2581 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2582 CustomDocHostUIHandler_QueryInterface,
2583 DocHostUIHandler_AddRef,
2584 DocHostUIHandler_Release,
2585 DocHostUIHandler_ShowContextMenu,
2586 DocHostUIHandler_GetHostInfo,
2587 DocHostUIHandler_ShowUI,
2588 DocHostUIHandler_HideUI,
2589 DocHostUIHandler_UpdateUI,
2590 DocHostUIHandler_EnableModeless,
2591 DocHostUIHandler_OnDocWindowActivate,
2592 DocHostUIHandler_OnFrameWindowActivate,
2593 DocHostUIHandler_ResizeBorder,
2594 DocHostUIHandler_TranslateAccelerator,
2595 DocHostUIHandler_GetOptionKeyPath,
2596 DocHostUIHandler_GetDropTarget,
2597 DocHostUIHandler_GetExternal,
2598 DocHostUIHandler_TranslateUrl,
2599 DocHostUIHandler_FilterDataObject,
2600 DocHostUIHandler_GetOverrideKeyPath
2603 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2605 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2606 REFIID riid, void **ppv)
2608 return QueryInterface(riid, ppv);
2611 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2616 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2621 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2622 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2624 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2625 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2626 ok(!pCmdText, "pCmdText != NULL\n");
2628 switch(prgCmds[0].cmdID) {
2629 case OLECMDID_SETPROGRESSTEXT:
2630 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2631 prgCmds[0].cmdf = OLECMDF_ENABLED;
2634 CHECK_EXPECT(QueryStatus_OPEN);
2635 prgCmds[0].cmdf = 0;
2638 CHECK_EXPECT(QueryStatus_NEW);
2639 prgCmds[0].cmdf = 0;
2642 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2648 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2649 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2651 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2652 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2653 test_readyState(NULL);
2655 if(!pguidCmdGroup) {
2657 case OLECMDID_SETPROGRESSMAX:
2658 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2659 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2660 ok(pvaIn != NULL, "pvaIn == NULL\n");
2662 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2663 if(load_state == LD_NO)
2664 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2666 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2668 case OLECMDID_SETPROGRESSPOS:
2669 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2670 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2671 ok(pvaIn != NULL, "pvaIn == NULL\n");
2673 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2674 if(load_state == LD_NO)
2675 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2677 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2679 case OLECMDID_HTTPEQUIV_DONE:
2680 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2681 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2682 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2683 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2684 readystate_set_loading = FALSE;
2685 readystate_set_interactive = FALSE;
2686 load_state = LD_COMPLETE;
2688 case OLECMDID_SETDOWNLOADSTATE:
2689 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2690 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2691 ok(pvaIn != NULL, "pvaIn == NULL\n");
2692 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2694 switch(V_I4(pvaIn)) {
2696 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2698 load_state = LD_INTERACTIVE;
2701 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2702 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2705 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2709 case OLECMDID_UPDATECOMMANDS:
2710 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2711 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2712 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2713 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2715 case OLECMDID_SETTITLE:
2716 CHECK_EXPECT2(Exec_SETTITLE);
2717 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2718 ok(pvaIn != NULL, "pvaIn == NULL\n");
2719 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2720 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2721 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2723 case OLECMDID_HTTPEQUIV:
2724 CHECK_EXPECT2(Exec_HTTPEQUIV);
2725 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2726 ok(pvaIn != NULL, "pvaIn == NULL\n");
2727 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2728 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2729 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2730 test_readyState(NULL);
2732 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2734 return E_FAIL; /* FIXME */
2736 ok(0, "unexpected command %d\n", nCmdID);
2741 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2742 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2746 CHECK_EXPECT2(Exec_ShellDocView_37);
2749 test_GetCurMoniker(doc_unk, NULL, nav_url);
2750 else if(load_from_stream)
2751 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2753 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2755 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2756 ok(pvaIn != NULL, "pvaIn == NULL\n");
2758 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2759 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2764 IHTMLPrivateWindow *priv_window;
2767 CHECK_EXPECT(Exec_ShellDocView_63);
2768 ok(pvaIn != NULL, "pvaIn == NULL\n");
2769 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2770 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2771 ok(pvaOut != NULL, "pvaOut == NULL\n");
2772 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2774 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2775 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2777 IHTMLPrivateWindow_Release(priv_window);
2779 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2780 return S_OK; /* TODO */
2784 CHECK_EXPECT(Exec_ShellDocView_67);
2785 ok(pvaIn != NULL, "pvaIn == NULL\n");
2786 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2788 ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2790 todo_wine ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2791 ok(pvaOut != NULL, "pvaOut == NULL\n");
2792 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2793 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2795 load_state = LD_DOLOAD;
2799 CHECK_EXPECT2(Exec_ShellDocView_84);
2801 ok(pvaIn == NULL, "pvaIn != NULL\n");
2802 ok(pvaOut != NULL, "pvaOut == NULL\n");
2804 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2809 CHECK_EXPECT2(Exec_ShellDocView_103);
2811 ok(pvaIn == NULL, "pvaIn != NULL\n");
2812 ok(pvaOut == NULL, "pvaOut != NULL\n");
2817 CHECK_EXPECT2(Exec_ShellDocView_105);
2819 ok(pvaIn != NULL, "pvaIn == NULL\n");
2820 ok(pvaOut == NULL, "pvaOut != NULL\n");
2825 CHECK_EXPECT2(Exec_ShellDocView_140);
2827 ok(pvaIn == NULL, "pvaIn != NULL\n");
2828 ok(pvaOut == NULL, "pvaOut != NULL\n");
2832 case 143: /* TODO */
2833 case 144: /* TODO */
2837 ok(0, "unexpected command %d\n", nCmdID);
2842 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2843 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2846 case IDM_PARSECOMPLETE:
2847 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2848 ok(pvaIn == NULL, "pvaIn != NULL\n");
2849 ok(pvaOut == NULL, "pvaOut != NULL\n");
2852 ok(0, "unexpected command %d\n", nCmdID);
2856 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2858 case DOCHOST_DOCCANNAVIGATE:
2859 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2860 ok(pvaIn != NULL, "pvaIn == NULL\n");
2861 ok(pvaOut == NULL, "pvaOut != NULL\n");
2862 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2863 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2872 ok(pvaIn != NULL, "pvaIn == NULL\n");
2873 ok(pvaOut != NULL || broken(!pvaOut), "pvaOut != NULL\n");
2874 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2876 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2877 sa = V_ARRAY(pvaIn);
2879 dim = SafeArrayGetDim(sa);
2880 ok(dim == 1, "dim = %d\n", dim);
2881 hres = SafeArrayGetLBound(sa, 1, &ind);
2882 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2883 ok(ind == 0, "Lower bound = %d\n", ind);
2884 hres = SafeArrayGetUBound(sa, 1, &ind);
2885 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2886 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2889 SafeArrayGetElement(sa, &ind, &var);
2890 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2891 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2894 SafeArrayGetElement(sa, &ind, &var);
2895 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2896 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2899 SafeArrayGetElement(sa, &ind, &var);
2900 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2903 SafeArrayGetElement(sa, &ind, &var);
2904 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2907 SafeArrayGetElement(sa, &ind, &var);
2908 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2909 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2912 SafeArrayGetElement(sa, &ind, &var);
2913 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2914 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2918 return E_FAIL; /* TODO */
2922 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2923 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2927 CHECK_EXPECT2(Exec_Explorer_38);
2928 ok(pvaIn != NULL, "pvaIn == NULL\n");
2929 ok(V_VT(pvaIn) == VT_I4 , "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2930 ok(!V_I4(pvaIn), "V_I4(pvaIn) = %d\n", V_I4(pvaIn));
2931 ok(!pvaOut, "pvaOut != NULL\n");
2933 test_current_url(doc_unk, prev_url);
2937 CHECK_EXPECT2(Exec_Explorer_69);
2938 ok(pvaIn == NULL, "pvaIn != NULL\n");
2939 ok(pvaOut != NULL, "pvaOut == NULL\n");
2941 case 109: /* TODO */
2944 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2949 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2951 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2952 SET_EXPECT(SetStatusText);
2953 ok(pvaIn == NULL, "pvaIn != NULL\n");
2954 ok(pvaOut == NULL, "pvaOut != NULL\n");
2956 case OLECMDID_SHOWSCRIPTERROR:
2960 ok(0, "unexpected command %d\n", nCmdID);
2965 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2969 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2970 OleCommandTarget_QueryInterface,
2971 OleCommandTarget_AddRef,
2972 OleCommandTarget_Release,
2973 OleCommandTarget_QueryStatus,
2974 OleCommandTarget_Exec
2977 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2979 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2981 return QueryInterface(riid, ppv);
2984 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2985 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2986 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2988 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2989 ok(pDispParams != NULL, "pDispParams == NULL\n");
2990 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2991 ok(puArgErr != NULL, "puArgErr == NULL\n");
2992 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2993 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2994 test_readyState(NULL);
2996 switch(dispIdMember) {
2997 case DISPID_AMBIENT_USERMODE:
2998 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2999 V_VT(pVarResult) = VT_BOOL;
3000 V_BOOL(pVarResult) = VARIANT_TRUE;
3002 case DISPID_AMBIENT_DLCONTROL:
3003 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
3005 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
3006 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3008 case DISPID_AMBIENT_SILENT:
3009 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
3010 V_VT(pVarResult) = VT_BOOL;
3011 V_BOOL(pVarResult) = VARIANT_FALSE;
3013 case DISPID_AMBIENT_USERAGENT:
3014 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
3016 case DISPID_AMBIENT_PALETTE:
3017 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
3021 ok(0, "unexpected dispid %d\n", dispIdMember);
3025 static const IDispatchVtbl DispatchVtbl = {
3026 Dispatch_QueryInterface,
3029 Dispatch_GetTypeInfoCount,
3030 Dispatch_GetTypeInfo,
3031 Dispatch_GetIDsOfNames,
3035 static IDispatch Dispatch = { &DispatchVtbl };
3037 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3039 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
3044 ok(0, "Unexpected call\n");
3045 return E_NOINTERFACE;
3048 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3049 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3050 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3053 IHTMLDocument2 *doc;
3056 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
3057 ok(pDispParams != NULL, "pDispParams == NULL\n");
3058 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3059 ok(puArgErr != NULL, "puArgErr == NULL\n");
3060 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3061 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3063 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3064 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3066 switch(dispIdMember) {
3067 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3068 hres = IHTMLDocument2_get_readyState(doc, &state);
3069 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3071 if(!strcmp_wa(state, "interactive"))
3072 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3073 else if(!strcmp_wa(state, "loading"))
3074 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3075 else if(!strcmp_wa(state, "complete")) {
3076 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3079 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3081 SysFreeString(state);
3083 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3094 break; /* FIXME: Handle these events. */
3096 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3099 IHTMLDocument2_Release(doc);
3103 static const IDispatchVtbl EventDispatchVtbl = {
3104 EventDispatch_QueryInterface,
3107 Dispatch_GetTypeInfoCount,
3108 Dispatch_GetTypeInfo,
3109 Dispatch_GetIDsOfNames,
3110 EventDispatch_Invoke
3113 static IDispatch EventDispatch = { &EventDispatchVtbl };
3115 static HRESULT WINAPI TravelLog_QueryInterface(ITravelLog *iface, REFIID riid, void **ppv)
3117 static const IID IID_IIETravelLog2 = {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3119 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITravelLog, riid)) {
3124 if(!IsEqualGUID(&IID_IIETravelLog2, riid))
3125 ok(0, "unexpected call %s\n", debugstr_guid(riid));
3128 return E_NOINTERFACE;
3131 static ULONG WINAPI TravelLog_AddRef(ITravelLog *iface)
3136 static ULONG WINAPI TravelLog_Release(ITravelLog *iface)
3141 static HRESULT WINAPI TravelLog_AddEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3143 ok(0, "unexpected call\n");
3147 static HRESULT WINAPI TravelLog_UpdateEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3149 ok(0, "unexpected call\n");
3153 static HRESULT WINAPI TravelLog_UpdateExternal(ITravelLog *iface, IUnknown *punk, IUnknown *punkHLBrowseContext)
3155 ok(0, "unexpected call\n");
3159 static HRESULT WINAPI TravelLog_Travel(ITravelLog *iface, IUnknown *punk, int iOffset)
3161 ok(0, "unexpected call\n");
3165 static HRESULT WINAPI TravelLog_GetTravelEntry(ITravelLog *iface, IUnknown *punk, int iOffset, ITravelEntry **ppte)
3167 ok(0, "unexpected call\n");
3171 static HRESULT WINAPI TravelLog_FindTravelEntry(ITravelLog *iface, IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
3173 ok(0, "unexpected call\n");
3177 static HRESULT WINAPI TravelLog_GetTooltipText(ITravelLog *iface, IUnknown *punk, int iOffset, int idsTemplate,
3178 LPWSTR pwzText, DWORD cchText)
3180 ok(0, "unexpected call\n");
3184 static HRESULT WINAPI TravelLog_InsertMenuEntries(ITravelLog *iface, IUnknown *punk, HMENU hmenu, int nPos,
3185 int idFirst, int idLast, DWORD dwFlags)
3187 ok(0, "unexpected call\n");
3191 static HRESULT WINAPI TravelLog_Clone(ITravelLog *iface, ITravelLog **pptl)
3193 ok(0, "unexpected call\n");
3197 static DWORD WINAPI TravelLog_CountEntries(ITravelLog *iface, IUnknown *punk)
3199 ok(0, "unexpected call\n");
3203 static HRESULT WINAPI TravelLog_Revert(ITravelLog *iface)
3205 ok(0, "unexpected call\n");
3209 static const ITravelLogVtbl TravelLogVtbl = {
3210 TravelLog_QueryInterface,
3214 TravelLog_UpdateEntry,
3215 TravelLog_UpdateExternal,
3217 TravelLog_GetTravelEntry,
3218 TravelLog_FindTravelEntry,
3219 TravelLog_GetTooltipText,
3220 TravelLog_InsertMenuEntries,
3222 TravelLog_CountEntries,
3226 static ITravelLog TravelLog = { &TravelLogVtbl };
3228 static HRESULT browserservice_qi(REFIID,void**);
3230 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3232 return browserservice_qi(riid, ppv);
3235 static ULONG WINAPI DocObjectService_AddRef(
3236 IDocObjectService* This)
3241 static ULONG WINAPI DocObjectService_Release(
3242 IDocObjectService* This)
3247 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(IDocObjectService *iface, IDispatch *pDispatch,
3248 LPCWSTR lpszUrl, DWORD dwFlags, LPCWSTR lpszFrameName, BYTE *pPostData, DWORD cbPostData,
3249 LPCWSTR lpszHeaders, BOOL fPlayNavSound, BOOL *pfCancel)
3251 CHECK_EXPECT(FireBeforeNavigate2);
3253 ok(!pDispatch, "pDispatch = %p\n", pDispatch);
3254 ok(!strcmp_wa(lpszUrl, nav_url), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl), nav_url);
3255 ok(dwFlags == 0x40 || !dwFlags, "dwFlags = %x\n", dwFlags);
3256 ok(!lpszFrameName, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName));
3257 ok(!pPostData, "pPostData = %p\n", pPostData);
3258 ok(!cbPostData, "cbPostData = %d\n", cbPostData);
3259 ok(!lpszHeaders, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3260 ok(fPlayNavSound, "fPlayNavSound = %x\n", fPlayNavSound);
3261 ok(pfCancel != NULL, "pfCancel = NULL\n");
3262 ok(!*pfCancel, "*pfCancel = %x\n", *pfCancel);
3267 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3268 IDocObjectService* This,
3269 IHTMLWindow2 *pHTMLWindow2,
3272 CHECK_EXPECT(FireNavigateComplete2);
3273 test_readyState(NULL);
3276 ok(dwFlags == 0x10 || broken(!dwFlags), "dwFlags = %x, expected 0x10\n", dwFlags);
3278 ok(!(dwFlags &~1), "dwFlags = %x\n", dwFlags);
3280 ok(pHTMLWindow2 != NULL, "pHTMLWindow2 = NULL\n");
3285 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3286 IDocObjectService* This)
3288 ok(0, "unexpected call\n");
3292 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3293 IDocObjectService* This)
3295 ok(0, "unexpected call\n");
3299 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3300 IDocObjectService* This,
3301 IHTMLWindow2 *pHTMLWindow,
3304 CHECK_EXPECT(FireDocumentComplete);
3306 ok(pHTMLWindow != NULL, "pHTMLWindow == NULL\n");
3307 ok(!dwFlags, "dwFlags = %x\n", dwFlags);
3312 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3313 IDocObjectService* This,
3314 IHTMLWindow2 *pHTMLWindow)
3316 ok(0, "unexpected call\n");
3320 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3321 IDocObjectService* This,
3322 BSTR *pbstrPendingUrl)
3324 CHECK_EXPECT(GetPendingUrl);
3328 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3329 IDocObjectService* This,
3330 IHTMLElement *pHTMLElement)
3332 CHECK_EXPECT(ActiveElementChanged);
3336 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3337 IDocObjectService* This,
3340 ok(0, "unexpected call\n");
3344 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3345 IDocObjectService* This,
3349 CHECK_EXPECT(IsErrorUrl);
3354 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3355 DocObjectService_QueryInterface,
3356 DocObjectService_AddRef,
3357 DocObjectService_Release,
3358 DocObjectService_FireBeforeNavigate2,
3359 DocObjectService_FireNavigateComplete2,
3360 DocObjectService_FireDownloadBegin,
3361 DocObjectService_FireDownloadComplete,
3362 DocObjectService_FireDocumentComplete,
3363 DocObjectService_UpdateDesktopComponent,
3364 DocObjectService_GetPendingUrl,
3365 DocObjectService_ActiveElementChanged,
3366 DocObjectService_GetUrlSearchComponent,
3367 DocObjectService_IsErrorUrl
3370 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3372 static HRESULT WINAPI ShellBrowser_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppv)
3374 return browserservice_qi(riid, ppv);
3377 static ULONG WINAPI ShellBrowser_AddRef(IShellBrowser *iface)
3382 static ULONG WINAPI ShellBrowser_Release(IShellBrowser *iface)
3387 static HRESULT WINAPI ShellBrowser_GetWindow(IShellBrowser *iface, HWND *phwnd)
3389 ok(0, "unexpected call\n");
3393 static HRESULT WINAPI ShellBrowser_ContextSensitiveHelp(IShellBrowser *iface, BOOL fEnterMode)
3395 ok(0, "unexpected call\n");
3399 static HRESULT WINAPI ShellBrowser_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
3401 ok(0, "unexpected call\n");
3405 static HRESULT WINAPI ShellBrowser_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved,
3406 HWND hwndActiveObject)
3408 ok(0, "unexpected call\n");
3412 static HRESULT WINAPI ShellBrowser_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
3414 ok(0, "unexpected call\n");
3418 static HRESULT WINAPI ShellBrowser_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR pszStatusText)
3420 ok(0, "unexpected call\n");
3424 static HRESULT WINAPI ShellBrowser_EnableModelessSB(IShellBrowser *iface, BOOL fEnable)
3426 ok(0, "unexpected call\n");
3430 static HRESULT WINAPI ShellBrowser_TranslateAcceleratorSB(IShellBrowser *iface, MSG *pmsg, WORD wID)
3432 ok(0, "unexpected call\n");
3436 static HRESULT WINAPI ShellBrowser_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
3438 ok(0, "unexpected call\n");
3442 static HRESULT WINAPI ShellBrowser_GetViewStateStream(IShellBrowser *iface, DWORD grfMode, IStream **ppStrm)
3444 ok(0, "unexpected call\n");
3448 static HRESULT WINAPI ShellBrowser_GetControlWindow(IShellBrowser *iface, UINT id, HWND *phwnd)
3450 ok(0, "unexpected call\n");
3454 static HRESULT WINAPI ShellBrowser_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam,
3455 LPARAM lParam, LRESULT *pret)
3457 ok(0, "unexpected call\n");
3461 static HRESULT WINAPI ShellBrowser_QueryActiveShellView(IShellBrowser *iface, IShellView **ppshv)
3463 ok(0, "unexpected call\n");
3467 static HRESULT WINAPI ShellBrowser_OnViewWindowActive(IShellBrowser* iface, IShellView *pshv)
3469 ok(0, "unexpected call\n");
3473 static HRESULT WINAPI ShellBrowser_SetToolbarItems(IShellBrowser *iface, LPTBBUTTONSB lpButtons,
3474 UINT nButtons, UINT uFlags)
3476 ok(0, "unexpected call\n");
3480 static const IShellBrowserVtbl ShellBrowserVtbl = {
3481 ShellBrowser_QueryInterface,
3482 ShellBrowser_AddRef,
3483 ShellBrowser_Release,
3484 ShellBrowser_GetWindow,
3485 ShellBrowser_ContextSensitiveHelp,
3486 ShellBrowser_InsertMenusSB,
3487 ShellBrowser_SetMenuSB,
3488 ShellBrowser_RemoveMenusSB,
3489 ShellBrowser_SetStatusTextSB,
3490 ShellBrowser_EnableModelessSB,
3491 ShellBrowser_TranslateAcceleratorSB,
3492 ShellBrowser_BrowseObject,
3493 ShellBrowser_GetViewStateStream,
3494 ShellBrowser_GetControlWindow,
3495 ShellBrowser_SendControlMsg,
3496 ShellBrowser_QueryActiveShellView,
3497 ShellBrowser_OnViewWindowActive,
3498 ShellBrowser_SetToolbarItems
3501 static IShellBrowser ShellBrowser = { &ShellBrowserVtbl };
3503 static HRESULT WINAPI BrowserService_QueryInterface(IBrowserService *iface, REFIID riid, void **ppv)
3505 return browserservice_qi(riid, ppv);
3508 static ULONG WINAPI BrowserService_AddRef(
3509 IBrowserService* This)
3514 static ULONG WINAPI BrowserService_Release(
3515 IBrowserService* This)
3520 static HRESULT WINAPI BrowserService_GetParentSite(
3521 IBrowserService* This,
3522 IOleInPlaceSite **ppipsite)
3524 ok(0, "unexpected call\n");
3528 static HRESULT WINAPI BrowserService_SetTitle(
3529 IBrowserService* This,
3533 ok(0, "unexpected call\n");
3537 static HRESULT WINAPI BrowserService_GetTitle(
3538 IBrowserService* This,
3543 ok(0, "unexpected call\n");
3547 static HRESULT WINAPI BrowserService_GetOleObject(
3548 IBrowserService* This,
3549 IOleObject **ppobjv)
3551 ok(0, "unexpected call\n");
3555 static HRESULT WINAPI BrowserService_GetTravelLog(IBrowserService* This, ITravelLog **pptl)
3557 CHECK_EXPECT(GetTravelLog);
3559 ok(pptl != NULL, "pptl = NULL\n");
3568 static HRESULT WINAPI BrowserService_ShowControlWindow(
3569 IBrowserService* This,
3573 ok(0, "unexpected call\n");
3577 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3578 IBrowserService* This,
3582 ok(0, "unexpected call\n");
3586 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3587 IBrowserService* This,
3588 PCIDLIST_ABSOLUTE pidl,
3592 ok(0, "unexpected call\n");
3596 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3597 IBrowserService* This,
3600 PIDLIST_ABSOLUTE *ppidlOut)
3602 ok(0, "unexpected call\n");
3606 static HRESULT WINAPI BrowserService_DisplayParseError(
3607 IBrowserService* This,
3611 ok(0, "unexpected call\n");
3615 static HRESULT WINAPI BrowserService_NavigateToPidl(
3616 IBrowserService* This,
3617 PCIDLIST_ABSOLUTE pidl,
3620 ok(0, "unexpected call\n");
3624 static HRESULT WINAPI BrowserService_SetNavigateState(
3625 IBrowserService* This,
3628 ok(0, "unexpected call\n");
3632 static HRESULT WINAPI BrowserService_GetNavigateState(
3633 IBrowserService* This,
3636 ok(0, "unexpected call\n");
3640 static HRESULT WINAPI BrowserService_NotifyRedirect(
3641 IBrowserService* This,
3643 PCIDLIST_ABSOLUTE pidl,
3646 ok(0, "unexpected call\n");
3650 static HRESULT WINAPI BrowserService_UpdateWindowList(
3651 IBrowserService* This)
3653 ok(0, "unexpected call\n");
3657 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3658 IBrowserService* This)
3660 CHECK_EXPECT(UpdateBackForwardState);
3664 static HRESULT WINAPI BrowserService_SetFlags(
3665 IBrowserService* This,
3669 ok(0, "unexpected call\n");
3673 static HRESULT WINAPI BrowserService_GetFlags(
3674 IBrowserService* This,
3677 ok(0, "unexpected call\n");
3681 static HRESULT WINAPI BrowserService_CanNavigateNow(
3682 IBrowserService* This)
3684 ok(0, "unexpected call\n");
3688 static HRESULT WINAPI BrowserService_GetPidl(
3689 IBrowserService* This,
3690 PIDLIST_ABSOLUTE *ppidl)
3692 ok(0, "unexpected call\n");
3696 static HRESULT WINAPI BrowserService_SetReferrer(
3697 IBrowserService* This,
3698 PCIDLIST_ABSOLUTE pidl)
3700 ok(0, "unexpected call\n");
3704 static DWORD WINAPI BrowserService_GetBrowserIndex(
3705 IBrowserService* This)
3707 ok(0, "unexpected call\n");
3711 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3712 IBrowserService* This,
3716 ok(0, "unexpected call\n");
3720 static HRESULT WINAPI BrowserService_GetHistoryObject(
3721 IBrowserService* This,
3726 ok(0, "unexpected call\n");
3730 static HRESULT WINAPI BrowserService_SetHistoryObject(
3731 IBrowserService* This,
3733 BOOL fIsLocalAnchor)
3735 ok(0, "unexpected call\n");
3739 static HRESULT WINAPI BrowserService_CacheOLEServer(
3740 IBrowserService* This,
3743 ok(0, "unexpected call\n");
3747 static HRESULT WINAPI BrowserService_GetSetCodePage(
3748 IBrowserService* This,
3752 ok(0, "unexpected call\n");
3756 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3757 IBrowserService* This,
3761 VARIANT *pvarargOut)
3763 ok(0, "unexpected call\n");
3767 static HRESULT WINAPI BrowserService_GetPalette(
3768 IBrowserService* This,
3771 ok(0, "unexpected call\n");
3775 static HRESULT WINAPI BrowserService_RegisterWindow(
3776 IBrowserService* This,
3777 BOOL fForceRegister,
3780 ok(0, "unexpected call\n");
3784 static IBrowserServiceVtbl BrowserServiceVtbl = {
3785 BrowserService_QueryInterface,
3786 BrowserService_AddRef,
3787 BrowserService_Release,
3788 BrowserService_GetParentSite,
3789 BrowserService_SetTitle,
3790 BrowserService_GetTitle,
3791 BrowserService_GetOleObject,
3792 BrowserService_GetTravelLog,
3793 BrowserService_ShowControlWindow,
3794 BrowserService_IsControlWindowShown,
3795 BrowserService_IEGetDisplayName,
3796 BrowserService_IEParseDisplayName,
3797 BrowserService_DisplayParseError,
3798 BrowserService_NavigateToPidl,
3799 BrowserService_SetNavigateState,
3800 BrowserService_GetNavigateState,
3801 BrowserService_NotifyRedirect,
3802 BrowserService_UpdateWindowList,
3803 BrowserService_UpdateBackForwardState,
3804 BrowserService_SetFlags,
3805 BrowserService_GetFlags,
3806 BrowserService_CanNavigateNow,
3807 BrowserService_GetPidl,
3808 BrowserService_SetReferrer,
3809 BrowserService_GetBrowserIndex,
3810 BrowserService_GetBrowserByIndex,
3811 BrowserService_GetHistoryObject,
3812 BrowserService_SetHistoryObject,
3813 BrowserService_CacheOLEServer,
3814 BrowserService_GetSetCodePage,
3815 BrowserService_OnHttpEquiv,
3816 BrowserService_GetPalette,
3817 BrowserService_RegisterWindow
3820 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3822 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3824 static HRESULT browserservice_qi(REFIID riid, void **ppv)
3826 if(IsEqualGUID(&IID_IShellBrowser, riid)) {
3827 *ppv = &ShellBrowser;
3831 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3832 *ppv = &DocObjectService;
3836 if(IsEqualGUID(&IID_IBrowserService, riid)) {
3837 *ppv = &BrowserService;
3842 return E_NOINTERFACE;
3845 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, void **ppv)
3849 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IWebBrowser, riid)
3850 || IsEqualGUID(&IID_IWebBrowserApp, riid) || IsEqualGUID(&IID_IWebBrowser2, riid)) {
3855 if(IsEqualGUID(riid, &IID_IOleObject))
3856 return E_NOINTERFACE; /* TODO */
3858 ok(0, "unexpected call %s\n", debugstr_guid(riid));
3859 return E_NOINTERFACE;
3862 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
3867 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
3872 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
3874 ok(0, "unexpected call\n");
3878 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
3879 LPTYPEINFO *ppTInfo)
3881 ok(0, "unexpected call\n");
3885 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
3886 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
3888 ok(0, "unexpected call\n");
3892 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
3893 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3894 EXCEPINFO *pExepInfo, UINT *puArgErr)
3896 ok(0, "unexpected call\n");
3900 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
3902 ok(0, "unexpected call\n");
3906 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
3908 ok(0, "unexpected call\n");
3912 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
3914 ok(0, "unexpected call\n");
3918 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
3920 ok(0, "unexpected call\n");
3924 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
3925 VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3927 ok(0, "unexpected call\n");
3931 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
3933 ok(0, "unexpected call\n");
3937 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
3939 ok(0, "unexpected call\n");
3943 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
3945 ok(0, "unexpected call\n");
3949 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
3951 ok(0, "unexpected call\n");
3955 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
3957 ok(0, "unexpected call\n");
3961 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
3963 ok(0, "unexpected call\n");
3967 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
3969 ok(0, "unexpected call\n");
3973 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
3975 ok(0, "unexpected call\n");
3979 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
3981 ok(0, "unexpected call\n");
3985 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
3987 ok(0, "unexpected call\n");
3991 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
3993 ok(0, "unexpected call\n");
3997 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
3999 ok(0, "unexpected call\n");
4003 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
4005 ok(0, "unexpected call\n");
4009 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
4011 ok(0, "unexpected call\n");
4015 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
4017 ok(0, "unexpected call\n");
4021 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
4023 ok(0, "unexpected call\n");
4027 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
4029 ok(0, "unexpected call\n");
4033 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
4035 ok(0, "unexpected call\n");
4039 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
4041 CHECK_EXPECT(get_LocationURL);
4045 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4047 ok(0, "unexpected call\n");
4051 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
4053 ok(0, "unexpected call\n");
4057 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
4059 ok(0, "unexpected call\n");
4063 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
4065 ok(0, "unexpected call\n");
4069 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
4071 ok(0, "unexpected call\n");
4075 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
4077 ok(0, "unexpected call\n");
4081 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, LONG *pHWND)
4083 ok(0, "unexpected call\n");
4087 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
4089 ok(0, "unexpected call\n");
4093 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
4095 ok(0, "unexpected call\n");
4099 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4101 ok(0, "unexpected call\n");
4105 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
4107 ok(0, "unexpected call\n");
4111 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4113 ok(0, "unexpected call\n");
4117 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4119 ok(0, "unexpected call\n");
4123 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
4125 ok(0, "unexpected call\n");
4129 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
4131 ok(0, "unexpected call\n");
4135 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
4137 ok(0, "unexpected call\n");
4141 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
4143 ok(0, "unexpected call\n");
4147 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4149 ok(0, "unexpected call\n");
4153 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4155 ok(0, "unexpected call\n");
4159 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
4161 ok(0, "unexpected call\n");
4165 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
4167 ok(0, "unexpected call\n");
4171 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
4172 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
4174 ok(0, "unexpected call\n");
4178 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
4180 ok(0, "unexpected call\n");
4184 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
4185 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
4187 ok(0, "unexpected call\n");
4191 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
4192 VARIANT *pvarShow, VARIANT *pvarSize)
4194 ok(0, "unexpected call\n");
4198 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
4200 ok(0, "unexpected call\n");
4204 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
4206 ok(0, "unexpected call\n");
4210 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
4212 ok(0, "unexpected call\n");
4216 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
4218 ok(0, "unexpected call\n");
4222 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
4224 ok(0, "unexpected call\n");
4228 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
4229 VARIANT_BOOL *pbRegister)
4231 ok(0, "unexpected call\n");
4235 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
4236 VARIANT_BOOL bRegister)
4238 ok(0, "unexpected call\n");
4242 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
4243 VARIANT_BOOL *pbRegister)
4245 ok(0, "unexpected call\n");
4249 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
4250 VARIANT_BOOL bRegister)
4252 ok(0, "unexpected call\n");
4256 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
4258 ok(0, "unexpected call\n");
4262 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
4264 ok(0, "unexpected call\n");
4268 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4270 ok(0, "unexpected call\n");
4274 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4276 ok(0, "unexpected call\n");
4280 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4282 ok(0, "unexpected call\n");
4286 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
4288 ok(0, "unexpected call\n");
4292 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
4294 WebBrowser_QueryInterface,
4297 WebBrowser_GetTypeInfoCount,
4298 WebBrowser_GetTypeInfo,
4299 WebBrowser_GetIDsOfNames,
4302 WebBrowser_GoForward,
4304 WebBrowser_GoSearch,
4305 WebBrowser_Navigate,
4307 WebBrowser_Refresh2,
4309 WebBrowser_get_Application,
4310 WebBrowser_get_Parent,
4311 WebBrowser_get_Container,
4312 WebBrowser_get_Document,
4313 WebBrowser_get_TopLevelContainer,
4314 WebBrowser_get_Type,
4315 WebBrowser_get_Left,
4316 WebBrowser_put_Left,
4319 WebBrowser_get_Width,
4320 WebBrowser_put_Width,
4321 WebBrowser_get_Height,
4322 WebBrowser_put_Height,
4323 WebBrowser_get_LocationName,
4324 WebBrowser_get_LocationURL,
4325 WebBrowser_get_Busy,
4327 WebBrowser_ClientToWindow,
4328 WebBrowser_PutProperty,
4329 WebBrowser_GetProperty,
4330 WebBrowser_get_Name,
4331 WebBrowser_get_HWND,
4332 WebBrowser_get_FullName,
4333 WebBrowser_get_Path,
4334 WebBrowser_get_Visible,
4335 WebBrowser_put_Visible,
4336 WebBrowser_get_StatusBar,
4337 WebBrowser_put_StatusBar,
4338 WebBrowser_get_StatusText,
4339 WebBrowser_put_StatusText,
4340 WebBrowser_get_ToolBar,
4341 WebBrowser_put_ToolBar,
4342 WebBrowser_get_MenuBar,
4343 WebBrowser_put_MenuBar,
4344 WebBrowser_get_FullScreen,
4345 WebBrowser_put_FullScreen,
4346 WebBrowser_Navigate2,
4347 WebBrowser_QueryStatusWB,
4349 WebBrowser_ShowBrowserBar,
4350 WebBrowser_get_ReadyState,
4351 WebBrowser_get_Offline,
4352 WebBrowser_put_Offline,
4353 WebBrowser_get_Silent,
4354 WebBrowser_put_Silent,
4355 WebBrowser_get_RegisterAsBrowser,
4356 WebBrowser_put_RegisterAsBrowser,
4357 WebBrowser_get_RegisterAsDropTarget,
4358 WebBrowser_put_RegisterAsDropTarget,
4359 WebBrowser_get_TheaterMode,
4360 WebBrowser_put_TheaterMode,
4361 WebBrowser_get_AddressBar,
4362 WebBrowser_put_AddressBar,
4363 WebBrowser_get_Resizable,
4364 WebBrowser_put_Resizable
4367 static IWebBrowser2 WebBrowser2 = { &WebBrowser2Vtbl };
4369 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
4370 REFIID riid, void **ppv)
4372 return QueryInterface(riid, ppv);
4375 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
4380 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
4385 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
4386 REFIID riid, void **ppv)
4389 * Services used by HTMLDocument:
4392 * IInternetSecurityManager
4394 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
4397 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
4398 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
4399 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
4401 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
4402 * IElementBehaviorFactory
4403 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
4412 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
4413 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
4418 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
4419 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
4420 *ppv = &NewWindowManager;
4424 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
4425 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
4426 *ppv = &BrowserService;
4430 if(support_wbapp && IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
4431 if(IsEqualGUID(riid, &IID_IWebBrowser2)) {
4432 *ppv = &WebBrowser2;
4435 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4438 return E_NOINTERFACE;
4441 static const IServiceProviderVtbl ServiceProviderVtbl = {
4442 ServiceProvider_QueryInterface,
4443 ServiceProvider_AddRef,
4444 ServiceProvider_Release,
4445 ServiceProvider_QueryService
4448 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
4450 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
4451 REFIID riid, void **ppv)
4453 return QueryInterface(riid, ppv);
4456 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
4461 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
4466 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
4467 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
4469 ok(0, "unexpected call\n");
4472 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
4473 DWORD dwAspect, LONG lindex)
4475 ok(0, "unexpected call\n");
4478 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
4480 ok(0, "unexpected call\n");
4483 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
4485 ok(0, "unexpected call\n");
4488 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
4490 ok(0, "unexpected call\n");
4493 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
4495 ok(0, "unexpected call\n");
4498 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
4500 CHECK_EXPECT(Advise_Close);
4503 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
4504 AdviseSink_QueryInterface,
4507 AdviseSink_OnDataChange,
4508 AdviseSink_OnViewChange,
4509 AdviseSink_OnRename,
4511 ObjectAdviseSink_OnClose,
4512 AdviseSinkEx_OnViewStatusChange
4515 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
4517 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
4518 REFIID riid, void **ppv)
4520 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
4525 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4527 return E_NOINTERFACE;
4530 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
4531 DWORD dwAspect, LONG lindex)
4533 CHECK_EXPECT2(OnViewChange);
4535 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
4536 ok(lindex == -1, "lindex = %d\n", lindex);
4539 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
4540 ViewAdviseSink_QueryInterface,
4543 AdviseSink_OnDataChange,
4544 ViewAdviseSink_OnViewChange,
4545 AdviseSink_OnRename,
4548 AdviseSinkEx_OnViewStatusChange
4551 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
4553 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
4554 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
4555 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
4556 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
4557 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
4559 static HRESULT QueryInterface(REFIID riid, void **ppv)
4563 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
4565 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
4566 *ppv = &DocumentSite;
4567 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
4568 *ppv = &DocHostUIHandler;
4569 else if(IsEqualGUID(&IID_IOleContainer, riid))
4570 *ppv = &OleContainer;
4571 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
4572 *ppv = &InPlaceSiteWindowless;
4573 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
4574 *ppv = &OleCommandTarget;
4575 else if(IsEqualGUID(&IID_IDispatch, riid))
4577 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4578 *ppv = &ServiceProvider;
4579 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
4580 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
4581 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
4582 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
4583 else if(IsEqualGUID(&IID_IOleControlSite, riid))
4584 *ppv = &OleControlSite;
4585 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
4586 return E_NOINTERFACE; /* TODO */
4587 else if(IsEqualGUID(&IID_IProxyManager, riid))
4588 return E_NOINTERFACE; /* ? */
4589 else if(IsEqualGUID(&IID_unk1, riid))
4590 return E_NOINTERFACE; /* HTMLWindow2 ? */
4591 else if(IsEqualGUID(&IID_IThumbnailView, riid))
4592 return E_NOINTERFACE; /* ? */
4593 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
4594 return E_NOINTERFACE; /* ? */
4595 else if(IsEqualGUID(&IID_unk4, riid))
4596 return E_NOINTERFACE; /* ? */
4597 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
4598 return E_NOINTERFACE; /* ? */
4600 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4604 return E_NOINTERFACE;
4607 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4609 if(msg == WM_CONTINUE_BINDING) {
4610 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
4611 continue_binding(callback);
4614 return DefWindowProc(hwnd, msg, wParam, lParam);
4617 static void test_doscroll(IUnknown *unk)
4619 IHTMLDocument3 *doc;
4620 IHTMLElement2 *elem2;
4625 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
4626 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
4630 hres = IHTMLDocument3_get_documentElement(doc, &elem);
4631 IHTMLDocument3_Release(doc);
4632 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
4633 switch(load_state) {
4637 ok(!elem, "elem != NULL\n");
4640 case LD_INTERACTIVE:
4642 ok(elem != NULL, "elem == NULL\n");
4647 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4648 IHTMLElement_Release(elem);
4649 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4652 V_BSTR(&v) = a2bstr("left");
4653 hres = IHTMLElement2_doScroll(elem2, v);
4654 SysFreeString(V_BSTR(&v));
4655 IHTMLElement2_Release(elem2);
4657 if(inplace_deactivated)
4658 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
4659 else if(load_state == LD_COMPLETE)
4660 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
4662 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
4665 static void _test_readyState(unsigned line, IUnknown *unk)
4667 IHTMLDocument2 *htmldoc;
4668 DISPPARAMS dispparams;
4674 static const LPCSTR expected_state[] = {
4689 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
4690 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
4694 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
4695 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
4697 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
4698 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
4700 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
4701 load_state = LD_INTERACTIVE;
4704 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
4705 wine_dbgstr_w(state), load_state);
4706 SysFreeString(state);
4708 hres = IHTMLDocument2_get_body(htmldoc, &elem);
4709 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
4711 IHTMLElement2 *elem2;
4714 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4715 IHTMLElement_Release(elem);
4716 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4718 hres = IHTMLElement2_get_readyState(elem2, &var);
4719 IHTMLElement2_Release(elem2);
4720 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
4721 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
4722 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
4725 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
4728 dispparams.cArgs = 0;
4729 dispparams.cNamedArgs = 0;
4730 dispparams.rgdispidNamedArgs = NULL;
4731 dispparams.rgvarg = NULL;
4735 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
4736 &dispparams, &out, NULL, NULL);
4737 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
4739 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
4740 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
4742 test_doscroll((IUnknown*)htmldoc);
4744 IHTMLDocument2_Release(htmldoc);
4747 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
4752 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
4753 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
4755 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
4756 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
4758 IViewObject_Release(view);
4761 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
4763 IConnectionPointContainer *tmp_container = NULL;
4764 IConnectionPoint *cp;
4769 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
4770 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
4774 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
4775 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
4776 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
4778 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
4779 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
4781 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
4782 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
4783 ok(tmp_container == container, "container != tmp_container\n");
4785 IConnectionPointContainer_Release(tmp_container);
4787 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
4788 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
4790 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
4791 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
4792 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4793 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
4794 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
4795 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4798 IConnectionPoint_Release(cp);
4801 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
4803 IConnectionPointContainer *container;
4806 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
4807 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
4811 test_ConnectionPoint(container, &IID_IDispatch);
4812 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
4813 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
4814 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
4816 IConnectionPointContainer_Release(container);
4819 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
4821 ICustomDoc *custom_doc;
4824 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
4825 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
4827 expect_uihandler_iface = uihandler;
4829 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
4830 ICustomDoc_Release(custom_doc);
4831 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
4834 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
4838 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
4840 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
4842 test_readyState((IUnknown*)persist);
4846 CreateBindCtx(0, &bind);
4847 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
4848 (IUnknown*)&ClientSite);
4851 SET_EXPECT(GetDisplayName);
4852 if(!set_clientsite) {
4853 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4854 SET_EXPECT(GetHostInfo);
4855 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4856 SET_EXPECT(Invoke_AMBIENT_SILENT);
4857 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4858 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4859 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4860 SET_EXPECT(GetOptionKeyPath);
4861 SET_EXPECT(GetOverrideKeyPath);
4862 SET_EXPECT(GetWindow);
4863 SET_EXPECT(Exec_DOCCANNAVIGATE);
4864 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4865 SET_EXPECT(Exec_SETPROGRESSMAX);
4866 SET_EXPECT(Exec_SETPROGRESSPOS);
4867 SET_EXPECT(Exec_ShellDocView_37);
4869 if(!container_locked) {
4870 SET_EXPECT(GetContainer);
4871 SET_EXPECT(LockContainer);
4873 SET_EXPECT(OnChanged_READYSTATE);
4874 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4875 SET_EXPECT(Exec_ShellDocView_84);
4876 SET_EXPECT(IsSystemMoniker);
4878 SET_EXPECT(BindToStorage);
4879 SET_EXPECT(SetActiveObject);
4880 if(set_clientsite) {
4881 SET_EXPECT(Invoke_AMBIENT_SILENT);
4882 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4883 SET_EXPECT(Exec_ShellDocView_37);
4884 SET_EXPECT(IsErrorUrl);
4887 SET_EXPECT(GetTravelLog);
4888 SET_EXPECT(GetPendingUrl);
4889 load_state = LD_DOLOAD;
4890 expect_LockContainer_fLock = TRUE;
4891 readystate_set_loading = TRUE;
4893 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
4894 ok(hres == S_OK, "Load failed: %08x\n", hres);
4897 CHECK_CALLED(GetDisplayName);
4898 if(!set_clientsite) {
4899 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4900 CHECK_CALLED(GetHostInfo);
4901 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4902 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4903 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4904 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4905 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
4906 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
4907 CHECK_CALLED(GetOverrideKeyPath);
4908 CHECK_CALLED(GetWindow);
4909 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4910 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4911 CHECK_CALLED(Exec_SETPROGRESSMAX);
4912 CHECK_CALLED(Exec_SETPROGRESSPOS);
4913 CHECK_CALLED(Exec_ShellDocView_37);
4915 if(!container_locked) {
4916 CHECK_CALLED(GetContainer);
4917 CHECK_CALLED(LockContainer);
4918 container_locked = TRUE;
4920 CHECK_CALLED(OnChanged_READYSTATE);
4921 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4922 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
4923 SET_CALLED(Exec_ShellDocView_84);
4925 CHECK_CALLED(BindToStorage);
4926 CLEAR_CALLED(SetActiveObject); /* FIXME */
4927 if(set_clientsite) {
4928 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4929 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4930 CHECK_CALLED(Exec_ShellDocView_37);
4931 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4934 todo_wine CHECK_CALLED(GetTravelLog);
4935 todo_wine CHECK_CALLED(GetPendingUrl);
4937 set_clientsite = container_locked = TRUE;
4939 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
4941 IBindCtx_Release(bind);
4943 test_readyState((IUnknown*)persist);
4946 #define DWL_VERBDONE 0x0001
4947 #define DWL_CSS 0x0002
4948 #define DWL_TRYCSS 0x0004
4949 #define DWL_HTTP 0x0008
4950 #define DWL_EMPTY 0x0010
4951 #define DWL_JAVASCRIPT 0x0020
4952 #define DWL_ONREADY_LOADING 0x0040
4953 #define DWL_EXPECT_HISTUPDATE 0x0080
4955 static void test_download(DWORD flags)
4957 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
4962 b = is_js ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Exec_HTTPEQUIV_DONE;
4964 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
4965 ok(hwnd != NULL, "Could not find hidden window\n");
4967 test_readyState(NULL);
4969 if(flags & (DWL_VERBDONE|DWL_HTTP))
4970 SET_EXPECT(Exec_SETPROGRESSMAX);
4971 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js)
4972 SET_EXPECT(GetHostInfo);
4973 SET_EXPECT(SetStatusText);
4974 if(!(flags & DWL_EMPTY))
4975 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
4977 SET_EXPECT(GetExternal);
4978 SET_EXPECT(OnViewChange);
4979 SET_EXPECT(GetDropTarget);
4980 if(flags & DWL_TRYCSS)
4981 SET_EXPECT(Exec_ShellDocView_84);
4982 if(flags & DWL_CSS) {
4983 SET_EXPECT(CreateInstance);
4985 SET_EXPECT(LockRequest);
4986 SET_EXPECT(Terminate);
4987 SET_EXPECT(Protocol_Read);
4988 SET_EXPECT(UnlockRequest);
4990 if(flags & DWL_ONREADY_LOADING)
4991 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4992 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4993 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
4995 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
4996 SET_EXPECT(Exec_Explorer_69);
4997 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
4998 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
4999 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
5000 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
5001 if((nav_url && !is_js) || (flags & (DWL_CSS|DWL_HTTP)))
5002 SET_EXPECT(Exec_ShellDocView_37);
5003 if(flags & DWL_HTTP) {
5004 SET_EXPECT(OnChanged_1012);
5005 SET_EXPECT(Exec_HTTPEQUIV);
5006 SET_EXPECT(Exec_SETTITLE);
5009 SET_EXPECT(OnChanged_1005);
5010 SET_EXPECT(OnChanged_READYSTATE);
5011 SET_EXPECT(Exec_SETPROGRESSPOS);
5012 if(!(flags & DWL_EMPTY))
5013 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
5014 SET_EXPECT(Exec_ShellDocView_103);
5015 SET_EXPECT(Exec_ShellDocView_105);
5016 SET_EXPECT(Exec_ShellDocView_140);
5018 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
5019 SET_EXPECT(Exec_HTTPEQUIV_DONE);
5021 SET_EXPECT(SetStatusText);
5022 if(nav_url || support_wbapp) {
5023 SET_EXPECT(UpdateUI);
5024 SET_EXPECT(Exec_UPDATECOMMANDS);
5025 SET_EXPECT(Exec_SETTITLE);
5026 if(flags & DWL_EXPECT_HISTUPDATE)
5027 SET_EXPECT(Exec_Explorer_38);
5028 SET_EXPECT(UpdateBackForwardState);
5032 if(!(flags & DWL_EMPTY))
5033 SET_EXPECT(FireNavigateComplete2);
5034 SET_EXPECT(FireDocumentComplete);
5036 SET_EXPECT(ActiveElementChanged);
5038 SET_EXPECT(IsErrorUrl);
5039 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
5041 while(!*b && GetMessage(&msg, NULL, 0, 0)) {
5042 TranslateMessage(&msg);
5043 DispatchMessage(&msg);
5046 if(flags & DWL_VERBDONE)
5047 CHECK_CALLED(Exec_SETPROGRESSMAX);
5048 if(flags & DWL_HTTP)
5049 SET_CALLED(Exec_SETPROGRESSMAX);
5050 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js) {
5052 todo_wine CHECK_CALLED(GetHostInfo);
5054 CHECK_CALLED(GetHostInfo);
5056 CHECK_CALLED(SetStatusText);
5057 if(!(flags & DWL_EMPTY))
5058 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
5060 CHECK_CALLED(GetExternal);
5061 CHECK_CALLED(OnViewChange);
5062 CLEAR_CALLED(GetDropTarget);
5063 if(flags & DWL_TRYCSS)
5064 SET_CALLED(Exec_ShellDocView_84);
5065 if(flags & DWL_CSS) {
5066 CHECK_CALLED(CreateInstance);
5067 CHECK_CALLED(Start);
5068 CHECK_CALLED(LockRequest);
5069 CHECK_CALLED(Terminate);
5070 CHECK_CALLED(Protocol_Read);
5071 CHECK_CALLED(UnlockRequest);
5073 if(flags & DWL_ONREADY_LOADING)
5074 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5075 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
5076 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
5078 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
5079 SET_CALLED(Exec_Explorer_69);
5080 SET_CALLED(EnableModeless_TRUE); /* IE7 */
5081 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
5082 SET_CALLED(EnableModeless_FALSE); /* IE7 */
5083 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
5084 if(nav_url && !is_js)
5085 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
5086 else if(flags & (DWL_CSS|DWL_HTTP))
5087 CLEAR_CALLED(Exec_ShellDocView_37); /* Called by IE9 */
5088 if(flags & DWL_HTTP) {
5089 todo_wine CHECK_CALLED(OnChanged_1012);
5090 todo_wine CHECK_CALLED(Exec_HTTPEQUIV);
5091 todo_wine CHECK_CALLED(Exec_SETTITLE);
5094 CHECK_CALLED(OnChanged_1005);
5095 CHECK_CALLED(OnChanged_READYSTATE);
5096 CHECK_CALLED(Exec_SETPROGRESSPOS);
5098 CLEAR_CALLED(OnChanged_READYSTATE); /* sometimes called */
5099 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
5101 if(!(flags & DWL_EMPTY))
5102 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
5103 CLEAR_CALLED(Exec_ShellDocView_103);
5104 CLEAR_CALLED(Exec_ShellDocView_105);
5105 CLEAR_CALLED(Exec_ShellDocView_140);
5107 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
5108 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
5110 SET_CALLED(SetStatusText);
5111 if(nav_url || support_wbapp) { /* avoiding race, FIXME: find better way */
5112 CLEAR_CALLED(UpdateUI);
5113 CLEAR_CALLED(Exec_UPDATECOMMANDS);
5114 CLEAR_CALLED(Exec_SETTITLE);
5115 if(flags & DWL_EXPECT_HISTUPDATE)
5116 todo_wine CHECK_CALLED(Exec_Explorer_38);
5117 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
5121 if(!(flags & DWL_EMPTY)) {
5123 CHECK_CALLED(FireNavigateComplete2);
5125 todo_wine CHECK_CALLED(FireNavigateComplete2);
5127 CHECK_CALLED(FireDocumentComplete);
5129 todo_wine CHECK_CALLED(ActiveElementChanged);
5131 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
5133 load_state = LD_COMPLETE;
5135 test_readyState(NULL);
5138 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
5140 IPersistMoniker *persist_mon;
5141 IPersistFile *persist_file;
5145 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
5146 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
5147 if(SUCCEEDED(hres)) {
5148 hres = IPersist_GetClassID(persist_file, NULL);
5149 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5151 hres = IPersist_GetClassID(persist_file, &guid);
5152 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5153 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5155 IPersist_Release(persist_file);
5158 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
5159 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
5160 if(SUCCEEDED(hres)) {
5161 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
5162 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5164 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
5165 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5166 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5168 if(load_state == LD_DOLOAD)
5169 test_Load(persist_mon, mon);
5171 test_readyState((IUnknown*)doc);
5173 IPersistMoniker_Release(persist_mon);
5177 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const char *href, const char *new_nav_url, BOOL is_js,
5178 BOOL is_hash, DWORD dwl_flags)
5180 const char *prev_nav_url = NULL;
5181 IHTMLPrivateWindow *priv_window;
5182 IHTMLLocation *location;
5183 IHTMLWindow2 *window;
5187 trace("put_href %s...\n", new_nav_url);
5190 loading_hash = is_hash;
5193 hres = IHTMLDocument2_get_location(doc, &location);
5194 ok(hres == S_OK, "get_location failed: %08x\n", hres);
5195 ok(location != NULL, "location == NULL\n");
5197 prev_url = prev_nav_url = nav_url;
5198 nav_url = new_nav_url;
5200 nav_serv_url = new_nav_url;
5205 SET_EXPECT(TranslateUrl);
5207 SET_EXPECT(FireBeforeNavigate2);
5208 SET_EXPECT(Exec_ShellDocView_67);
5210 SET_EXPECT(Invoke_AMBIENT_SILENT);
5211 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5212 SET_EXPECT(Exec_ShellDocView_63);
5214 SET_EXPECT(FireNavigateComplete2);
5215 SET_EXPECT(FireDocumentComplete);
5218 SET_EXPECT(Navigate);
5221 hres = IHTMLLocation_replace(location, str);
5222 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5224 hres = IHTMLLocation_put_href(location, str);
5225 if(is_js && hres == E_ACCESSDENIED)
5226 win_skip("put_href: got E_ACCESSDENIED\n");
5228 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5232 CHECK_CALLED(TranslateUrl);
5234 CHECK_CALLED(FireBeforeNavigate2);
5235 CHECK_CALLED(Exec_ShellDocView_67);
5237 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5238 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5239 CHECK_CALLED(Exec_ShellDocView_63);
5241 CHECK_CALLED(FireNavigateComplete2);
5242 CHECK_CALLED(FireDocumentComplete);
5245 CHECK_CALLED(Navigate);
5248 CLEAR_CALLED(TranslateUrl);
5250 CLEAR_CALLED(FireBeforeNavigate2);
5251 SET_CALLED(Exec_ShellDocView_67);
5253 CLEAR_CALLED(Invoke_AMBIENT_SILENT);
5254 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5255 CLEAR_CALLED(Exec_ShellDocView_63);
5257 CLEAR_CALLED(FireNavigateComplete2);
5258 CLEAR_CALLED(FireDocumentComplete);
5261 CLEAR_CALLED(Navigate);
5265 IHTMLLocation_Release(location);
5267 if(is_js && hres == E_ACCESSDENIED) {
5268 nav_url = prev_nav_url;
5272 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5273 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5275 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
5276 IHTMLWindow2_Release(window);
5277 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
5279 if(!support_wbapp) {
5282 readystate_set_loading = TRUE;
5283 SET_EXPECT(TranslateUrl);
5284 SET_EXPECT(Exec_ShellDocView_67);
5285 SET_EXPECT(Invoke_AMBIENT_SILENT);
5286 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5287 SET_EXPECT(Exec_ShellDocView_63);
5289 str = a2bstr(nav_url);
5291 V_VT(&vempty) = VT_EMPTY;
5292 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
5294 SysFreeString(str2);
5295 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
5297 CHECK_CALLED(TranslateUrl);
5298 CHECK_CALLED(Exec_ShellDocView_67);
5299 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5300 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5301 CHECK_CALLED(Exec_ShellDocView_63);
5305 test_GetCurMoniker(doc_unk, doc_mon, NULL);
5310 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5311 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5312 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2), prev_nav_url);
5313 SysFreeString(str2);
5316 ignore_external_qi = TRUE;
5317 test_download(DWL_VERBDONE | (is_js ? DWL_JAVASCRIPT : DWL_ONREADY_LOADING) | dwl_flags);
5319 ignore_external_qi = FALSE;
5323 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5324 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5326 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5328 ok(!strcmp_wa(str2, nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5329 SysFreeString(str2);
5330 IHTMLPrivateWindow_Release(priv_window);
5334 nav_url = prev_nav_url;
5337 static void test_open_window(IHTMLDocument2 *doc, BOOL do_block)
5339 IHTMLWindow2 *window, *new_window;
5343 allow_new_window = !do_block;
5345 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5346 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5348 url = a2bstr(nav_serv_url = nav_url = "about:blank");
5349 name = a2bstr("test");
5350 new_window = (void*)0xdeadbeef;
5356 SET_EXPECT(get_LocationURL);
5357 SET_EXPECT(TranslateUrl);
5358 SET_EXPECT(EvaluateNewWindow);
5360 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
5363 SysFreeString(name);
5366 todo_wine CHECK_CALLED_BROKEN(get_LocationURL);
5368 CHECK_CALLED(TranslateUrl);
5370 if(!called_EvaluateNewWindow) {
5371 win_skip("INewWindowManager not supported\n");
5372 if(SUCCEEDED(hres) && new_window)
5373 IHTMLWindow2_Release(new_window);
5374 IHTMLWindow2_Release(window);
5377 CHECK_CALLED(EvaluateNewWindow);
5379 ok(hres == S_OK, "open failed: %08x\n", hres);
5382 ok(!new_window, "new_window != NULL\n");
5384 ok(new_window != NULL, "new_window == NULL\n");
5386 hres = IHTMLWindow2_close(new_window);
5387 ok(hres == S_OK, "close failed: %08x\n", hres);
5390 IHTMLWindow2_Release(window);
5393 static void test_elem_from_point(IHTMLDocument2 *doc)
5400 hres = IHTMLDocument2_elementFromPoint(doc, 3, 3, &elem);
5401 ok(hres == S_OK, "elementFromPoint failed: %08x\n", hres);
5402 ok(elem != NULL, "elem == NULL\n");
5404 hres = IHTMLElement_get_tagName(elem, &tag);
5405 IHTMLElement_Release(elem);
5406 ok(hres == S_OK, "get_tagName failed: %08x\n", hres);
5407 ok(!strcmp_wa(tag, "DIV"), "tag = %s\n", wine_dbgstr_w(tag));
5410 static void test_clear(IHTMLDocument2 *doc)
5414 hres = IHTMLDocument2_clear(doc);
5415 ok(hres == S_OK, "clear failed: %08x\n", hres);
5418 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
5420 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
5421 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
5422 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
5423 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
5424 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
5425 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
5426 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
5427 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
5428 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
5429 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
5430 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
5431 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
5432 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
5433 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
5434 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
5435 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
5436 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
5437 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
5438 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
5439 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
5441 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
5442 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
5444 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
5446 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
5448 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
5449 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
5451 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
5452 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
5454 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
5456 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
5457 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
5460 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
5461 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
5463 IOleCommandTarget *cmdtrg;
5464 OLECMD olecmd = {cmdid, 0};
5467 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5468 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5472 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
5473 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
5475 IOleCommandTarget_Release(cmdtrg);
5477 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
5478 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
5481 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
5483 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
5485 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
5486 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
5487 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
5488 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
5489 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
5490 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
5491 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
5492 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
5493 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
5494 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
5495 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
5496 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
5497 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
5498 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
5499 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
5500 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
5503 static void test_OleCommandTarget(IHTMLDocument2 *doc)
5505 IOleCommandTarget *cmdtrg;
5506 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
5510 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5511 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5515 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5516 cmds[i].cmdID = i+1;
5517 cmds[i].cmdf = 0xf0f0;
5520 SET_EXPECT(QueryStatus_OPEN);
5521 SET_EXPECT(QueryStatus_NEW);
5522 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
5523 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5524 CHECK_CALLED(QueryStatus_OPEN);
5525 CHECK_CALLED(QueryStatus_NEW);
5527 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5528 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
5529 if(i+1 == OLECMDID_FIND)
5531 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
5532 i+1, cmds[i].cmdf, expect_cmds[i+1]);
5535 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
5536 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
5538 IOleCommandTarget_Release(cmdtrg);
5541 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
5543 IOleCommandTarget *cmdtrg;
5548 {OLECMDID_OPEN, 0xf0f0},
5549 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
5552 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5553 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
5557 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
5558 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5560 SET_EXPECT(QueryStatus_OPEN);
5561 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
5562 CHECK_CALLED(QueryStatus_OPEN);
5564 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5565 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5566 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
5567 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
5568 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
5569 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
5570 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
5572 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
5573 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
5574 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
5576 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5577 if(!expect_cmds[i]) {
5578 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
5579 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5580 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5581 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5585 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
5586 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5587 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5588 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5590 IOleCommandTarget_Release(cmdtrg);
5593 static void test_exec_onunload(IHTMLDocument2 *doc)
5595 IOleCommandTarget *cmdtrg;
5599 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5600 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5604 memset(&var, 0x0a, sizeof(var));
5605 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5606 OLECMDEXECOPT_DODEFAULT, NULL, &var);
5607 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5608 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
5609 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
5611 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5612 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5613 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5615 IOleCommandTarget_Release(cmdtrg);
5618 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
5620 IOleCommandTarget *cmdtrg;
5623 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5624 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5631 load_state = LD_DOLOAD;
5634 SET_EXPECT(GetClassID);
5635 SET_EXPECT(SetStatusText);
5636 SET_EXPECT(Exec_ShellDocView_37);
5637 SET_EXPECT(GetHostInfo);
5639 SET_EXPECT(GetDisplayName);
5640 SET_EXPECT(Invoke_AMBIENT_SILENT);
5641 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5642 SET_EXPECT(OnChanged_READYSTATE);
5643 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5644 SET_EXPECT(IsSystemMoniker);
5645 SET_EXPECT(Exec_ShellDocView_84);
5647 SET_EXPECT(BindToStorage);
5648 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5651 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5653 expect_status_text = NULL;
5654 readystate_set_loading = TRUE;
5656 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5657 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5658 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5661 CHECK_CALLED(GetClassID);
5662 CHECK_CALLED(SetStatusText);
5663 CHECK_CALLED(Exec_ShellDocView_37);
5664 CHECK_CALLED(GetHostInfo);
5666 CHECK_CALLED(GetDisplayName);
5667 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5668 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5669 CHECK_CALLED(OnChanged_READYSTATE);
5670 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5671 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
5672 SET_CALLED(Exec_ShellDocView_84);
5674 CHECK_CALLED(BindToStorage);
5675 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5676 CHECK_CALLED(HideUI);
5677 CHECK_CALLED(ShowUI);
5678 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5680 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
5682 IOleCommandTarget_Release(cmdtrg);
5684 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5685 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5686 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5689 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
5691 IOleCommandTarget *cmdtrg;
5692 VARIANT *in = NULL, _in, *out = NULL, _out;
5695 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5696 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
5703 V_BSTR(in) = SysAllocString(name);
5709 V_I4(out) = 0xdeadbeef;
5712 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
5713 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
5719 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
5720 if(V_VT(out) == VT_BSTR) {
5722 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
5723 "unexpected fontname %s\n", wine_dbgstr_w(name));
5725 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
5730 IOleCommandTarget_Release(cmdtrg);
5733 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
5735 IOleCommandTarget *cmdtrg;
5738 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5739 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5743 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
5744 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5745 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5747 IOleCommandTarget_Release(cmdtrg);
5750 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
5752 IPersistStreamInit *perinit;
5753 IPersistMoniker *permon;
5754 IPersistFile *perfile;
5757 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
5758 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
5759 if(SUCCEEDED(hres)) {
5760 hres = IPersistStreamInit_IsDirty(perinit);
5761 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5762 IPersistStreamInit_Release(perinit);
5765 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
5766 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
5767 if(SUCCEEDED(hres)) {
5768 hres = IPersistMoniker_IsDirty(permon);
5769 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5770 IPersistMoniker_Release(permon);
5773 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
5774 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
5775 if(SUCCEEDED(hres)) {
5776 hres = IPersistFile_IsDirty(perfile);
5777 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5778 IPersistFile_Release(perfile);
5782 static HWND create_container_window(void)
5784 static const WCHAR wszHTMLDocumentTest[] =
5785 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
5786 static WNDCLASSEXW wndclass = {
5787 sizeof(WNDCLASSEXW),
5790 0, 0, NULL, NULL, NULL, NULL, NULL,
5791 wszHTMLDocumentTest,
5795 RegisterClassExW(&wndclass);
5796 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
5797 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
5798 515, 530, NULL, NULL, NULL, NULL);
5801 static void test_DoVerb(IOleObject *oleobj)
5803 RECT rect = {0,0,500,500};
5806 if(!container_locked) {
5807 SET_EXPECT(GetContainer);
5808 SET_EXPECT(LockContainer);
5810 SET_EXPECT(ActivateMe);
5811 expect_LockContainer_fLock = TRUE;
5813 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
5814 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
5816 if(!container_locked) {
5817 CHECK_CALLED(GetContainer);
5818 CHECK_CALLED(LockContainer);
5819 container_locked = TRUE;
5821 CHECK_CALLED(ActivateMe);
5824 #define CLIENTSITE_EXPECTPATH 0x00000001
5825 #define CLIENTSITE_SETNULL 0x00000002
5826 #define CLIENTSITE_DONTSET 0x00000004
5828 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
5830 IOleClientSite *clientsite;
5833 if(flags & CLIENTSITE_SETNULL) {
5834 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5835 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5837 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
5839 ok(!clientsite, "clientsite != NULL\n");
5841 SET_EXPECT(GetOverrideKeyPath);
5842 hres = IOleObject_SetClientSite(oleobj, NULL);
5843 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5844 CLEAR_CALLED(GetOverrideKeyPath); /* IE9 sometimes calls it */
5846 set_clientsite = FALSE;
5849 if(flags & CLIENTSITE_DONTSET)
5852 if(!expect_uihandler_iface)
5853 expect_uihandler_iface = &DocHostUIHandler;
5855 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5856 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5857 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
5858 clientsite, set_clientsite ? &ClientSite : NULL);
5860 if(!set_clientsite) {
5861 if(expect_uihandler_iface)
5862 SET_EXPECT(GetHostInfo);
5863 if(flags & CLIENTSITE_EXPECTPATH) {
5864 SET_EXPECT(GetOptionKeyPath);
5865 SET_EXPECT(GetOverrideKeyPath);
5867 SET_EXPECT(GetWindow);
5868 if(flags & CLIENTSITE_EXPECTPATH)
5869 SET_EXPECT(Exec_DOCCANNAVIGATE);
5870 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
5871 SET_EXPECT(Exec_SETPROGRESSMAX);
5872 SET_EXPECT(Exec_SETPROGRESSPOS);
5873 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5874 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5875 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5876 SET_EXPECT(Invoke_AMBIENT_SILENT);
5877 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5878 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5879 SET_EXPECT(GetOverrideKeyPath);
5880 SET_EXPECT(GetTravelLog);
5882 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5883 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5885 if(expect_uihandler_iface)
5886 CHECK_CALLED(GetHostInfo);
5887 if(flags & CLIENTSITE_EXPECTPATH) {
5888 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
5889 CHECK_CALLED(GetOverrideKeyPath);
5891 CHECK_CALLED(GetWindow);
5892 if(flags & CLIENTSITE_EXPECTPATH)
5893 CHECK_CALLED(Exec_DOCCANNAVIGATE);
5894 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
5895 CHECK_CALLED(Exec_SETPROGRESSMAX);
5896 CHECK_CALLED(Exec_SETPROGRESSPOS);
5897 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5898 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5899 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5900 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5901 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5902 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5903 CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
5904 todo_wine CHECK_CALLED(GetTravelLog);
5906 set_clientsite = TRUE;
5909 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5910 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5912 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5913 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5914 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
5917 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
5919 IOleControl *control = NULL;
5922 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5923 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5927 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5928 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
5929 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5930 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5932 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5933 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
5934 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5935 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5937 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5938 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5939 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
5940 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5941 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5942 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5944 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5945 SET_EXPECT(Invoke_AMBIENT_SILENT);
5946 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
5947 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5948 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5949 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5951 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5952 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
5953 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5954 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5956 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5957 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
5958 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5959 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5961 IOleControl_Release(control);
5966 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
5968 IOleControl *control = NULL;
5971 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5972 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5976 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
5977 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
5979 IOleControl_Release(control);
5982 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
5984 IOleObject *oleobj = NULL;
5987 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5988 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5992 SET_EXPECT(GetContainer);
5993 SET_EXPECT(LockContainer);
5994 expect_LockContainer_fLock = FALSE;
5995 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
5996 ok(hres == S_OK, "Close failed: %08x\n", hres);
5997 CHECK_CALLED(GetContainer);
5998 CHECK_CALLED(LockContainer);
5999 container_locked = FALSE;
6002 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6004 IOleObject_Release(oleobj);
6007 static void test_Advise(IHTMLDocument2 *doc)
6009 IOleObject *oleobj = NULL;
6010 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
6014 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6015 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6019 hres = IOleObject_Unadvise(oleobj, 0);
6020 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
6022 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
6023 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
6024 ok(enum_advise == NULL, "enum_advise != NULL\n");
6027 hres = IOleObject_Advise(oleobj, NULL, &conn);
6028 /* Old IE returns S_OK and sets conn to 1 */
6029 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
6030 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
6032 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
6033 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
6035 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6036 ok(hres == S_OK, "Advise returned: %08x\n", hres);
6037 ok(conn == 1, "conn = %d\n", conn);
6039 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6040 ok(hres == S_OK, "Advise returned: %08x\n", hres);
6041 ok(conn == 2, "conn = %d\n", conn);
6043 hres = IOleObject_Unadvise(oleobj, 1);
6044 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
6046 hres = IOleObject_Unadvise(oleobj, 1);
6047 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
6049 hres = IOleObject_Unadvise(oleobj, 2);
6050 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
6052 IOleObject_Release(oleobj);
6055 static void test_OnFrameWindowActivate(IUnknown *unk)
6057 IOleInPlaceActiveObject *inplaceact;
6060 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
6061 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
6065 if(set_clientsite) {
6066 expect_OnFrameWindowActivate_fActivate = TRUE;
6067 SET_EXPECT(OnFrameWindowActivate);
6068 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6069 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6070 CHECK_CALLED(OnFrameWindowActivate);
6072 SET_EXPECT(OnFrameWindowActivate);
6073 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6074 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6075 CHECK_CALLED(OnFrameWindowActivate);
6077 expect_OnFrameWindowActivate_fActivate = FALSE;
6078 SET_EXPECT(OnFrameWindowActivate);
6079 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
6080 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6081 CHECK_CALLED(OnFrameWindowActivate);
6083 expect_OnFrameWindowActivate_fActivate = TRUE;
6084 SET_EXPECT(OnFrameWindowActivate);
6085 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6086 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6087 CHECK_CALLED(OnFrameWindowActivate);
6089 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
6090 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6092 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6093 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6096 IOleInPlaceActiveObject_Release(inplaceact);
6099 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
6101 IOleInPlaceObjectWindowless *windowlessobj = NULL;
6104 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
6105 (void**)&windowlessobj);
6106 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
6111 SET_EXPECT(SetStatusText);
6112 SET_EXPECT(OnFocus_FALSE);
6114 SET_EXPECT(OnInPlaceDeactivateEx);
6116 SET_EXPECT(OnInPlaceDeactivate);
6118 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
6119 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
6121 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
6122 CHECK_CALLED(OnFocus_FALSE);
6124 CHECK_CALLED(OnInPlaceDeactivateEx);
6126 CHECK_CALLED(OnInPlaceDeactivate);
6129 IOleInPlaceObjectWindowless_Release(windowlessobj);
6132 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
6134 IOleObject *oleobj = NULL;
6135 IOleDocumentView *docview;
6142 IOleDocumentView_Release(view);
6145 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6146 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6148 hres = IOleObject_GetUserClassID(oleobj, NULL);
6149 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
6151 hres = IOleObject_GetUserClassID(oleobj, &guid);
6152 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
6153 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
6155 test_OnFrameWindowActivate((IUnknown*)doc);
6157 test_ClientSite(oleobj, flags);
6158 test_InPlaceDeactivate(doc, FALSE);
6159 test_DoVerb(oleobj);
6161 if(call_UIActivate == CallUIActivate_AfterShow) {
6162 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
6163 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
6165 SET_EXPECT(OnFocus_TRUE);
6166 SET_EXPECT(SetActiveObject);
6168 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6169 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6170 expect_status_text = NULL;
6172 hres = IOleDocumentView_UIActivate(docview, TRUE);
6173 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
6175 CHECK_CALLED(OnFocus_TRUE);
6176 CHECK_CALLED(SetActiveObject);
6177 CHECK_CALLED(ShowUI);
6178 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6179 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6181 IOleDocumentView_Release(docview);
6184 IOleObject_Release(oleobj);
6186 test_OnFrameWindowActivate((IUnknown*)doc);
6189 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
6191 IOleInPlaceActiveObject *activeobject = NULL;
6195 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
6196 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
6200 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
6202 if(expect_success) {
6203 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
6204 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
6206 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
6207 ok(IsWindow(hwnd), "hwnd is destroyed\n");
6210 IOleInPlaceActiveObject_Release(activeobject);
6213 static void test_CloseView(void)
6215 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
6221 hres = IOleDocumentView_Show(view, FALSE);
6222 ok(hres == S_OK, "Show failed: %08x\n", hres);
6224 hres = IOleDocumentView_CloseView(view, 0);
6225 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
6227 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
6228 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6230 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6231 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6232 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
6235 static void test_UIDeactivate(void)
6239 if(call_UIActivate == CallUIActivate_AfterShow) {
6240 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6242 if(call_UIActivate != CallUIActivate_None) {
6243 SET_EXPECT(SetActiveObject_null);
6245 SET_EXPECT(OnUIDeactivate);
6248 hres = IOleDocumentView_UIActivate(view, FALSE);
6249 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6251 if(call_UIActivate != CallUIActivate_None) {
6252 CHECK_CALLED(SetActiveObject_null);
6253 CHECK_CALLED(HideUI);
6254 CHECK_CALLED(OnUIDeactivate);
6256 if(call_UIActivate == CallUIActivate_AfterShow) {
6257 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6261 static void test_Hide(void)
6268 hres = IOleDocumentView_Show(view, FALSE);
6269 ok(hres == S_OK, "Show failed: %08x\n", hres);
6272 static IHTMLDocument2 *create_document(void)
6274 IHTMLDocument2 *doc;
6277 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
6278 &IID_IHTMLDocument2, (void**)&doc);
6279 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
6286 static void release_document(IHTMLDocument2 *doc)
6292 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
6293 * To workaround it, we release it via IUnknown iface */
6294 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
6295 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
6297 IHTMLDocument2_Release(doc);
6298 ref = IUnknown_Release(unk);
6299 ok(!ref, "ref = %d\n", ref);
6302 static void test_Navigate(IHTMLDocument2 *doc)
6304 IHlinkTarget *hlink;
6307 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
6308 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
6310 SET_EXPECT(ActivateMe);
6311 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
6312 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
6313 CHECK_CALLED(ActivateMe);
6315 IHlinkTarget_Release(hlink);
6318 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
6320 IDispatch *external;
6321 IHTMLWindow2 *htmlwin;
6324 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
6325 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6328 SET_EXPECT(GetExternal);
6329 external = (void*)0xdeadbeef;
6330 hres = IHTMLWindow2_get_external(htmlwin, &external);
6332 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
6333 CHECK_CALLED(GetExternal);
6334 ok(external != NULL, "external == NULL\n");
6336 ok(hres == S_OK, "get_external failed: %08x\n", hres);
6337 ok(external == NULL, "external != NULL\n");
6340 IHTMLWindow2_Release(htmlwin);
6343 static void test_enum_objects(IOleContainer *container)
6345 IEnumUnknown *enum_unknown;
6346 IUnknown *buf[100] = {(void*)0xdeadbeef};
6350 enum_unknown = NULL;
6351 hres = IOleContainer_EnumObjects(container, OLECONTF_EMBEDDINGS, &enum_unknown);
6352 ok(hres == S_OK, "EnumObjects failed: %08x\n", hres);
6353 ok(enum_unknown != NULL, "enum_unknown == NULL\n");
6355 fetched = 0xdeadbeef;
6356 hres = IEnumUnknown_Next(enum_unknown, sizeof(buf)/sizeof(*buf), buf, &fetched);
6357 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6358 ok(!fetched, "fetched = %d\n", fetched);
6359 ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
6361 fetched = 0xdeadbeef;
6362 hres = IEnumUnknown_Next(enum_unknown, 1, buf, &fetched);
6363 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6364 ok(!fetched, "fetched = %d\n", fetched);
6366 hres = IEnumUnknown_Next(enum_unknown, 1, buf, NULL);
6367 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6369 IEnumUnknown_Release(enum_unknown);
6372 static void test_target_container(IHTMLDocument2 *doc)
6374 IOleContainer *ole_container, *doc_ole_container;
6375 ITargetContainer *target_container;
6378 hres = IHTMLDocument2_QueryInterface(doc, &IID_ITargetContainer, (void**)&target_container);
6379 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
6381 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleContainer, (void**)&doc_ole_container);
6382 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
6384 ole_container = (void*)0xdeadbeef;
6385 hres = ITargetContainer_GetFramesContainer(target_container, &ole_container);
6386 ok(hres == S_OK, "GetFramesContainer failed: %08x\n", hres);
6387 ok(ole_container != NULL, "ole_container == NULL\n");
6388 ok(iface_cmp((IUnknown*)ole_container, (IUnknown*)doc_ole_container), "ole_container != doc_ole_container\n");
6389 test_enum_objects(ole_container);
6390 IOleContainer_Release(ole_container);
6392 ITargetContainer_Release(target_container);
6393 IOleContainer_Release(doc_ole_container);
6396 static void test_travellog(IHTMLDocument2 *doc)
6398 ITravelLogClient *travellog_client;
6399 IHTMLWindow2 *window, *top_window;
6404 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6405 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6406 ok(window != NULL, "window = NULL\n");
6408 hres = IHTMLWindow2_get_top(window, &top_window);
6409 IHTMLWindow2_Release(window);
6410 ok(hres == S_OK, "get_top failed: %08x\n", hres);
6412 hres = IHTMLWindow2_QueryInterface(top_window, &IID_ITravelLogClient, (void**)&travellog_client);
6413 IHTMLWindow2_Release(top_window);
6414 if(hres == E_NOINTERFACE) {
6415 win_skip("ITravelLogClient not supported\n");
6418 ok(hres == S_OK, "Could not get ITraveLogClient iface: %08x\n", hres);
6420 unk = (void*)0xdeadbeef;
6421 hres = ITravelLogClient_FindWindowByIndex(travellog_client, 0, &unk);
6422 ok(hres == E_FAIL, "FindWindowByIndex failed: %08x\n", hres);
6423 ok(!unk, "unk != NULL\n");
6425 ITravelLogClient_Release(travellog_client);
6428 static void test_StreamLoad(IHTMLDocument2 *doc)
6430 IPersistStreamInit *init;
6433 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6434 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6438 SET_EXPECT(Invoke_AMBIENT_SILENT);
6439 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6440 SET_EXPECT(Exec_ShellDocView_37);
6441 SET_EXPECT(OnChanged_READYSTATE);
6442 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6444 SET_EXPECT(GetPendingUrl);
6445 readystate_set_loading = TRUE;
6447 hres = IPersistStreamInit_Load(init, &Stream);
6448 ok(hres == S_OK, "Load failed: %08x\n", hres);
6450 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6451 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6452 CHECK_CALLED(Exec_ShellDocView_37);
6453 CHECK_CALLED(OnChanged_READYSTATE);
6454 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6456 todo_wine CHECK_CALLED(GetPendingUrl);
6458 test_timer(EXPECT_SETTITLE);
6459 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6461 IPersistStreamInit_Release(init);
6464 static void test_StreamInitNew(IHTMLDocument2 *doc)
6466 IPersistStreamInit *init;
6469 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6470 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6474 SET_EXPECT(Invoke_AMBIENT_SILENT);
6475 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6476 SET_EXPECT(Exec_ShellDocView_37);
6477 SET_EXPECT(OnChanged_READYSTATE);
6478 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6479 SET_EXPECT(GetPendingUrl);
6480 readystate_set_loading = TRUE;
6482 hres = IPersistStreamInit_InitNew(init);
6483 ok(hres == S_OK, "Load failed: %08x\n", hres);
6485 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6486 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6487 CHECK_CALLED(Exec_ShellDocView_37);
6488 CHECK_CALLED(OnChanged_READYSTATE);
6489 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6490 todo_wine CHECK_CALLED(GetPendingUrl);
6492 test_timer(EXPECT_SETTITLE);
6493 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6495 IPersistStreamInit_Release(init);
6498 static void test_QueryInterface(IHTMLDocument2 *doc)
6503 static const IID IID_UndocumentedScriptIface =
6504 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
6506 qi = (void*)0xdeadbeef;
6507 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
6508 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6509 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
6511 qi = (void*)0xdeadbeef;
6512 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
6513 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6514 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6516 qi = (void*)0xdeadbeef;
6517 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
6518 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6519 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6521 qi = (void*)0xdeadbeef;
6522 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
6523 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6524 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6526 qi = (void*)0xdeadbeef;
6527 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
6528 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6529 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6531 qi = (void*)0xdeadbeef;
6532 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
6533 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6534 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6536 qi = (void*)0xdeadbeef;
6537 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
6538 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6539 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6541 qi = (void*)0xdeadbeef;
6542 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
6543 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6544 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6546 qi = (void*)0xdeadbeef;
6547 hres = IUnknown_QueryInterface(doc, &IID_ITargetFrame, (void**)&qi);
6548 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6549 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6551 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
6552 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
6553 ok(qi != (IUnknown*)doc, "disp == doc\n");
6554 IUnknown_Release(qi);
6557 static void init_test(enum load_state_t ls) {
6559 hwnd = last_hwnd = NULL;
6560 set_clientsite = FALSE;
6561 load_from_stream = FALSE;
6562 call_UIActivate = CallUIActivate_None;
6569 inplace_deactivated = FALSE;
6571 expect_uihandler_iface = &DocHostUIHandler;
6574 static void test_HTMLDocument(BOOL do_load)
6576 IHTMLDocument2 *doc;
6578 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
6580 init_test(do_load ? LD_DOLOAD : LD_NO);
6582 doc = create_document();
6583 doc_unk = (IUnknown*)doc;
6585 test_QueryInterface(doc);
6587 test_IsDirty(doc, S_FALSE);
6588 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6589 test_external(doc, FALSE);
6590 test_ViewAdviseSink(doc);
6591 test_ConnectionPointContainer(doc);
6592 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6593 test_Persist(doc, &Moniker);
6595 test_OnAmbientPropertyChange2(doc);
6597 test_Activate(doc, CLIENTSITE_EXPECTPATH);
6600 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6601 test_download(DWL_CSS|DWL_TRYCSS);
6602 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6603 test_elem_from_point(doc);
6606 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6607 test_OleCommandTarget_fail(doc);
6608 test_OleCommandTarget(doc);
6609 test_OnAmbientPropertyChange(doc);
6610 test_Window(doc, TRUE);
6611 test_external(doc, TRUE);
6612 test_target_container(doc);
6614 test_UIDeactivate();
6615 test_OleCommandTarget(doc);
6616 test_Window(doc, TRUE);
6617 test_InPlaceDeactivate(doc, TRUE);
6619 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
6620 * MSHTML. It doesn't with Wine. */
6622 test_Window(doc, FALSE);
6624 test_InPlaceDeactivate(doc, FALSE);
6626 test_Close(doc, FALSE);
6628 /* Activate HTMLDocument again */
6629 test_Activate(doc, CLIENTSITE_SETNULL);
6630 test_Window(doc, TRUE);
6631 test_OleCommandTarget(doc);
6632 test_UIDeactivate();
6633 test_InPlaceDeactivate(doc, TRUE);
6634 test_Close(doc, FALSE);
6636 /* Activate HTMLDocument again, this time without UIActivate */
6637 call_UIActivate = CallUIActivate_None;
6638 test_Activate(doc, CLIENTSITE_SETNULL);
6639 test_Window(doc, TRUE);
6641 test_external(doc, TRUE);
6642 set_custom_uihandler(doc, NULL);
6643 test_external(doc, FALSE);
6645 test_UIDeactivate();
6646 test_InPlaceDeactivate(doc, TRUE);
6649 test_Close(doc, TRUE);
6650 test_OnAmbientPropertyChange2(doc);
6651 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
6654 /* Activate HTMLDocument again, calling UIActivate after showing the window */
6655 call_UIActivate = CallUIActivate_AfterShow;
6656 test_Activate(doc, 0);
6657 test_Window(doc, TRUE);
6658 test_OleCommandTarget(doc);
6659 test_UIDeactivate();
6660 test_InPlaceDeactivate(doc, TRUE);
6661 test_Close(doc, FALSE);
6662 call_UIActivate = CallUIActivate_None;
6666 IOleDocumentView_Release(view);
6669 ok(IsWindow(hwnd), "hwnd is destroyed\n");
6670 release_document(doc);
6671 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
6674 static void test_HTMLDocument_hlink(DWORD status)
6676 IHTMLDocument2 *doc;
6678 trace("Testing HTMLDocument (hlink)...\n");
6680 init_test(LD_DOLOAD);
6683 doc = create_document();
6684 doc_unk = (IUnknown*)doc;
6686 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6687 test_ViewAdviseSink(doc);
6688 test_ConnectionPointContainer(doc);
6689 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6690 test_Persist(doc, &Moniker);
6693 status_code = status;
6694 test_download(DWL_CSS|DWL_TRYCSS);
6695 status_code = HTTP_STATUS_OK;
6697 test_IsDirty(doc, S_FALSE);
6698 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6700 test_exec_onunload(doc);
6701 test_Window(doc, TRUE);
6702 test_InPlaceDeactivate(doc, TRUE);
6703 test_Close(doc, FALSE);
6704 test_IsDirty(doc, S_FALSE);
6705 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6707 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6710 IOleDocumentView_Release(view);
6713 release_document(doc);
6716 static void test_cookies(IHTMLDocument2 *doc)
6724 hres = IHTMLDocument2_get_cookie(doc, &str);
6725 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6727 size = sizeof(buf)/sizeof(WCHAR);
6728 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6729 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6730 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
6734 str = a2bstr("test=testval");
6735 hres = IHTMLDocument2_put_cookie(doc, str);
6736 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6739 hres = IHTMLDocument2_get_cookie(doc, &str2);
6740 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6741 ok(str2 != NULL, "cookie = NULL\n");
6742 size = sizeof(buf)/sizeof(WCHAR);
6743 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6744 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6745 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6746 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6748 SysFreeString(str2);
6750 str = a2bstr("test=testval2");
6751 hres = IHTMLDocument2_put_cookie(doc, str);
6752 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6755 hres = IHTMLDocument2_get_cookie(doc, &str2);
6756 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6757 ok(str2 != NULL, "cookie = NULL\n");
6758 size = sizeof(buf)/sizeof(WCHAR);
6759 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6760 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6761 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6762 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6764 SysFreeString(str2);
6767 static void test_HTMLDocument_http(BOOL with_wbapp)
6770 IHTMLDocument2 *doc;
6774 trace("Testing HTMLDocument (http%s)...\n", with_wbapp ? " with IWebBrowserApp" : "");
6776 support_wbapp = with_wbapp;
6778 if(!winetest_interactive && is_ie_hardened()) {
6779 win_skip("IE running in Enhanced Security Configuration\n");
6783 init_test(LD_DOLOAD);
6786 doc = create_document();
6787 doc_unk = (IUnknown*)doc;
6789 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
6790 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
6792 test_ViewAdviseSink(doc);
6793 test_ConnectionPointContainer(doc);
6794 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6795 test_Persist(doc, http_mon);
6797 test_download(DWL_HTTP);
6799 test_IsDirty(doc, S_FALSE);
6800 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6801 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
6802 test_travellog(doc);
6804 nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */
6806 test_put_href(doc, FALSE, "#test", "http://www.winehq.org/#test", FALSE, TRUE, 0);
6807 test_travellog(doc);
6809 test_put_href(doc, FALSE, NULL, "javascript:external&&undefined", TRUE, FALSE, 0);
6810 test_put_href(doc, FALSE, NULL, "about:blank", FALSE, FALSE, support_wbapp ? DWL_EXPECT_HISTUPDATE : 0);
6811 test_put_href(doc, TRUE, NULL, "about:replace", FALSE, FALSE, 0);
6813 test_open_window(doc, TRUE);
6814 if(!support_wbapp) /* FIXME */
6815 test_open_window(doc, FALSE);
6817 test_InPlaceDeactivate(doc, TRUE);
6818 test_Close(doc, FALSE);
6819 test_IsDirty(doc, S_FALSE);
6820 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
6823 IOleDocumentView_Release(view);
6826 release_document(doc);
6828 ref = IMoniker_Release(http_mon);
6829 ok(!ref, "ref=%d, expected 0\n", ref);
6832 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
6834 IHTMLWindow2 *window, *sp_window;
6835 IServiceProvider *sp;
6839 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
6840 ok(hres == S_OK, "QueryService returned %08x\n", hres);
6842 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6844 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
6845 IServiceProvider_Release(sp);
6849 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6850 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6851 IHlinkFrame_Release(hf);
6853 IServiceProvider_Release(sp);
6855 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6856 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6858 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
6859 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
6861 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
6862 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
6863 /* FIXME: test returned window */
6864 IHTMLWindow2_Release(sp_window);
6866 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6867 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6868 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6869 IHlinkFrame_Release(hf);
6871 IServiceProvider_Release(sp);
6872 IHTMLWindow2_Release(window);
6875 static void test_HTMLDocument_StreamLoad(void)
6877 IHTMLDocument2 *doc;
6882 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
6884 init_test(LD_DOLOAD);
6885 load_from_stream = TRUE;
6887 doc = create_document();
6888 doc_unk = (IUnknown*)doc;
6890 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6891 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6893 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6894 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6896 test_readyState((IUnknown*)doc);
6897 test_IsDirty(doc, S_FALSE);
6898 test_ViewAdviseSink(doc);
6899 test_ConnectionPointContainer(doc);
6900 test_QueryService(doc, FALSE);
6901 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6902 test_QueryService(doc, TRUE);
6903 test_DoVerb(oleobj);
6904 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6906 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6907 test_StreamLoad(doc);
6908 test_download(DWL_VERBDONE|DWL_TRYCSS);
6909 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6911 test_UIDeactivate();
6912 test_InPlaceDeactivate(doc, TRUE);
6913 SET_EXPECT(Advise_Close);
6914 test_Close(doc, TRUE);
6915 CHECK_CALLED(Advise_Close);
6916 test_external(doc, FALSE);
6917 test_IsDirty(doc, S_FALSE);
6919 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6920 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
6921 test_external(doc, TRUE);
6922 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6923 test_external(doc, TRUE);
6924 set_custom_uihandler(doc, NULL);
6925 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6927 IOleObject_Release(oleobj);
6929 IOleDocumentView_Release(view);
6933 release_document(doc);
6936 static void test_HTMLDocument_StreamInitNew(void)
6938 IHTMLDocument2 *doc;
6943 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
6945 init_test(LD_DOLOAD);
6946 load_from_stream = TRUE;
6948 doc = create_document();
6949 doc_unk = (IUnknown*)doc;
6951 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6952 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6954 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6955 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6957 test_readyState((IUnknown*)doc);
6958 test_IsDirty(doc, S_FALSE);
6959 test_ViewAdviseSink(doc);
6960 test_ConnectionPointContainer(doc);
6961 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6962 test_DoVerb(oleobj);
6963 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6965 IOleObject_Release(oleobj);
6967 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6968 test_StreamInitNew(doc);
6970 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
6971 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
6972 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
6974 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6976 test_UIDeactivate();
6977 test_InPlaceDeactivate(doc, TRUE);
6978 SET_EXPECT(Advise_Close);
6979 test_Close(doc, FALSE);
6980 CHECK_CALLED(Advise_Close);
6981 test_IsDirty(doc, S_FALSE);
6984 IOleDocumentView_Release(view);
6988 release_document(doc);
6991 static void test_edit_uiactivate(IOleObject *oleobj)
6993 IOleDocumentView *docview;
6996 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
6997 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
6999 SET_EXPECT(OnFocus_TRUE);
7000 SET_EXPECT(SetActiveObject);
7002 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7003 SET_EXPECT(InPlaceFrame_SetBorderSpace);
7004 expect_status_text = NULL;
7006 hres = IOleDocumentView_UIActivate(docview, TRUE);
7007 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
7009 CHECK_CALLED(OnFocus_TRUE);
7010 CHECK_CALLED(SetActiveObject);
7011 CHECK_CALLED(ShowUI);
7012 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7013 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
7015 IOleDocumentView_Release(docview);
7018 static void test_editing_mode(BOOL do_load)
7020 IHTMLDocument2 *doc;
7026 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
7028 init_test(do_load ? LD_DOLOAD : LD_NO);
7029 call_UIActivate = CallUIActivate_AfterShow;
7031 doc = create_document();
7032 unk = doc_unk = (IUnknown*)doc;
7034 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7035 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
7037 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
7038 ok(hres == S_OK, "Advise failed: %08x\n", hres);
7040 test_readyState((IUnknown*)doc);
7041 test_ViewAdviseSink(doc);
7042 test_ConnectionPointContainer(doc);
7043 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
7044 test_DoVerb(oleobj);
7045 test_edit_uiactivate(oleobj);
7047 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7049 test_Persist(doc, &Moniker);
7050 stream_read = protocol_read = 0;
7051 test_exec_editmode(unk, do_load);
7052 test_UIDeactivate();
7053 call_UIActivate = CallUIActivate_None;
7054 IOleObject_Release(oleobj);
7056 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7057 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
7059 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
7060 test_timer(EXPECT_UPDATEUI);
7061 CLEAR_CALLED(SetStatusText);
7063 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7066 test_exec_fontname(unk, NULL, wszTimesNewRoman);
7067 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
7068 test_timer(EXPECT_UPDATEUI);
7069 test_exec_fontname(unk, NULL, wszArial);
7071 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
7072 test_timer(EXPECT_UPDATEUI);
7073 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
7074 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
7076 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
7077 test_timer(EXPECT_UPDATEUI);
7078 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
7079 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7080 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
7081 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
7083 test_exec_noargs(unk, IDM_HORIZONTALLINE);
7084 test_timer(EXPECT_UPDATEUI);
7085 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
7086 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7089 test_UIDeactivate();
7090 test_InPlaceDeactivate(doc, TRUE);
7091 SET_EXPECT(Advise_Close);
7092 test_Close(doc, FALSE);
7093 CHECK_CALLED(Advise_Close);
7096 IOleDocumentView_Release(view);
7100 release_document(doc);
7103 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
7105 IHTMLDocument2 *doc;
7107 IOleInPlaceSite *inplacesite;
7110 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
7112 init_test(do_load ? LD_DOLOAD : LD_NO);
7114 doc = create_document();
7115 doc_unk = (IUnknown*)doc;
7120 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7121 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
7123 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
7124 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
7126 SET_EXPECT(Invoke_AMBIENT_USERMODE);
7127 SET_EXPECT(GetHostInfo);
7128 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
7129 SET_EXPECT(Invoke_AMBIENT_SILENT);
7130 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7131 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
7132 SET_EXPECT(Invoke_AMBIENT_PALETTE);
7133 SET_EXPECT(GetOptionKeyPath);
7134 SET_EXPECT(GetOverrideKeyPath);
7135 SET_EXPECT(GetWindow);
7136 SET_EXPECT(Exec_DOCCANNAVIGATE);
7137 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
7138 SET_EXPECT(Exec_SETPROGRESSMAX);
7139 SET_EXPECT(Exec_SETPROGRESSPOS);
7140 SET_EXPECT(GetTravelLog);
7142 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
7143 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
7144 set_clientsite = TRUE;
7146 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
7147 CHECK_CALLED(GetHostInfo);
7148 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
7149 CHECK_CALLED(Invoke_AMBIENT_SILENT);
7150 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7151 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
7152 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
7153 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
7154 CHECK_CALLED(GetOverrideKeyPath);
7155 CHECK_CALLED(GetWindow);
7156 CHECK_CALLED(Exec_DOCCANNAVIGATE);
7157 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
7158 CHECK_CALLED(Exec_SETPROGRESSMAX);
7159 CHECK_CALLED(Exec_SETPROGRESSPOS);
7160 todo_wine CHECK_CALLED(GetTravelLog);
7162 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
7163 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
7164 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
7166 SET_EXPECT(GetContainer);
7167 SET_EXPECT(LockContainer);
7168 SET_EXPECT(CanInPlaceActivate);
7169 SET_EXPECT(GetWindowContext);
7170 SET_EXPECT(GetWindow);
7172 SET_EXPECT(OnInPlaceActivateEx);
7173 SET_EXPECT(RequestUIActivate);
7176 SET_EXPECT(OnInPlaceActivate);
7177 SET_EXPECT(OnUIActivate);
7178 SET_EXPECT(SetStatusText);
7179 SET_EXPECT(Exec_SETPROGRESSMAX);
7180 SET_EXPECT(Exec_SETPROGRESSPOS);
7182 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7183 SET_EXPECT(InPlaceFrame_SetBorderSpace);
7184 SET_EXPECT(OnFocus_TRUE);
7185 SET_EXPECT(SetActiveObject);
7186 expect_LockContainer_fLock = TRUE;
7188 hres = IOleDocumentView_UIActivate(view, TRUE);
7189 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
7191 CHECK_CALLED(GetContainer);
7192 CHECK_CALLED(LockContainer);
7193 CHECK_CALLED(CanInPlaceActivate);
7194 CHECK_CALLED(GetWindowContext);
7195 CHECK_CALLED(GetWindow);
7197 CHECK_CALLED(OnInPlaceActivateEx);
7198 SET_EXPECT(RequestUIActivate);
7201 CHECK_CALLED(OnInPlaceActivate);
7202 CHECK_CALLED(OnUIActivate);
7203 CHECK_CALLED(SetStatusText);
7204 CHECK_CALLED(Exec_SETPROGRESSMAX);
7205 CHECK_CALLED(Exec_SETPROGRESSPOS);
7206 CHECK_CALLED(ShowUI);
7207 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7208 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
7209 CHECK_CALLED(OnFocus_TRUE);
7210 CHECK_CALLED(SetActiveObject);
7211 container_locked = TRUE;
7213 SET_EXPECT(SetActiveObject_null);
7214 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7216 SET_EXPECT(OnUIDeactivate);
7218 hres = IOleDocumentView_UIActivate(view, FALSE);
7219 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
7221 CHECK_CALLED(SetActiveObject_null);
7222 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7223 CHECK_CALLED(HideUI);
7224 CHECK_CALLED(OnUIDeactivate);
7226 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
7227 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
7228 ok(inplacesite != NULL, "inplacesite = NULL\n");
7229 IOleInPlaceSite_Release(inplacesite);
7231 SET_EXPECT(SetStatusText);
7232 SET_EXPECT(OnFocus_FALSE);
7234 SET_EXPECT(OnInPlaceDeactivateEx);
7236 SET_EXPECT(OnInPlaceDeactivate);
7240 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
7241 CHECK_CALLED(OnFocus_FALSE);
7243 CHECK_CALLED(OnInPlaceDeactivateEx);
7245 CHECK_CALLED(OnInPlaceDeactivate);
7247 test_Close(doc, TRUE);
7249 IOleObject_Release(oleobj);
7250 IOleDocumentView_Release(view);
7253 release_document(doc);
7256 static void register_protocol(void)
7258 IInternetSession *session;
7261 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
7263 hres = CoInternetGetSession(0, &session, 0);
7264 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
7266 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
7267 wsz_winetest, 0, NULL, 0);
7268 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
7270 IInternetSession_Release(session);
7273 static void test_HTMLDoc_ISupportErrorInfo(void)
7275 IHTMLDocument2 *doc;
7277 ISupportErrorInfo *sinfo;
7279 doc = create_document();
7281 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
7282 ok(hres == S_OK, "got %x\n", hres);
7283 ok(sinfo != NULL, "got %p\n", sinfo);
7286 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
7287 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
7288 IUnknown_Release(sinfo);
7291 release_document(doc);
7294 static void test_IPersistHistory(void)
7296 IHTMLDocument2 *doc;
7298 IPersistHistory *phist;
7300 doc = create_document();
7302 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
7303 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
7305 IPersistHistory_Release(phist);
7307 release_document(doc);
7310 static BOOL check_ie(void)
7312 IHTMLDocument2 *doc;
7313 IHTMLDocument5 *doc5;
7316 doc = create_document();
7320 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
7322 IHTMLDocument5_Release(doc5);
7324 release_document(doc);
7325 return SUCCEEDED(hres);
7328 static void test_ServiceProvider(void)
7330 IHTMLDocument3 *doc3, *doc3_2;
7331 IServiceProvider *provider;
7332 IHTMLDocument2 *doc, *doc2;
7336 doc = create_document();
7340 hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&provider);
7341 ok(hres == S_OK, "got 0x%08x\n", hres);
7343 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc2);
7344 ok(hres == S_OK, "got 0x%08x\n", hres);
7345 ok(iface_cmp((IUnknown*)doc2, (IUnknown*)doc), "got wrong pointer\n");
7346 IHTMLDocument2_Release(doc2);
7348 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument3, (void**)&doc3);
7349 ok(hres == S_OK, "got 0x%08x\n", hres);
7350 ok(iface_cmp((IUnknown*)doc3, (IUnknown*)doc), "got wrong pointer\n");
7352 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3_2);
7353 ok(hres == S_OK, "got 0x%08x\n", hres);
7354 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc), "got wrong pointer\n");
7355 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc3), "got wrong pointer\n");
7356 IHTMLDocument3_Release(doc3);
7357 IHTMLDocument3_Release(doc3_2);
7359 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IUnknown, (void**)&unk);
7360 ok(hres == S_OK, "got 0x%08x\n", hres);
7361 ok(iface_cmp((IUnknown*)doc, unk), "got wrong pointer\n");
7363 IUnknown_Release(unk);
7364 IServiceProvider_Release(provider);
7365 release_document(doc);
7374 win_skip("Too old IE\n");
7378 container_hwnd = create_container_window();
7379 register_protocol();
7381 asynchronous_binding = TRUE;
7382 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
7384 asynchronous_binding = FALSE;
7385 test_HTMLDocument_hlink(HTTP_STATUS_OK);
7386 test_HTMLDocument(FALSE);
7387 test_HTMLDocument(TRUE);
7388 test_HTMLDocument_StreamLoad();
7389 test_HTMLDocument_StreamInitNew();
7390 test_editing_mode(FALSE);
7391 test_editing_mode(TRUE);
7392 test_HTMLDocument_http(FALSE);
7393 test_HTMLDocument_http(TRUE);
7394 test_UIActivate(FALSE, FALSE, FALSE);
7395 test_UIActivate(FALSE, TRUE, FALSE);
7396 test_UIActivate(FALSE, TRUE, TRUE);
7397 test_UIActivate(TRUE, FALSE, FALSE);
7398 test_UIActivate(TRUE, TRUE, FALSE);
7399 test_UIActivate(TRUE, TRUE, TRUE);
7400 test_HTMLDoc_ISupportErrorInfo();
7401 test_IPersistHistory();
7402 test_ServiceProvider();
7404 DestroyWindow(container_hwnd);