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
96 static IOleDocumentView *view = NULL;
97 static HWND container_hwnd = NULL, doc_hwnd = NULL, last_hwnd = NULL;
99 DEFINE_EXPECT(LockContainer);
100 DEFINE_EXPECT(SetActiveObject);
101 DEFINE_EXPECT(SetActiveObject_null);
102 DEFINE_EXPECT(GetWindow);
103 DEFINE_EXPECT(CanInPlaceActivate);
104 DEFINE_EXPECT(OnInPlaceActivate);
105 DEFINE_EXPECT(OnInPlaceActivateEx);
106 DEFINE_EXPECT(OnUIActivate);
107 DEFINE_EXPECT(GetWindowContext);
108 DEFINE_EXPECT(OnUIDeactivate);
109 DEFINE_EXPECT(OnInPlaceDeactivate);
110 DEFINE_EXPECT(OnInPlaceDeactivateEx);
111 DEFINE_EXPECT(GetContainer);
112 DEFINE_EXPECT(ShowUI);
113 DEFINE_EXPECT(ActivateMe);
114 DEFINE_EXPECT(GetHostInfo);
115 DEFINE_EXPECT(HideUI);
116 DEFINE_EXPECT(GetOptionKeyPath);
117 DEFINE_EXPECT(GetOverrideKeyPath);
118 DEFINE_EXPECT(SetStatusText);
119 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
120 DEFINE_EXPECT(QueryStatus_OPEN);
121 DEFINE_EXPECT(QueryStatus_NEW);
122 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
123 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
124 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
125 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
126 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
127 DEFINE_EXPECT(Exec_ShellDocView_37);
128 DEFINE_EXPECT(Exec_ShellDocView_63);
129 DEFINE_EXPECT(Exec_ShellDocView_67);
130 DEFINE_EXPECT(Exec_ShellDocView_84);
131 DEFINE_EXPECT(Exec_ShellDocView_103);
132 DEFINE_EXPECT(Exec_ShellDocView_105);
133 DEFINE_EXPECT(Exec_ShellDocView_140);
134 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
135 DEFINE_EXPECT(Exec_SETTITLE);
136 DEFINE_EXPECT(Exec_HTTPEQUIV);
137 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
138 DEFINE_EXPECT(Exec_Explorer_38);
139 DEFINE_EXPECT(Exec_Explorer_69);
140 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
141 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
142 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
143 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
144 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
145 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
146 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
147 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive);
148 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading);
149 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete);
150 DEFINE_EXPECT(GetDropTarget);
151 DEFINE_EXPECT(UpdateUI);
152 DEFINE_EXPECT(Navigate);
153 DEFINE_EXPECT(OnFrameWindowActivate);
154 DEFINE_EXPECT(OnChanged_READYSTATE);
155 DEFINE_EXPECT(OnChanged_1005);
156 DEFINE_EXPECT(OnChanged_1012);
157 DEFINE_EXPECT(GetDisplayName);
158 DEFINE_EXPECT(BindToStorage);
159 DEFINE_EXPECT(IsSystemMoniker);
160 DEFINE_EXPECT(GetBindResult);
161 DEFINE_EXPECT(GetClassID);
162 DEFINE_EXPECT(Abort);
164 DEFINE_EXPECT(CreateInstance);
165 DEFINE_EXPECT(Start);
166 DEFINE_EXPECT(Terminate);
167 DEFINE_EXPECT(Protocol_Read);
168 DEFINE_EXPECT(LockRequest);
169 DEFINE_EXPECT(UnlockRequest);
170 DEFINE_EXPECT(OnFocus_TRUE);
171 DEFINE_EXPECT(OnFocus_FALSE);
172 DEFINE_EXPECT(RequestUIActivate);
173 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
174 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
175 DEFINE_EXPECT(GetExternal);
176 DEFINE_EXPECT(EnableModeless_TRUE);
177 DEFINE_EXPECT(EnableModeless_FALSE);
178 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
179 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
180 DEFINE_EXPECT(Frame_GetWindow);
181 DEFINE_EXPECT(TranslateUrl);
182 DEFINE_EXPECT(Advise_Close);
183 DEFINE_EXPECT(OnViewChange);
184 DEFINE_EXPECT(EvaluateNewWindow);
185 DEFINE_EXPECT(GetTravelLog);
186 DEFINE_EXPECT(UpdateBackForwardState);
187 DEFINE_EXPECT(FireBeforeNavigate2);
188 DEFINE_EXPECT(FireNavigateComplete2);
189 DEFINE_EXPECT(FireDocumentComplete);
190 DEFINE_EXPECT(GetPendingUrl);
191 DEFINE_EXPECT(ActiveElementChanged);
192 DEFINE_EXPECT(IsErrorUrl);
193 DEFINE_EXPECT(get_LocationURL);
194 DEFINE_EXPECT(CountEntries);
196 static IUnknown *doc_unk;
197 static IMoniker *doc_mon;
198 static BOOL expect_LockContainer_fLock;
199 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
200 static BOOL ipsex, ipsw;
201 static BOOL set_clientsite, container_locked;
202 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
203 static BOOL editmode = FALSE, ignore_external_qi;
204 static BOOL inplace_deactivated, open_call;
205 static BOOL complete, loading_js, loading_hash;
206 static DWORD status_code = HTTP_STATUS_OK;
207 static BOOL asynchronous_binding = FALSE;
208 static BOOL support_wbapp, allow_new_window;
209 static BOOL report_mime;
210 static int stream_read, protocol_read;
211 static enum load_state_t {
220 static LPCOLESTR expect_status_text = NULL;
221 static const char *nav_url, *nav_serv_url, *prev_url;
223 static const char html_page[] =
225 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
226 "<body><div>test</div></body>"
229 static const char css_data[] = "body {color: red; margin: 0}";
231 static const WCHAR http_urlW[] =
232 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
234 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
236 #define DOCHOST_DOCCANNAVIGATE 0
237 #define WM_CONTINUE_BINDING (WM_APP+1)
239 static HRESULT QueryInterface(REFIID riid, void **ppv);
240 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
242 #define test_readyState(u) _test_readyState(__LINE__,u)
243 static void _test_readyState(unsigned,IUnknown*);
245 static const WCHAR wszTimesNewRoman[] =
246 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
247 static const WCHAR wszArial[] =
248 {'A','r','i','a','l',0};
250 static const char *debugstr_guid(REFIID riid)
257 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
258 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
259 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
260 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
265 static int strcmp_wa(LPCWSTR strw, const char *stra)
268 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
269 return lstrcmpA(stra, buf);
272 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
276 const WCHAR *p1 = str, *p2 = sub;
277 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
278 if (!*p2) return str;
284 static BSTR a2bstr(const char *str)
289 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
290 ret = SysAllocStringLen(NULL, len);
291 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
296 /* Returns true if the user interface is in English. Note that this does not
297 * presume of the formatting of dates, numbers, etc.
299 static BOOL is_lang_english(void)
301 static HMODULE hkernel32 = NULL;
302 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
303 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
307 hkernel32 = GetModuleHandleA("kernel32.dll");
308 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
309 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
311 if (pGetThreadUILanguage)
312 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
313 if (pGetUserDefaultUILanguage)
314 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
316 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
319 static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
321 IUnknown *unk1, *unk2;
326 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
327 IUnknown_Release(unk1);
328 IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
329 IUnknown_Release(unk2);
334 #define EXPECT_UPDATEUI 1
335 #define EXPECT_SETTITLE 2
337 static void test_timer(DWORD flags)
339 BOOL *b = &called_Exec_SETTITLE;
342 if(flags & EXPECT_UPDATEUI) {
343 SET_EXPECT(UpdateUI);
344 SET_EXPECT(Exec_UPDATECOMMANDS);
345 b = &called_UpdateUI;
347 if(flags & EXPECT_SETTITLE)
348 SET_EXPECT(Exec_SETTITLE);
350 while(!*b && GetMessage(&msg, doc_hwnd, 0, 0)) {
351 TranslateMessage(&msg);
352 DispatchMessage(&msg);
355 if(flags & EXPECT_UPDATEUI) {
356 CHECK_CALLED(UpdateUI);
357 CHECK_CALLED(Exec_UPDATECOMMANDS);
359 if(flags & EXPECT_SETTITLE)
360 CHECK_CALLED(Exec_SETTITLE);
363 static IMoniker Moniker;
365 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
366 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
369 IPersistMoniker *permon;
370 IMoniker *mon = (void*)0xdeadbeef;
371 BSTR doc_url = (void*)0xdeadbeef;
377 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
378 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
382 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
383 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
385 hres = IHTMLDocument2_get_URL(doc, &doc_url);
386 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
388 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
389 IPersistMoniker_Release(permon);
393 BOOL exb = expect_GetDisplayName;
394 BOOL clb = called_GetDisplayName;
396 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
397 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
400 SET_EXPECT(GetDisplayName);
401 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
402 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
404 CHECK_CALLED(GetDisplayName);
405 expect_GetDisplayName = exb;
406 called_GetDisplayName = clb;
409 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
411 ok(!strcmp_wa(url, nav_serv_url), "url = %s, expected %s\n", wine_dbgstr_w(url), nav_serv_url);
416 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
418 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
419 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
421 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
422 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
426 ok_(__FILE__,line)(hres == E_UNEXPECTED,
427 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
428 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
429 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
432 SysFreeString(doc_url);
433 IHTMLDocument2_Release(doc);
434 if(mon && mon != (void*)0xdeadbeef)
435 IMoniker_Release(mon);
438 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
439 static void _test_current_url(unsigned line, IUnknown *unk, const char *exurl)
445 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
446 ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
448 hres = IHTMLDocument2_get_URL(doc, &url);
449 ok_(__FILE__,line)(hres == S_OK, "get_URL failed: %08x\n", hres);
450 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url), exurl);
453 IHTMLDocument2_Release(doc);
456 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
458 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
462 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
467 if(IsEqualGUID(&IID_IProxyManager, riid))
468 return E_NOINTERFACE; /* TODO */
469 if(IsEqualGUID(&IID_IDispatchEx, riid))
470 return E_NOINTERFACE; /* TODO */
471 if(IsEqualGUID(&IID_External_unk, riid))
472 return E_NOINTERFACE; /* TODO */
474 if(!ignore_external_qi)
475 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
476 return E_NOINTERFACE;
479 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
484 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
489 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
491 ok(0, "unexpected call\n");
495 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
498 ok(0, "unexpected call\n");
502 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
503 UINT cNames, LCID lcid, DISPID *rgDispId)
505 ok(0, "unexpected call\n");
509 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
510 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
511 EXCEPINFO *pExcepInfo, UINT *puArgErr)
513 ok(0, "unexpected call\n");
517 static const IDispatchVtbl ExternalVtbl = {
518 External_QueryInterface,
521 Dispatch_GetTypeInfoCount,
522 Dispatch_GetTypeInfo,
523 Dispatch_GetIDsOfNames,
527 static IDispatch External = { &ExternalVtbl };
529 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
531 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
537 return E_NOINTERFACE;
540 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
545 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
550 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
551 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
552 DWORD grfPI, HANDLE_PTR dwReserved)
558 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
559 static const WCHAR empty_str = {0};
563 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
564 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
565 ok(!grfPI, "grfPI = %x\n", grfPI);
566 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
568 memset(&bindinfo, 0, sizeof(bindinfo));
569 bindinfo.cbSize = sizeof(bindinfo);
570 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
571 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
572 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
573 "bindf = %x\n", bindf);
575 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
576 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
577 /* TODO: test stgmedData */
578 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
579 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
580 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
581 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
582 ok(bindinfo.dwOptions == 0x80000 ||
583 bindinfo.dwOptions == 0x4080000, /* win2k3 */
584 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
585 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
586 /* TODO: test dwCodePage */
587 /* TODO: test securityAttributes */
588 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
589 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
590 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
592 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
593 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
594 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
597 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
598 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
600 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
603 hres = IInternetProtocolSink_ReportData(pOIProtSink,
604 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
605 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
607 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
608 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
613 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
614 PROTOCOLDATA *pProtocolData)
616 ok(0, "unexpected call\n");
620 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
623 ok(0, "unexpected call\n");
627 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
629 CHECK_EXPECT(Terminate);
633 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
635 ok(0, "unexpected call\n");
639 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
641 ok(0, "unexpected call\n");
645 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
646 ULONG cb, ULONG *pcbRead)
648 CHECK_EXPECT2(Protocol_Read);
650 ok(pv != NULL, "pv == NULL\n");
651 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
652 ok(pcbRead != NULL, "pcbRead == NULL\n");
653 ok(!*pcbRead || *pcbRead==sizeof(css_data)-1, "*pcbRead=%d\n", *pcbRead);
658 protocol_read += *pcbRead = sizeof(css_data)-1;
659 memcpy(pv, css_data, sizeof(css_data)-1);
663 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
664 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
666 ok(0, "unexpected call\n");
670 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
672 CHECK_EXPECT(LockRequest);
676 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
678 CHECK_EXPECT(UnlockRequest);
682 static const IInternetProtocolVtbl ProtocolVtbl = {
683 Protocol_QueryInterface,
694 Protocol_LockRequest,
695 Protocol_UnlockRequest
698 static IInternetProtocol Protocol = { &ProtocolVtbl };
700 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
702 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
703 ok(0, "unexpected call\n");
704 return E_NOINTERFACE;
707 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
712 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
717 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
718 REFIID riid, void **ppv)
720 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
721 return E_NOINTERFACE;
723 CHECK_EXPECT(CreateInstance);
724 ok(ppv != NULL, "ppv == NULL\n");
730 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
732 ok(0, "unexpected call\n");
736 static const IClassFactoryVtbl ClassFactoryVtbl = {
737 ClassFactory_QueryInterface,
739 ClassFactory_Release,
740 ClassFactory_CreateInstance,
741 ClassFactory_LockServer
744 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
746 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
748 ok(0, "unexpected call\n");
752 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
757 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
762 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
763 IHlinkBrowseContext *pihlbc)
765 ok(0, "unexpected call\n");
769 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
770 IHlinkBrowseContext **ppihlbc)
772 ok(0, "unexpected call\n");
776 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
777 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
781 CHECK_EXPECT(Navigate);
783 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
784 ok(pbc != NULL, "pbc == NULL\n");
785 ok(pibsc != NULL, "pubsc == NULL\n");
786 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
789 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
790 LPWSTR location = (LPWSTR)0xdeadbeef;
792 IMoniker *mon = NULL;
793 DWORD site_data = 0xdeadbeef;
795 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
796 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
797 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
799 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
800 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
801 ok(location == NULL, "location = %p\n", location);
802 ok(mon != NULL, "mon == NULL\n");
804 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &location);
805 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
806 ok(!strcmp_wa(location, nav_url), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location), nav_url);
807 CoTaskMemFree(location);
808 IMoniker_Release(mon);
810 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
811 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
812 ok(site == NULL, "site = %p\n, expected NULL\n", site);
813 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
819 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
820 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
822 ok(0, "unexpected call\n");
826 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
827 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
829 ok(0, "unexpected call\n");
833 static const IHlinkFrameVtbl HlinkFrameVtbl = {
834 HlinkFrame_QueryInterface,
837 HlinkFrame_SetBrowseContext,
838 HlinkFrame_GetBrowseContext,
840 HlinkFrame_OnNavigate,
841 HlinkFrame_UpdateHlink
844 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
846 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
848 ok(0, "unexpected call\n");
849 return E_NOINTERFACE;
852 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
857 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
862 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
863 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
864 DWORD dwUserActionTime)
866 CHECK_EXPECT(EvaluateNewWindow);
868 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
869 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
870 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
871 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
872 ok(!fReplace, "fReplace = %x\n", fReplace);
873 ok(dwFlags == (allow_new_window ? 0 : NWMF_FIRST), "dwFlags = %x\n", dwFlags);
874 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
876 return allow_new_window ? S_OK : E_FAIL;
879 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
880 NewWindowManager_QueryInterface,
881 NewWindowManager_AddRef,
882 NewWindowManager_Release,
883 NewWindowManager_EvaluateNewWindow
886 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
888 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
889 REFIID riid, void**ppv)
891 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
896 ok(0, "unexpected call\n");
897 return E_NOINTERFACE;
900 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
905 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
910 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
913 case DISPID_READYSTATE:
914 CHECK_EXPECT2(OnChanged_READYSTATE);
916 if(!readystate_set_interactive)
917 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
918 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
919 ? OLECMDF_ENABLED : 0));
921 if(readystate_set_loading) {
922 readystate_set_loading = FALSE;
923 load_state = LD_LOADING;
925 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
926 test_readyState(NULL);
929 CHECK_EXPECT(OnChanged_1005);
931 test_readyState(NULL);
932 readystate_set_interactive = (load_state != LD_INTERACTIVE);
935 CHECK_EXPECT(OnChanged_1012);
951 ok(0, "unexpected id %d\n", dispID);
955 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
957 ok(0, "unexpected call\n");
961 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
962 PropertyNotifySink_QueryInterface,
963 PropertyNotifySink_AddRef,
964 PropertyNotifySink_Release,
965 PropertyNotifySink_OnChanged,
966 PropertyNotifySink_OnRequestEdit
969 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
971 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
973 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
978 ok(0, "unexpected call %s\n", debugstr_guid(riid));
980 return E_NOINTERFACE;
983 static ULONG WINAPI Stream_AddRef(IStream *iface)
988 static ULONG WINAPI Stream_Release(IStream *iface)
993 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
994 ULONG cb, ULONG *pcbRead)
997 ok(pv != NULL, "pv == NULL\n");
998 ok(cb > sizeof(html_page), "cb = %d\n", cb);
999 ok(pcbRead != NULL, "pcbRead == NULL\n");
1000 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
1005 memcpy(pv, html_page, sizeof(html_page)-1);
1006 stream_read += *pcbRead = sizeof(html_page)-1;
1010 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
1011 ULONG cb, ULONG *pcbWritten)
1013 ok(0, "unexpected call\n");
1017 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
1018 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1020 ok(0, "unexpected call\n");
1024 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
1026 ok(0, "unexpected call\n");
1030 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
1031 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
1033 ok(0, "unexpected call\n");
1037 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
1039 ok(0, "unexpected call\n");
1043 static HRESULT WINAPI Stream_Revert(IStream *iface)
1045 ok(0, "unexpected call\n");
1049 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1050 ULARGE_INTEGER cb, DWORD dwLockType)
1052 ok(0, "unexpected call\n");
1056 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1057 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1059 ok(0, "unexpected call\n");
1063 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1066 ok(0, "unexpected call\n");
1070 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1072 ok(0, "unexpected call\n");
1076 static const IStreamVtbl StreamVtbl = {
1077 Stream_QueryInterface,
1088 Stream_UnlockRegion,
1093 static IStream Stream = { &StreamVtbl };
1095 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1096 IWinInetHttpInfo* This,
1100 ok(0, "unexpected call\n");
1101 return E_NOINTERFACE;
1104 static ULONG WINAPI WinInetHttpInfo_AddRef(
1105 IWinInetHttpInfo* This)
1110 static ULONG WINAPI WinInetHttpInfo_Release(
1111 IWinInetHttpInfo* This)
1116 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1117 IWinInetHttpInfo* This,
1122 return E_NOTIMPL; /* TODO */
1125 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1126 IWinInetHttpInfo* This,
1133 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1135 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1136 ok(pBuffer != NULL, "pBuffer == NULL\n");
1137 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1138 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1139 *((DWORD*)pBuffer) = status_code;
1143 return E_NOTIMPL; /* TODO */
1146 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1147 WinInetHttpInfo_QueryInterface,
1148 WinInetHttpInfo_AddRef,
1149 WinInetHttpInfo_Release,
1150 WinInetHttpInfo_QueryOption,
1151 WinInetHttpInfo_QueryInfo
1154 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1156 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1158 if(IsEqualGUID(&IID_IUnknown, riid)) {
1163 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1164 *ppv = &WinInetHttpInfo;
1168 ok(0, "unexpected call\n");
1169 return E_NOINTERFACE;
1172 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1177 static ULONG WINAPI Binding_Release(IBinding *iface)
1182 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1184 CHECK_EXPECT(Abort);
1185 if(asynchronous_binding)
1186 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1190 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1192 ok(0, "unexpected call\n");
1196 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1198 ok(0, "unexpected call\n");
1202 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1204 ok(0, "unexpected call\n");
1208 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1210 ok(0, "unexpected call\n");
1214 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1215 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1217 CHECK_EXPECT(GetBindResult);
1221 static const IBindingVtbl BindingVtbl = {
1222 Binding_QueryInterface,
1228 Binding_SetPriority,
1229 Binding_GetPriority,
1230 Binding_GetBindResult
1233 static IBinding Binding = { &BindingVtbl };
1235 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1236 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1238 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1242 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1243 return E_NOINTERFACE; /* TODO */
1244 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1245 return E_NOINTERFACE; /* TODO */
1247 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1248 return E_NOINTERFACE;
1251 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1256 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1261 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1263 CHECK_EXPECT(GetClassID);
1264 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1268 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1270 ok(0, "unexpected call\n");
1274 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1276 ok(0, "unexpected call\n");
1280 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1282 ok(0, "unexpected call\n");
1286 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1288 ok(0, "unexpected call\n");
1292 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1293 REFIID riidResult, void **ppvResult)
1295 ok(0, "unexpected call\n");
1299 static void test_binding_ui(IUnknown *unk)
1301 IWindowForBindingUI *binding_ui;
1302 IServiceProvider *serv_prov;
1306 hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
1307 ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
1309 hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
1310 (void**)&binding_ui);
1311 ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
1313 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &binding_hwnd);
1314 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1316 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1318 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1320 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IAuthenticate, &binding_hwnd);
1321 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1323 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1325 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1327 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
1328 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1330 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1332 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1334 IWindowForBindingUI_Release(binding_ui);
1335 IServiceProvider_Release(serv_prov);
1338 static void continue_binding(IBindStatusCallback *callback)
1340 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1341 STGMEDIUM stgmedium;
1344 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1346 test_binding_ui((IUnknown*)callback);
1349 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1351 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1354 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1355 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1356 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1357 if(status_code != HTTP_STATUS_OK) {
1358 CHECK_CALLED_BROKEN(IsErrorUrl);
1359 SET_EXPECT(IsErrorUrl);
1363 stgmedium.tymed = TYMED_ISTREAM;
1364 U(stgmedium).pstm = &Stream;
1365 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1366 hres = IBindStatusCallback_OnDataAvailable(callback,
1367 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1368 sizeof(html_page)-1, &formatetc, &stgmedium);
1369 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1372 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1373 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1374 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1376 SET_EXPECT(GetBindResult);
1377 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1378 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1379 CLEAR_CALLED(GetBindResult); /* IE7 */
1381 IBindStatusCallback_Release(callback);
1384 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1385 REFIID riid, void **ppv)
1387 IBindStatusCallback *callback = NULL;
1392 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1394 CHECK_EXPECT(BindToStorage);
1396 load_state = LD_LOADING;
1398 ok(pbc != NULL, "pbc == NULL\n");
1399 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1400 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1401 ok(ppv != NULL, "ppv == NULL\n");
1402 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1404 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1405 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1406 ok(callback != NULL, "callback == NULL\n");
1408 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1409 bindinfo.cbSize = sizeof(bindinfo);
1411 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1412 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1413 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1414 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1415 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1416 /* TODO: test stgmedData */
1417 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1418 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1419 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1420 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1421 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1422 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1423 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1424 /* TODO: test dwCodePage */
1425 /* TODO: test securityAttributes */
1426 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1427 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1428 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1430 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1431 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1433 if(asynchronous_binding) {
1434 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1435 return MK_S_ASYNCHRONOUS;
1438 continue_binding(callback);
1442 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1443 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1445 ok(0, "unexpected call\n");
1449 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1450 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1452 ok(0, "unexpected call\n");
1456 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1458 ok(0, "unexpected call\n");
1462 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1464 ok(0, "unexpected call\n");
1468 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1470 ok(0, "unexpected call\n");
1474 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1475 IMoniker *pmkNewlyRunning)
1477 ok(0, "unexpected call\n");
1481 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1482 IMoniker *pmkToLeft, FILETIME *pFileTime)
1484 ok(0, "unexpected call\n");
1488 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1490 ok(0, "unexpected call\n");
1494 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1495 IMoniker **ppmkPrefix)
1497 ok(0, "unexpected call\n");
1501 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1502 IMoniker **pmkRelPath)
1504 ok(0, "unexpected call\n");
1508 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1509 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1511 CHECK_EXPECT2(GetDisplayName);
1513 /* ok(pbc != NULL, "pbc == NULL\n"); */
1514 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1515 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1517 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1518 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1523 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1524 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1526 ok(0, "unexpected call\n");
1530 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1532 CHECK_EXPECT(IsSystemMoniker);
1536 static const IMonikerVtbl MonikerVtbl = {
1537 Moniker_QueryInterface,
1545 Moniker_BindToObject,
1546 Moniker_BindToStorage,
1548 Moniker_ComposeWith,
1553 Moniker_GetTimeOfLastChange,
1555 Moniker_CommonPrefixWith,
1556 Moniker_RelativePathTo,
1557 Moniker_GetDisplayName,
1558 Moniker_ParseDisplayName,
1559 Moniker_IsSystemMoniker
1562 static IMoniker Moniker = { &MonikerVtbl };
1564 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1566 return QueryInterface(riid, ppv);
1569 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1574 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1579 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1580 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1582 ok(0, "unexpected call\n");
1586 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1587 IEnumUnknown **ppenum)
1589 ok(0, "unexpected call\n");
1593 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1595 CHECK_EXPECT(LockContainer);
1596 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1600 static const IOleContainerVtbl OleContainerVtbl = {
1601 OleContainer_QueryInterface,
1602 OleContainer_AddRef,
1603 OleContainer_Release,
1604 OleContainer_ParseDisplayName,
1605 OleContainer_EnumObjects,
1606 OleContainer_LockContainer
1609 static IOleContainer OleContainer = { &OleContainerVtbl };
1611 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1613 return QueryInterface(riid, ppv);
1616 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1621 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1626 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1628 ok(0, "unexpected call\n");
1632 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1635 ok(0, "unexpected call\n");
1639 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1641 CHECK_EXPECT(GetContainer);
1642 ok(ppContainer != NULL, "ppContainer = NULL\n");
1643 *ppContainer = &OleContainer;
1647 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1649 ok(0, "unexpected call\n");
1653 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1655 ok(0, "unexpected call\n");
1659 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1661 ok(0, "unexpected call\n");
1665 static const IOleClientSiteVtbl ClientSiteVtbl = {
1666 ClientSite_QueryInterface,
1669 ClientSite_SaveObject,
1670 ClientSite_GetMoniker,
1671 ClientSite_GetContainer,
1672 ClientSite_ShowObject,
1673 ClientSite_OnShowWindow,
1674 ClientSite_RequestNewObjectLayout
1677 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1679 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1681 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1683 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1684 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1687 return E_NOINTERFACE;
1690 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1695 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1700 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1702 CHECK_EXPECT(Frame_GetWindow);
1706 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1708 ok(0, "unexpected call\n");
1712 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1714 ok(0, "unexpected call\n");
1718 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1719 LPCBORDERWIDTHS pborderwidths)
1721 ok(0, "unexpected call\n");
1725 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1726 LPCBORDERWIDTHS pborderwidths)
1728 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1732 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1733 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1735 static const WCHAR wszHTML_Document[] =
1736 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1738 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1740 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1741 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1742 if(pActiveObject && is_lang_english())
1743 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1746 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1747 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1749 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1753 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1754 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1756 static const WCHAR wszHTML_Document[] =
1757 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1760 CHECK_EXPECT2(SetActiveObject);
1762 if(pActiveObject && is_lang_english())
1763 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1765 CHECK_EXPECT(SetActiveObject_null);
1767 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1768 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1774 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1775 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1777 ok(0, "unexpected call\n");
1781 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1782 HOLEMENU holemenu, HWND hwndActiveObject)
1784 ok(0, "unexpected call\n");
1788 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1790 ok(0, "unexpected call\n");
1794 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1796 CHECK_EXPECT2(SetStatusText);
1797 if(!expect_status_text)
1798 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1802 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1805 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1807 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1811 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1813 ok(0, "unexpected call\n");
1817 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1818 InPlaceFrame_QueryInterface,
1819 InPlaceFrame_AddRef,
1820 InPlaceFrame_Release,
1821 InPlaceFrame_GetWindow,
1822 InPlaceFrame_ContextSensitiveHelp,
1823 InPlaceFrame_GetBorder,
1824 InPlaceFrame_RequestBorderSpace,
1825 InPlaceFrame_SetBorderSpace,
1826 InPlaceFrame_SetActiveObject,
1827 InPlaceFrame_InsertMenus,
1828 InPlaceFrame_SetMenu,
1829 InPlaceFrame_RemoveMenus,
1830 InPlaceFrame_SetStatusText,
1831 InPlaceFrame_EnableModeless,
1832 InPlaceFrame_TranslateAccelerator
1835 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1837 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1838 InPlaceFrame_QueryInterface,
1839 InPlaceFrame_AddRef,
1840 InPlaceFrame_Release,
1841 InPlaceFrame_GetWindow,
1842 InPlaceFrame_ContextSensitiveHelp,
1843 InPlaceFrame_GetBorder,
1844 InPlaceFrame_RequestBorderSpace,
1845 InPlaceFrame_SetBorderSpace,
1846 InPlaceUIWindow_SetActiveObject,
1849 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1851 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1853 return QueryInterface(riid, ppv);
1856 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1861 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1866 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1867 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1869 IOleClientSite *client_site;
1870 IOleObject *ole_obj;
1873 CHECK_EXPECT2(GetWindow);
1874 ok(phwnd != NULL, "phwnd = NULL\n");
1875 *phwnd = container_hwnd;
1877 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1878 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1880 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1881 IOleObject_Release(ole_obj);
1882 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1883 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1884 IOleClientSite_Release(client_site);
1889 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1890 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1892 ok(0, "unexpected call\n");
1896 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1897 IOleInPlaceSiteWindowless *iface)
1899 CHECK_EXPECT(CanInPlaceActivate);
1903 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1904 IOleInPlaceSiteWindowless *iface)
1906 CHECK_EXPECT(OnInPlaceActivate);
1907 inplace_deactivated = FALSE;
1911 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1912 IOleInPlaceSiteWindowless *iface)
1914 CHECK_EXPECT(OnUIActivate);
1918 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1919 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1920 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1921 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1923 static const RECT rect = {0,0,500,500};
1925 CHECK_EXPECT(GetWindowContext);
1927 ok(ppFrame != NULL, "ppFrame = NULL\n");
1929 *ppFrame = &InPlaceFrame;
1930 ok(ppDoc != NULL, "ppDoc = NULL\n");
1932 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1933 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1935 memcpy(lprcPosRect, &rect, sizeof(RECT));
1936 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1938 memcpy(lprcClipRect, &rect, sizeof(RECT));
1939 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1941 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1942 lpFrameInfo->fMDIApp = FALSE;
1943 lpFrameInfo->hwndFrame = container_hwnd;
1944 lpFrameInfo->haccel = NULL;
1945 lpFrameInfo->cAccelEntries = 0;
1951 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1952 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1954 ok(0, "unexpected call\n");
1958 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1959 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1961 CHECK_EXPECT(OnUIDeactivate);
1962 ok(!fUndoable, "fUndoable = TRUE\n");
1966 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1967 IOleInPlaceSiteWindowless *iface)
1969 CHECK_EXPECT(OnInPlaceDeactivate);
1970 inplace_deactivated = TRUE;
1974 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1975 IOleInPlaceSiteWindowless *iface)
1977 ok(0, "unexpected call\n");
1981 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1982 IOleInPlaceSiteWindowless *iface)
1984 ok(0, "unexpected call\n");
1988 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1989 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1991 ok(0, "unexpected call\n");
1995 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1996 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1998 CHECK_EXPECT(OnInPlaceActivateEx);
2000 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
2001 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
2002 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
2007 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2008 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
2010 CHECK_EXPECT(OnInPlaceDeactivateEx);
2012 ok(fNoRedraw, "fNoRedraw == FALSE\n");
2017 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
2018 IOleInPlaceSiteWindowless *iface)
2020 CHECK_EXPECT2(RequestUIActivate);
2024 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
2025 IOleInPlaceSiteWindowless *iface)
2027 ok(0, "unexpected call\n");
2031 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
2032 IOleInPlaceSiteWindowless *iface)
2034 ok(0, "unexpected call\n");
2038 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
2039 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
2041 ok(0, "unexpected call\n");
2045 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
2046 IOleInPlaceSiteWindowless *iface)
2048 ok(0, "unexpected call\n");
2052 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
2053 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
2055 ok(0, "unexpected call\n");
2059 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
2060 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
2061 DWORD grfFlags, HDC *phDC)
2063 ok(0, "unexpected call\n");
2067 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
2068 IOleInPlaceSiteWindowless *iface, HDC hDC)
2070 ok(0, "unexpected call\n");
2074 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
2075 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
2077 ok(0, "unexpected call\n");
2081 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
2082 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
2084 ok(0, "unexpected call\n");
2088 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2089 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2090 LPCRECT pRectScroll, LPCRECT pRectClip)
2092 ok(0, "unexpected call\n");
2096 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2097 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2099 ok(0, "unexpected call\n");
2103 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2104 IOleInPlaceSiteWindowless *iface, UINT msg,
2105 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2107 ok(0, "unexpected call\n");
2111 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2112 InPlaceSiteWindowless_QueryInterface,
2113 InPlaceSiteWindowless_AddRef,
2114 InPlaceSiteWindowless_Release,
2115 InPlaceSiteWindowless_GetWindow,
2116 InPlaceSiteWindowless_ContextSensitiveHelp,
2117 InPlaceSiteWindowless_CanInPlaceActivate,
2118 InPlaceSiteWindowless_OnInPlaceActivate,
2119 InPlaceSiteWindowless_OnUIActivate,
2120 InPlaceSiteWindowless_GetWindowContext,
2121 InPlaceSiteWindowless_Scroll,
2122 InPlaceSiteWindowless_OnUIDeactivate,
2123 InPlaceSiteWindowless_OnInPlaceDeactivate,
2124 InPlaceSiteWindowless_DiscardUndoState,
2125 InPlaceSiteWindowless_DeactivateAndUndo,
2126 InPlaceSiteWindowless_OnPosRectChange,
2127 InPlaceSiteWindowless_OnInPlaceActivateEx,
2128 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2129 InPlaceSiteWindowless_RequestUIActivate,
2130 InPlaceSiteWindowless_CanWindowlessActivate,
2131 InPlaceSiteWindowless_GetCapture,
2132 InPlaceSiteWindowless_SetCapture,
2133 InPlaceSiteWindowless_GetFocus,
2134 InPlaceSiteWindowless_SetFocus,
2135 InPlaceSiteWindowless_GetDC,
2136 InPlaceSiteWindowless_ReleaseDC,
2137 InPlaceSiteWindowless_InvalidateRect,
2138 InPlaceSiteWindowless_InvalidateRgn,
2139 InPlaceSiteWindowless_ScrollRect,
2140 InPlaceSiteWindowless_AdjustRect,
2141 InPlaceSiteWindowless_OnDefWindowMessage
2144 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2146 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2148 return QueryInterface(riid, ppv);
2151 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2156 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2163 CallUIActivate_None,
2164 CallUIActivate_ActivateMe,
2165 CallUIActivate_AfterShow,
2168 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2169 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2171 IOleDocument *document;
2174 CHECK_EXPECT(ActivateMe);
2175 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2177 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2178 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2180 if(SUCCEEDED(hres)) {
2181 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2182 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2184 if(SUCCEEDED(hres)) {
2185 IOleInPlaceActiveObject *activeobj = NULL;
2186 IOleInPlaceSite *inplacesite = NULL;
2187 HWND tmp_hwnd = NULL;
2188 static RECT rect = {0,0,400,500};
2190 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2191 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2192 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2193 inplacesite, &InPlaceSiteWindowless);
2195 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2196 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2198 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2199 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2200 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2201 inplacesite, &InPlaceSiteWindowless);
2203 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2204 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2207 HWND hwnd = (void*)0xdeadbeef;
2208 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2209 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
2210 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2213 if(call_UIActivate == CallUIActivate_ActivateMe) {
2214 SET_EXPECT(CanInPlaceActivate);
2215 SET_EXPECT(GetWindowContext);
2216 SET_EXPECT(GetWindow);
2218 SET_EXPECT(OnInPlaceActivateEx);
2220 SET_EXPECT(OnInPlaceActivate);
2221 SET_EXPECT(SetStatusText);
2222 SET_EXPECT(Exec_SETPROGRESSMAX);
2223 SET_EXPECT(Exec_SETPROGRESSPOS);
2224 SET_EXPECT(OnUIActivate);
2225 SET_EXPECT(SetActiveObject);
2227 expect_status_text = NULL;
2229 hres = IOleDocumentView_UIActivate(view, TRUE);
2230 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2232 CHECK_CALLED(CanInPlaceActivate);
2233 CHECK_CALLED(GetWindowContext);
2234 CHECK_CALLED(GetWindow);
2236 CHECK_CALLED(OnInPlaceActivateEx);
2238 CHECK_CALLED(OnInPlaceActivate);
2239 CHECK_CALLED(SetStatusText);
2240 CHECK_CALLED(Exec_SETPROGRESSMAX);
2241 CHECK_CALLED(Exec_SETPROGRESSPOS);
2242 CHECK_CALLED(OnUIActivate);
2243 CHECK_CALLED(SetActiveObject);
2244 CHECK_CALLED(ShowUI);
2247 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2248 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2249 ok(doc_hwnd != NULL, "hwnd == NULL\n");
2251 ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
2254 hres = IOleDocumentView_UIActivate(view, TRUE);
2255 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2258 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2259 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2260 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
2264 hres = IOleDocumentView_SetRect(view, &rect);
2265 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2267 if(call_UIActivate == CallUIActivate_ActivateMe) {
2268 hres = IOleDocumentView_Show(view, TRUE);
2269 ok(hres == S_OK, "Show failed: %08x\n", hres);
2271 SET_EXPECT(CanInPlaceActivate);
2272 SET_EXPECT(GetWindowContext);
2273 SET_EXPECT(GetWindow);
2275 SET_EXPECT(OnInPlaceActivateEx);
2277 SET_EXPECT(OnInPlaceActivate);
2278 SET_EXPECT(SetStatusText);
2279 SET_EXPECT(Exec_SETPROGRESSMAX);
2280 SET_EXPECT(Exec_SETPROGRESSPOS);
2281 SET_EXPECT(OnUIActivate);
2282 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2284 hres = IOleDocumentView_Show(view, TRUE);
2285 ok(hres == S_OK, "Show failed: %08x\n", hres);
2287 CHECK_CALLED(CanInPlaceActivate);
2288 CHECK_CALLED(GetWindowContext);
2289 CHECK_CALLED(GetWindow);
2291 CHECK_CALLED(OnInPlaceActivateEx);
2293 CHECK_CALLED(OnInPlaceActivate);
2294 CHECK_CALLED(SetStatusText);
2295 CHECK_CALLED(Exec_SETPROGRESSMAX);
2296 CHECK_CALLED(Exec_SETPROGRESSPOS);
2299 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2300 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2301 ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
2303 ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
2307 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2310 IOleInPlaceActiveObject_Release(activeobj);
2313 IOleDocument_Release(document);
2319 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2320 DocumentSite_QueryInterface,
2321 DocumentSite_AddRef,
2322 DocumentSite_Release,
2323 DocumentSite_ActivateMe
2326 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2328 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2330 return QueryInterface(riid, ppv);
2333 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2338 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2343 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2345 ok(0, "unexpected call\n");
2349 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2351 ok(0, "unexpected call\n");
2355 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2357 ok(0, "unexpected call\n");
2361 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2362 POINTF *pPtfContainer, DWORD dwFlags)
2364 ok(0, "unexpected call\n");
2368 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2369 MSG *pMsg, DWORD grfModifiers)
2371 ok(0, "unexpected call\n");
2375 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2378 CHECK_EXPECT(OnFocus_TRUE);
2380 CHECK_EXPECT2(OnFocus_FALSE);
2384 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2386 ok(0, "unexpected call\n");
2390 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2391 OleControlSite_QueryInterface,
2392 OleControlSite_AddRef,
2393 OleControlSite_Release,
2394 OleControlSite_OnControlInfoChanged,
2395 OleControlSite_LockInPlaceActive,
2396 OleControlSite_GetExtendedControl,
2397 OleControlSite_TransformCoords,
2398 OleControlSite_TranslateAccelerator,
2399 OleControlSite_OnFocus,
2400 OleControlSite_ShowPropertyFrame
2403 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2405 static IDocHostUIHandler2 *expect_uihandler_iface;
2407 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2409 return QueryInterface(riid, ppv);
2412 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2417 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2422 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2423 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2425 ok(0, "unexpected call\n");
2426 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2430 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2432 CHECK_EXPECT(GetHostInfo);
2433 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2434 ok(pInfo != NULL, "pInfo=NULL\n");
2436 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2437 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2438 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2439 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2440 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2441 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2442 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2443 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2448 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2449 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2450 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2452 CHECK_EXPECT(ShowUI);
2453 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2456 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2458 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2459 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2460 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2461 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2462 if (expect_InPlaceUIWindow_SetActiveObject_active)
2463 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2465 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2470 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2472 CHECK_EXPECT(HideUI);
2473 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2477 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2479 CHECK_EXPECT(UpdateUI);
2480 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2484 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2486 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2488 CHECK_EXPECT2(EnableModeless_TRUE);
2490 CHECK_EXPECT2(EnableModeless_FALSE);
2494 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2496 ok(0, "unexpected call\n");
2497 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2501 static BOOL expect_OnFrameWindowActivate_fActivate;
2502 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2504 CHECK_EXPECT2(OnFrameWindowActivate);
2505 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2506 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2510 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2511 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2513 ok(0, "unexpected call\n");
2517 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2518 const GUID *pguidCmdGroup, DWORD nCmdID)
2520 ok(0, "unexpected call\n");
2521 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2525 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2526 LPOLESTR *pchKey, DWORD dw)
2528 CHECK_EXPECT(GetOptionKeyPath);
2529 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2530 ok(pchKey != NULL, "pchKey = NULL\n");
2531 ok(!dw, "dw=%d, expected 0\n", dw);
2533 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2537 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2538 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2540 CHECK_EXPECT(GetDropTarget);
2541 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2546 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2548 CHECK_EXPECT(GetExternal);
2549 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2550 *ppDispatch = &External;
2554 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2555 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2557 CHECK_EXPECT(TranslateUrl);
2558 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2559 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2561 ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2563 todo_wine ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2564 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2565 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2570 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2571 IDataObject **ppPORet)
2573 ok(0, "unexpected call\n");
2574 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2578 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2579 LPOLESTR *pchKey, DWORD dw)
2581 CHECK_EXPECT(GetOverrideKeyPath);
2582 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2583 ok(pchKey != NULL, "pchKey = NULL\n");
2585 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2586 ok(!dw, "dw=%d, xepected 0\n", dw);
2590 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2591 DocHostUIHandler_QueryInterface,
2592 DocHostUIHandler_AddRef,
2593 DocHostUIHandler_Release,
2594 DocHostUIHandler_ShowContextMenu,
2595 DocHostUIHandler_GetHostInfo,
2596 DocHostUIHandler_ShowUI,
2597 DocHostUIHandler_HideUI,
2598 DocHostUIHandler_UpdateUI,
2599 DocHostUIHandler_EnableModeless,
2600 DocHostUIHandler_OnDocWindowActivate,
2601 DocHostUIHandler_OnFrameWindowActivate,
2602 DocHostUIHandler_ResizeBorder,
2603 DocHostUIHandler_TranslateAccelerator,
2604 DocHostUIHandler_GetOptionKeyPath,
2605 DocHostUIHandler_GetDropTarget,
2606 DocHostUIHandler_GetExternal,
2607 DocHostUIHandler_TranslateUrl,
2608 DocHostUIHandler_FilterDataObject,
2609 DocHostUIHandler_GetOverrideKeyPath
2612 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2614 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2616 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2621 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2622 return E_NOINTERFACE;
2624 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2625 return E_NOINTERFACE; /* TODO */
2627 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2628 return E_NOINTERFACE;
2631 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2632 CustomDocHostUIHandler_QueryInterface,
2633 DocHostUIHandler_AddRef,
2634 DocHostUIHandler_Release,
2635 DocHostUIHandler_ShowContextMenu,
2636 DocHostUIHandler_GetHostInfo,
2637 DocHostUIHandler_ShowUI,
2638 DocHostUIHandler_HideUI,
2639 DocHostUIHandler_UpdateUI,
2640 DocHostUIHandler_EnableModeless,
2641 DocHostUIHandler_OnDocWindowActivate,
2642 DocHostUIHandler_OnFrameWindowActivate,
2643 DocHostUIHandler_ResizeBorder,
2644 DocHostUIHandler_TranslateAccelerator,
2645 DocHostUIHandler_GetOptionKeyPath,
2646 DocHostUIHandler_GetDropTarget,
2647 DocHostUIHandler_GetExternal,
2648 DocHostUIHandler_TranslateUrl,
2649 DocHostUIHandler_FilterDataObject,
2650 DocHostUIHandler_GetOverrideKeyPath
2653 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2655 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2656 REFIID riid, void **ppv)
2658 return QueryInterface(riid, ppv);
2661 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2666 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2671 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2672 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2674 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2675 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2676 ok(!pCmdText, "pCmdText != NULL\n");
2678 switch(prgCmds[0].cmdID) {
2679 case OLECMDID_SETPROGRESSTEXT:
2680 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2681 prgCmds[0].cmdf = OLECMDF_ENABLED;
2684 CHECK_EXPECT(QueryStatus_OPEN);
2685 prgCmds[0].cmdf = 0;
2688 CHECK_EXPECT(QueryStatus_NEW);
2689 prgCmds[0].cmdf = 0;
2692 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2698 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2699 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2701 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2702 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2703 test_readyState(NULL);
2705 if(!pguidCmdGroup) {
2707 case OLECMDID_SETPROGRESSMAX:
2708 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2709 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2710 ok(pvaIn != NULL, "pvaIn == NULL\n");
2712 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2713 if(load_state == LD_NO)
2714 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2716 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2718 case OLECMDID_SETPROGRESSPOS:
2719 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2720 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2721 ok(pvaIn != NULL, "pvaIn == NULL\n");
2723 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2724 if(load_state == LD_NO)
2725 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2727 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2729 case OLECMDID_HTTPEQUIV_DONE:
2730 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2731 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2732 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2733 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2734 readystate_set_loading = FALSE;
2735 readystate_set_interactive = FALSE;
2736 load_state = LD_COMPLETE;
2738 case OLECMDID_SETDOWNLOADSTATE:
2739 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2740 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2741 ok(pvaIn != NULL, "pvaIn == NULL\n");
2742 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2744 switch(V_I4(pvaIn)) {
2746 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2748 load_state = LD_INTERACTIVE;
2751 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2752 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2755 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2759 case OLECMDID_UPDATECOMMANDS:
2760 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2761 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2762 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2763 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2765 case OLECMDID_SETTITLE:
2766 CHECK_EXPECT2(Exec_SETTITLE);
2767 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2768 ok(pvaIn != NULL, "pvaIn == NULL\n");
2769 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2770 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2771 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2773 case OLECMDID_HTTPEQUIV:
2774 CHECK_EXPECT2(Exec_HTTPEQUIV);
2775 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2776 ok(pvaIn != NULL, "pvaIn == NULL\n");
2777 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2778 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2779 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2780 test_readyState(NULL);
2782 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2784 return E_FAIL; /* FIXME */
2786 ok(0, "unexpected command %d\n", nCmdID);
2791 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2792 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2796 CHECK_EXPECT2(Exec_ShellDocView_37);
2799 test_GetCurMoniker(doc_unk, NULL, nav_url);
2800 else if(load_from_stream)
2801 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2803 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2805 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2806 ok(pvaIn != NULL, "pvaIn == NULL\n");
2808 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2809 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2814 IHTMLPrivateWindow *priv_window;
2817 CHECK_EXPECT(Exec_ShellDocView_63);
2818 ok(pvaIn != NULL, "pvaIn == NULL\n");
2819 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2820 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2821 ok(pvaOut != NULL, "pvaOut == NULL\n");
2822 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2824 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2825 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2827 IHTMLPrivateWindow_Release(priv_window);
2829 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2830 return S_OK; /* TODO */
2834 CHECK_EXPECT(Exec_ShellDocView_67);
2835 ok(pvaIn != NULL, "pvaIn == NULL\n");
2836 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2838 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);
2840 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);
2841 ok(pvaOut != NULL, "pvaOut == NULL\n");
2842 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2843 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2845 load_state = LD_DOLOAD;
2849 CHECK_EXPECT2(Exec_ShellDocView_84);
2851 ok(pvaIn == NULL, "pvaIn != NULL\n");
2852 ok(pvaOut != NULL, "pvaOut == NULL\n");
2854 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2859 CHECK_EXPECT2(Exec_ShellDocView_103);
2861 ok(pvaIn == NULL, "pvaIn != NULL\n");
2862 ok(pvaOut == NULL, "pvaOut != NULL\n");
2867 CHECK_EXPECT2(Exec_ShellDocView_105);
2869 ok(pvaIn != NULL, "pvaIn == NULL\n");
2870 ok(pvaOut == NULL, "pvaOut != NULL\n");
2875 CHECK_EXPECT2(Exec_ShellDocView_140);
2877 ok(pvaIn == NULL, "pvaIn != NULL\n");
2878 ok(pvaOut == NULL, "pvaOut != NULL\n");
2882 case 143: /* TODO */
2883 case 144: /* TODO */
2887 ok(0, "unexpected command %d\n", nCmdID);
2892 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2893 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2896 case IDM_PARSECOMPLETE:
2897 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2898 ok(pvaIn == NULL, "pvaIn != NULL\n");
2899 ok(pvaOut == NULL, "pvaOut != NULL\n");
2902 ok(0, "unexpected command %d\n", nCmdID);
2906 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2908 case DOCHOST_DOCCANNAVIGATE:
2909 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2910 ok(pvaIn != NULL, "pvaIn == NULL\n");
2911 ok(pvaOut == NULL, "pvaOut != NULL\n");
2912 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2913 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2922 ok(pvaIn != NULL, "pvaIn == NULL\n");
2923 ok(pvaOut != NULL || broken(!pvaOut), "pvaOut != NULL\n");
2924 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2926 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2927 sa = V_ARRAY(pvaIn);
2929 dim = SafeArrayGetDim(sa);
2930 ok(dim == 1, "dim = %d\n", dim);
2931 hres = SafeArrayGetLBound(sa, 1, &ind);
2932 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2933 ok(ind == 0, "Lower bound = %d\n", ind);
2934 hres = SafeArrayGetUBound(sa, 1, &ind);
2935 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2936 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2939 SafeArrayGetElement(sa, &ind, &var);
2940 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2941 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2944 SafeArrayGetElement(sa, &ind, &var);
2945 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2946 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2949 SafeArrayGetElement(sa, &ind, &var);
2950 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2953 SafeArrayGetElement(sa, &ind, &var);
2954 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2957 SafeArrayGetElement(sa, &ind, &var);
2958 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2959 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2962 SafeArrayGetElement(sa, &ind, &var);
2963 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2964 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2968 return E_FAIL; /* TODO */
2972 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2973 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2977 CHECK_EXPECT2(Exec_Explorer_38);
2978 ok(pvaIn != NULL, "pvaIn == NULL\n");
2979 ok(V_VT(pvaIn) == VT_I4 , "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2980 ok(!V_I4(pvaIn), "V_I4(pvaIn) = %d\n", V_I4(pvaIn));
2981 ok(!pvaOut, "pvaOut != NULL\n");
2983 test_current_url(doc_unk, prev_url);
2987 CHECK_EXPECT2(Exec_Explorer_69);
2988 ok(pvaIn == NULL, "pvaIn != NULL\n");
2989 ok(pvaOut != NULL, "pvaOut == NULL\n");
2991 case 109: /* TODO */
2994 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2999 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
3001 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
3002 SET_EXPECT(SetStatusText);
3003 ok(pvaIn == NULL, "pvaIn != NULL\n");
3004 ok(pvaOut == NULL, "pvaOut != NULL\n");
3006 case OLECMDID_SHOWSCRIPTERROR:
3010 ok(0, "unexpected command %d\n", nCmdID);
3015 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
3019 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
3020 OleCommandTarget_QueryInterface,
3021 OleCommandTarget_AddRef,
3022 OleCommandTarget_Release,
3023 OleCommandTarget_QueryStatus,
3024 OleCommandTarget_Exec
3027 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
3029 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3031 return QueryInterface(riid, ppv);
3034 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3035 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3036 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3038 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
3039 ok(pDispParams != NULL, "pDispParams == NULL\n");
3040 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
3041 ok(puArgErr != NULL, "puArgErr == NULL\n");
3042 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
3043 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
3044 test_readyState(NULL);
3046 switch(dispIdMember) {
3047 case DISPID_AMBIENT_USERMODE:
3048 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
3049 V_VT(pVarResult) = VT_BOOL;
3050 V_BOOL(pVarResult) = VARIANT_TRUE;
3052 case DISPID_AMBIENT_DLCONTROL:
3053 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
3055 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
3056 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3058 case DISPID_AMBIENT_SILENT:
3059 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
3060 V_VT(pVarResult) = VT_BOOL;
3061 V_BOOL(pVarResult) = VARIANT_FALSE;
3063 case DISPID_AMBIENT_USERAGENT:
3064 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
3066 case DISPID_AMBIENT_PALETTE:
3067 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
3071 ok(0, "unexpected dispid %d\n", dispIdMember);
3075 static const IDispatchVtbl DispatchVtbl = {
3076 Dispatch_QueryInterface,
3079 Dispatch_GetTypeInfoCount,
3080 Dispatch_GetTypeInfo,
3081 Dispatch_GetIDsOfNames,
3085 static IDispatch Dispatch = { &DispatchVtbl };
3087 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3089 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
3094 ok(0, "Unexpected call\n");
3095 return E_NOINTERFACE;
3098 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3099 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3100 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3103 IHTMLDocument2 *doc;
3106 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
3107 ok(pDispParams != NULL, "pDispParams == NULL\n");
3108 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3109 ok(puArgErr != NULL, "puArgErr == NULL\n");
3110 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3111 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3113 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3114 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3116 switch(dispIdMember) {
3117 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3118 hres = IHTMLDocument2_get_readyState(doc, &state);
3119 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3121 if(!strcmp_wa(state, "interactive"))
3122 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3123 else if(!strcmp_wa(state, "loading"))
3124 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3125 else if(!strcmp_wa(state, "complete")) {
3126 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3129 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3131 SysFreeString(state);
3133 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3144 break; /* FIXME: Handle these events. */
3146 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3149 IHTMLDocument2_Release(doc);
3153 static const IDispatchVtbl EventDispatchVtbl = {
3154 EventDispatch_QueryInterface,
3157 Dispatch_GetTypeInfoCount,
3158 Dispatch_GetTypeInfo,
3159 Dispatch_GetIDsOfNames,
3160 EventDispatch_Invoke
3163 static IDispatch EventDispatch = { &EventDispatchVtbl };
3165 static HRESULT WINAPI TravelLog_QueryInterface(ITravelLog *iface, REFIID riid, void **ppv)
3167 static const IID IID_IIETravelLog2 = {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3169 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITravelLog, riid)) {
3174 if(!IsEqualGUID(&IID_IIETravelLog2, riid))
3175 ok(0, "unexpected call %s\n", debugstr_guid(riid));
3178 return E_NOINTERFACE;
3181 static ULONG WINAPI TravelLog_AddRef(ITravelLog *iface)
3186 static ULONG WINAPI TravelLog_Release(ITravelLog *iface)
3191 static HRESULT WINAPI TravelLog_AddEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3193 ok(0, "unexpected call\n");
3197 static HRESULT WINAPI TravelLog_UpdateEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3199 ok(0, "unexpected call\n");
3203 static HRESULT WINAPI TravelLog_UpdateExternal(ITravelLog *iface, IUnknown *punk, IUnknown *punkHLBrowseContext)
3205 ok(0, "unexpected call\n");
3209 static HRESULT WINAPI TravelLog_Travel(ITravelLog *iface, IUnknown *punk, int iOffset)
3211 ok(0, "unexpected call\n");
3215 static HRESULT WINAPI TravelLog_GetTravelEntry(ITravelLog *iface, IUnknown *punk, int iOffset, ITravelEntry **ppte)
3217 ok(0, "unexpected call\n");
3221 static HRESULT WINAPI TravelLog_FindTravelEntry(ITravelLog *iface, IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
3223 ok(0, "unexpected call\n");
3227 static HRESULT WINAPI TravelLog_GetTooltipText(ITravelLog *iface, IUnknown *punk, int iOffset, int idsTemplate,
3228 LPWSTR pwzText, DWORD cchText)
3230 ok(0, "unexpected call\n");
3234 static HRESULT WINAPI TravelLog_InsertMenuEntries(ITravelLog *iface, IUnknown *punk, HMENU hmenu, int nPos,
3235 int idFirst, int idLast, DWORD dwFlags)
3237 ok(0, "unexpected call\n");
3241 static HRESULT WINAPI TravelLog_Clone(ITravelLog *iface, ITravelLog **pptl)
3243 ok(0, "unexpected call\n");
3247 static DWORD WINAPI TravelLog_CountEntries(ITravelLog *iface, IUnknown *punk)
3249 CHECK_EXPECT(CountEntries);
3253 static HRESULT WINAPI TravelLog_Revert(ITravelLog *iface)
3255 ok(0, "unexpected call\n");
3259 static const ITravelLogVtbl TravelLogVtbl = {
3260 TravelLog_QueryInterface,
3264 TravelLog_UpdateEntry,
3265 TravelLog_UpdateExternal,
3267 TravelLog_GetTravelEntry,
3268 TravelLog_FindTravelEntry,
3269 TravelLog_GetTooltipText,
3270 TravelLog_InsertMenuEntries,
3272 TravelLog_CountEntries,
3276 static ITravelLog TravelLog = { &TravelLogVtbl };
3278 static HRESULT browserservice_qi(REFIID,void**);
3280 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3282 return browserservice_qi(riid, ppv);
3285 static ULONG WINAPI DocObjectService_AddRef(
3286 IDocObjectService* This)
3291 static ULONG WINAPI DocObjectService_Release(
3292 IDocObjectService* This)
3297 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(IDocObjectService *iface, IDispatch *pDispatch,
3298 LPCWSTR lpszUrl, DWORD dwFlags, LPCWSTR lpszFrameName, BYTE *pPostData, DWORD cbPostData,
3299 LPCWSTR lpszHeaders, BOOL fPlayNavSound, BOOL *pfCancel)
3301 CHECK_EXPECT(FireBeforeNavigate2);
3303 ok(!pDispatch, "pDispatch = %p\n", pDispatch);
3304 ok(!strcmp_wa(lpszUrl, nav_url), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl), nav_url);
3305 ok(dwFlags == 0x40 || !dwFlags, "dwFlags = %x\n", dwFlags);
3306 ok(!lpszFrameName, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName));
3307 ok(!pPostData, "pPostData = %p\n", pPostData);
3308 ok(!cbPostData, "cbPostData = %d\n", cbPostData);
3309 ok(!lpszHeaders, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3310 ok(fPlayNavSound, "fPlayNavSound = %x\n", fPlayNavSound);
3311 ok(pfCancel != NULL, "pfCancel = NULL\n");
3312 ok(!*pfCancel, "*pfCancel = %x\n", *pfCancel);
3317 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3318 IDocObjectService* This,
3319 IHTMLWindow2 *pHTMLWindow2,
3322 CHECK_EXPECT(FireNavigateComplete2);
3323 test_readyState(NULL);
3326 ok(dwFlags == 0x10 || broken(!dwFlags), "dwFlags = %x, expected 0x10\n", dwFlags);
3328 ok(!(dwFlags &~1), "dwFlags = %x\n", dwFlags);
3330 ok(pHTMLWindow2 != NULL, "pHTMLWindow2 = NULL\n");
3335 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3336 IDocObjectService* This)
3338 ok(0, "unexpected call\n");
3342 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3343 IDocObjectService* This)
3345 ok(0, "unexpected call\n");
3349 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3350 IDocObjectService* This,
3351 IHTMLWindow2 *pHTMLWindow,
3354 CHECK_EXPECT(FireDocumentComplete);
3356 ok(pHTMLWindow != NULL, "pHTMLWindow == NULL\n");
3357 ok(!dwFlags, "dwFlags = %x\n", dwFlags);
3362 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3363 IDocObjectService* This,
3364 IHTMLWindow2 *pHTMLWindow)
3366 ok(0, "unexpected call\n");
3370 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3371 IDocObjectService* This,
3372 BSTR *pbstrPendingUrl)
3374 CHECK_EXPECT(GetPendingUrl);
3378 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3379 IDocObjectService* This,
3380 IHTMLElement *pHTMLElement)
3382 CHECK_EXPECT(ActiveElementChanged);
3386 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3387 IDocObjectService* This,
3390 ok(0, "unexpected call\n");
3394 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3395 IDocObjectService* This,
3399 CHECK_EXPECT(IsErrorUrl);
3404 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3405 DocObjectService_QueryInterface,
3406 DocObjectService_AddRef,
3407 DocObjectService_Release,
3408 DocObjectService_FireBeforeNavigate2,
3409 DocObjectService_FireNavigateComplete2,
3410 DocObjectService_FireDownloadBegin,
3411 DocObjectService_FireDownloadComplete,
3412 DocObjectService_FireDocumentComplete,
3413 DocObjectService_UpdateDesktopComponent,
3414 DocObjectService_GetPendingUrl,
3415 DocObjectService_ActiveElementChanged,
3416 DocObjectService_GetUrlSearchComponent,
3417 DocObjectService_IsErrorUrl
3420 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3422 static HRESULT WINAPI ShellBrowser_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppv)
3424 return browserservice_qi(riid, ppv);
3427 static ULONG WINAPI ShellBrowser_AddRef(IShellBrowser *iface)
3432 static ULONG WINAPI ShellBrowser_Release(IShellBrowser *iface)
3437 static HRESULT WINAPI ShellBrowser_GetWindow(IShellBrowser *iface, HWND *phwnd)
3439 ok(0, "unexpected call\n");
3443 static HRESULT WINAPI ShellBrowser_ContextSensitiveHelp(IShellBrowser *iface, BOOL fEnterMode)
3445 ok(0, "unexpected call\n");
3449 static HRESULT WINAPI ShellBrowser_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
3451 ok(0, "unexpected call\n");
3455 static HRESULT WINAPI ShellBrowser_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved,
3456 HWND hwndActiveObject)
3458 ok(0, "unexpected call\n");
3462 static HRESULT WINAPI ShellBrowser_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
3464 ok(0, "unexpected call\n");
3468 static HRESULT WINAPI ShellBrowser_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR pszStatusText)
3470 ok(0, "unexpected call\n");
3474 static HRESULT WINAPI ShellBrowser_EnableModelessSB(IShellBrowser *iface, BOOL fEnable)
3476 ok(0, "unexpected call\n");
3480 static HRESULT WINAPI ShellBrowser_TranslateAcceleratorSB(IShellBrowser *iface, MSG *pmsg, WORD wID)
3482 ok(0, "unexpected call\n");
3486 static HRESULT WINAPI ShellBrowser_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
3488 ok(0, "unexpected call\n");
3492 static HRESULT WINAPI ShellBrowser_GetViewStateStream(IShellBrowser *iface, DWORD grfMode, IStream **ppStrm)
3494 ok(0, "unexpected call\n");
3498 static HRESULT WINAPI ShellBrowser_GetControlWindow(IShellBrowser *iface, UINT id, HWND *phwnd)
3500 ok(0, "unexpected call\n");
3504 static HRESULT WINAPI ShellBrowser_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam,
3505 LPARAM lParam, LRESULT *pret)
3507 ok(0, "unexpected call\n");
3511 static HRESULT WINAPI ShellBrowser_QueryActiveShellView(IShellBrowser *iface, IShellView **ppshv)
3513 ok(0, "unexpected call\n");
3517 static HRESULT WINAPI ShellBrowser_OnViewWindowActive(IShellBrowser* iface, IShellView *pshv)
3519 ok(0, "unexpected call\n");
3523 static HRESULT WINAPI ShellBrowser_SetToolbarItems(IShellBrowser *iface, LPTBBUTTONSB lpButtons,
3524 UINT nButtons, UINT uFlags)
3526 ok(0, "unexpected call\n");
3530 static const IShellBrowserVtbl ShellBrowserVtbl = {
3531 ShellBrowser_QueryInterface,
3532 ShellBrowser_AddRef,
3533 ShellBrowser_Release,
3534 ShellBrowser_GetWindow,
3535 ShellBrowser_ContextSensitiveHelp,
3536 ShellBrowser_InsertMenusSB,
3537 ShellBrowser_SetMenuSB,
3538 ShellBrowser_RemoveMenusSB,
3539 ShellBrowser_SetStatusTextSB,
3540 ShellBrowser_EnableModelessSB,
3541 ShellBrowser_TranslateAcceleratorSB,
3542 ShellBrowser_BrowseObject,
3543 ShellBrowser_GetViewStateStream,
3544 ShellBrowser_GetControlWindow,
3545 ShellBrowser_SendControlMsg,
3546 ShellBrowser_QueryActiveShellView,
3547 ShellBrowser_OnViewWindowActive,
3548 ShellBrowser_SetToolbarItems
3551 static IShellBrowser ShellBrowser = { &ShellBrowserVtbl };
3553 static HRESULT WINAPI BrowserService_QueryInterface(IBrowserService *iface, REFIID riid, void **ppv)
3555 return browserservice_qi(riid, ppv);
3558 static ULONG WINAPI BrowserService_AddRef(
3559 IBrowserService* This)
3564 static ULONG WINAPI BrowserService_Release(
3565 IBrowserService* This)
3570 static HRESULT WINAPI BrowserService_GetParentSite(
3571 IBrowserService* This,
3572 IOleInPlaceSite **ppipsite)
3574 ok(0, "unexpected call\n");
3578 static HRESULT WINAPI BrowserService_SetTitle(
3579 IBrowserService* This,
3583 ok(0, "unexpected call\n");
3587 static HRESULT WINAPI BrowserService_GetTitle(
3588 IBrowserService* This,
3593 ok(0, "unexpected call\n");
3597 static HRESULT WINAPI BrowserService_GetOleObject(
3598 IBrowserService* This,
3599 IOleObject **ppobjv)
3601 ok(0, "unexpected call\n");
3605 static HRESULT WINAPI BrowserService_GetTravelLog(IBrowserService* This, ITravelLog **pptl)
3607 CHECK_EXPECT(GetTravelLog);
3609 ok(pptl != NULL, "pptl = NULL\n");
3618 static HRESULT WINAPI BrowserService_ShowControlWindow(
3619 IBrowserService* This,
3623 ok(0, "unexpected call\n");
3627 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3628 IBrowserService* This,
3632 ok(0, "unexpected call\n");
3636 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3637 IBrowserService* This,
3638 PCIDLIST_ABSOLUTE pidl,
3642 ok(0, "unexpected call\n");
3646 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3647 IBrowserService* This,
3650 PIDLIST_ABSOLUTE *ppidlOut)
3652 ok(0, "unexpected call\n");
3656 static HRESULT WINAPI BrowserService_DisplayParseError(
3657 IBrowserService* This,
3661 ok(0, "unexpected call\n");
3665 static HRESULT WINAPI BrowserService_NavigateToPidl(
3666 IBrowserService* This,
3667 PCIDLIST_ABSOLUTE pidl,
3670 ok(0, "unexpected call\n");
3674 static HRESULT WINAPI BrowserService_SetNavigateState(
3675 IBrowserService* This,
3678 ok(0, "unexpected call\n");
3682 static HRESULT WINAPI BrowserService_GetNavigateState(
3683 IBrowserService* This,
3686 ok(0, "unexpected call\n");
3690 static HRESULT WINAPI BrowserService_NotifyRedirect(
3691 IBrowserService* This,
3693 PCIDLIST_ABSOLUTE pidl,
3696 ok(0, "unexpected call\n");
3700 static HRESULT WINAPI BrowserService_UpdateWindowList(
3701 IBrowserService* This)
3703 ok(0, "unexpected call\n");
3707 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3708 IBrowserService* This)
3710 CHECK_EXPECT(UpdateBackForwardState);
3714 static HRESULT WINAPI BrowserService_SetFlags(
3715 IBrowserService* This,
3719 ok(0, "unexpected call\n");
3723 static HRESULT WINAPI BrowserService_GetFlags(
3724 IBrowserService* This,
3727 ok(0, "unexpected call\n");
3731 static HRESULT WINAPI BrowserService_CanNavigateNow(
3732 IBrowserService* This)
3734 ok(0, "unexpected call\n");
3738 static HRESULT WINAPI BrowserService_GetPidl(
3739 IBrowserService* This,
3740 PIDLIST_ABSOLUTE *ppidl)
3742 ok(0, "unexpected call\n");
3746 static HRESULT WINAPI BrowserService_SetReferrer(
3747 IBrowserService* This,
3748 PCIDLIST_ABSOLUTE pidl)
3750 ok(0, "unexpected call\n");
3754 static DWORD WINAPI BrowserService_GetBrowserIndex(
3755 IBrowserService* This)
3757 ok(0, "unexpected call\n");
3761 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3762 IBrowserService* This,
3766 ok(0, "unexpected call\n");
3770 static HRESULT WINAPI BrowserService_GetHistoryObject(
3771 IBrowserService* This,
3776 ok(0, "unexpected call\n");
3780 static HRESULT WINAPI BrowserService_SetHistoryObject(
3781 IBrowserService* This,
3783 BOOL fIsLocalAnchor)
3785 ok(0, "unexpected call\n");
3789 static HRESULT WINAPI BrowserService_CacheOLEServer(
3790 IBrowserService* This,
3793 ok(0, "unexpected call\n");
3797 static HRESULT WINAPI BrowserService_GetSetCodePage(
3798 IBrowserService* This,
3802 ok(0, "unexpected call\n");
3806 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3807 IBrowserService* This,
3811 VARIANT *pvarargOut)
3813 ok(0, "unexpected call\n");
3817 static HRESULT WINAPI BrowserService_GetPalette(
3818 IBrowserService* This,
3821 ok(0, "unexpected call\n");
3825 static HRESULT WINAPI BrowserService_RegisterWindow(
3826 IBrowserService* This,
3827 BOOL fForceRegister,
3830 ok(0, "unexpected call\n");
3834 static IBrowserServiceVtbl BrowserServiceVtbl = {
3835 BrowserService_QueryInterface,
3836 BrowserService_AddRef,
3837 BrowserService_Release,
3838 BrowserService_GetParentSite,
3839 BrowserService_SetTitle,
3840 BrowserService_GetTitle,
3841 BrowserService_GetOleObject,
3842 BrowserService_GetTravelLog,
3843 BrowserService_ShowControlWindow,
3844 BrowserService_IsControlWindowShown,
3845 BrowserService_IEGetDisplayName,
3846 BrowserService_IEParseDisplayName,
3847 BrowserService_DisplayParseError,
3848 BrowserService_NavigateToPidl,
3849 BrowserService_SetNavigateState,
3850 BrowserService_GetNavigateState,
3851 BrowserService_NotifyRedirect,
3852 BrowserService_UpdateWindowList,
3853 BrowserService_UpdateBackForwardState,
3854 BrowserService_SetFlags,
3855 BrowserService_GetFlags,
3856 BrowserService_CanNavigateNow,
3857 BrowserService_GetPidl,
3858 BrowserService_SetReferrer,
3859 BrowserService_GetBrowserIndex,
3860 BrowserService_GetBrowserByIndex,
3861 BrowserService_GetHistoryObject,
3862 BrowserService_SetHistoryObject,
3863 BrowserService_CacheOLEServer,
3864 BrowserService_GetSetCodePage,
3865 BrowserService_OnHttpEquiv,
3866 BrowserService_GetPalette,
3867 BrowserService_RegisterWindow
3870 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3872 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3874 static HRESULT browserservice_qi(REFIID riid, void **ppv)
3876 if(IsEqualGUID(&IID_IShellBrowser, riid)) {
3877 *ppv = &ShellBrowser;
3881 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3882 *ppv = &DocObjectService;
3886 if(IsEqualGUID(&IID_IBrowserService, riid)) {
3887 *ppv = &BrowserService;
3892 return E_NOINTERFACE;
3895 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, void **ppv)
3899 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IWebBrowser, riid)
3900 || IsEqualGUID(&IID_IWebBrowserApp, riid) || IsEqualGUID(&IID_IWebBrowser2, riid)) {
3905 if(IsEqualGUID(riid, &IID_IOleObject))
3906 return E_NOINTERFACE; /* TODO */
3908 ok(0, "unexpected call %s\n", debugstr_guid(riid));
3909 return E_NOINTERFACE;
3912 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
3917 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
3922 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
3924 ok(0, "unexpected call\n");
3928 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
3929 LPTYPEINFO *ppTInfo)
3931 ok(0, "unexpected call\n");
3935 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
3936 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
3938 ok(0, "unexpected call\n");
3942 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
3943 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3944 EXCEPINFO *pExepInfo, UINT *puArgErr)
3946 ok(0, "unexpected call\n");
3950 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
3952 ok(0, "unexpected call\n");
3956 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
3958 ok(0, "unexpected call\n");
3962 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
3964 ok(0, "unexpected call\n");
3968 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
3970 ok(0, "unexpected call\n");
3974 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
3975 VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3977 ok(0, "unexpected call\n");
3981 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
3983 ok(0, "unexpected call\n");
3987 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
3989 ok(0, "unexpected call\n");
3993 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
3995 ok(0, "unexpected call\n");
3999 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
4001 ok(0, "unexpected call\n");
4005 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
4007 ok(0, "unexpected call\n");
4011 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
4013 ok(0, "unexpected call\n");
4017 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
4019 ok(0, "unexpected call\n");
4023 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4025 ok(0, "unexpected call\n");
4029 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
4031 ok(0, "unexpected call\n");
4035 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
4037 ok(0, "unexpected call\n");
4041 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
4043 ok(0, "unexpected call\n");
4047 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
4049 ok(0, "unexpected call\n");
4053 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
4055 ok(0, "unexpected call\n");
4059 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
4061 ok(0, "unexpected call\n");
4065 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
4067 ok(0, "unexpected call\n");
4071 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
4073 ok(0, "unexpected call\n");
4077 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
4079 ok(0, "unexpected call\n");
4083 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
4085 ok(0, "unexpected call\n");
4089 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
4091 CHECK_EXPECT(get_LocationURL);
4095 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4097 ok(0, "unexpected call\n");
4101 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
4103 ok(0, "unexpected call\n");
4107 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
4109 ok(0, "unexpected call\n");
4113 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
4115 ok(0, "unexpected call\n");
4119 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
4121 ok(0, "unexpected call\n");
4125 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
4127 ok(0, "unexpected call\n");
4131 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, LONG *pHWND)
4133 ok(0, "unexpected call\n");
4137 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
4139 ok(0, "unexpected call\n");
4143 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
4145 ok(0, "unexpected call\n");
4149 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4151 ok(0, "unexpected call\n");
4155 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
4157 ok(0, "unexpected call\n");
4161 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4163 ok(0, "unexpected call\n");
4167 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4169 ok(0, "unexpected call\n");
4173 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
4175 ok(0, "unexpected call\n");
4179 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
4181 ok(0, "unexpected call\n");
4185 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
4187 ok(0, "unexpected call\n");
4191 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
4193 ok(0, "unexpected call\n");
4197 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4199 ok(0, "unexpected call\n");
4203 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4205 ok(0, "unexpected call\n");
4209 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
4211 ok(0, "unexpected call\n");
4215 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
4217 ok(0, "unexpected call\n");
4221 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
4222 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
4224 ok(0, "unexpected call\n");
4228 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
4230 ok(0, "unexpected call\n");
4234 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
4235 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
4237 ok(0, "unexpected call\n");
4241 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
4242 VARIANT *pvarShow, VARIANT *pvarSize)
4244 ok(0, "unexpected call\n");
4248 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
4250 ok(0, "unexpected call\n");
4254 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
4256 ok(0, "unexpected call\n");
4260 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
4262 ok(0, "unexpected call\n");
4266 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
4268 ok(0, "unexpected call\n");
4272 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
4274 ok(0, "unexpected call\n");
4278 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
4279 VARIANT_BOOL *pbRegister)
4281 ok(0, "unexpected call\n");
4285 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
4286 VARIANT_BOOL bRegister)
4288 ok(0, "unexpected call\n");
4292 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
4293 VARIANT_BOOL *pbRegister)
4295 ok(0, "unexpected call\n");
4299 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
4300 VARIANT_BOOL bRegister)
4302 ok(0, "unexpected call\n");
4306 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
4308 ok(0, "unexpected call\n");
4312 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
4314 ok(0, "unexpected call\n");
4318 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4320 ok(0, "unexpected call\n");
4324 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4326 ok(0, "unexpected call\n");
4330 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4332 ok(0, "unexpected call\n");
4336 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
4338 ok(0, "unexpected call\n");
4342 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
4344 WebBrowser_QueryInterface,
4347 WebBrowser_GetTypeInfoCount,
4348 WebBrowser_GetTypeInfo,
4349 WebBrowser_GetIDsOfNames,
4352 WebBrowser_GoForward,
4354 WebBrowser_GoSearch,
4355 WebBrowser_Navigate,
4357 WebBrowser_Refresh2,
4359 WebBrowser_get_Application,
4360 WebBrowser_get_Parent,
4361 WebBrowser_get_Container,
4362 WebBrowser_get_Document,
4363 WebBrowser_get_TopLevelContainer,
4364 WebBrowser_get_Type,
4365 WebBrowser_get_Left,
4366 WebBrowser_put_Left,
4369 WebBrowser_get_Width,
4370 WebBrowser_put_Width,
4371 WebBrowser_get_Height,
4372 WebBrowser_put_Height,
4373 WebBrowser_get_LocationName,
4374 WebBrowser_get_LocationURL,
4375 WebBrowser_get_Busy,
4377 WebBrowser_ClientToWindow,
4378 WebBrowser_PutProperty,
4379 WebBrowser_GetProperty,
4380 WebBrowser_get_Name,
4381 WebBrowser_get_HWND,
4382 WebBrowser_get_FullName,
4383 WebBrowser_get_Path,
4384 WebBrowser_get_Visible,
4385 WebBrowser_put_Visible,
4386 WebBrowser_get_StatusBar,
4387 WebBrowser_put_StatusBar,
4388 WebBrowser_get_StatusText,
4389 WebBrowser_put_StatusText,
4390 WebBrowser_get_ToolBar,
4391 WebBrowser_put_ToolBar,
4392 WebBrowser_get_MenuBar,
4393 WebBrowser_put_MenuBar,
4394 WebBrowser_get_FullScreen,
4395 WebBrowser_put_FullScreen,
4396 WebBrowser_Navigate2,
4397 WebBrowser_QueryStatusWB,
4399 WebBrowser_ShowBrowserBar,
4400 WebBrowser_get_ReadyState,
4401 WebBrowser_get_Offline,
4402 WebBrowser_put_Offline,
4403 WebBrowser_get_Silent,
4404 WebBrowser_put_Silent,
4405 WebBrowser_get_RegisterAsBrowser,
4406 WebBrowser_put_RegisterAsBrowser,
4407 WebBrowser_get_RegisterAsDropTarget,
4408 WebBrowser_put_RegisterAsDropTarget,
4409 WebBrowser_get_TheaterMode,
4410 WebBrowser_put_TheaterMode,
4411 WebBrowser_get_AddressBar,
4412 WebBrowser_put_AddressBar,
4413 WebBrowser_get_Resizable,
4414 WebBrowser_put_Resizable
4417 static IWebBrowser2 WebBrowser2 = { &WebBrowser2Vtbl };
4419 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
4420 REFIID riid, void **ppv)
4422 return QueryInterface(riid, ppv);
4425 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
4430 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
4435 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
4436 REFIID riid, void **ppv)
4439 * Services used by HTMLDocument:
4442 * IInternetSecurityManager
4444 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
4447 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
4448 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
4449 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
4451 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
4452 * IElementBehaviorFactory
4453 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
4462 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
4463 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
4468 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
4469 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
4470 *ppv = &NewWindowManager;
4474 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
4475 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
4476 *ppv = &BrowserService;
4480 if(support_wbapp && IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
4481 if(IsEqualGUID(riid, &IID_IWebBrowser2)) {
4482 *ppv = &WebBrowser2;
4485 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4488 return E_NOINTERFACE;
4491 static const IServiceProviderVtbl ServiceProviderVtbl = {
4492 ServiceProvider_QueryInterface,
4493 ServiceProvider_AddRef,
4494 ServiceProvider_Release,
4495 ServiceProvider_QueryService
4498 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
4500 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
4501 REFIID riid, void **ppv)
4503 return QueryInterface(riid, ppv);
4506 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
4511 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
4516 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
4517 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
4519 ok(0, "unexpected call\n");
4522 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
4523 DWORD dwAspect, LONG lindex)
4525 ok(0, "unexpected call\n");
4528 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
4530 ok(0, "unexpected call\n");
4533 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
4535 ok(0, "unexpected call\n");
4538 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
4540 ok(0, "unexpected call\n");
4543 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
4545 ok(0, "unexpected call\n");
4548 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
4550 CHECK_EXPECT(Advise_Close);
4553 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
4554 AdviseSink_QueryInterface,
4557 AdviseSink_OnDataChange,
4558 AdviseSink_OnViewChange,
4559 AdviseSink_OnRename,
4561 ObjectAdviseSink_OnClose,
4562 AdviseSinkEx_OnViewStatusChange
4565 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
4567 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
4568 REFIID riid, void **ppv)
4570 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
4575 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4577 return E_NOINTERFACE;
4580 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
4581 DWORD dwAspect, LONG lindex)
4583 CHECK_EXPECT2(OnViewChange);
4585 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
4586 ok(lindex == -1, "lindex = %d\n", lindex);
4589 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
4590 ViewAdviseSink_QueryInterface,
4593 AdviseSink_OnDataChange,
4594 ViewAdviseSink_OnViewChange,
4595 AdviseSink_OnRename,
4598 AdviseSinkEx_OnViewStatusChange
4601 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
4603 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
4604 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
4605 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
4606 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
4607 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
4609 static HRESULT QueryInterface(REFIID riid, void **ppv)
4613 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
4615 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
4616 *ppv = &DocumentSite;
4617 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
4618 *ppv = &DocHostUIHandler;
4619 else if(IsEqualGUID(&IID_IOleContainer, riid))
4620 *ppv = &OleContainer;
4621 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
4622 *ppv = &InPlaceSiteWindowless;
4623 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
4624 *ppv = &OleCommandTarget;
4625 else if(IsEqualGUID(&IID_IDispatch, riid))
4627 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4628 *ppv = &ServiceProvider;
4629 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
4630 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
4631 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
4632 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
4633 else if(IsEqualGUID(&IID_IOleControlSite, riid))
4634 *ppv = &OleControlSite;
4635 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
4636 return E_NOINTERFACE; /* TODO */
4637 else if(IsEqualGUID(&IID_IProxyManager, riid))
4638 return E_NOINTERFACE; /* ? */
4639 else if(IsEqualGUID(&IID_unk1, riid))
4640 return E_NOINTERFACE; /* HTMLWindow2 ? */
4641 else if(IsEqualGUID(&IID_IThumbnailView, riid))
4642 return E_NOINTERFACE; /* ? */
4643 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
4644 return E_NOINTERFACE; /* ? */
4645 else if(IsEqualGUID(&IID_unk4, riid))
4646 return E_NOINTERFACE; /* ? */
4647 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
4648 return E_NOINTERFACE; /* ? */
4650 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4654 return E_NOINTERFACE;
4657 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4659 if(msg == WM_CONTINUE_BINDING) {
4660 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
4661 continue_binding(callback);
4664 return DefWindowProc(hwnd, msg, wParam, lParam);
4667 static void test_doscroll(IUnknown *unk)
4669 IHTMLDocument3 *doc;
4670 IHTMLElement2 *elem2;
4675 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
4676 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
4680 hres = IHTMLDocument3_get_documentElement(doc, &elem);
4681 IHTMLDocument3_Release(doc);
4682 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
4683 switch(load_state) {
4687 ok(!elem, "elem != NULL\n");
4690 case LD_INTERACTIVE:
4692 ok(elem != NULL, "elem == NULL\n");
4697 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4698 IHTMLElement_Release(elem);
4699 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4702 V_BSTR(&v) = a2bstr("left");
4703 hres = IHTMLElement2_doScroll(elem2, v);
4704 SysFreeString(V_BSTR(&v));
4705 IHTMLElement2_Release(elem2);
4707 if(inplace_deactivated)
4708 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
4709 else if(load_state == LD_COMPLETE)
4710 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
4712 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
4715 static void _test_readyState(unsigned line, IUnknown *unk)
4717 IHTMLDocument2 *htmldoc;
4718 DISPPARAMS dispparams;
4724 static const LPCSTR expected_state[] = {
4739 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
4740 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
4744 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
4745 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
4747 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
4748 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
4750 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
4751 load_state = LD_INTERACTIVE;
4754 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
4755 wine_dbgstr_w(state), load_state);
4756 SysFreeString(state);
4758 hres = IHTMLDocument2_get_body(htmldoc, &elem);
4759 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
4761 IHTMLElement2 *elem2;
4764 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4765 IHTMLElement_Release(elem);
4766 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4768 hres = IHTMLElement2_get_readyState(elem2, &var);
4769 IHTMLElement2_Release(elem2);
4770 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
4771 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
4772 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
4775 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
4778 dispparams.cArgs = 0;
4779 dispparams.cNamedArgs = 0;
4780 dispparams.rgdispidNamedArgs = NULL;
4781 dispparams.rgvarg = NULL;
4785 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
4786 &dispparams, &out, NULL, NULL);
4787 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
4789 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
4790 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
4792 test_doscroll((IUnknown*)htmldoc);
4794 IHTMLDocument2_Release(htmldoc);
4797 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
4802 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
4803 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
4805 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
4806 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
4808 IViewObject_Release(view);
4811 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
4813 IConnectionPointContainer *tmp_container = NULL;
4814 IConnectionPoint *cp;
4819 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
4820 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
4824 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
4825 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
4826 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
4828 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
4829 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
4831 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
4832 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
4833 ok(tmp_container == container, "container != tmp_container\n");
4835 IConnectionPointContainer_Release(tmp_container);
4837 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
4838 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
4840 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
4841 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
4842 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4843 hres = IConnectionPoint_Unadvise(cp, cookie);
4844 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
4845 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, NULL);
4846 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4847 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
4848 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
4849 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4852 IConnectionPoint_Release(cp);
4855 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
4857 IConnectionPointContainer *container;
4860 hres = IHTMLDocument2_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
4861 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
4865 test_ConnectionPoint(container, &IID_IDispatch);
4866 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
4867 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
4868 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
4870 IConnectionPointContainer_Release(container);
4873 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
4875 ICustomDoc *custom_doc;
4878 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
4879 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
4881 expect_uihandler_iface = uihandler;
4883 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
4884 ICustomDoc_Release(custom_doc);
4885 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
4888 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
4892 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
4894 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
4896 test_readyState((IUnknown*)persist);
4900 CreateBindCtx(0, &bind);
4901 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
4902 (IUnknown*)&ClientSite);
4905 SET_EXPECT(GetDisplayName);
4906 if(!set_clientsite) {
4907 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4908 SET_EXPECT(GetHostInfo);
4909 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4910 SET_EXPECT(Invoke_AMBIENT_SILENT);
4911 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4912 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4913 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4914 SET_EXPECT(GetOptionKeyPath);
4915 SET_EXPECT(GetOverrideKeyPath);
4916 SET_EXPECT(GetWindow);
4917 SET_EXPECT(Exec_DOCCANNAVIGATE);
4918 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4919 SET_EXPECT(Exec_SETPROGRESSMAX);
4920 SET_EXPECT(Exec_SETPROGRESSPOS);
4921 SET_EXPECT(Exec_ShellDocView_37);
4923 if(!container_locked) {
4924 SET_EXPECT(GetContainer);
4925 SET_EXPECT(LockContainer);
4927 SET_EXPECT(OnChanged_READYSTATE);
4928 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4929 SET_EXPECT(IsSystemMoniker);
4931 SET_EXPECT(BindToStorage);
4932 SET_EXPECT(SetActiveObject);
4933 if(set_clientsite) {
4934 SET_EXPECT(Invoke_AMBIENT_SILENT);
4935 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4936 SET_EXPECT(Exec_ShellDocView_37);
4937 SET_EXPECT(IsErrorUrl);
4939 SET_EXPECT(GetTravelLog);
4941 SET_EXPECT(Exec_ShellDocView_84);
4942 SET_EXPECT(GetPendingUrl);
4943 load_state = LD_DOLOAD;
4944 expect_LockContainer_fLock = TRUE;
4945 readystate_set_loading = TRUE;
4947 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
4948 ok(hres == S_OK, "Load failed: %08x\n", hres);
4951 CHECK_CALLED(GetDisplayName);
4952 if(!set_clientsite) {
4953 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4954 CHECK_CALLED(GetHostInfo);
4955 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4956 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4957 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4958 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4959 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
4960 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
4961 CHECK_CALLED(GetOverrideKeyPath);
4962 CHECK_CALLED(GetWindow);
4963 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4964 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4965 CHECK_CALLED(Exec_SETPROGRESSMAX);
4966 CHECK_CALLED(Exec_SETPROGRESSPOS);
4967 CHECK_CALLED(Exec_ShellDocView_37);
4969 if(!container_locked) {
4970 CHECK_CALLED(GetContainer);
4971 CHECK_CALLED(LockContainer);
4972 container_locked = TRUE;
4974 CHECK_CALLED(OnChanged_READYSTATE);
4975 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4976 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
4978 CHECK_CALLED(BindToStorage);
4979 CLEAR_CALLED(SetActiveObject); /* FIXME */
4980 if(set_clientsite) {
4981 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4982 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4983 CHECK_CALLED(Exec_ShellDocView_37);
4984 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4986 todo_wine CHECK_CALLED(GetTravelLog);
4988 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
4989 todo_wine CHECK_CALLED(GetPendingUrl);
4991 set_clientsite = container_locked = TRUE;
4993 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
4995 IBindCtx_Release(bind);
4997 test_readyState((IUnknown*)persist);
5000 #define DWL_VERBDONE 0x0001
5001 #define DWL_CSS 0x0002
5002 #define DWL_TRYCSS 0x0004
5003 #define DWL_HTTP 0x0008
5004 #define DWL_EMPTY 0x0010
5005 #define DWL_JAVASCRIPT 0x0020
5006 #define DWL_ONREADY_LOADING 0x0040
5007 #define DWL_EXPECT_HISTUPDATE 0x0080
5009 static void test_download(DWORD flags)
5011 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
5016 b = is_js ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Exec_HTTPEQUIV_DONE;
5018 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
5019 ok(hwnd != NULL, "Could not find hidden window\n");
5021 test_readyState(NULL);
5023 if(flags & (DWL_VERBDONE|DWL_HTTP))
5024 SET_EXPECT(Exec_SETPROGRESSMAX);
5025 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js)
5026 SET_EXPECT(GetHostInfo);
5027 SET_EXPECT(SetStatusText);
5028 if(!(flags & DWL_EMPTY))
5029 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
5031 SET_EXPECT(GetExternal);
5032 SET_EXPECT(OnViewChange);
5033 SET_EXPECT(GetDropTarget);
5034 if((flags & DWL_TRYCSS) && !(flags & DWL_EMPTY))
5035 SET_EXPECT(Exec_ShellDocView_84);
5036 if(flags & DWL_CSS) {
5037 SET_EXPECT(CreateInstance);
5039 SET_EXPECT(LockRequest);
5040 SET_EXPECT(Terminate);
5041 SET_EXPECT(Protocol_Read);
5042 SET_EXPECT(UnlockRequest);
5044 if(flags & DWL_ONREADY_LOADING)
5045 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5046 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
5047 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
5049 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
5050 SET_EXPECT(Exec_Explorer_69);
5051 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
5052 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
5053 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
5054 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
5055 if((nav_url && !is_js) || (flags & (DWL_CSS|DWL_HTTP)))
5056 SET_EXPECT(Exec_ShellDocView_37);
5057 if(flags & DWL_HTTP) {
5058 SET_EXPECT(OnChanged_1012);
5059 SET_EXPECT(Exec_HTTPEQUIV);
5060 SET_EXPECT(Exec_SETTITLE);
5063 SET_EXPECT(OnChanged_1005);
5064 SET_EXPECT(OnChanged_READYSTATE);
5065 SET_EXPECT(Exec_SETPROGRESSPOS);
5066 if(!(flags & DWL_EMPTY))
5067 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
5068 SET_EXPECT(Exec_ShellDocView_103);
5069 SET_EXPECT(Exec_ShellDocView_105);
5070 SET_EXPECT(Exec_ShellDocView_140);
5072 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
5073 if(support_wbapp) /* Called on some Vista installations */
5074 SET_EXPECT(CountEntries);
5075 SET_EXPECT(Exec_HTTPEQUIV_DONE);
5077 SET_EXPECT(SetStatusText);
5078 if(nav_url || support_wbapp) {
5079 SET_EXPECT(UpdateUI);
5080 SET_EXPECT(Exec_UPDATECOMMANDS);
5081 SET_EXPECT(Exec_SETTITLE);
5082 if(flags & DWL_EXPECT_HISTUPDATE)
5083 SET_EXPECT(Exec_Explorer_38);
5084 SET_EXPECT(UpdateBackForwardState);
5088 if(!(flags & DWL_EMPTY))
5089 SET_EXPECT(FireNavigateComplete2);
5090 SET_EXPECT(FireDocumentComplete);
5092 SET_EXPECT(ActiveElementChanged);
5094 SET_EXPECT(IsErrorUrl);
5095 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
5097 while(!*b && GetMessage(&msg, NULL, 0, 0)) {
5098 TranslateMessage(&msg);
5099 DispatchMessage(&msg);
5102 if(flags & DWL_VERBDONE)
5103 CHECK_CALLED(Exec_SETPROGRESSMAX);
5104 if(flags & DWL_HTTP)
5105 SET_CALLED(Exec_SETPROGRESSMAX);
5106 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js) {
5108 todo_wine CHECK_CALLED(GetHostInfo);
5110 CHECK_CALLED(GetHostInfo);
5112 CHECK_CALLED(SetStatusText);
5113 if(!(flags & DWL_EMPTY))
5114 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
5116 CHECK_CALLED(GetExternal);
5117 CHECK_CALLED(OnViewChange);
5118 CLEAR_CALLED(GetDropTarget);
5119 if((flags & DWL_TRYCSS) && !(flags & DWL_EMPTY))
5120 todo_wine CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5121 if(flags & DWL_CSS) {
5122 CHECK_CALLED(CreateInstance);
5123 CHECK_CALLED(Start);
5124 CHECK_CALLED(LockRequest);
5125 CHECK_CALLED(Terminate);
5126 CHECK_CALLED(Protocol_Read);
5127 CHECK_CALLED(UnlockRequest);
5129 if(flags & DWL_ONREADY_LOADING)
5130 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5131 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
5132 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
5134 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
5135 SET_CALLED(Exec_Explorer_69);
5136 SET_CALLED(EnableModeless_TRUE); /* IE7 */
5137 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
5138 SET_CALLED(EnableModeless_FALSE); /* IE7 */
5139 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
5140 if(nav_url && !is_js)
5141 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
5142 else if(flags & (DWL_CSS|DWL_HTTP))
5143 CLEAR_CALLED(Exec_ShellDocView_37); /* Called by IE9 */
5144 if(flags & DWL_HTTP) {
5145 todo_wine CHECK_CALLED(OnChanged_1012);
5146 todo_wine CHECK_CALLED(Exec_HTTPEQUIV);
5147 todo_wine CHECK_CALLED(Exec_SETTITLE);
5150 CHECK_CALLED(OnChanged_1005);
5151 CHECK_CALLED(OnChanged_READYSTATE);
5152 CHECK_CALLED(Exec_SETPROGRESSPOS);
5154 CLEAR_CALLED(OnChanged_READYSTATE); /* sometimes called */
5155 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
5157 if(!(flags & DWL_EMPTY))
5158 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
5159 CLEAR_CALLED(Exec_ShellDocView_103);
5160 CLEAR_CALLED(Exec_ShellDocView_105);
5161 CLEAR_CALLED(Exec_ShellDocView_140);
5163 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
5164 if(support_wbapp) /* Called on some Vista installations */
5165 CLEAR_CALLED(CountEntries);
5166 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
5168 SET_CALLED(SetStatusText);
5169 if(nav_url || support_wbapp) { /* avoiding race, FIXME: find better way */
5170 CLEAR_CALLED(UpdateUI);
5171 CLEAR_CALLED(Exec_UPDATECOMMANDS);
5172 CLEAR_CALLED(Exec_SETTITLE);
5173 if(flags & DWL_EXPECT_HISTUPDATE)
5174 CHECK_CALLED(Exec_Explorer_38);
5175 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
5179 if(!(flags & DWL_EMPTY)) {
5181 CHECK_CALLED(FireNavigateComplete2);
5183 todo_wine CHECK_CALLED(FireNavigateComplete2);
5185 CHECK_CALLED(FireDocumentComplete);
5187 todo_wine CHECK_CALLED(ActiveElementChanged);
5189 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
5191 load_state = LD_COMPLETE;
5193 test_readyState(NULL);
5196 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
5198 IPersistMoniker *persist_mon;
5199 IPersistFile *persist_file;
5203 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
5204 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
5205 if(SUCCEEDED(hres)) {
5206 hres = IPersistFile_GetClassID(persist_file, NULL);
5207 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5209 hres = IPersistFile_GetClassID(persist_file, &guid);
5210 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5211 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5213 IPersistFile_Release(persist_file);
5216 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
5217 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
5218 if(SUCCEEDED(hres)) {
5219 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
5220 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5222 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
5223 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5224 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5226 if(load_state == LD_DOLOAD)
5227 test_Load(persist_mon, mon);
5229 test_readyState((IUnknown*)doc);
5231 IPersistMoniker_Release(persist_mon);
5235 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const char *href, const char *new_nav_url, BOOL is_js,
5236 BOOL is_hash, DWORD dwl_flags)
5238 const char *prev_nav_url = NULL;
5239 IHTMLPrivateWindow *priv_window;
5240 IHTMLLocation *location;
5241 IHTMLWindow2 *window;
5245 trace("put_href %s...\n", new_nav_url);
5248 loading_hash = is_hash;
5251 hres = IHTMLDocument2_get_location(doc, &location);
5252 ok(hres == S_OK, "get_location failed: %08x\n", hres);
5253 ok(location != NULL, "location == NULL\n");
5255 prev_url = prev_nav_url = nav_url;
5256 nav_url = new_nav_url;
5258 nav_serv_url = new_nav_url;
5263 SET_EXPECT(TranslateUrl);
5265 SET_EXPECT(FireBeforeNavigate2);
5266 SET_EXPECT(Exec_ShellDocView_67);
5268 SET_EXPECT(Invoke_AMBIENT_SILENT);
5269 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5270 SET_EXPECT(Exec_ShellDocView_63);
5271 SET_EXPECT(Exec_ShellDocView_84);
5273 SET_EXPECT(FireNavigateComplete2);
5274 SET_EXPECT(FireDocumentComplete);
5277 SET_EXPECT(Navigate);
5280 hres = IHTMLLocation_replace(location, str);
5281 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5283 hres = IHTMLLocation_put_href(location, str);
5284 if(is_js && hres == E_ACCESSDENIED)
5285 win_skip("put_href: got E_ACCESSDENIED\n");
5287 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5291 CHECK_CALLED(TranslateUrl);
5293 CHECK_CALLED(FireBeforeNavigate2);
5294 CHECK_CALLED(Exec_ShellDocView_67);
5296 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5297 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5298 CHECK_CALLED(Exec_ShellDocView_63);
5299 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5301 CHECK_CALLED(FireNavigateComplete2);
5302 CHECK_CALLED(FireDocumentComplete);
5305 CHECK_CALLED(Navigate);
5308 CLEAR_CALLED(TranslateUrl);
5310 CLEAR_CALLED(FireBeforeNavigate2);
5311 SET_CALLED(Exec_ShellDocView_67);
5313 CLEAR_CALLED(Invoke_AMBIENT_SILENT);
5314 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5315 CLEAR_CALLED(Exec_ShellDocView_63);
5316 todo_wine CLEAR_CALLED(Exec_ShellDocView_84);
5318 CLEAR_CALLED(FireNavigateComplete2);
5319 CLEAR_CALLED(FireDocumentComplete);
5322 CLEAR_CALLED(Navigate);
5326 IHTMLLocation_Release(location);
5328 if(is_js && hres == E_ACCESSDENIED) {
5329 nav_url = prev_nav_url;
5333 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5334 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5336 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
5337 IHTMLWindow2_Release(window);
5338 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
5340 if(!support_wbapp) {
5343 readystate_set_loading = TRUE;
5344 SET_EXPECT(TranslateUrl);
5345 SET_EXPECT(Exec_ShellDocView_67);
5346 SET_EXPECT(Invoke_AMBIENT_SILENT);
5347 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5348 SET_EXPECT(Exec_ShellDocView_63);
5349 SET_EXPECT(Exec_ShellDocView_84);
5351 str = a2bstr(nav_url);
5353 V_VT(&vempty) = VT_EMPTY;
5354 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
5356 SysFreeString(str2);
5357 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
5359 CHECK_CALLED(TranslateUrl);
5360 CHECK_CALLED(Exec_ShellDocView_67);
5361 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5362 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5363 CHECK_CALLED(Exec_ShellDocView_63);
5364 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5368 test_GetCurMoniker(doc_unk, doc_mon, NULL);
5373 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5374 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5375 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2), prev_nav_url);
5376 SysFreeString(str2);
5379 ignore_external_qi = TRUE;
5380 test_download(DWL_VERBDONE | (is_js ? DWL_JAVASCRIPT : DWL_ONREADY_LOADING) | dwl_flags);
5382 ignore_external_qi = FALSE;
5386 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5387 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5389 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5391 ok(!strcmp_wa(str2, nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5392 SysFreeString(str2);
5393 IHTMLPrivateWindow_Release(priv_window);
5397 nav_url = prev_nav_url;
5400 static void test_open_window(IHTMLDocument2 *doc, BOOL do_block)
5402 IHTMLWindow2 *window, *new_window;
5406 allow_new_window = !do_block;
5408 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5409 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5411 url = a2bstr(nav_serv_url = nav_url = "about:blank");
5412 name = a2bstr("test");
5413 new_window = (void*)0xdeadbeef;
5419 SET_EXPECT(get_LocationURL);
5420 SET_EXPECT(TranslateUrl);
5421 SET_EXPECT(EvaluateNewWindow);
5423 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
5426 SysFreeString(name);
5429 todo_wine CHECK_CALLED_BROKEN(get_LocationURL);
5431 CHECK_CALLED(TranslateUrl);
5433 if(!called_EvaluateNewWindow) {
5434 win_skip("INewWindowManager not supported\n");
5435 if(SUCCEEDED(hres) && new_window)
5436 IHTMLWindow2_Release(new_window);
5437 IHTMLWindow2_Release(window);
5440 CHECK_CALLED(EvaluateNewWindow);
5442 ok(hres == S_OK, "open failed: %08x\n", hres);
5445 ok(!new_window, "new_window != NULL\n");
5447 ok(new_window != NULL, "new_window == NULL\n");
5449 hres = IHTMLWindow2_close(new_window);
5450 ok(hres == S_OK, "close failed: %08x\n", hres);
5453 IHTMLWindow2_Release(window);
5456 static void test_elem_from_point(IHTMLDocument2 *doc)
5463 hres = IHTMLDocument2_elementFromPoint(doc, 3, 3, &elem);
5464 ok(hres == S_OK, "elementFromPoint failed: %08x\n", hres);
5465 ok(elem != NULL, "elem == NULL\n");
5467 hres = IHTMLElement_get_tagName(elem, &tag);
5468 IHTMLElement_Release(elem);
5469 ok(hres == S_OK, "get_tagName failed: %08x\n", hres);
5470 ok(!strcmp_wa(tag, "DIV"), "tag = %s\n", wine_dbgstr_w(tag));
5473 static void test_clear(IHTMLDocument2 *doc)
5477 hres = IHTMLDocument2_clear(doc);
5478 ok(hres == S_OK, "clear failed: %08x\n", hres);
5481 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
5483 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
5484 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
5485 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
5486 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
5487 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
5488 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
5489 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
5490 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
5491 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
5492 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
5493 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
5494 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
5495 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
5496 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
5497 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
5498 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
5499 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
5500 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
5501 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
5502 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
5504 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
5505 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
5507 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
5509 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
5511 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
5512 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
5514 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
5515 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
5517 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
5519 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
5520 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
5523 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
5524 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
5526 IOleCommandTarget *cmdtrg;
5527 OLECMD olecmd = {cmdid, 0};
5530 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5531 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5535 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
5536 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
5538 IOleCommandTarget_Release(cmdtrg);
5540 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
5541 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
5544 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
5546 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
5548 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
5549 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
5550 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
5551 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
5552 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
5553 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
5554 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
5555 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
5556 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
5557 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
5558 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
5559 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
5560 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
5561 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
5562 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
5563 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
5566 static void test_OleCommandTarget(IHTMLDocument2 *doc)
5568 IOleCommandTarget *cmdtrg;
5569 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
5573 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5574 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5578 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5579 cmds[i].cmdID = i+1;
5580 cmds[i].cmdf = 0xf0f0;
5583 SET_EXPECT(QueryStatus_OPEN);
5584 SET_EXPECT(QueryStatus_NEW);
5585 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
5586 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5587 CHECK_CALLED(QueryStatus_OPEN);
5588 CHECK_CALLED(QueryStatus_NEW);
5590 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5591 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
5592 if(i+1 == OLECMDID_FIND)
5594 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
5595 i+1, cmds[i].cmdf, expect_cmds[i+1]);
5598 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
5599 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
5601 IOleCommandTarget_Release(cmdtrg);
5604 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
5606 IOleCommandTarget *cmdtrg;
5611 {OLECMDID_OPEN, 0xf0f0},
5612 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
5615 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5616 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
5620 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
5621 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5623 SET_EXPECT(QueryStatus_OPEN);
5624 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
5625 CHECK_CALLED(QueryStatus_OPEN);
5627 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5628 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5629 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
5630 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
5631 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
5632 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
5633 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
5635 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
5636 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
5637 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
5639 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5640 if(!expect_cmds[i]) {
5641 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
5642 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5643 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5644 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5648 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
5649 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5650 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5651 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5653 IOleCommandTarget_Release(cmdtrg);
5656 static void test_exec_onunload(IHTMLDocument2 *doc)
5658 IOleCommandTarget *cmdtrg;
5662 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5663 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5667 memset(&var, 0x0a, sizeof(var));
5668 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5669 OLECMDEXECOPT_DODEFAULT, NULL, &var);
5670 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5671 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
5672 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
5674 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5675 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5676 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5678 IOleCommandTarget_Release(cmdtrg);
5681 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
5683 IOleCommandTarget *cmdtrg;
5686 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5687 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5694 load_state = LD_DOLOAD;
5697 SET_EXPECT(GetClassID);
5698 SET_EXPECT(SetStatusText);
5699 SET_EXPECT(Exec_ShellDocView_37);
5700 SET_EXPECT(GetHostInfo);
5702 SET_EXPECT(GetDisplayName);
5703 SET_EXPECT(Invoke_AMBIENT_SILENT);
5704 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5705 SET_EXPECT(OnChanged_READYSTATE);
5706 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5707 SET_EXPECT(IsSystemMoniker);
5708 SET_EXPECT(Exec_ShellDocView_84);
5710 SET_EXPECT(BindToStorage);
5711 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5714 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5716 expect_status_text = NULL;
5717 readystate_set_loading = TRUE;
5719 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5720 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5721 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5724 CHECK_CALLED(GetClassID);
5725 CHECK_CALLED(SetStatusText);
5726 CHECK_CALLED(Exec_ShellDocView_37);
5727 CHECK_CALLED(GetHostInfo);
5729 CHECK_CALLED(GetDisplayName);
5730 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5731 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5732 CHECK_CALLED(OnChanged_READYSTATE);
5733 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5734 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
5735 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5737 CHECK_CALLED(BindToStorage);
5738 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5739 CHECK_CALLED(HideUI);
5740 CHECK_CALLED(ShowUI);
5741 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5743 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
5745 IOleCommandTarget_Release(cmdtrg);
5747 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5748 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5749 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5752 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
5754 IOleCommandTarget *cmdtrg;
5755 VARIANT *in = NULL, _in, *out = NULL, _out;
5758 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5759 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
5766 V_BSTR(in) = SysAllocString(name);
5772 V_I4(out) = 0xdeadbeef;
5775 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
5776 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
5782 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
5783 if(V_VT(out) == VT_BSTR) {
5785 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
5786 "unexpected fontname %s\n", wine_dbgstr_w(name));
5788 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
5793 IOleCommandTarget_Release(cmdtrg);
5796 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
5798 IOleCommandTarget *cmdtrg;
5801 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5802 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5806 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
5807 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5808 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5810 IOleCommandTarget_Release(cmdtrg);
5813 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
5815 IPersistStreamInit *perinit;
5816 IPersistMoniker *permon;
5817 IPersistFile *perfile;
5820 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
5821 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
5822 if(SUCCEEDED(hres)) {
5823 hres = IPersistStreamInit_IsDirty(perinit);
5824 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5825 IPersistStreamInit_Release(perinit);
5828 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
5829 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
5830 if(SUCCEEDED(hres)) {
5831 hres = IPersistMoniker_IsDirty(permon);
5832 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5833 IPersistMoniker_Release(permon);
5836 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
5837 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
5838 if(SUCCEEDED(hres)) {
5839 hres = IPersistFile_IsDirty(perfile);
5840 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5841 IPersistFile_Release(perfile);
5845 static HWND create_container_window(void)
5847 static const WCHAR wszHTMLDocumentTest[] =
5848 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
5849 static WNDCLASSEXW wndclass = {
5850 sizeof(WNDCLASSEXW),
5853 0, 0, NULL, NULL, NULL, NULL, NULL,
5854 wszHTMLDocumentTest,
5858 RegisterClassExW(&wndclass);
5859 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
5860 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
5861 515, 530, NULL, NULL, NULL, NULL);
5864 static void test_DoVerb(IOleObject *oleobj)
5866 RECT rect = {0,0,500,500};
5869 if(!container_locked) {
5870 SET_EXPECT(GetContainer);
5871 SET_EXPECT(LockContainer);
5873 SET_EXPECT(ActivateMe);
5874 expect_LockContainer_fLock = TRUE;
5876 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
5877 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
5879 if(!container_locked) {
5880 CHECK_CALLED(GetContainer);
5881 CHECK_CALLED(LockContainer);
5882 container_locked = TRUE;
5884 CHECK_CALLED(ActivateMe);
5887 #define CLIENTSITE_EXPECTPATH 0x00000001
5888 #define CLIENTSITE_SETNULL 0x00000002
5889 #define CLIENTSITE_DONTSET 0x00000004
5891 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
5893 IOleClientSite *clientsite;
5896 if(flags & CLIENTSITE_SETNULL) {
5897 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5898 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5900 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
5902 ok(!clientsite, "clientsite != NULL\n");
5904 SET_EXPECT(GetOverrideKeyPath);
5905 hres = IOleObject_SetClientSite(oleobj, NULL);
5906 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5907 CLEAR_CALLED(GetOverrideKeyPath); /* IE9 sometimes calls it */
5909 set_clientsite = FALSE;
5912 if(flags & CLIENTSITE_DONTSET)
5915 if(!expect_uihandler_iface)
5916 expect_uihandler_iface = &DocHostUIHandler;
5918 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5919 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5920 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
5921 clientsite, set_clientsite ? &ClientSite : NULL);
5923 if(!set_clientsite) {
5924 if(expect_uihandler_iface)
5925 SET_EXPECT(GetHostInfo);
5926 if(flags & CLIENTSITE_EXPECTPATH) {
5927 SET_EXPECT(GetOptionKeyPath);
5928 SET_EXPECT(GetOverrideKeyPath);
5930 SET_EXPECT(GetWindow);
5931 if(flags & CLIENTSITE_EXPECTPATH)
5932 SET_EXPECT(Exec_DOCCANNAVIGATE);
5933 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
5934 SET_EXPECT(Exec_SETPROGRESSMAX);
5935 SET_EXPECT(Exec_SETPROGRESSPOS);
5936 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5937 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5938 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5939 SET_EXPECT(Invoke_AMBIENT_SILENT);
5940 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5941 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5942 SET_EXPECT(GetOverrideKeyPath);
5943 SET_EXPECT(GetTravelLog);
5944 SET_EXPECT(Exec_ShellDocView_84);
5946 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5947 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5949 if(expect_uihandler_iface)
5950 CHECK_CALLED(GetHostInfo);
5951 if(flags & CLIENTSITE_EXPECTPATH) {
5952 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
5953 CHECK_CALLED(GetOverrideKeyPath);
5955 CHECK_CALLED(GetWindow);
5956 if(flags & CLIENTSITE_EXPECTPATH)
5957 CHECK_CALLED(Exec_DOCCANNAVIGATE);
5958 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
5959 CHECK_CALLED(Exec_SETPROGRESSMAX);
5960 CHECK_CALLED(Exec_SETPROGRESSPOS);
5961 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5962 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5963 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5964 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5965 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5966 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5967 CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
5968 todo_wine CHECK_CALLED(GetTravelLog);
5969 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5971 set_clientsite = TRUE;
5974 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5975 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5977 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5978 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5979 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
5982 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
5984 IOleControl *control = NULL;
5987 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5988 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5992 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5993 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
5994 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5995 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5997 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5998 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
5999 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6000 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6002 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6003 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6004 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
6005 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6006 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6007 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6009 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6010 SET_EXPECT(Invoke_AMBIENT_SILENT);
6011 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
6012 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6013 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6014 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6016 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6017 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
6018 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6019 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6021 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6022 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
6023 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6024 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
6026 IOleControl_Release(control);
6031 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
6033 IOleControl *control = NULL;
6036 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleControl, (void**)&control);
6037 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
6041 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
6042 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
6044 IOleControl_Release(control);
6047 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
6049 IOleObject *oleobj = NULL;
6052 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6053 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6057 SET_EXPECT(GetContainer);
6058 SET_EXPECT(LockContainer);
6059 expect_LockContainer_fLock = FALSE;
6060 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
6061 ok(hres == S_OK, "Close failed: %08x\n", hres);
6062 CHECK_CALLED(GetContainer);
6063 CHECK_CALLED(LockContainer);
6064 container_locked = FALSE;
6067 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6069 IOleObject_Release(oleobj);
6072 static void test_Advise(IHTMLDocument2 *doc)
6074 IOleObject *oleobj = NULL;
6075 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
6079 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6080 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6084 hres = IOleObject_Unadvise(oleobj, 0);
6085 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
6087 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
6088 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
6089 ok(enum_advise == NULL, "enum_advise != NULL\n");
6092 hres = IOleObject_Advise(oleobj, NULL, &conn);
6093 /* Old IE returns S_OK and sets conn to 1 */
6094 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
6095 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
6097 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
6098 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
6100 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6101 ok(hres == S_OK, "Advise returned: %08x\n", hres);
6102 ok(conn == 1, "conn = %d\n", conn);
6104 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6105 ok(hres == S_OK, "Advise returned: %08x\n", hres);
6106 ok(conn == 2, "conn = %d\n", conn);
6108 hres = IOleObject_Unadvise(oleobj, 1);
6109 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
6111 hres = IOleObject_Unadvise(oleobj, 1);
6112 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
6114 hres = IOleObject_Unadvise(oleobj, 2);
6115 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
6117 IOleObject_Release(oleobj);
6120 static void test_OnFrameWindowActivate(IUnknown *unk)
6122 IOleInPlaceActiveObject *inplaceact;
6125 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
6126 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
6130 if(set_clientsite) {
6131 expect_OnFrameWindowActivate_fActivate = TRUE;
6132 SET_EXPECT(OnFrameWindowActivate);
6133 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6134 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6135 CHECK_CALLED(OnFrameWindowActivate);
6137 SET_EXPECT(OnFrameWindowActivate);
6138 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6139 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6140 CHECK_CALLED(OnFrameWindowActivate);
6142 expect_OnFrameWindowActivate_fActivate = FALSE;
6143 SET_EXPECT(OnFrameWindowActivate);
6144 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
6145 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6146 CHECK_CALLED(OnFrameWindowActivate);
6148 expect_OnFrameWindowActivate_fActivate = TRUE;
6149 SET_EXPECT(OnFrameWindowActivate);
6150 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6151 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6152 CHECK_CALLED(OnFrameWindowActivate);
6154 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
6155 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6157 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
6158 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
6161 IOleInPlaceActiveObject_Release(inplaceact);
6164 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
6166 IOleInPlaceObjectWindowless *windowlessobj = NULL;
6169 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
6170 (void**)&windowlessobj);
6171 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
6176 SET_EXPECT(SetStatusText);
6177 SET_EXPECT(OnFocus_FALSE);
6179 SET_EXPECT(OnInPlaceDeactivateEx);
6181 SET_EXPECT(OnInPlaceDeactivate);
6183 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
6184 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
6186 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
6187 CHECK_CALLED(OnFocus_FALSE);
6189 CHECK_CALLED(OnInPlaceDeactivateEx);
6191 CHECK_CALLED(OnInPlaceDeactivate);
6194 IOleInPlaceObjectWindowless_Release(windowlessobj);
6197 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
6199 IOleObject *oleobj = NULL;
6200 IOleDocumentView *docview;
6204 last_hwnd = doc_hwnd;
6207 IOleDocumentView_Release(view);
6210 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6211 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6213 hres = IOleObject_GetUserClassID(oleobj, NULL);
6214 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
6216 hres = IOleObject_GetUserClassID(oleobj, &guid);
6217 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
6218 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
6220 test_OnFrameWindowActivate((IUnknown*)doc);
6222 test_ClientSite(oleobj, flags);
6223 test_InPlaceDeactivate(doc, FALSE);
6224 test_DoVerb(oleobj);
6226 if(call_UIActivate == CallUIActivate_AfterShow) {
6227 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
6228 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
6230 SET_EXPECT(OnFocus_TRUE);
6231 SET_EXPECT(SetActiveObject);
6233 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6234 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6235 expect_status_text = NULL;
6237 hres = IOleDocumentView_UIActivate(docview, TRUE);
6238 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
6240 CHECK_CALLED(OnFocus_TRUE);
6241 CHECK_CALLED(SetActiveObject);
6242 CHECK_CALLED(ShowUI);
6243 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6244 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6246 IOleDocumentView_Release(docview);
6249 IOleObject_Release(oleobj);
6251 test_OnFrameWindowActivate((IUnknown*)doc);
6254 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
6256 IOleInPlaceActiveObject *activeobject = NULL;
6260 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
6261 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
6265 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
6267 if(expect_success) {
6268 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
6269 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
6271 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
6272 ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
6275 IOleInPlaceActiveObject_Release(activeobject);
6278 static void test_CloseView(void)
6280 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
6286 hres = IOleDocumentView_Show(view, FALSE);
6287 ok(hres == S_OK, "Show failed: %08x\n", hres);
6289 hres = IOleDocumentView_CloseView(view, 0);
6290 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
6292 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
6293 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6295 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6296 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6297 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
6300 static void test_UIDeactivate(void)
6304 if(call_UIActivate == CallUIActivate_AfterShow) {
6305 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6307 if(call_UIActivate != CallUIActivate_None) {
6308 SET_EXPECT(SetActiveObject_null);
6310 SET_EXPECT(OnUIDeactivate);
6313 hres = IOleDocumentView_UIActivate(view, FALSE);
6314 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6316 if(call_UIActivate != CallUIActivate_None) {
6317 CHECK_CALLED(SetActiveObject_null);
6318 CHECK_CALLED(HideUI);
6319 CHECK_CALLED(OnUIDeactivate);
6321 if(call_UIActivate == CallUIActivate_AfterShow) {
6322 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6326 static void test_Hide(void)
6333 hres = IOleDocumentView_Show(view, FALSE);
6334 ok(hres == S_OK, "Show failed: %08x\n", hres);
6337 static IHTMLDocument2 *create_document(void)
6339 IHTMLDocument2 *doc;
6342 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
6343 &IID_IHTMLDocument2, (void**)&doc);
6344 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
6351 static void release_document(IHTMLDocument2 *doc)
6357 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
6358 * To workaround it, we release it via IUnknown iface */
6359 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
6360 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
6362 IHTMLDocument2_Release(doc);
6363 ref = IUnknown_Release(unk);
6364 ok(!ref, "ref = %d\n", ref);
6367 static void test_Navigate(IHTMLDocument2 *doc)
6369 IHlinkTarget *hlink;
6372 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
6373 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
6375 SET_EXPECT(ActivateMe);
6376 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
6377 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
6378 CHECK_CALLED(ActivateMe);
6380 IHlinkTarget_Release(hlink);
6383 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
6385 IDispatch *external;
6386 IHTMLWindow2 *htmlwin;
6389 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
6390 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6393 SET_EXPECT(GetExternal);
6394 external = (void*)0xdeadbeef;
6395 hres = IHTMLWindow2_get_external(htmlwin, &external);
6397 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
6398 CHECK_CALLED(GetExternal);
6399 ok(external != NULL, "external == NULL\n");
6401 ok(hres == S_OK, "get_external failed: %08x\n", hres);
6402 ok(external == NULL, "external != NULL\n");
6405 IHTMLWindow2_Release(htmlwin);
6408 static void test_enum_objects(IOleContainer *container)
6410 IEnumUnknown *enum_unknown;
6411 IUnknown *buf[100] = {(void*)0xdeadbeef};
6415 enum_unknown = NULL;
6416 hres = IOleContainer_EnumObjects(container, OLECONTF_EMBEDDINGS, &enum_unknown);
6417 ok(hres == S_OK, "EnumObjects failed: %08x\n", hres);
6418 ok(enum_unknown != NULL, "enum_unknown == NULL\n");
6420 fetched = 0xdeadbeef;
6421 hres = IEnumUnknown_Next(enum_unknown, sizeof(buf)/sizeof(*buf), buf, &fetched);
6422 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6423 ok(!fetched, "fetched = %d\n", fetched);
6424 ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
6426 fetched = 0xdeadbeef;
6427 hres = IEnumUnknown_Next(enum_unknown, 1, buf, &fetched);
6428 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6429 ok(!fetched, "fetched = %d\n", fetched);
6431 hres = IEnumUnknown_Next(enum_unknown, 1, buf, NULL);
6432 ok(hres == S_FALSE, "Next returned %08x\n", hres);
6434 IEnumUnknown_Release(enum_unknown);
6437 static void test_target_container(IHTMLDocument2 *doc)
6439 IOleContainer *ole_container, *doc_ole_container;
6440 ITargetContainer *target_container;
6443 hres = IHTMLDocument2_QueryInterface(doc, &IID_ITargetContainer, (void**)&target_container);
6444 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
6446 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleContainer, (void**)&doc_ole_container);
6447 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
6449 ole_container = (void*)0xdeadbeef;
6450 hres = ITargetContainer_GetFramesContainer(target_container, &ole_container);
6451 ok(hres == S_OK, "GetFramesContainer failed: %08x\n", hres);
6452 ok(ole_container != NULL, "ole_container == NULL\n");
6453 ok(iface_cmp((IUnknown*)ole_container, (IUnknown*)doc_ole_container), "ole_container != doc_ole_container\n");
6454 test_enum_objects(ole_container);
6455 IOleContainer_Release(ole_container);
6457 ITargetContainer_Release(target_container);
6458 IOleContainer_Release(doc_ole_container);
6461 static void test_travellog(IHTMLDocument2 *doc)
6463 ITravelLogClient *travellog_client;
6464 IHTMLWindow2 *window, *top_window;
6469 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6470 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6471 ok(window != NULL, "window = NULL\n");
6473 hres = IHTMLWindow2_get_top(window, &top_window);
6474 IHTMLWindow2_Release(window);
6475 ok(hres == S_OK, "get_top failed: %08x\n", hres);
6477 hres = IHTMLWindow2_QueryInterface(top_window, &IID_ITravelLogClient, (void**)&travellog_client);
6478 IHTMLWindow2_Release(top_window);
6479 if(hres == E_NOINTERFACE) {
6480 win_skip("ITravelLogClient not supported\n");
6483 ok(hres == S_OK, "Could not get ITraveLogClient iface: %08x\n", hres);
6485 unk = (void*)0xdeadbeef;
6486 hres = ITravelLogClient_FindWindowByIndex(travellog_client, 0, &unk);
6487 ok(hres == E_FAIL, "FindWindowByIndex failed: %08x\n", hres);
6488 ok(!unk, "unk != NULL\n");
6490 ITravelLogClient_Release(travellog_client);
6493 static void test_StreamLoad(IHTMLDocument2 *doc)
6495 IPersistStreamInit *init;
6498 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6499 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6503 SET_EXPECT(Invoke_AMBIENT_SILENT);
6504 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6505 SET_EXPECT(Exec_ShellDocView_37);
6506 SET_EXPECT(OnChanged_READYSTATE);
6507 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6509 SET_EXPECT(GetPendingUrl);
6510 readystate_set_loading = TRUE;
6512 hres = IPersistStreamInit_Load(init, &Stream);
6513 ok(hres == S_OK, "Load failed: %08x\n", hres);
6515 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6516 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6517 CHECK_CALLED(Exec_ShellDocView_37);
6518 CHECK_CALLED(OnChanged_READYSTATE);
6519 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6521 todo_wine CHECK_CALLED(GetPendingUrl);
6523 test_timer(EXPECT_SETTITLE);
6524 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6526 IPersistStreamInit_Release(init);
6529 static void test_StreamInitNew(IHTMLDocument2 *doc)
6531 IPersistStreamInit *init;
6534 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6535 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6539 SET_EXPECT(Invoke_AMBIENT_SILENT);
6540 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6541 SET_EXPECT(Exec_ShellDocView_37);
6542 SET_EXPECT(OnChanged_READYSTATE);
6543 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6544 SET_EXPECT(GetPendingUrl);
6545 readystate_set_loading = TRUE;
6547 hres = IPersistStreamInit_InitNew(init);
6548 ok(hres == S_OK, "Load failed: %08x\n", hres);
6550 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6551 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6552 CHECK_CALLED(Exec_ShellDocView_37);
6553 CHECK_CALLED(OnChanged_READYSTATE);
6554 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6555 todo_wine CHECK_CALLED(GetPendingUrl);
6557 test_timer(EXPECT_SETTITLE);
6558 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6560 IPersistStreamInit_Release(init);
6563 static void test_QueryInterface(IHTMLDocument2 *htmldoc)
6565 IUnknown *qi, *doc = (IUnknown*)htmldoc;
6568 static const IID IID_UndocumentedScriptIface =
6569 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
6571 qi = (void*)0xdeadbeef;
6572 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
6573 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6574 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
6576 qi = (void*)0xdeadbeef;
6577 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
6578 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6579 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6581 qi = (void*)0xdeadbeef;
6582 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
6583 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6584 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6586 qi = (void*)0xdeadbeef;
6587 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
6588 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6589 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6591 qi = (void*)0xdeadbeef;
6592 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
6593 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6594 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6596 qi = (void*)0xdeadbeef;
6597 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
6598 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6599 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6601 qi = (void*)0xdeadbeef;
6602 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
6603 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6604 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6606 qi = (void*)0xdeadbeef;
6607 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
6608 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6609 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6611 qi = (void*)0xdeadbeef;
6612 hres = IUnknown_QueryInterface(doc, &IID_ITargetFrame, (void**)&qi);
6613 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6614 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6616 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
6617 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
6618 ok(qi != (IUnknown*)doc, "disp == doc\n");
6619 IUnknown_Release(qi);
6622 static void init_test(enum load_state_t ls) {
6624 doc_hwnd = last_hwnd = NULL;
6625 set_clientsite = FALSE;
6626 load_from_stream = FALSE;
6627 call_UIActivate = CallUIActivate_None;
6634 inplace_deactivated = FALSE;
6636 expect_uihandler_iface = &DocHostUIHandler;
6639 static void test_HTMLDocument(BOOL do_load, BOOL mime)
6641 IHTMLDocument2 *doc;
6643 trace("Testing HTMLDocument (%s, %s)...\n", (do_load ? "load" : "no load"),
6644 (report_mime ? "mime" : "no mime"));
6646 init_test(do_load ? LD_DOLOAD : LD_NO);
6649 doc = create_document();
6650 doc_unk = (IUnknown*)doc;
6652 test_QueryInterface(doc);
6654 test_IsDirty(doc, S_FALSE);
6655 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6656 test_external(doc, FALSE);
6657 test_ViewAdviseSink(doc);
6658 test_ConnectionPointContainer(doc);
6659 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6660 test_Persist(doc, &Moniker);
6662 test_OnAmbientPropertyChange2(doc);
6664 test_Activate(doc, CLIENTSITE_EXPECTPATH);
6667 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6668 test_download(DWL_CSS|DWL_TRYCSS);
6669 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6670 test_elem_from_point(doc);
6673 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6674 test_OleCommandTarget_fail(doc);
6675 test_OleCommandTarget(doc);
6676 test_OnAmbientPropertyChange(doc);
6677 test_Window(doc, TRUE);
6678 test_external(doc, TRUE);
6679 test_target_container(doc);
6681 test_UIDeactivate();
6682 test_OleCommandTarget(doc);
6683 test_Window(doc, TRUE);
6684 test_InPlaceDeactivate(doc, TRUE);
6686 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
6687 * MSHTML. It doesn't with Wine. */
6689 test_Window(doc, FALSE);
6691 test_InPlaceDeactivate(doc, FALSE);
6693 test_Close(doc, FALSE);
6695 /* Activate HTMLDocument again */
6696 test_Activate(doc, CLIENTSITE_SETNULL);
6697 test_Window(doc, TRUE);
6698 test_OleCommandTarget(doc);
6699 test_UIDeactivate();
6700 test_InPlaceDeactivate(doc, TRUE);
6701 test_Close(doc, FALSE);
6703 /* Activate HTMLDocument again, this time without UIActivate */
6704 call_UIActivate = CallUIActivate_None;
6705 test_Activate(doc, CLIENTSITE_SETNULL);
6706 test_Window(doc, TRUE);
6708 test_external(doc, TRUE);
6709 set_custom_uihandler(doc, NULL);
6710 test_external(doc, FALSE);
6712 test_UIDeactivate();
6713 test_InPlaceDeactivate(doc, TRUE);
6716 test_Close(doc, TRUE);
6717 test_OnAmbientPropertyChange2(doc);
6718 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
6721 /* Activate HTMLDocument again, calling UIActivate after showing the window */
6722 call_UIActivate = CallUIActivate_AfterShow;
6723 test_Activate(doc, 0);
6724 test_Window(doc, TRUE);
6725 test_OleCommandTarget(doc);
6726 test_UIDeactivate();
6727 test_InPlaceDeactivate(doc, TRUE);
6728 test_Close(doc, FALSE);
6729 call_UIActivate = CallUIActivate_None;
6733 IOleDocumentView_Release(view);
6736 ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
6737 release_document(doc);
6738 ok(!IsWindow(doc_hwnd), "hwnd is not destroyed\n");
6741 static void test_HTMLDocument_hlink(DWORD status)
6743 IHTMLDocument2 *doc;
6745 trace("Testing HTMLDocument (hlink)...\n");
6747 init_test(LD_DOLOAD);
6750 doc = create_document();
6751 doc_unk = (IUnknown*)doc;
6753 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6754 test_ViewAdviseSink(doc);
6755 test_ConnectionPointContainer(doc);
6756 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6757 test_Persist(doc, &Moniker);
6760 status_code = status;
6761 test_download(DWL_CSS|DWL_TRYCSS);
6762 status_code = HTTP_STATUS_OK;
6764 test_IsDirty(doc, S_FALSE);
6765 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6767 test_exec_onunload(doc);
6768 test_Window(doc, TRUE);
6769 test_InPlaceDeactivate(doc, TRUE);
6770 test_Close(doc, FALSE);
6771 test_IsDirty(doc, S_FALSE);
6772 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6774 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6777 IOleDocumentView_Release(view);
6780 release_document(doc);
6783 static void test_cookies(IHTMLDocument2 *doc)
6791 hres = IHTMLDocument2_get_cookie(doc, &str);
6792 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6794 size = sizeof(buf)/sizeof(WCHAR);
6795 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6796 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6797 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
6801 str = a2bstr("test=testval");
6802 hres = IHTMLDocument2_put_cookie(doc, str);
6803 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6806 hres = IHTMLDocument2_get_cookie(doc, &str2);
6807 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6808 ok(str2 != NULL, "cookie = NULL\n");
6809 size = sizeof(buf)/sizeof(WCHAR);
6810 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6811 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6812 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6813 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6815 SysFreeString(str2);
6817 str = a2bstr("test=testval2");
6818 hres = IHTMLDocument2_put_cookie(doc, str);
6819 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6822 hres = IHTMLDocument2_get_cookie(doc, &str2);
6823 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6824 ok(str2 != NULL, "cookie = NULL\n");
6825 size = sizeof(buf)/sizeof(WCHAR);
6826 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6827 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6828 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6829 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6831 SysFreeString(str2);
6834 static void test_HTMLDocument_http(BOOL with_wbapp)
6837 IHTMLDocument2 *doc;
6841 trace("Testing HTMLDocument (http%s)...\n", with_wbapp ? " with IWebBrowserApp" : "");
6843 support_wbapp = with_wbapp;
6845 if(!winetest_interactive && is_ie_hardened()) {
6846 win_skip("IE running in Enhanced Security Configuration\n");
6850 init_test(LD_DOLOAD);
6853 doc = create_document();
6854 doc_unk = (IUnknown*)doc;
6856 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
6857 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
6859 test_ViewAdviseSink(doc);
6860 test_ConnectionPointContainer(doc);
6861 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6862 test_Persist(doc, http_mon);
6864 test_download(DWL_HTTP);
6866 test_IsDirty(doc, S_FALSE);
6867 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6868 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
6869 test_travellog(doc);
6870 test_binding_ui((IUnknown*)doc);
6872 nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */
6874 test_put_href(doc, FALSE, "#test", "http://www.winehq.org/#test", FALSE, TRUE, 0);
6875 test_travellog(doc);
6877 test_put_href(doc, FALSE, NULL, "javascript:external%20&&undefined", TRUE, FALSE, 0);
6878 test_put_href(doc, FALSE, NULL, "about:blank", FALSE, FALSE, support_wbapp ? DWL_EXPECT_HISTUPDATE : 0);
6879 test_put_href(doc, TRUE, NULL, "about:replace", FALSE, FALSE, 0);
6881 test_open_window(doc, TRUE);
6882 if(!support_wbapp) /* FIXME */
6883 test_open_window(doc, FALSE);
6885 test_InPlaceDeactivate(doc, TRUE);
6886 test_Close(doc, FALSE);
6887 test_IsDirty(doc, S_FALSE);
6888 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
6891 IOleDocumentView_Release(view);
6894 release_document(doc);
6896 ref = IMoniker_Release(http_mon);
6897 ok(!ref, "ref=%d, expected 0\n", ref);
6900 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
6902 IHTMLWindow2 *window, *sp_window;
6903 IServiceProvider *sp;
6907 hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
6908 ok(hres == S_OK, "QueryService returned %08x\n", hres);
6910 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6912 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
6913 IServiceProvider_Release(sp);
6917 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6918 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6919 IHlinkFrame_Release(hf);
6921 IServiceProvider_Release(sp);
6923 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6924 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6926 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
6927 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
6929 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
6930 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
6931 /* FIXME: test returned window */
6932 IHTMLWindow2_Release(sp_window);
6934 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6935 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6936 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6937 IHlinkFrame_Release(hf);
6939 IServiceProvider_Release(sp);
6940 IHTMLWindow2_Release(window);
6943 static void test_HTMLDocument_StreamLoad(void)
6945 IHTMLDocument2 *doc;
6950 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
6952 init_test(LD_DOLOAD);
6953 load_from_stream = TRUE;
6955 doc = create_document();
6956 doc_unk = (IUnknown*)doc;
6958 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6959 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6961 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6962 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6964 test_readyState((IUnknown*)doc);
6965 test_IsDirty(doc, S_FALSE);
6966 test_ViewAdviseSink(doc);
6967 test_ConnectionPointContainer(doc);
6968 test_QueryService(doc, FALSE);
6969 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6970 test_QueryService(doc, TRUE);
6971 test_DoVerb(oleobj);
6972 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6974 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6975 test_StreamLoad(doc);
6976 test_download(DWL_VERBDONE|DWL_TRYCSS);
6977 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6979 test_UIDeactivate();
6980 test_InPlaceDeactivate(doc, TRUE);
6981 SET_EXPECT(Advise_Close);
6982 test_Close(doc, TRUE);
6983 CHECK_CALLED(Advise_Close);
6984 test_external(doc, FALSE);
6985 test_IsDirty(doc, S_FALSE);
6987 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6988 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
6989 test_external(doc, TRUE);
6990 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6991 test_external(doc, TRUE);
6992 set_custom_uihandler(doc, NULL);
6993 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6995 IOleObject_Release(oleobj);
6997 IOleDocumentView_Release(view);
7001 release_document(doc);
7004 static void test_HTMLDocument_StreamInitNew(void)
7006 IHTMLDocument2 *doc;
7011 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
7013 init_test(LD_DOLOAD);
7014 load_from_stream = TRUE;
7016 doc = create_document();
7017 doc_unk = (IUnknown*)doc;
7019 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7020 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
7022 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
7023 ok(hres == S_OK, "Advise failed: %08x\n", hres);
7025 test_readyState((IUnknown*)doc);
7026 test_IsDirty(doc, S_FALSE);
7027 test_ViewAdviseSink(doc);
7028 test_ConnectionPointContainer(doc);
7029 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
7030 test_DoVerb(oleobj);
7031 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7033 IOleObject_Release(oleobj);
7035 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
7036 test_StreamInitNew(doc);
7038 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
7039 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
7040 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
7042 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7044 test_UIDeactivate();
7045 test_InPlaceDeactivate(doc, TRUE);
7046 SET_EXPECT(Advise_Close);
7047 test_Close(doc, FALSE);
7048 CHECK_CALLED(Advise_Close);
7049 test_IsDirty(doc, S_FALSE);
7052 IOleDocumentView_Release(view);
7056 release_document(doc);
7059 static void test_edit_uiactivate(IOleObject *oleobj)
7061 IOleDocumentView *docview;
7064 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
7065 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
7067 SET_EXPECT(OnFocus_TRUE);
7068 SET_EXPECT(SetActiveObject);
7070 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7071 SET_EXPECT(InPlaceFrame_SetBorderSpace);
7072 expect_status_text = NULL;
7074 hres = IOleDocumentView_UIActivate(docview, TRUE);
7075 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
7077 CHECK_CALLED(OnFocus_TRUE);
7078 CHECK_CALLED(SetActiveObject);
7079 CHECK_CALLED(ShowUI);
7080 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7081 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
7083 IOleDocumentView_Release(docview);
7086 static void test_editing_mode(BOOL do_load)
7088 IHTMLDocument2 *doc;
7094 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
7096 init_test(do_load ? LD_DOLOAD : LD_NO);
7097 call_UIActivate = CallUIActivate_AfterShow;
7099 doc = create_document();
7100 unk = doc_unk = (IUnknown*)doc;
7102 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7103 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
7105 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
7106 ok(hres == S_OK, "Advise failed: %08x\n", hres);
7108 test_readyState((IUnknown*)doc);
7109 test_ViewAdviseSink(doc);
7110 test_ConnectionPointContainer(doc);
7111 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
7112 test_DoVerb(oleobj);
7113 test_edit_uiactivate(oleobj);
7115 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7117 test_Persist(doc, &Moniker);
7118 stream_read = protocol_read = 0;
7119 test_exec_editmode(unk, do_load);
7120 test_UIDeactivate();
7121 call_UIActivate = CallUIActivate_None;
7122 IOleObject_Release(oleobj);
7124 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7125 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
7127 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
7128 test_timer(EXPECT_UPDATEUI);
7129 CLEAR_CALLED(SetStatusText);
7131 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7134 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
7135 test_timer(EXPECT_UPDATEUI);
7136 test_exec_fontname(unk, NULL, wszArial);
7138 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
7139 test_timer(EXPECT_UPDATEUI);
7140 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
7141 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
7143 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
7144 test_timer(EXPECT_UPDATEUI);
7145 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
7146 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7147 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
7148 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
7150 test_exec_noargs(unk, IDM_HORIZONTALLINE);
7151 test_timer(EXPECT_UPDATEUI);
7152 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
7153 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
7156 test_UIDeactivate();
7157 test_InPlaceDeactivate(doc, TRUE);
7158 SET_EXPECT(Advise_Close);
7159 test_Close(doc, FALSE);
7160 CHECK_CALLED(Advise_Close);
7163 IOleDocumentView_Release(view);
7167 release_document(doc);
7170 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
7172 IHTMLDocument2 *doc;
7174 IOleInPlaceSite *inplacesite;
7177 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
7179 init_test(do_load ? LD_DOLOAD : LD_NO);
7181 doc = create_document();
7182 doc_unk = (IUnknown*)doc;
7187 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7188 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
7190 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
7191 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
7193 SET_EXPECT(Invoke_AMBIENT_USERMODE);
7194 SET_EXPECT(GetHostInfo);
7195 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
7196 SET_EXPECT(Invoke_AMBIENT_SILENT);
7197 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7198 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
7199 SET_EXPECT(Invoke_AMBIENT_PALETTE);
7200 SET_EXPECT(GetOptionKeyPath);
7201 SET_EXPECT(GetOverrideKeyPath);
7202 SET_EXPECT(GetWindow);
7203 SET_EXPECT(Exec_DOCCANNAVIGATE);
7204 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
7205 SET_EXPECT(Exec_SETPROGRESSMAX);
7206 SET_EXPECT(Exec_SETPROGRESSPOS);
7207 SET_EXPECT(GetTravelLog);
7208 SET_EXPECT(Exec_ShellDocView_84);
7210 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
7211 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
7212 set_clientsite = TRUE;
7214 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
7215 CHECK_CALLED(GetHostInfo);
7216 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
7217 CHECK_CALLED(Invoke_AMBIENT_SILENT);
7218 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7219 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
7220 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
7221 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
7222 CHECK_CALLED(GetOverrideKeyPath);
7223 CHECK_CALLED(GetWindow);
7224 CHECK_CALLED(Exec_DOCCANNAVIGATE);
7225 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
7226 CHECK_CALLED(Exec_SETPROGRESSMAX);
7227 CHECK_CALLED(Exec_SETPROGRESSPOS);
7228 todo_wine CHECK_CALLED(GetTravelLog);
7229 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
7231 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
7232 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
7233 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
7235 SET_EXPECT(GetContainer);
7236 SET_EXPECT(LockContainer);
7237 SET_EXPECT(CanInPlaceActivate);
7238 SET_EXPECT(GetWindowContext);
7239 SET_EXPECT(GetWindow);
7241 SET_EXPECT(OnInPlaceActivateEx);
7242 SET_EXPECT(RequestUIActivate);
7245 SET_EXPECT(OnInPlaceActivate);
7246 SET_EXPECT(OnUIActivate);
7247 SET_EXPECT(SetStatusText);
7248 SET_EXPECT(Exec_SETPROGRESSMAX);
7249 SET_EXPECT(Exec_SETPROGRESSPOS);
7251 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7252 SET_EXPECT(InPlaceFrame_SetBorderSpace);
7253 SET_EXPECT(OnFocus_TRUE);
7254 SET_EXPECT(SetActiveObject);
7255 expect_LockContainer_fLock = TRUE;
7257 hres = IOleDocumentView_UIActivate(view, TRUE);
7258 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
7260 CHECK_CALLED(GetContainer);
7261 CHECK_CALLED(LockContainer);
7262 CHECK_CALLED(CanInPlaceActivate);
7263 CHECK_CALLED(GetWindowContext);
7264 CHECK_CALLED(GetWindow);
7266 CHECK_CALLED(OnInPlaceActivateEx);
7267 SET_EXPECT(RequestUIActivate);
7270 CHECK_CALLED(OnInPlaceActivate);
7271 CHECK_CALLED(OnUIActivate);
7272 CHECK_CALLED(SetStatusText);
7273 CHECK_CALLED(Exec_SETPROGRESSMAX);
7274 CHECK_CALLED(Exec_SETPROGRESSPOS);
7275 CHECK_CALLED(ShowUI);
7276 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7277 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
7278 CHECK_CALLED(OnFocus_TRUE);
7279 CHECK_CALLED(SetActiveObject);
7280 container_locked = TRUE;
7282 SET_EXPECT(SetActiveObject_null);
7283 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7285 SET_EXPECT(OnUIDeactivate);
7287 hres = IOleDocumentView_UIActivate(view, FALSE);
7288 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
7290 CHECK_CALLED(SetActiveObject_null);
7291 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7292 CHECK_CALLED(HideUI);
7293 CHECK_CALLED(OnUIDeactivate);
7295 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
7296 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
7297 ok(inplacesite != NULL, "inplacesite = NULL\n");
7298 IOleInPlaceSite_Release(inplacesite);
7300 SET_EXPECT(SetStatusText);
7301 SET_EXPECT(OnFocus_FALSE);
7303 SET_EXPECT(OnInPlaceDeactivateEx);
7305 SET_EXPECT(OnInPlaceDeactivate);
7309 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
7310 CHECK_CALLED(OnFocus_FALSE);
7312 CHECK_CALLED(OnInPlaceDeactivateEx);
7314 CHECK_CALLED(OnInPlaceDeactivate);
7316 test_Close(doc, TRUE);
7318 IOleObject_Release(oleobj);
7319 IOleDocumentView_Release(view);
7322 release_document(doc);
7325 static void register_protocol(void)
7327 IInternetSession *session;
7330 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
7332 hres = CoInternetGetSession(0, &session, 0);
7333 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
7335 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
7336 wsz_winetest, 0, NULL, 0);
7337 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
7339 IInternetSession_Release(session);
7342 static void test_HTMLDoc_ISupportErrorInfo(void)
7344 IHTMLDocument2 *doc;
7346 ISupportErrorInfo *sinfo;
7348 doc = create_document();
7350 hres = IHTMLDocument2_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
7351 ok(hres == S_OK, "got %x\n", hres);
7352 ok(sinfo != NULL, "got %p\n", sinfo);
7355 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
7356 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
7357 ISupportErrorInfo_Release(sinfo);
7360 release_document(doc);
7363 static void test_IPersistHistory(void)
7365 IHTMLDocument2 *doc;
7367 IPersistHistory *phist;
7369 doc = create_document();
7371 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
7372 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
7374 IPersistHistory_Release(phist);
7376 release_document(doc);
7379 static BOOL check_ie(void)
7381 IHTMLDocument2 *doc;
7382 IHTMLDocument5 *doc5;
7385 doc = create_document();
7389 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
7391 IHTMLDocument5_Release(doc5);
7393 release_document(doc);
7394 return SUCCEEDED(hres);
7397 static void test_ServiceProvider(void)
7399 IHTMLDocument3 *doc3, *doc3_2;
7400 IServiceProvider *provider;
7401 IHTMLDocument2 *doc, *doc2;
7405 doc = create_document();
7409 hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&provider);
7410 ok(hres == S_OK, "got 0x%08x\n", hres);
7412 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc2);
7413 ok(hres == S_OK, "got 0x%08x\n", hres);
7414 ok(iface_cmp((IUnknown*)doc2, (IUnknown*)doc), "got wrong pointer\n");
7415 IHTMLDocument2_Release(doc2);
7417 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument3, (void**)&doc3);
7418 ok(hres == S_OK, "got 0x%08x\n", hres);
7419 ok(iface_cmp((IUnknown*)doc3, (IUnknown*)doc), "got wrong pointer\n");
7421 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3_2);
7422 ok(hres == S_OK, "got 0x%08x\n", hres);
7423 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc), "got wrong pointer\n");
7424 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc3), "got wrong pointer\n");
7425 IHTMLDocument3_Release(doc3);
7426 IHTMLDocument3_Release(doc3_2);
7428 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IUnknown, (void**)&unk);
7429 ok(hres == S_OK, "got 0x%08x\n", hres);
7430 ok(iface_cmp((IUnknown*)doc, unk), "got wrong pointer\n");
7432 IUnknown_Release(unk);
7433 IServiceProvider_Release(provider);
7434 release_document(doc);
7443 win_skip("Too old IE\n");
7447 container_hwnd = create_container_window();
7448 register_protocol();
7450 asynchronous_binding = TRUE;
7451 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
7453 asynchronous_binding = FALSE;
7454 test_HTMLDocument_hlink(HTTP_STATUS_OK);
7455 test_HTMLDocument(FALSE, TRUE);
7456 test_HTMLDocument(TRUE, FALSE);
7457 test_HTMLDocument(TRUE, TRUE);
7458 test_HTMLDocument_StreamLoad();
7459 test_HTMLDocument_StreamInitNew();
7460 test_editing_mode(FALSE);
7461 test_editing_mode(TRUE);
7462 test_HTMLDocument_http(FALSE);
7463 test_HTMLDocument_http(TRUE);
7464 test_UIActivate(FALSE, FALSE, FALSE);
7465 test_UIActivate(FALSE, TRUE, FALSE);
7466 test_UIActivate(FALSE, TRUE, TRUE);
7467 test_UIActivate(TRUE, FALSE, FALSE);
7468 test_UIActivate(TRUE, TRUE, FALSE);
7469 test_UIActivate(TRUE, TRUE, TRUE);
7470 test_HTMLDoc_ISupportErrorInfo();
7471 test_IPersistHistory();
7472 test_ServiceProvider();
7474 DestroyWindow(container_hwnd);