wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / mshtml / tests / htmldoc.c
blob89311c5d8c8e80c96d06819a5823053371a78b42
1 /*
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
19 #define COBJMACROS
20 #define CONST_VTABLE
22 #include <wine/test.h>
23 #include <stdarg.h>
24 #include <stdio.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "initguid.h"
29 #include "ole2.h"
30 #include "mshtml.h"
31 #include "docobj.h"
32 #include "docobjectservice.h"
33 #include "wininet.h"
34 #include "mshtmhst.h"
35 #include "mshtmdid.h"
36 #include "mshtmcid.h"
37 #include "hlink.h"
38 #include "dispex.h"
39 #include "idispids.h"
40 #include "shlguid.h"
41 #include "shdeprecated.h"
42 #include "perhist.h"
43 #include "shobjidl.h"
44 #include "htiface.h"
45 #include "tlogstg.h"
46 #include "exdispid.h"
47 #include "mshtml_test.h"
48 #include "mscoree.h"
50 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
51 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
52 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
53 DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
54 DEFINE_GUID(outer_test_iid,0xabcabc00,0,0,0,0,0,0,0,0,0,0x66);
56 #define DEFINE_EXPECT(func) \
57 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
59 #define SET_EXPECT(func) \
60 expect_ ## func = TRUE
62 #define SET_CALLED(func) \
63 called_ ## func = TRUE
65 #define CHECK_EXPECT2(func) \
66 do { \
67 ok(expect_ ##func, "unexpected call " #func "\n"); \
68 called_ ## func = TRUE; \
69 }while(0)
71 #define CHECK_EXPECT(func) \
72 do { \
73 CHECK_EXPECT2(func); \
74 expect_ ## func = FALSE; \
75 }while(0)
77 #define CHECK_CALLED(func) \
78 do { \
79 ok(called_ ## func, "expected " #func "\n"); \
80 expect_ ## func = called_ ## func = FALSE; \
81 }while(0)
83 #define CHECK_NOT_CALLED(func) \
84 do { \
85 ok(!called_ ## func, "unexpected " #func "\n"); \
86 expect_ ## func = called_ ## func = FALSE; \
87 }while(0)
89 #define CHECK_CALLED_BROKEN(func) \
90 do { \
91 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
92 expect_ ## func = called_ ## func = FALSE; \
93 }while(0)
95 #define CLEAR_CALLED(func) \
96 expect_ ## func = called_ ## func = FALSE
99 static IOleDocumentView *view = NULL;
100 static HWND container_hwnd = NULL, doc_hwnd = NULL, last_hwnd = NULL;
102 DEFINE_EXPECT(LockContainer);
103 DEFINE_EXPECT(SetActiveObject);
104 DEFINE_EXPECT(SetActiveObject_null);
105 DEFINE_EXPECT(GetWindow);
106 DEFINE_EXPECT(CanInPlaceActivate);
107 DEFINE_EXPECT(OnInPlaceActivate);
108 DEFINE_EXPECT(OnInPlaceActivateEx);
109 DEFINE_EXPECT(OnUIActivate);
110 DEFINE_EXPECT(GetWindowContext);
111 DEFINE_EXPECT(OnUIDeactivate);
112 DEFINE_EXPECT(OnInPlaceDeactivate);
113 DEFINE_EXPECT(OnInPlaceDeactivateEx);
114 DEFINE_EXPECT(GetContainer);
115 DEFINE_EXPECT(ShowUI);
116 DEFINE_EXPECT(ActivateMe);
117 DEFINE_EXPECT(GetHostInfo);
118 DEFINE_EXPECT(HideUI);
119 DEFINE_EXPECT(GetOptionKeyPath);
120 DEFINE_EXPECT(GetOverrideKeyPath);
121 DEFINE_EXPECT(SetStatusText);
122 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
123 DEFINE_EXPECT(QueryStatus_OPEN);
124 DEFINE_EXPECT(QueryStatus_NEW);
125 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
126 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
127 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
128 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
129 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
130 DEFINE_EXPECT(Exec_ShellDocView_37);
131 DEFINE_EXPECT(Exec_ShellDocView_62);
132 DEFINE_EXPECT(Exec_ShellDocView_63);
133 DEFINE_EXPECT(Exec_ShellDocView_67);
134 DEFINE_EXPECT(Exec_ShellDocView_84);
135 DEFINE_EXPECT(Exec_ShellDocView_103);
136 DEFINE_EXPECT(Exec_ShellDocView_105);
137 DEFINE_EXPECT(Exec_ShellDocView_138);
138 DEFINE_EXPECT(Exec_ShellDocView_140);
139 DEFINE_EXPECT(Exec_DocHostCommandHandler_2300);
140 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
141 DEFINE_EXPECT(Exec_SETTITLE);
142 DEFINE_EXPECT(Exec_HTTPEQUIV);
143 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
144 DEFINE_EXPECT(Exec_Explorer_38);
145 DEFINE_EXPECT(Exec_Explorer_69);
146 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
147 DEFINE_EXPECT(Exec_DOCCANNAVIGATE_NULL);
148 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
149 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
150 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
151 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
152 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
153 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
154 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive);
155 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading);
156 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete);
157 DEFINE_EXPECT(GetDropTarget);
158 DEFINE_EXPECT(UpdateUI);
159 DEFINE_EXPECT(Navigate);
160 DEFINE_EXPECT(OnFrameWindowActivate);
161 DEFINE_EXPECT(OnChanged_READYSTATE);
162 DEFINE_EXPECT(OnChanged_1005);
163 DEFINE_EXPECT(OnChanged_1012);
164 DEFINE_EXPECT(OnChanged_1014);
165 DEFINE_EXPECT(GetDisplayName);
166 DEFINE_EXPECT(BindToStorage);
167 DEFINE_EXPECT(IsSystemMoniker);
168 DEFINE_EXPECT(GetBindResult);
169 DEFINE_EXPECT(GetClassID);
170 DEFINE_EXPECT(Abort);
171 DEFINE_EXPECT(Read);
172 DEFINE_EXPECT(CreateInstance);
173 DEFINE_EXPECT(Start);
174 DEFINE_EXPECT(Terminate);
175 DEFINE_EXPECT(Protocol_Read);
176 DEFINE_EXPECT(LockRequest);
177 DEFINE_EXPECT(UnlockRequest);
178 DEFINE_EXPECT(OnFocus_TRUE);
179 DEFINE_EXPECT(OnFocus_FALSE);
180 DEFINE_EXPECT(RequestUIActivate);
181 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
182 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
183 DEFINE_EXPECT(GetExternal);
184 DEFINE_EXPECT(EnableModeless_TRUE);
185 DEFINE_EXPECT(EnableModeless_FALSE);
186 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
187 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
188 DEFINE_EXPECT(Frame_GetWindow);
189 DEFINE_EXPECT(TranslateUrl);
190 DEFINE_EXPECT(Advise_Close);
191 DEFINE_EXPECT(OnViewChange);
192 DEFINE_EXPECT(EvaluateNewWindow);
193 DEFINE_EXPECT(GetTravelLog);
194 DEFINE_EXPECT(UpdateBackForwardState);
195 DEFINE_EXPECT(FireBeforeNavigate2);
196 DEFINE_EXPECT(FireNavigateComplete2);
197 DEFINE_EXPECT(FireDocumentComplete);
198 DEFINE_EXPECT(GetPendingUrl);
199 DEFINE_EXPECT(ActiveElementChanged);
200 DEFINE_EXPECT(IsErrorUrl);
201 DEFINE_EXPECT(get_LocationURL);
202 DEFINE_EXPECT(CountEntries);
203 DEFINE_EXPECT(FindConnectionPoint);
204 DEFINE_EXPECT(EnumConnections);
205 DEFINE_EXPECT(EnumConnections_Next);
206 DEFINE_EXPECT(WindowClosing);
207 DEFINE_EXPECT(NavigateWithBindCtx);
208 DEFINE_EXPECT(outer_QI_IPersistMoniker);
209 DEFINE_EXPECT(outer_QI_test);
211 static BOOL is_ie9plus;
212 static IUnknown *doc_unk;
213 static IMoniker *doc_mon;
214 static BOOL expect_LockContainer_fLock;
215 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
216 static BOOL ipsex, ipsw;
217 static BOOL set_clientsite, container_locked;
218 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
219 static BOOL editmode = FALSE, ignore_external_qi;
220 static BOOL inplace_deactivated, open_call;
221 static BOOL complete, loading_js, loading_hash, is_refresh;
222 static DWORD status_code = HTTP_STATUS_OK;
223 static BOOL asynchronous_binding = FALSE;
224 static BOOL support_wbapp, allow_new_window, no_travellog;
225 static BOOL report_mime;
226 static BOOL testing_submit;
227 static BOOL resetting_document;
228 static BOOL is_mhtml;
229 static int stream_read, protocol_read;
230 static IStream *history_stream;
231 static enum load_state_t {
232 LD_DOLOAD,
233 LD_LOADING,
234 LD_LOADED,
235 LD_INTERACTIVE,
236 LD_COMPLETE,
237 LD_NO
238 } load_state;
240 static LPCOLESTR expect_status_text = NULL;
241 static const WCHAR *nav_url, *nav_serv_url, *prev_url;
243 static const char html_page[] =
244 "<html>"
245 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
246 "<body><div>test</div></body>"
247 "</html>";
249 static const char mhtml_page[] =
250 "MIME-Version: 1.0\r\n"
251 "Content-Type: multipart/related; type:=\"text/html\"; boundary=\"----=_NextPart_000_00\"\r\n"
252 "\r\n"
253 "------=_NextPart_000_00\r\n"
254 "Content-Type: text/html; charset=\"Windows-1252\"\r\n"
255 "Content-Transfer-Encoding: quoted-printable\r\n"
256 "\r\n"
257 "<HTML></HTML>\r\n"
258 "------=_NextPart_000_00\r\n"
259 "Content-Type: Image/Jpeg\r\n"
260 "Content-Transfer-Encoding: base64\r\n"
261 "Content-Location: http://winehq.org/mhtmltest.html\r\n"
262 "\r\n\t\t\t\tVGVzdA==\r\n\r\n"
263 "------=_NextPart_000_00--";
265 static const char css_data[] = "body {color: red; margin: 0}";
267 static const WCHAR http_urlW[] =
268 {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t','s','/','w','i','n','e','h','q','_','s','n','a','p','s','h','o','t','/',0};
270 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
272 #define DOCHOST_DOCCANNAVIGATE 0
273 #define WM_CONTINUE_BINDING (WM_APP+1)
275 static HRESULT QueryInterface(REFIID riid, void **ppv);
276 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
278 #define test_readyState(u) _test_readyState(__LINE__,u)
279 static void _test_readyState(unsigned,IUnknown*);
281 static const WCHAR wszTimesNewRoman[] =
282 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
283 static const WCHAR wszArial[] =
284 {'A','r','i','a','l',0};
286 /* Returns true if the user interface is in English. Note that this does not
287 * presume of the formatting of dates, numbers, etc.
289 static BOOL is_lang_english(void)
291 static HMODULE hkernel32 = NULL;
292 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
293 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
295 if (!hkernel32)
297 hkernel32 = GetModuleHandleA("kernel32.dll");
298 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
299 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
301 if (pGetThreadUILanguage)
302 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
303 if (pGetUserDefaultUILanguage)
304 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
306 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
309 static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
311 IUnknown *unk1, *unk2;
313 if(iface1 == iface2)
314 return TRUE;
316 IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
317 IUnknown_Release(unk1);
318 IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
319 IUnknown_Release(unk2);
321 return unk1 == unk2;
324 #define EXPECT_UPDATEUI 1
325 #define EXPECT_SETTITLE 2
327 static void test_timer(DWORD flags)
329 BOOL *b = &called_Exec_SETTITLE;
330 MSG msg;
332 if(flags & EXPECT_UPDATEUI) {
333 SET_EXPECT(UpdateUI);
334 SET_EXPECT(Exec_UPDATECOMMANDS);
335 b = &called_UpdateUI;
337 if(flags & EXPECT_SETTITLE)
338 SET_EXPECT(Exec_SETTITLE);
340 while(!*b && GetMessageA(&msg, doc_hwnd, 0, 0)) {
341 TranslateMessage(&msg);
342 DispatchMessageA(&msg);
345 if(flags & EXPECT_UPDATEUI) {
346 CHECK_CALLED(UpdateUI);
347 CHECK_CALLED(Exec_UPDATECOMMANDS);
349 if(flags & EXPECT_SETTITLE)
350 CHECK_CALLED(Exec_SETTITLE);
353 static IMoniker Moniker;
355 #define test_GetCurMoniker(u,m,v,t) _test_GetCurMoniker(__LINE__,u,m,v,t)
356 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const WCHAR *exurl, BOOL is_todo)
358 IHTMLDocument2 *doc;
359 IPersistMoniker *permon;
360 IMoniker *mon = (void*)0xdeadbeef;
361 BSTR doc_url = (void*)0xdeadbeef;
362 const WCHAR *ptr;
363 HRESULT hres;
365 if(open_call)
366 return; /* FIXME */
368 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
369 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
370 if(FAILED(hres))
371 return;
373 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
374 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
376 hres = IHTMLDocument2_get_URL(doc, &doc_url);
377 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
378 for(ptr = doc_url; *ptr && *ptr != '#'; ptr++);
380 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
381 IPersistMoniker_Release(permon);
383 if(exmon) {
384 LPOLESTR url;
385 BOOL exb = expect_GetDisplayName;
386 BOOL clb = called_GetDisplayName;
388 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
389 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
391 if(mon == &Moniker)
392 SET_EXPECT(GetDisplayName);
393 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
394 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
395 if(mon == &Moniker)
396 CHECK_CALLED(GetDisplayName);
397 expect_GetDisplayName = exb;
398 called_GetDisplayName = clb;
400 if(!*ptr)
401 ok(!lstrcmpW(url, doc_url), "url %s != doc_url %s\n", wine_dbgstr_w(url), wine_dbgstr_w(doc_url));
402 else
403 ok(!lstrcmpW(url, nav_serv_url), "url = %s, expected %s\n", wine_dbgstr_w(url),
404 wine_dbgstr_w(nav_serv_url));
405 CoTaskMemFree(url);
406 }else if(exurl) {
407 LPOLESTR url;
409 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
411 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
412 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
414 todo_wine_if(is_todo)
415 ok_(__FILE__,line)(!lstrcmpW(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
416 if(!*ptr)
417 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url %s != doc_url %s\n", wine_dbgstr_w(url), wine_dbgstr_w(doc_url));
419 CoTaskMemFree(url);
420 }else {
421 ok_(__FILE__,line)(hres == E_UNEXPECTED,
422 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
423 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
424 ok_(__FILE__,line)(!lstrcmpW(doc_url, L"about:blank"), "doc_url is not about:blank\n");
427 SysFreeString(doc_url);
428 IHTMLDocument2_Release(doc);
429 if(mon && mon != (void*)0xdeadbeef)
430 IMoniker_Release(mon);
433 #define test_current_url(a,b) _test_current_url(__LINE__,a,b)
434 static void _test_current_url(unsigned line, IUnknown *unk, const WCHAR *exurl)
436 IHTMLDocument2 *doc;
437 BSTR url;
438 HRESULT hres;
440 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
441 ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
443 hres = IHTMLDocument2_get_URL(doc, &url);
444 ok_(__FILE__,line)(hres == S_OK, "get_URL failed: %08x\n", hres);
445 ok_(__FILE__,line)(!lstrcmpW(url, exurl), "Unexpected URL %s, expected %s\n", wine_dbgstr_w(url),
446 wine_dbgstr_w(exurl));
447 SysFreeString(url);
449 IHTMLDocument2_Release(doc);
452 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
454 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
456 *ppv = NULL;
458 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
459 *ppv = iface;
460 return S_OK;
463 if(IsEqualGUID(&IID_IProxyManager, riid))
464 return E_NOINTERFACE; /* TODO */
465 if(IsEqualGUID(&IID_IDispatchEx, riid))
466 return E_NOINTERFACE; /* TODO */
467 if(IsEqualGUID(&IID_External_unk, riid))
468 return E_NOINTERFACE; /* TODO */
470 if(!ignore_external_qi)
471 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
472 return E_NOINTERFACE;
475 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
477 return 2;
480 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
482 return 1;
485 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
487 ok(0, "unexpected call\n");
488 return E_NOTIMPL;
491 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
492 ITypeInfo **ppTInfo)
494 ok(0, "unexpected call\n");
495 return E_NOTIMPL;
498 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
499 UINT cNames, LCID lcid, DISPID *rgDispId)
501 ok(0, "unexpected call\n");
502 return E_NOTIMPL;
505 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
506 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
507 EXCEPINFO *pExcepInfo, UINT *puArgErr)
509 ok(0, "unexpected call\n");
510 return E_NOTIMPL;
513 static const IDispatchVtbl ExternalVtbl = {
514 External_QueryInterface,
515 Dispatch_AddRef,
516 Dispatch_Release,
517 Dispatch_GetTypeInfoCount,
518 Dispatch_GetTypeInfo,
519 Dispatch_GetIDsOfNames,
520 External_Invoke
523 static IDispatch External = { &ExternalVtbl };
525 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
527 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
528 *ppv = iface;
529 return S_OK;
532 *ppv = NULL;
533 return E_NOINTERFACE;
536 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
538 return 2;
541 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
543 return 1;
546 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
547 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
548 DWORD grfPI, HANDLE_PTR dwReserved)
550 BINDINFO bindinfo;
551 DWORD bindf = 0;
552 HRESULT hres;
554 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
555 static const WCHAR empty_str = {0};
557 CHECK_EXPECT(Start);
559 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
560 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
561 ok(!grfPI, "grfPI = %x\n", grfPI);
562 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
563 if(is_mhtml)
564 ok(!lstrcmpW(szUrl, L"winetest:doc"), "unexpected URL %s\n", wine_dbgstr_w(szUrl));
566 memset(&bindinfo, 0, sizeof(bindinfo));
567 bindinfo.cbSize = sizeof(bindinfo);
568 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
569 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
570 if(!testing_submit)
571 todo_wine_if(is_mhtml)
572 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
573 "bindf = %x\n", bindf);
574 else
575 ok(bindf == (BINDF_FROMURLMON|BINDF_FORMS_SUBMIT|BINDF_PRAGMA_NO_CACHE|BINDF_HYPERLINK
576 |BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_GETNEWESTVERSION|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
577 "bindf = %x\n", bindf);
579 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
580 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
581 /* TODO: test stgmedData */
582 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
583 if(!testing_submit) {
584 ok(bindinfo.dwBindVerb == BINDVERB_GET, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
585 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
586 ok(bindinfo.stgmedData.tymed == TYMED_NULL, "bindinfo.stgmedData.tymed=%d\n", bindinfo.stgmedData.tymed);
587 }else {
588 ok(bindinfo.dwBindVerb == BINDVERB_POST, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
589 ok(bindinfo.cbstgmedData == 8, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
590 ok(bindinfo.stgmedData.tymed == TYMED_HGLOBAL, "bindinfo.stgmedData.tymed=%d\n", bindinfo.stgmedData.tymed);
591 ok(!memcmp(U(bindinfo.stgmedData).hGlobal, "cmd=TEST", 8), "unexpected hGlobal\n");
593 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
594 if(is_mhtml)
595 ok(!bindinfo.dwOptions, "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
596 else
597 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000, /* win2k3 */
598 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
599 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
600 /* TODO: test dwCodePage */
601 /* TODO: test securityAttributes */
602 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
603 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
604 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
606 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
607 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
608 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
610 if(report_mime) {
611 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
612 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
613 ok(hres == S_OK,
614 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
617 hres = IInternetProtocolSink_ReportData(pOIProtSink,
618 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
619 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
621 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
622 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
624 return S_OK;
627 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
628 PROTOCOLDATA *pProtocolData)
630 ok(0, "unexpected call\n");
631 return E_NOTIMPL;
634 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
635 DWORD dwOptions)
637 ok(0, "unexpected call\n");
638 return E_NOTIMPL;
641 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
643 CHECK_EXPECT(Terminate);
644 return S_OK;
647 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
649 ok(0, "unexpected call\n");
650 return E_NOTIMPL;
653 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
655 ok(0, "unexpected call\n");
656 return E_NOTIMPL;
659 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
660 ULONG cb, ULONG *pcbRead)
662 const char *data = is_mhtml ? mhtml_page : css_data;
663 unsigned data_len = strlen(data);
665 CHECK_EXPECT2(Protocol_Read);
667 ok(pv != NULL, "pv == NULL\n");
668 ok(cb > data_len, "cb < data_len\n");
669 ok(pcbRead != NULL, "pcbRead == NULL\n");
670 ok(!*pcbRead || *pcbRead == data_len, "*pcbRead=%d\n", *pcbRead);
672 if(protocol_read) {
673 *pcbRead = 0;
674 return S_FALSE;
677 protocol_read += *pcbRead = data_len;
678 memcpy(pv, data, data_len);
680 return S_OK;
683 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
684 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
686 ok(0, "unexpected call\n");
687 return E_NOTIMPL;
690 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
692 CHECK_EXPECT(LockRequest);
693 return S_OK;
696 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
698 CHECK_EXPECT(UnlockRequest);
699 return S_OK;
702 static const IInternetProtocolVtbl ProtocolVtbl = {
703 Protocol_QueryInterface,
704 Protocol_AddRef,
705 Protocol_Release,
706 Protocol_Start,
707 Protocol_Continue,
708 Protocol_Abort,
709 Protocol_Terminate,
710 Protocol_Suspend,
711 Protocol_Resume,
712 Protocol_Read,
713 Protocol_Seek,
714 Protocol_LockRequest,
715 Protocol_UnlockRequest
718 static IInternetProtocol Protocol = { &ProtocolVtbl };
720 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
722 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
723 ok(0, "unexpected call\n");
724 return E_NOINTERFACE;
727 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
729 return 2;
732 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
734 return 1;
737 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
738 REFIID riid, void **ppv)
740 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
741 return E_NOINTERFACE;
743 CHECK_EXPECT(CreateInstance);
744 ok(ppv != NULL, "ppv == NULL\n");
746 *ppv = &Protocol;
747 return S_OK;
750 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
752 ok(0, "unexpected call\n");
753 return S_OK;
756 static const IClassFactoryVtbl ClassFactoryVtbl = {
757 ClassFactory_QueryInterface,
758 ClassFactory_AddRef,
759 ClassFactory_Release,
760 ClassFactory_CreateInstance,
761 ClassFactory_LockServer
764 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
766 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
768 ok(0, "unexpected call\n");
769 return E_NOTIMPL;
772 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
774 return 2;
777 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
779 return 1;
782 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
783 IHlinkBrowseContext *pihlbc)
785 ok(0, "unexpected call\n");
786 return E_NOTIMPL;
789 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
790 IHlinkBrowseContext **ppihlbc)
792 ok(0, "unexpected call\n");
793 return E_NOTIMPL;
796 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
797 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
799 HRESULT hres;
801 CHECK_EXPECT(Navigate);
803 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
804 ok(pbc != NULL, "pbc == NULL\n");
805 ok(pibsc != NULL, "pubsc == NULL\n");
806 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
808 if(pihlNavigate) {
809 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
810 LPWSTR location = (LPWSTR)0xdeadbeef;
811 IHlinkSite *site;
812 IMoniker *mon = NULL;
813 DWORD site_data = 0xdeadbeef;
815 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
816 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
817 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
819 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
820 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
821 ok(location == NULL, "location = %p\n", location);
822 ok(mon != NULL, "mon == NULL\n");
824 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &location);
825 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
826 ok(!lstrcmpW(location, nav_url), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location),
827 wine_dbgstr_w(nav_url));
828 CoTaskMemFree(location);
829 IMoniker_Release(mon);
831 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
832 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
833 ok(site == NULL, "site = %p\n, expected NULL\n", site);
834 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
837 return S_OK;
840 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
841 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
843 ok(0, "unexpected call\n");
844 return E_NOTIMPL;
847 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
848 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
850 ok(0, "unexpected call\n");
851 return E_NOTIMPL;
854 static const IHlinkFrameVtbl HlinkFrameVtbl = {
855 HlinkFrame_QueryInterface,
856 HlinkFrame_AddRef,
857 HlinkFrame_Release,
858 HlinkFrame_SetBrowseContext,
859 HlinkFrame_GetBrowseContext,
860 HlinkFrame_Navigate,
861 HlinkFrame_OnNavigate,
862 HlinkFrame_UpdateHlink
865 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
867 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
869 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(riid, &IID_INewWindowManager)) {
870 *ppv = iface;
871 return S_OK;
874 if(winetest_debug > 1) trace("NewWindowManager_QueryInterface %s\n", wine_dbgstr_guid(riid));
875 *ppv = NULL;
876 return E_NOINTERFACE;
879 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
881 return 2;
884 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
886 return 1;
889 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
890 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
891 DWORD dwUserActionTime)
893 CHECK_EXPECT(EvaluateNewWindow);
895 ok(!lstrcmpW(pszUrl, L"about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
896 ok(!lstrcmpW(pszName, L"test"), "pszName = %s\n", wine_dbgstr_w(pszName));
897 ok(!lstrcmpW(pszUrlContext, prev_url), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
898 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
899 ok(!fReplace, "fReplace = %x\n", fReplace);
900 ok(dwFlags == (allow_new_window ? 0 : NWMF_FIRST), "dwFlags = %x\n", dwFlags);
901 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
903 return allow_new_window ? S_OK : E_FAIL;
906 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
907 NewWindowManager_QueryInterface,
908 NewWindowManager_AddRef,
909 NewWindowManager_Release,
910 NewWindowManager_EvaluateNewWindow
913 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
915 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
916 REFIID riid, void**ppv)
918 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
919 *ppv = iface;
920 return S_OK;
923 ok(0, "unexpected call\n");
924 return E_NOINTERFACE;
927 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
929 return 2;
932 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
934 return 1;
937 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
939 if(resetting_document)
940 return S_OK;
942 switch(dispID) {
943 case DISPID_READYSTATE:
944 CHECK_EXPECT2(OnChanged_READYSTATE);
946 if(!readystate_set_interactive)
947 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
948 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
949 ? OLECMDF_ENABLED : 0));
951 if(readystate_set_loading) {
952 readystate_set_loading = FALSE;
953 load_state = LD_LOADING;
955 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
956 test_readyState(NULL);
957 return S_OK;
958 case 1005:
959 CHECK_EXPECT2(OnChanged_1005);
960 if(!editmode)
961 test_readyState(NULL);
962 readystate_set_interactive = (load_state != LD_INTERACTIVE);
963 return S_OK;
964 case 1012:
965 CHECK_EXPECT2(OnChanged_1012);
966 return S_OK;
967 case 1014:
968 CHECK_EXPECT2(OnChanged_1014);
969 return S_OK;
970 case 1029:
971 case 1030:
972 case 3000022:
973 case 3000023:
974 case 3000024:
975 case 3000025:
976 case 3000026:
977 case 3000027:
978 case 3000028:
979 case 3000029:
980 case 3000030:
981 case 3000031:
982 case 3000032:
983 /* TODO */
984 return S_OK;
987 ok(0, "unexpected id %d\n", dispID);
988 return E_NOTIMPL;
991 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
993 ok(0, "unexpected call\n");
994 return E_NOTIMPL;
997 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
998 PropertyNotifySink_QueryInterface,
999 PropertyNotifySink_AddRef,
1000 PropertyNotifySink_Release,
1001 PropertyNotifySink_OnChanged,
1002 PropertyNotifySink_OnRequestEdit
1005 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
1007 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
1009 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
1010 *ppv = iface;
1011 return S_OK;
1014 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1015 *ppv = NULL;
1016 return E_NOINTERFACE;
1019 static ULONG WINAPI Stream_AddRef(IStream *iface)
1021 return 2;
1024 static ULONG WINAPI Stream_Release(IStream *iface)
1026 return 1;
1029 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
1030 ULONG cb, ULONG *pcbRead)
1032 CHECK_EXPECT2(Read);
1033 ok(pv != NULL, "pv == NULL\n");
1034 ok(cb > sizeof(html_page), "cb = %d\n", cb);
1035 ok(pcbRead != NULL, "pcbRead == NULL\n");
1036 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
1038 if(stream_read)
1039 return S_FALSE;
1041 memcpy(pv, html_page, sizeof(html_page)-1);
1042 stream_read += *pcbRead = sizeof(html_page)-1;
1043 return S_OK;
1046 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
1047 ULONG cb, ULONG *pcbWritten)
1049 ok(0, "unexpected call\n");
1050 return E_NOTIMPL;
1053 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
1054 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
1056 ok(0, "unexpected call\n");
1057 return E_NOTIMPL;
1060 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
1062 ok(0, "unexpected call\n");
1063 return E_NOTIMPL;
1066 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
1067 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
1069 ok(0, "unexpected call\n");
1070 return E_NOTIMPL;
1073 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
1075 ok(0, "unexpected call\n");
1076 return E_NOTIMPL;
1079 static HRESULT WINAPI Stream_Revert(IStream *iface)
1081 ok(0, "unexpected call\n");
1082 return E_NOTIMPL;
1085 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1086 ULARGE_INTEGER cb, DWORD dwLockType)
1088 ok(0, "unexpected call\n");
1089 return E_NOTIMPL;
1092 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1093 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1095 ok(0, "unexpected call\n");
1096 return E_NOTIMPL;
1099 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1100 DWORD dwStatFlag)
1102 ok(0, "unexpected call\n");
1103 return E_NOTIMPL;
1106 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1108 ok(0, "unexpected call\n");
1109 return E_NOTIMPL;
1112 static const IStreamVtbl StreamVtbl = {
1113 Stream_QueryInterface,
1114 Stream_AddRef,
1115 Stream_Release,
1116 Stream_Read,
1117 Stream_Write,
1118 Stream_Seek,
1119 Stream_SetSize,
1120 Stream_CopyTo,
1121 Stream_Commit,
1122 Stream_Revert,
1123 Stream_LockRegion,
1124 Stream_UnlockRegion,
1125 Stream_Stat,
1126 Stream_Clone
1129 static IStream Stream = { &StreamVtbl };
1131 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1132 IWinInetHttpInfo* This,
1133 REFIID riid,
1134 void **ppvObject)
1136 *ppvObject = NULL;
1138 if(IsEqualGUID(&IID_IGetBindHandle, riid))
1139 return E_NOINTERFACE;
1141 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
1142 return E_NOINTERFACE;
1145 static ULONG WINAPI WinInetHttpInfo_AddRef(
1146 IWinInetHttpInfo* This)
1148 return 2;
1151 static ULONG WINAPI WinInetHttpInfo_Release(
1152 IWinInetHttpInfo* This)
1154 return 1;
1157 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1158 IWinInetHttpInfo* This,
1159 DWORD dwOption,
1160 LPVOID pBuffer,
1161 DWORD *pcbBuf)
1163 return E_NOTIMPL; /* TODO */
1166 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1167 IWinInetHttpInfo* This,
1168 DWORD dwOption,
1169 LPVOID pBuffer,
1170 DWORD *pcbBuf,
1171 DWORD *pdwFlags,
1172 DWORD *pdwReserved)
1174 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1176 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1177 ok(pBuffer != NULL, "pBuffer == NULL\n");
1178 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1179 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1180 *((DWORD*)pBuffer) = status_code;
1181 return S_OK;
1184 return E_NOTIMPL; /* TODO */
1187 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1188 WinInetHttpInfo_QueryInterface,
1189 WinInetHttpInfo_AddRef,
1190 WinInetHttpInfo_Release,
1191 WinInetHttpInfo_QueryOption,
1192 WinInetHttpInfo_QueryInfo
1195 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1197 DEFINE_GUID(IID_unk_binding, 0xf3d8f080,0xa5eb,0x476f,0x9d,0x19,0xa5,0xef,0x24,0xe5,0xc2,0xe6);
1199 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1201 if(IsEqualGUID(&IID_IUnknown, riid)) {
1202 *ppv = iface;
1203 return S_OK;
1206 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1207 *ppv = &WinInetHttpInfo;
1208 return S_OK;
1211 if(IsEqualGUID(&IID_unk_binding, riid)) {
1212 *ppv = NULL;
1213 return E_NOINTERFACE;
1216 if(winetest_debug > 1) trace("Binding::QI(%s)\n", wine_dbgstr_guid(riid));
1217 *ppv = NULL;
1218 return E_NOINTERFACE;
1221 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1223 return 2;
1226 static ULONG WINAPI Binding_Release(IBinding *iface)
1228 return 1;
1231 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1233 CHECK_EXPECT(Abort);
1234 if(asynchronous_binding)
1235 PeekMessageA(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1236 return S_OK;
1239 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1241 ok(0, "unexpected call\n");
1242 return E_NOTIMPL;
1245 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1247 ok(0, "unexpected call\n");
1248 return E_NOTIMPL;
1251 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1253 ok(0, "unexpected call\n");
1254 return E_NOTIMPL;
1257 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1259 ok(0, "unexpected call\n");
1260 return E_NOTIMPL;
1263 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1264 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1266 CHECK_EXPECT(GetBindResult);
1267 return E_NOTIMPL;
1270 static const IBindingVtbl BindingVtbl = {
1271 Binding_QueryInterface,
1272 Binding_AddRef,
1273 Binding_Release,
1274 Binding_Abort,
1275 Binding_Suspend,
1276 Binding_Resume,
1277 Binding_SetPriority,
1278 Binding_GetPriority,
1279 Binding_GetBindResult
1282 static IBinding Binding = { &BindingVtbl };
1284 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1285 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1287 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1289 *ppv = NULL;
1291 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1292 return E_NOINTERFACE; /* TODO */
1293 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1294 return E_NOINTERFACE; /* TODO */
1296 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
1297 return E_NOINTERFACE;
1300 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1302 return 2;
1305 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1307 return 1;
1310 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1312 CHECK_EXPECT(GetClassID);
1313 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", wine_dbgstr_guid(pClassID));
1314 return E_FAIL;
1317 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1319 ok(0, "unexpected call\n");
1320 return E_NOTIMPL;
1323 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1325 ok(0, "unexpected call\n");
1326 return E_NOTIMPL;
1329 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1331 ok(0, "unexpected call\n");
1332 return E_NOTIMPL;
1335 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1337 ok(0, "unexpected call\n");
1338 return E_NOTIMPL;
1341 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1342 REFIID riidResult, void **ppvResult)
1344 ok(0, "unexpected call\n");
1345 return E_NOTIMPL;
1348 static void test_binding_ui(IUnknown *unk)
1350 IWindowForBindingUI *binding_ui;
1351 IServiceProvider *serv_prov;
1352 HWND binding_hwnd;
1353 HRESULT hres;
1355 hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
1356 ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
1358 hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
1359 (void**)&binding_ui);
1360 ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
1362 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &binding_hwnd);
1363 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1364 if(doc_hwnd)
1365 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1366 else
1367 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1369 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IAuthenticate, &binding_hwnd);
1370 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1371 if(doc_hwnd)
1372 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1373 else
1374 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1376 hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
1377 ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
1378 if(doc_hwnd)
1379 ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
1380 else
1381 todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
1383 IWindowForBindingUI_Release(binding_ui);
1384 IServiceProvider_Release(serv_prov);
1387 static void continue_binding(IBindStatusCallback *callback)
1389 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1390 STGMEDIUM stgmedium;
1391 HRESULT hres;
1393 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1395 test_binding_ui((IUnknown*)callback);
1397 if(report_mime) {
1398 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1399 wszTextHtml);
1400 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1403 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1404 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1405 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1406 if(status_code != HTTP_STATUS_OK) {
1407 CHECK_CALLED_BROKEN(IsErrorUrl);
1408 SET_EXPECT(IsErrorUrl);
1411 SET_EXPECT(Read);
1412 stgmedium.tymed = TYMED_ISTREAM;
1413 U(stgmedium).pstm = &Stream;
1414 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1415 hres = IBindStatusCallback_OnDataAvailable(callback,
1416 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1417 sizeof(html_page)-1, &formatetc, &stgmedium);
1418 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1419 CHECK_CALLED(Read);
1421 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1422 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1423 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1425 SET_EXPECT(GetBindResult);
1426 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1427 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1428 CLEAR_CALLED(GetBindResult); /* IE7 */
1430 IBindStatusCallback_Release(callback);
1433 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1434 REFIID riid, void **ppv)
1436 IBindStatusCallback *callback = NULL;
1437 IBindCallbackRedirect *redirect_callback;
1438 IServiceProvider *service_provider;
1439 BINDINFO bindinfo;
1440 DWORD bindf;
1441 HRESULT hres;
1443 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1445 CHECK_EXPECT(BindToStorage);
1447 load_state = LD_LOADING;
1449 ok(pbc != NULL, "pbc == NULL\n");
1450 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1451 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1452 ok(ppv != NULL, "ppv == NULL\n");
1453 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1455 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1456 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1457 ok(callback != NULL, "callback == NULL\n");
1459 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1460 bindinfo.cbSize = sizeof(bindinfo);
1462 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1463 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1464 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1465 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1466 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1467 /* TODO: test stgmedData */
1468 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1469 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1470 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1471 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1472 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1473 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1474 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1475 /* TODO: test dwCodePage */
1476 /* TODO: test securityAttributes */
1477 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1478 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1479 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1481 hres = IBindStatusCallback_QueryInterface(callback, &IID_IServiceProvider, (void**)&service_provider);
1482 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
1484 hres = IServiceProvider_QueryService(service_provider, &IID_IBindCallbackRedirect, &IID_IBindCallbackRedirect, (void**)&redirect_callback);
1485 ok(hres == S_OK, "QueryService(IID_IBindCallbackRedirect) returned %08x\n", hres);
1487 IBindCallbackRedirect_Release(redirect_callback);
1488 IServiceProvider_Release(service_provider);
1490 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1491 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1493 if(asynchronous_binding) {
1494 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1495 return MK_S_ASYNCHRONOUS;
1498 continue_binding(callback);
1499 return S_OK;
1502 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1503 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1505 ok(0, "unexpected call\n");
1506 return E_NOTIMPL;
1509 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1510 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1512 ok(0, "unexpected call\n");
1513 return E_NOTIMPL;
1516 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1518 ok(0, "unexpected call\n");
1519 return E_NOTIMPL;
1522 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1524 ok(0, "unexpected call\n");
1525 return E_NOTIMPL;
1528 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1530 ok(0, "unexpected call\n");
1531 return E_NOTIMPL;
1534 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1535 IMoniker *pmkNewlyRunning)
1537 ok(0, "unexpected call\n");
1538 return E_NOTIMPL;
1541 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1542 IMoniker *pmkToLeft, FILETIME *pFileTime)
1544 ok(0, "unexpected call\n");
1545 return E_NOTIMPL;
1548 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1550 ok(0, "unexpected call\n");
1551 return E_NOTIMPL;
1554 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1555 IMoniker **ppmkPrefix)
1557 ok(0, "unexpected call\n");
1558 return E_NOTIMPL;
1561 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1562 IMoniker **pmkRelPath)
1564 ok(0, "unexpected call\n");
1565 return E_NOTIMPL;
1568 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1569 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1571 CHECK_EXPECT2(GetDisplayName);
1573 /* ok(pbc != NULL, "pbc == NULL\n"); */
1574 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1575 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1577 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1578 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1580 return S_OK;
1583 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1584 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1586 ok(0, "unexpected call\n");
1587 return E_NOTIMPL;
1590 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1592 CHECK_EXPECT(IsSystemMoniker);
1593 return E_NOTIMPL;
1596 static const IMonikerVtbl MonikerVtbl = {
1597 Moniker_QueryInterface,
1598 Moniker_AddRef,
1599 Moniker_Release,
1600 Moniker_GetClassID,
1601 Moniker_IsDirty,
1602 Moniker_Load,
1603 Moniker_Save,
1604 Moniker_GetSizeMax,
1605 Moniker_BindToObject,
1606 Moniker_BindToStorage,
1607 Moniker_Reduce,
1608 Moniker_ComposeWith,
1609 Moniker_Enum,
1610 Moniker_IsEqual,
1611 Moniker_Hash,
1612 Moniker_IsRunning,
1613 Moniker_GetTimeOfLastChange,
1614 Moniker_Inverse,
1615 Moniker_CommonPrefixWith,
1616 Moniker_RelativePathTo,
1617 Moniker_GetDisplayName,
1618 Moniker_ParseDisplayName,
1619 Moniker_IsSystemMoniker
1622 static IMoniker Moniker = { &MonikerVtbl };
1624 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1626 return QueryInterface(riid, ppv);
1629 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1631 return 2;
1634 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1636 return 1;
1639 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1640 LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1642 ok(0, "unexpected call\n");
1643 return E_NOTIMPL;
1646 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1647 IEnumUnknown **ppenum)
1649 ok(0, "unexpected call\n");
1650 return E_NOTIMPL;
1653 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1655 CHECK_EXPECT(LockContainer);
1656 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1657 return S_OK;
1660 static const IOleContainerVtbl OleContainerVtbl = {
1661 OleContainer_QueryInterface,
1662 OleContainer_AddRef,
1663 OleContainer_Release,
1664 OleContainer_ParseDisplayName,
1665 OleContainer_EnumObjects,
1666 OleContainer_LockContainer
1669 static IOleContainer OleContainer = { &OleContainerVtbl };
1671 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1673 return QueryInterface(riid, ppv);
1676 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1678 return 2;
1681 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1683 return 1;
1686 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1688 ok(0, "unexpected call\n");
1689 return E_NOTIMPL;
1692 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1693 IMoniker **ppmon)
1695 ok(0, "unexpected call\n");
1696 return E_NOTIMPL;
1699 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1701 CHECK_EXPECT(GetContainer);
1702 ok(ppContainer != NULL, "ppContainer = NULL\n");
1703 *ppContainer = &OleContainer;
1704 return S_OK;
1707 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1709 ok(0, "unexpected call\n");
1710 return E_NOTIMPL;
1713 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1715 ok(0, "unexpected call\n");
1716 return E_NOTIMPL;
1719 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1721 ok(0, "unexpected call\n");
1722 return E_NOTIMPL;
1725 static const IOleClientSiteVtbl ClientSiteVtbl = {
1726 ClientSite_QueryInterface,
1727 ClientSite_AddRef,
1728 ClientSite_Release,
1729 ClientSite_SaveObject,
1730 ClientSite_GetMoniker,
1731 ClientSite_GetContainer,
1732 ClientSite_ShowObject,
1733 ClientSite_OnShowWindow,
1734 ClientSite_RequestNewObjectLayout
1737 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1739 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1741 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1743 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1744 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
1746 *ppv = NULL;
1747 return E_NOINTERFACE;
1750 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1752 return 2;
1755 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1757 return 1;
1760 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1762 CHECK_EXPECT(Frame_GetWindow);
1763 return E_NOTIMPL;
1766 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1768 ok(0, "unexpected call\n");
1769 return E_NOTIMPL;
1772 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1774 ok(0, "unexpected call\n");
1775 return E_NOTIMPL;
1778 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1779 LPCBORDERWIDTHS pborderwidths)
1781 ok(0, "unexpected call\n");
1782 return E_NOTIMPL;
1785 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1786 LPCBORDERWIDTHS pborderwidths)
1788 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1789 return S_OK;
1792 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1793 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1795 static const WCHAR wszHTML_Document[] =
1796 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1798 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1800 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1801 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1802 if(pActiveObject && is_lang_english())
1803 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1805 else {
1806 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1807 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1809 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1810 return S_OK;
1813 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1814 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1816 static const WCHAR wszHTML_Document[] =
1817 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1819 if(pActiveObject) {
1820 CHECK_EXPECT2(SetActiveObject);
1822 if(pActiveObject && is_lang_english())
1823 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1824 }else {
1825 CHECK_EXPECT(SetActiveObject_null);
1827 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1828 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1831 return S_OK;
1834 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1835 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1837 ok(0, "unexpected call\n");
1838 return E_NOTIMPL;
1841 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1842 HOLEMENU holemenu, HWND hwndActiveObject)
1844 ok(0, "unexpected call\n");
1845 return E_NOTIMPL;
1848 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1850 ok(0, "unexpected call\n");
1851 return E_NOTIMPL;
1854 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1856 if(!resetting_document)
1857 CHECK_EXPECT2(SetStatusText);
1858 if(!expect_status_text)
1859 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1860 return S_OK;
1863 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1865 if(fEnable)
1866 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1867 else
1868 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1869 return E_NOTIMPL;
1872 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1874 ok(0, "unexpected call\n");
1875 return E_NOTIMPL;
1878 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1879 InPlaceFrame_QueryInterface,
1880 InPlaceFrame_AddRef,
1881 InPlaceFrame_Release,
1882 InPlaceFrame_GetWindow,
1883 InPlaceFrame_ContextSensitiveHelp,
1884 InPlaceFrame_GetBorder,
1885 InPlaceFrame_RequestBorderSpace,
1886 InPlaceFrame_SetBorderSpace,
1887 InPlaceFrame_SetActiveObject,
1888 InPlaceFrame_InsertMenus,
1889 InPlaceFrame_SetMenu,
1890 InPlaceFrame_RemoveMenus,
1891 InPlaceFrame_SetStatusText,
1892 InPlaceFrame_EnableModeless,
1893 InPlaceFrame_TranslateAccelerator
1896 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1898 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1899 InPlaceFrame_QueryInterface,
1900 InPlaceFrame_AddRef,
1901 InPlaceFrame_Release,
1902 InPlaceFrame_GetWindow,
1903 InPlaceFrame_ContextSensitiveHelp,
1904 InPlaceFrame_GetBorder,
1905 InPlaceFrame_RequestBorderSpace,
1906 InPlaceFrame_SetBorderSpace,
1907 InPlaceUIWindow_SetActiveObject,
1910 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1912 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1914 return QueryInterface(riid, ppv);
1917 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1919 return 2;
1922 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1924 return 1;
1927 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1928 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1930 IOleClientSite *client_site;
1931 IOleObject *ole_obj;
1932 HRESULT hres;
1934 CHECK_EXPECT2(GetWindow);
1935 ok(phwnd != NULL, "phwnd = NULL\n");
1936 *phwnd = container_hwnd;
1938 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1939 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1941 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1942 IOleObject_Release(ole_obj);
1943 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1944 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1945 IOleClientSite_Release(client_site);
1947 return S_OK;
1950 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1951 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1953 ok(0, "unexpected call\n");
1954 return E_NOTIMPL;
1957 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1958 IOleInPlaceSiteWindowless *iface)
1960 CHECK_EXPECT(CanInPlaceActivate);
1961 return S_OK;
1964 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1965 IOleInPlaceSiteWindowless *iface)
1967 CHECK_EXPECT(OnInPlaceActivate);
1968 inplace_deactivated = FALSE;
1969 return S_OK;
1972 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1973 IOleInPlaceSiteWindowless *iface)
1975 CHECK_EXPECT(OnUIActivate);
1976 return S_OK;
1979 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1980 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1981 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1982 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1984 static const RECT rect = {0,0,500,500};
1986 CHECK_EXPECT(GetWindowContext);
1988 ok(ppFrame != NULL, "ppFrame = NULL\n");
1989 if(ppFrame)
1990 *ppFrame = &InPlaceFrame;
1991 ok(ppDoc != NULL, "ppDoc = NULL\n");
1992 if(ppDoc)
1993 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1994 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1995 if(lprcPosRect)
1996 memcpy(lprcPosRect, &rect, sizeof(RECT));
1997 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1998 if(lprcClipRect)
1999 memcpy(lprcClipRect, &rect, sizeof(RECT));
2000 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
2001 if(lpFrameInfo) {
2002 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
2003 lpFrameInfo->fMDIApp = FALSE;
2004 lpFrameInfo->hwndFrame = container_hwnd;
2005 lpFrameInfo->haccel = NULL;
2006 lpFrameInfo->cAccelEntries = 0;
2009 return S_OK;
2012 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
2013 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
2015 ok(0, "unexpected call\n");
2016 return E_NOTIMPL;
2019 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
2020 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
2022 CHECK_EXPECT(OnUIDeactivate);
2023 ok(!fUndoable, "fUndoable = TRUE\n");
2024 return S_OK;
2027 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
2028 IOleInPlaceSiteWindowless *iface)
2030 CHECK_EXPECT(OnInPlaceDeactivate);
2031 inplace_deactivated = TRUE;
2032 return S_OK;
2035 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
2036 IOleInPlaceSiteWindowless *iface)
2038 ok(0, "unexpected call\n");
2039 return E_NOTIMPL;
2042 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
2043 IOleInPlaceSiteWindowless *iface)
2045 ok(0, "unexpected call\n");
2046 return E_NOTIMPL;
2049 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
2050 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
2052 ok(0, "unexpected call\n");
2053 return E_NOTIMPL;
2056 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
2057 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
2059 CHECK_EXPECT(OnInPlaceActivateEx);
2061 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
2062 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
2063 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
2065 return S_OK;
2068 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
2069 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
2071 CHECK_EXPECT(OnInPlaceDeactivateEx);
2073 ok(fNoRedraw, "fNoRedraw == FALSE\n");
2075 return S_OK;
2078 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
2079 IOleInPlaceSiteWindowless *iface)
2081 CHECK_EXPECT2(RequestUIActivate);
2082 return S_OK;
2085 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
2086 IOleInPlaceSiteWindowless *iface)
2088 ok(0, "unexpected call\n");
2089 return E_NOTIMPL;
2092 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
2093 IOleInPlaceSiteWindowless *iface)
2095 ok(0, "unexpected call\n");
2096 return E_NOTIMPL;
2099 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
2100 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
2102 ok(0, "unexpected call\n");
2103 return E_NOTIMPL;
2106 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
2107 IOleInPlaceSiteWindowless *iface)
2109 ok(0, "unexpected call\n");
2110 return E_NOTIMPL;
2113 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
2114 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
2116 ok(0, "unexpected call\n");
2117 return E_NOTIMPL;
2120 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
2121 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
2122 DWORD grfFlags, HDC *phDC)
2124 ok(0, "unexpected call\n");
2125 return E_NOTIMPL;
2128 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
2129 IOleInPlaceSiteWindowless *iface, HDC hDC)
2131 ok(0, "unexpected call\n");
2132 return E_NOTIMPL;
2135 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
2136 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
2138 ok(0, "unexpected call\n");
2139 return E_NOTIMPL;
2142 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
2143 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
2145 ok(0, "unexpected call\n");
2146 return E_NOTIMPL;
2149 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2150 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2151 LPCRECT pRectScroll, LPCRECT pRectClip)
2153 ok(0, "unexpected call\n");
2154 return E_NOTIMPL;
2157 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2158 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2160 ok(0, "unexpected call\n");
2161 return E_NOTIMPL;
2164 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2165 IOleInPlaceSiteWindowless *iface, UINT msg,
2166 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2168 ok(0, "unexpected call\n");
2169 return E_NOTIMPL;
2172 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2173 InPlaceSiteWindowless_QueryInterface,
2174 InPlaceSiteWindowless_AddRef,
2175 InPlaceSiteWindowless_Release,
2176 InPlaceSiteWindowless_GetWindow,
2177 InPlaceSiteWindowless_ContextSensitiveHelp,
2178 InPlaceSiteWindowless_CanInPlaceActivate,
2179 InPlaceSiteWindowless_OnInPlaceActivate,
2180 InPlaceSiteWindowless_OnUIActivate,
2181 InPlaceSiteWindowless_GetWindowContext,
2182 InPlaceSiteWindowless_Scroll,
2183 InPlaceSiteWindowless_OnUIDeactivate,
2184 InPlaceSiteWindowless_OnInPlaceDeactivate,
2185 InPlaceSiteWindowless_DiscardUndoState,
2186 InPlaceSiteWindowless_DeactivateAndUndo,
2187 InPlaceSiteWindowless_OnPosRectChange,
2188 InPlaceSiteWindowless_OnInPlaceActivateEx,
2189 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2190 InPlaceSiteWindowless_RequestUIActivate,
2191 InPlaceSiteWindowless_CanWindowlessActivate,
2192 InPlaceSiteWindowless_GetCapture,
2193 InPlaceSiteWindowless_SetCapture,
2194 InPlaceSiteWindowless_GetFocus,
2195 InPlaceSiteWindowless_SetFocus,
2196 InPlaceSiteWindowless_GetDC,
2197 InPlaceSiteWindowless_ReleaseDC,
2198 InPlaceSiteWindowless_InvalidateRect,
2199 InPlaceSiteWindowless_InvalidateRgn,
2200 InPlaceSiteWindowless_ScrollRect,
2201 InPlaceSiteWindowless_AdjustRect,
2202 InPlaceSiteWindowless_OnDefWindowMessage
2205 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2207 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2209 return QueryInterface(riid, ppv);
2212 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2214 return 2;
2217 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2219 return 1;
2222 typedef enum
2224 CallUIActivate_None,
2225 CallUIActivate_ActivateMe,
2226 CallUIActivate_AfterShow,
2227 } CallUIActivate;
2229 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2230 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2232 IOleDocument *document;
2233 HRESULT hres;
2235 CHECK_EXPECT(ActivateMe);
2236 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2238 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2239 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2241 if(SUCCEEDED(hres)) {
2242 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2243 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2245 if(SUCCEEDED(hres)) {
2246 IOleInPlaceActiveObject *activeobj = NULL;
2247 IOleInPlaceSite *inplacesite = NULL;
2248 HWND tmp_hwnd = NULL;
2249 static RECT rect = {0,0,400,500};
2251 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2252 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2253 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2254 inplacesite, &InPlaceSiteWindowless);
2256 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2257 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2259 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2260 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2261 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2262 inplacesite, &InPlaceSiteWindowless);
2264 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2265 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2267 if(activeobj) {
2268 HWND hwnd = (void*)0xdeadbeef;
2269 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2270 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
2271 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2274 if(call_UIActivate == CallUIActivate_ActivateMe) {
2275 SET_EXPECT(CanInPlaceActivate);
2276 SET_EXPECT(GetWindowContext);
2277 SET_EXPECT(GetWindow);
2278 if(ipsex)
2279 SET_EXPECT(OnInPlaceActivateEx);
2280 else
2281 SET_EXPECT(OnInPlaceActivate);
2282 SET_EXPECT(SetStatusText);
2283 SET_EXPECT(Exec_SETPROGRESSMAX);
2284 SET_EXPECT(Exec_SETPROGRESSPOS);
2285 SET_EXPECT(OnUIActivate);
2286 SET_EXPECT(SetActiveObject);
2287 SET_EXPECT(ShowUI);
2288 expect_status_text = NULL;
2290 hres = IOleDocumentView_UIActivate(view, TRUE);
2291 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2293 CHECK_CALLED(CanInPlaceActivate);
2294 CHECK_CALLED(GetWindowContext);
2295 CHECK_CALLED(GetWindow);
2296 if(ipsex)
2297 CHECK_CALLED(OnInPlaceActivateEx);
2298 else
2299 CHECK_CALLED(OnInPlaceActivate);
2300 CHECK_CALLED(SetStatusText);
2301 CHECK_CALLED(Exec_SETPROGRESSMAX);
2302 CHECK_CALLED(Exec_SETPROGRESSPOS);
2303 CHECK_CALLED(OnUIActivate);
2304 CHECK_CALLED(SetActiveObject);
2305 CHECK_CALLED(ShowUI);
2307 if(activeobj) {
2308 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2309 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2310 ok(doc_hwnd != NULL, "hwnd == NULL\n");
2311 if(last_hwnd)
2312 ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
2315 hres = IOleDocumentView_UIActivate(view, TRUE);
2316 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2318 if(activeobj) {
2319 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2320 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2321 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
2325 hres = IOleDocumentView_SetRect(view, &rect);
2326 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2328 if(call_UIActivate == CallUIActivate_ActivateMe) {
2329 hres = IOleDocumentView_Show(view, TRUE);
2330 ok(hres == S_OK, "Show failed: %08x\n", hres);
2331 }else {
2332 SET_EXPECT(CanInPlaceActivate);
2333 SET_EXPECT(GetWindowContext);
2334 SET_EXPECT(GetWindow);
2335 if(ipsex)
2336 SET_EXPECT(OnInPlaceActivateEx);
2337 else
2338 SET_EXPECT(OnInPlaceActivate);
2339 SET_EXPECT(SetStatusText);
2340 SET_EXPECT(Exec_SETPROGRESSMAX);
2341 SET_EXPECT(Exec_SETPROGRESSPOS);
2342 SET_EXPECT(OnUIActivate);
2343 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2345 hres = IOleDocumentView_Show(view, TRUE);
2346 ok(hres == S_OK, "Show failed: %08x\n", hres);
2348 CHECK_CALLED(CanInPlaceActivate);
2349 CHECK_CALLED(GetWindowContext);
2350 CHECK_CALLED(GetWindow);
2351 if(ipsex)
2352 CHECK_CALLED(OnInPlaceActivateEx);
2353 else
2354 CHECK_CALLED(OnInPlaceActivate);
2355 CHECK_CALLED(SetStatusText);
2356 CHECK_CALLED(Exec_SETPROGRESSMAX);
2357 CHECK_CALLED(Exec_SETPROGRESSPOS);
2359 if(activeobj) {
2360 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
2361 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2362 ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
2363 if(last_hwnd)
2364 ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
2368 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2370 if(activeobj)
2371 IOleInPlaceActiveObject_Release(activeobj);
2374 IOleDocument_Release(document);
2377 return S_OK;
2380 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2381 DocumentSite_QueryInterface,
2382 DocumentSite_AddRef,
2383 DocumentSite_Release,
2384 DocumentSite_ActivateMe
2387 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2389 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2391 return QueryInterface(riid, ppv);
2394 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2396 return 2;
2399 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2401 return 1;
2404 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2406 ok(0, "unexpected call\n");
2407 return E_NOTIMPL;
2410 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2412 ok(0, "unexpected call\n");
2413 return E_NOTIMPL;
2416 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2418 ok(0, "unexpected call\n");
2419 return E_NOTIMPL;
2422 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2423 POINTF *pPtfContainer, DWORD dwFlags)
2425 ok(0, "unexpected call\n");
2426 return E_NOTIMPL;
2429 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2430 MSG *pMsg, DWORD grfModifiers)
2432 ok(0, "unexpected call\n");
2433 return E_NOTIMPL;
2436 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2438 if(fGotFocus)
2439 CHECK_EXPECT(OnFocus_TRUE);
2440 else
2441 CHECK_EXPECT2(OnFocus_FALSE);
2442 return S_OK;
2445 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2447 ok(0, "unexpected call\n");
2448 return E_NOTIMPL;
2451 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2452 OleControlSite_QueryInterface,
2453 OleControlSite_AddRef,
2454 OleControlSite_Release,
2455 OleControlSite_OnControlInfoChanged,
2456 OleControlSite_LockInPlaceActive,
2457 OleControlSite_GetExtendedControl,
2458 OleControlSite_TransformCoords,
2459 OleControlSite_TranslateAccelerator,
2460 OleControlSite_OnFocus,
2461 OleControlSite_ShowPropertyFrame
2464 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2466 static IDocHostUIHandler2 *expect_uihandler_iface;
2468 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2470 return QueryInterface(riid, ppv);
2473 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2475 return 2;
2478 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2480 return 1;
2483 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2484 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2486 ok(0, "unexpected call\n");
2487 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2488 return E_NOTIMPL;
2491 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2493 if(!resetting_document)
2494 CHECK_EXPECT(GetHostInfo);
2495 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2496 ok(pInfo != NULL, "pInfo=NULL\n");
2497 if(pInfo) {
2498 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2499 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2500 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2501 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2502 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2503 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2504 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2505 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2507 return S_OK;
2510 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2511 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2512 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2514 CHECK_EXPECT(ShowUI);
2515 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2517 if (editmode)
2518 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2519 else
2520 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2521 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2522 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2523 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2524 if (expect_InPlaceUIWindow_SetActiveObject_active)
2525 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2526 else
2527 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2529 return S_OK;
2532 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2534 CHECK_EXPECT(HideUI);
2535 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2536 return S_OK;
2539 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2541 CHECK_EXPECT(UpdateUI);
2542 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2543 return S_OK;
2546 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2548 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2549 if(fEnable)
2550 CHECK_EXPECT2(EnableModeless_TRUE);
2551 else
2552 CHECK_EXPECT2(EnableModeless_FALSE);
2553 return E_NOTIMPL;
2556 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2558 ok(0, "unexpected call\n");
2559 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2560 return E_NOTIMPL;
2563 static BOOL expect_OnFrameWindowActivate_fActivate;
2564 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2566 CHECK_EXPECT2(OnFrameWindowActivate);
2567 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2568 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2569 return S_OK;
2572 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2573 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2575 ok(0, "unexpected call\n");
2576 return E_NOTIMPL;
2579 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2580 const GUID *pguidCmdGroup, DWORD nCmdID)
2582 ok(0, "unexpected call\n");
2583 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2584 return E_NOTIMPL;
2587 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2588 LPOLESTR *pchKey, DWORD dw)
2590 CHECK_EXPECT(GetOptionKeyPath);
2591 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2592 ok(pchKey != NULL, "pchKey = NULL\n");
2593 ok(!dw, "dw=%d, expected 0\n", dw);
2594 if(pchKey)
2595 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2596 return S_OK;
2599 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2600 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2602 CHECK_EXPECT(GetDropTarget);
2603 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2604 /* TODO */
2605 return E_NOTIMPL;
2608 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2610 CHECK_EXPECT(GetExternal);
2611 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2612 *ppDispatch = &External;
2613 return S_FALSE;
2616 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2617 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2619 CHECK_EXPECT(TranslateUrl);
2620 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2621 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2622 todo_wine_if(loading_hash)
2623 ok(!lstrcmpW(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn),
2624 wine_dbgstr_w(nav_serv_url));
2625 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2626 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2628 /* Not related to hash navigation, just return NULL and S_OK in some cases. */
2629 if(loading_hash) {
2630 *ppchURLOut = NULL;
2631 return S_OK;
2634 return S_FALSE;
2637 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2638 IDataObject **ppPORet)
2640 ok(0, "unexpected call\n");
2641 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2642 return E_NOTIMPL;
2645 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2646 LPOLESTR *pchKey, DWORD dw)
2648 CHECK_EXPECT(GetOverrideKeyPath);
2649 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2650 ok(pchKey != NULL, "pchKey = NULL\n");
2651 if(pchKey)
2652 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2653 ok(!dw, "dw=%d, expected 0\n", dw);
2654 return S_OK;
2657 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2658 DocHostUIHandler_QueryInterface,
2659 DocHostUIHandler_AddRef,
2660 DocHostUIHandler_Release,
2661 DocHostUIHandler_ShowContextMenu,
2662 DocHostUIHandler_GetHostInfo,
2663 DocHostUIHandler_ShowUI,
2664 DocHostUIHandler_HideUI,
2665 DocHostUIHandler_UpdateUI,
2666 DocHostUIHandler_EnableModeless,
2667 DocHostUIHandler_OnDocWindowActivate,
2668 DocHostUIHandler_OnFrameWindowActivate,
2669 DocHostUIHandler_ResizeBorder,
2670 DocHostUIHandler_TranslateAccelerator,
2671 DocHostUIHandler_GetOptionKeyPath,
2672 DocHostUIHandler_GetDropTarget,
2673 DocHostUIHandler_GetExternal,
2674 DocHostUIHandler_TranslateUrl,
2675 DocHostUIHandler_FilterDataObject,
2676 DocHostUIHandler_GetOverrideKeyPath
2679 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2681 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2683 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2684 *ppv = iface;
2685 return S_OK;
2688 *ppv = NULL;
2690 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2691 return E_NOINTERFACE;
2693 if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2694 return E_NOINTERFACE; /* TODO */
2696 if(winetest_debug > 1) trace("CustomDocHostUIHandler::QI(%s)\n", wine_dbgstr_guid(riid));
2697 return E_NOINTERFACE;
2700 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2701 CustomDocHostUIHandler_QueryInterface,
2702 DocHostUIHandler_AddRef,
2703 DocHostUIHandler_Release,
2704 DocHostUIHandler_ShowContextMenu,
2705 DocHostUIHandler_GetHostInfo,
2706 DocHostUIHandler_ShowUI,
2707 DocHostUIHandler_HideUI,
2708 DocHostUIHandler_UpdateUI,
2709 DocHostUIHandler_EnableModeless,
2710 DocHostUIHandler_OnDocWindowActivate,
2711 DocHostUIHandler_OnFrameWindowActivate,
2712 DocHostUIHandler_ResizeBorder,
2713 DocHostUIHandler_TranslateAccelerator,
2714 DocHostUIHandler_GetOptionKeyPath,
2715 DocHostUIHandler_GetDropTarget,
2716 DocHostUIHandler_GetExternal,
2717 DocHostUIHandler_TranslateUrl,
2718 DocHostUIHandler_FilterDataObject,
2719 DocHostUIHandler_GetOverrideKeyPath
2722 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2724 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2725 REFIID riid, void **ppv)
2727 return QueryInterface(riid, ppv);
2730 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2732 return 2;
2735 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2737 return 1;
2740 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2741 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2743 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2744 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2745 ok(!pCmdText, "pCmdText != NULL\n");
2747 switch(prgCmds[0].cmdID) {
2748 case OLECMDID_SETPROGRESSTEXT:
2749 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2750 prgCmds[0].cmdf = OLECMDF_ENABLED;
2751 return S_OK;
2752 case OLECMDID_OPEN:
2753 CHECK_EXPECT(QueryStatus_OPEN);
2754 prgCmds[0].cmdf = 0;
2755 return S_OK;
2756 case OLECMDID_NEW:
2757 CHECK_EXPECT(QueryStatus_NEW);
2758 prgCmds[0].cmdf = 0;
2759 return S_OK;
2760 default:
2761 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2764 return E_FAIL;
2767 static void test_save_history(IUnknown *unk)
2769 IPersistHistory *per_hist;
2770 LARGE_INTEGER li;
2771 IStream *stream;
2772 HRESULT hres;
2774 hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&per_hist);
2775 ok(hres == S_OK, "Could not get IPersistHistory iface: %08x\n", hres);
2777 hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
2778 ok(hres == S_OK, "CreateStreamOnHGlobal failed: %08x\n", hres);
2780 hres = IPersistHistory_SaveHistory(per_hist, stream);
2781 ok(hres == S_OK, "SaveHistory failed: %08x\n", hres);
2782 IPersistHistory_Release(per_hist);
2784 li.QuadPart = 0;
2785 hres = IStream_Seek(stream, li, STREAM_SEEK_SET, NULL);
2786 ok(hres == S_OK, "Stat failed: %08x\n", hres);
2787 history_stream = stream;
2790 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2791 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2793 if(resetting_document)
2794 return E_FAIL;
2796 if(!pguidCmdGroup) {
2797 test_readyState(NULL);
2799 switch(nCmdID) {
2800 case OLECMDID_SETPROGRESSMAX:
2801 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2802 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2803 ok(pvaIn != NULL, "pvaIn == NULL\n");
2804 if(pvaIn) {
2805 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2806 if(load_state == LD_NO)
2807 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2809 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2810 return S_OK;
2811 case OLECMDID_SETPROGRESSPOS:
2812 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2813 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2814 ok(pvaIn != NULL, "pvaIn == NULL\n");
2815 if(pvaIn) {
2816 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2817 if(load_state == LD_NO)
2818 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2820 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2821 return S_OK;
2822 case OLECMDID_HTTPEQUIV_DONE:
2823 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2824 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2825 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2826 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2827 readystate_set_loading = FALSE;
2828 readystate_set_interactive = FALSE;
2829 load_state = LD_COMPLETE;
2830 return S_OK;
2831 case OLECMDID_SETDOWNLOADSTATE:
2832 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2833 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2834 ok(pvaIn != NULL, "pvaIn == NULL\n");
2835 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2837 switch(V_I4(pvaIn)) {
2838 case 0:
2839 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2840 if(!loading_js)
2841 load_state = LD_INTERACTIVE;
2842 break;
2843 case 1:
2844 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2845 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2846 break;
2847 default:
2848 ok(0, "unexpected V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2851 return S_OK;
2852 case OLECMDID_UPDATECOMMANDS:
2853 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2854 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2855 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2856 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2857 return S_OK;
2858 case OLECMDID_SETTITLE:
2859 CHECK_EXPECT2(Exec_SETTITLE);
2860 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2861 ok(pvaIn != NULL, "pvaIn == NULL\n");
2862 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2863 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2864 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2865 return S_OK;
2866 case OLECMDID_HTTPEQUIV:
2867 CHECK_EXPECT2(Exec_HTTPEQUIV);
2868 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2869 ok(pvaIn != NULL, "pvaIn == NULL\n");
2870 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2871 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2872 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2873 test_readyState(NULL);
2874 return S_OK;
2875 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2876 case OLECMDID_PAGEAVAILABLE:
2877 case 6058:
2878 return E_FAIL; /* FIXME */
2879 default:
2880 ok(0, "unexpected command %d\n", nCmdID);
2881 return E_FAIL;
2885 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2886 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2888 switch(nCmdID) {
2889 case 37:
2890 CHECK_EXPECT2(Exec_ShellDocView_37);
2892 if(is_refresh && load_state == LD_COMPLETE) {
2893 load_state = LD_DOLOAD;
2894 test_readyState(NULL);
2895 }else if(is_refresh && load_state == LD_DOLOAD) {
2896 test_readyState(NULL);
2897 load_state = LD_LOADING;
2898 }else {
2899 if(!is_refresh)
2900 test_readyState(NULL);
2901 if(nav_url)
2902 test_GetCurMoniker(doc_unk, NULL, nav_serv_url, FALSE);
2903 else if(load_from_stream)
2904 test_GetCurMoniker(doc_unk, NULL, L"about:blank", FALSE);
2905 else if(!editmode)
2906 test_GetCurMoniker(doc_unk, doc_mon, NULL, FALSE);
2909 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2910 ok(pvaIn != NULL, "pvaIn == NULL\n");
2911 if(pvaIn) {
2912 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2913 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2915 return S_OK;
2917 case 62:
2918 CHECK_EXPECT(Exec_ShellDocView_62);
2919 ok(!pvaIn, "pvaIn != NULL\n");
2920 ok(!pvaOut, "pvaOut != NULL\n");
2921 return S_OK;
2923 case 63: {
2924 IHTMLPrivateWindow *priv_window;
2925 HRESULT hres;
2927 CHECK_EXPECT(Exec_ShellDocView_63);
2928 ok(pvaIn != NULL, "pvaIn == NULL\n");
2929 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2930 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2931 ok(pvaOut != NULL, "pvaOut == NULL\n");
2932 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2934 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2935 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2936 if(SUCCEEDED(hres))
2937 IHTMLPrivateWindow_Release(priv_window);
2939 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2940 return S_OK; /* TODO */
2943 case 67:
2944 CHECK_EXPECT(Exec_ShellDocView_67);
2945 ok(pvaIn != NULL, "pvaIn == NULL\n");
2946 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2947 ok(!lstrcmpW(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected \"%s\"\n",
2948 wine_dbgstr_w(V_BSTR(pvaIn)), wine_dbgstr_w(nav_serv_url));
2949 ok(pvaOut != NULL, "pvaOut == NULL\n");
2950 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2951 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2952 if(!loading_hash)
2953 load_state = LD_DOLOAD;
2954 return S_OK;
2956 case 84:
2957 CHECK_EXPECT2(Exec_ShellDocView_84);
2959 ok(pvaIn == NULL, "pvaIn != NULL\n");
2960 ok(pvaOut != NULL, "pvaOut == NULL\n");
2961 if(pvaIn)
2962 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2964 test_readyState(NULL);
2965 return E_NOTIMPL;
2967 case 103:
2968 CHECK_EXPECT2(Exec_ShellDocView_103);
2970 ok(pvaIn == NULL, "pvaIn != NULL\n");
2971 ok(pvaOut == NULL, "pvaOut != NULL\n");
2973 test_readyState(NULL);
2974 return E_NOTIMPL;
2976 case 105:
2977 CHECK_EXPECT2(Exec_ShellDocView_105);
2979 ok(pvaIn != NULL, "pvaIn == NULL\n");
2980 ok(pvaOut == NULL, "pvaOut != NULL\n");
2982 test_readyState(NULL);
2983 return E_NOTIMPL;
2985 case 138:
2986 CHECK_EXPECT2(Exec_ShellDocView_138);
2987 ok(!pvaIn, "pvaIn != NULL\n");
2988 ok(!pvaOut, "pvaOut != NULL\n");
2989 test_readyState(NULL);
2990 return S_OK;
2992 case 140:
2993 CHECK_EXPECT2(Exec_ShellDocView_140);
2995 ok(pvaIn == NULL, "pvaIn != NULL\n");
2996 ok(pvaOut == NULL, "pvaOut != NULL\n");
2998 test_readyState(NULL);
2999 return E_NOTIMPL;
3001 case 83:
3002 case 101:
3003 case 102:
3004 case 132:
3005 case 133:
3006 case 134: /* TODO */
3007 case 135:
3008 case 136: /* TODO */
3009 case 137:
3010 case 139: /* TODO */
3011 case 143: /* TODO */
3012 case 144: /* TODO */
3013 case 178:
3014 case 179:
3015 case 180:
3016 case 181:
3017 case 182:
3018 case 183:
3019 return E_NOTIMPL;
3021 default:
3022 ok(0, "unexpected command %d\n", nCmdID);
3023 return E_FAIL;
3027 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
3028 test_readyState(NULL);
3029 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
3031 switch(nCmdID) {
3032 case IDM_PARSECOMPLETE:
3033 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
3034 ok(pvaIn == NULL, "pvaIn != NULL\n");
3035 ok(pvaOut == NULL, "pvaOut != NULL\n");
3036 return S_OK;
3037 default:
3038 ok(0, "unexpected command %d\n", nCmdID);
3042 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
3043 switch(nCmdID) {
3044 case DOCHOST_DOCCANNAVIGATE:
3045 if(pvaIn) {
3046 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
3047 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
3048 /* FIXME: test V_UNKNOWN(pvaIn) == window */
3049 }else {
3050 CHECK_EXPECT(Exec_DOCCANNAVIGATE_NULL);
3053 test_readyState(NULL);
3054 ok(pvaOut == NULL, "pvaOut != NULL\n");
3055 return S_OK;
3056 case 1: {
3057 SAFEARRAY *sa;
3058 UINT dim;
3059 LONG ind=0;
3060 VARIANT var;
3061 HRESULT hres;
3063 test_readyState(NULL);
3065 ok(pvaIn != NULL, "pvaIn == NULL\n");
3066 ok(pvaOut != NULL || broken(!pvaOut), "pvaOut != NULL\n");
3067 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3068 if(pvaOut)
3069 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
3070 sa = V_ARRAY(pvaIn);
3072 dim = SafeArrayGetDim(sa);
3073 ok(dim == 1, "dim = %d\n", dim);
3074 hres = SafeArrayGetLBound(sa, 1, &ind);
3075 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
3076 ok(ind == 0, "Lower bound = %d\n", ind);
3077 hres = SafeArrayGetUBound(sa, 1, &ind);
3078 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
3079 ok(ind == 7 || ind == 8 /* IE11 */ ||broken(ind == 5), "Upper bound = %d\n", ind);
3081 ind = 0;
3082 SafeArrayGetElement(sa, &ind, &var);
3083 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
3084 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
3085 VariantClear(&var);
3086 ind = 1;
3087 SafeArrayGetElement(sa, &ind, &var);
3088 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
3089 ok(!lstrcmpW(V_BSTR(&var), L"winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
3090 VariantClear(&var);
3091 ind = 2;
3092 SafeArrayGetElement(sa, &ind, &var);
3093 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3094 VariantClear(&var);
3095 ind = 3;
3096 SafeArrayGetElement(sa, &ind, &var);
3097 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
3098 VariantClear(&var);
3099 ind = 4;
3100 SafeArrayGetElement(sa, &ind, &var);
3101 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3102 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3103 VariantClear(&var);
3104 ind = 5;
3105 SafeArrayGetElement(sa, &ind, &var);
3106 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
3107 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
3108 VariantClear(&var);
3110 default:
3111 return E_FAIL; /* TODO */
3115 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
3116 test_readyState(NULL);
3117 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
3119 switch(nCmdID) {
3120 case 38:
3121 CHECK_EXPECT2(Exec_Explorer_38);
3122 ok(pvaIn != NULL, "pvaIn == NULL\n");
3123 ok(V_VT(pvaIn) == VT_I4 , "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
3124 ok(!V_I4(pvaIn), "V_I4(pvaIn) = %d\n", V_I4(pvaIn));
3125 ok(!pvaOut, "pvaOut != NULL\n");
3127 test_current_url(doc_unk, prev_url);
3128 if(!history_stream)
3129 test_save_history(doc_unk);
3131 return S_OK;
3132 case 69:
3133 CHECK_EXPECT2(Exec_Explorer_69);
3134 ok(pvaIn == NULL, "pvaIn != NULL\n");
3135 ok(pvaOut != NULL, "pvaOut == NULL\n");
3136 return E_NOTIMPL;
3137 case 109: /* TODO */
3138 return E_NOTIMPL;
3139 default:
3140 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
3142 return E_NOTIMPL;
3145 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
3146 test_readyState(NULL);
3148 switch (nCmdID) {
3149 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
3150 SET_EXPECT(SetStatusText);
3151 ok(pvaIn == NULL, "pvaIn != NULL\n");
3152 ok(pvaOut == NULL, "pvaOut != NULL\n");
3153 return S_OK;
3154 case OLECMDID_SHOWSCRIPTERROR:
3155 /* TODO */
3156 return S_OK;
3157 case 2300:
3158 CHECK_EXPECT(Exec_DocHostCommandHandler_2300);
3159 return E_NOTIMPL;
3160 default:
3161 ok(0, "unexpected command %d\n", nCmdID);
3162 return E_FAIL;
3166 ok(0, "unexpected pguidCmdGroup: %s\n", wine_dbgstr_guid(pguidCmdGroup));
3167 return E_NOTIMPL;
3170 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
3171 OleCommandTarget_QueryInterface,
3172 OleCommandTarget_AddRef,
3173 OleCommandTarget_Release,
3174 OleCommandTarget_QueryStatus,
3175 OleCommandTarget_Exec
3178 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
3180 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3182 return QueryInterface(riid, ppv);
3185 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3186 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3187 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3189 if(resetting_document)
3190 return E_FAIL;
3192 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
3193 ok(pDispParams != NULL, "pDispParams == NULL\n");
3194 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
3195 ok(puArgErr != NULL, "puArgErr == NULL\n");
3196 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
3197 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
3199 if(dispIdMember != DISPID_AMBIENT_SILENT && dispIdMember != DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)
3200 test_readyState(NULL);
3202 switch(dispIdMember) {
3203 case DISPID_AMBIENT_USERMODE:
3204 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
3205 V_VT(pVarResult) = VT_BOOL;
3206 V_BOOL(pVarResult) = VARIANT_TRUE;
3207 return S_OK;
3208 case DISPID_AMBIENT_DLCONTROL:
3209 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
3210 return E_FAIL;
3211 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
3212 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3213 return E_FAIL;
3214 case DISPID_AMBIENT_SILENT:
3215 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
3216 V_VT(pVarResult) = VT_BOOL;
3217 V_BOOL(pVarResult) = VARIANT_FALSE;
3218 return S_OK;
3219 case DISPID_AMBIENT_USERAGENT:
3220 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
3221 return E_FAIL;
3222 case DISPID_AMBIENT_PALETTE:
3223 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
3224 return E_FAIL;
3227 ok(0, "unexpected dispid %d\n", dispIdMember);
3228 return E_FAIL;
3231 static const IDispatchVtbl DispatchVtbl = {
3232 Dispatch_QueryInterface,
3233 Dispatch_AddRef,
3234 Dispatch_Release,
3235 Dispatch_GetTypeInfoCount,
3236 Dispatch_GetTypeInfo,
3237 Dispatch_GetIDsOfNames,
3238 Dispatch_Invoke
3241 static IDispatch Dispatch = { &DispatchVtbl };
3243 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
3245 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
3246 *ppv = iface;
3247 return S_OK;
3250 ok(0, "Unexpected call\n");
3251 return E_NOINTERFACE;
3254 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3255 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3256 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3258 HRESULT hres;
3259 IHTMLDocument2 *doc;
3260 BSTR state;
3262 if(resetting_document)
3263 return E_FAIL;
3265 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
3266 ok(pDispParams != NULL, "pDispParams == NULL\n");
3267 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3268 ok(puArgErr != NULL, "puArgErr == NULL\n");
3269 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3270 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3272 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3273 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3275 switch(dispIdMember) {
3276 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3277 hres = IHTMLDocument2_get_readyState(doc, &state);
3278 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3280 if(!lstrcmpW(state, L"interactive"))
3281 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3282 else if(!lstrcmpW(state, L"loading"))
3283 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3284 else if(!lstrcmpW(state, L"complete")) {
3285 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3286 complete = TRUE;
3287 } else
3288 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3290 SysFreeString(state);
3291 break;
3292 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3293 case 1026:
3294 case 1027:
3295 case 1034:
3296 case 1035:
3297 case 1037:
3298 case 1047:
3299 case 1045:
3300 case 1044:
3301 case 1048:
3302 case 1049:
3303 break; /* FIXME: Handle these events. */
3304 default:
3305 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3308 IHTMLDocument2_Release(doc);
3309 return S_OK;
3312 static const IDispatchVtbl EventDispatchVtbl = {
3313 EventDispatch_QueryInterface,
3314 Dispatch_AddRef,
3315 Dispatch_Release,
3316 Dispatch_GetTypeInfoCount,
3317 Dispatch_GetTypeInfo,
3318 Dispatch_GetIDsOfNames,
3319 EventDispatch_Invoke
3322 static IDispatch EventDispatch = { &EventDispatchVtbl };
3324 static HRESULT WINAPI TravelLog_QueryInterface(ITravelLog *iface, REFIID riid, void **ppv)
3326 static const IID IID_IIETravelLog2 = {0xb67cefd2,0xe3f1,0x478a,{0x9b,0xfa,0xd8,0x93,0x70,0x37,0x5e,0x94}};
3327 static const IID IID_unk_travellog = {0x6afc8b7f,0xbc17,0x4a95,{0x90,0x2f,0x6f,0x5c,0xb5,0x54,0xc3,0xd8}};
3328 static const IID IID_unk_travellog2 = {0xf6d02767,0x9c80,0x428d,{0xb9,0x74,0x3f,0x17,0x29,0x45,0x3f,0xdb}};
3330 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ITravelLog, riid)) {
3331 *ppv = iface;
3332 return S_OK;
3335 if(!IsEqualGUID(&IID_IIETravelLog2, riid) && !IsEqualGUID(&IID_unk_travellog, riid)
3336 && !IsEqualGUID(&IID_unk_travellog2, riid))
3337 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
3339 *ppv = NULL;
3340 return E_NOINTERFACE;
3343 static ULONG WINAPI TravelLog_AddRef(ITravelLog *iface)
3345 return 2;
3348 static ULONG WINAPI TravelLog_Release(ITravelLog *iface)
3350 return 1;
3353 static HRESULT WINAPI TravelLog_AddEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3355 ok(0, "unexpected call\n");
3356 return E_NOTIMPL;
3359 static HRESULT WINAPI TravelLog_UpdateEntry(ITravelLog *iface, IUnknown *punk, BOOL fIsLocalAnchor)
3361 ok(0, "unexpected call\n");
3362 return E_NOTIMPL;
3365 static HRESULT WINAPI TravelLog_UpdateExternal(ITravelLog *iface, IUnknown *punk, IUnknown *punkHLBrowseContext)
3367 ok(0, "unexpected call\n");
3368 return E_NOTIMPL;
3371 static HRESULT WINAPI TravelLog_Travel(ITravelLog *iface, IUnknown *punk, int iOffset)
3373 ok(0, "unexpected call\n");
3374 return E_NOTIMPL;
3377 static HRESULT WINAPI TravelLog_GetTravelEntry(ITravelLog *iface, IUnknown *punk, int iOffset, ITravelEntry **ppte)
3379 ok(0, "unexpected call\n");
3380 return E_NOTIMPL;
3383 static HRESULT WINAPI TravelLog_FindTravelEntry(ITravelLog *iface, IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)
3385 ok(0, "unexpected call\n");
3386 return E_NOTIMPL;
3389 static HRESULT WINAPI TravelLog_GetTooltipText(ITravelLog *iface, IUnknown *punk, int iOffset, int idsTemplate,
3390 LPWSTR pwzText, DWORD cchText)
3392 ok(0, "unexpected call\n");
3393 return E_NOTIMPL;
3396 static HRESULT WINAPI TravelLog_InsertMenuEntries(ITravelLog *iface, IUnknown *punk, HMENU hmenu, int nPos,
3397 int idFirst, int idLast, DWORD dwFlags)
3399 ok(0, "unexpected call\n");
3400 return E_NOTIMPL;
3403 static HRESULT WINAPI TravelLog_Clone(ITravelLog *iface, ITravelLog **pptl)
3405 ok(0, "unexpected call\n");
3406 return E_NOTIMPL;
3409 static IBrowserService BrowserService;
3410 static DWORD WINAPI TravelLog_CountEntries(ITravelLog *iface, IUnknown *punk)
3412 CHECK_EXPECT(CountEntries);
3414 ok(punk == (IUnknown*)&BrowserService, "punk != &BrowserService (%p)\n", punk);
3415 return 0;
3418 static HRESULT WINAPI TravelLog_Revert(ITravelLog *iface)
3420 ok(0, "unexpected call\n");
3421 return E_NOTIMPL;
3424 static const ITravelLogVtbl TravelLogVtbl = {
3425 TravelLog_QueryInterface,
3426 TravelLog_AddRef,
3427 TravelLog_Release,
3428 TravelLog_AddEntry,
3429 TravelLog_UpdateEntry,
3430 TravelLog_UpdateExternal,
3431 TravelLog_Travel,
3432 TravelLog_GetTravelEntry,
3433 TravelLog_FindTravelEntry,
3434 TravelLog_GetTooltipText,
3435 TravelLog_InsertMenuEntries,
3436 TravelLog_Clone,
3437 TravelLog_CountEntries,
3438 TravelLog_Revert
3441 static ITravelLog TravelLog = { &TravelLogVtbl };
3443 static HRESULT browserservice_qi(REFIID,void**);
3445 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3447 return browserservice_qi(riid, ppv);
3450 static ULONG WINAPI DocObjectService_AddRef(
3451 IDocObjectService* This)
3453 return 2;
3456 static ULONG WINAPI DocObjectService_Release(
3457 IDocObjectService* This)
3459 return 1;
3462 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(IDocObjectService *iface, IDispatch *pDispatch,
3463 LPCWSTR lpszUrl, DWORD dwFlags, LPCWSTR lpszFrameName, BYTE *pPostData, DWORD cbPostData,
3464 LPCWSTR lpszHeaders, BOOL fPlayNavSound, BOOL *pfCancel)
3466 CHECK_EXPECT(FireBeforeNavigate2);
3468 ok(!pDispatch, "pDispatch = %p\n", pDispatch);
3469 ok(!lstrcmpW(lpszUrl, nav_url), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl), wine_dbgstr_w(nav_url));
3470 ok(dwFlags == 0x140 /* IE11*/ || dwFlags == 0x40 || !dwFlags || dwFlags == 0x50, "dwFlags = %x\n", dwFlags);
3471 ok(!lpszFrameName, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName));
3472 if(!testing_submit) {
3473 ok(!pPostData, "pPostData = %p\n", pPostData);
3474 ok(!cbPostData, "cbPostData = %d\n", cbPostData);
3475 ok(!lpszHeaders || !lstrcmpW(lpszHeaders, L"Referer: http://test.winehq.org/tests/winehq_snapshot/\r\n"),
3476 "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3477 }else {
3478 ok(cbPostData == 9, "cbPostData = %d\n", cbPostData);
3479 ok(!memcmp(pPostData, "cmd=TEST", cbPostData), "pPostData = %p\n", pPostData);
3480 ok(wcsstr(lpszHeaders, L"Content-Type: application/x-www-form-urlencoded\r\n") != NULL,
3481 "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3484 ok(fPlayNavSound, "fPlayNavSound = %x\n", fPlayNavSound);
3485 ok(pfCancel != NULL, "pfCancel = NULL\n");
3486 ok(!*pfCancel, "*pfCancel = %x\n", *pfCancel);
3488 return S_OK;
3491 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3492 IDocObjectService* This,
3493 IHTMLWindow2 *pHTMLWindow2,
3494 DWORD dwFlags)
3496 CHECK_EXPECT(FireNavigateComplete2);
3497 test_readyState(NULL);
3499 if(loading_hash)
3500 ok(dwFlags == 0x10 || broken(!dwFlags), "dwFlags = %x, expected 0x10\n", dwFlags);
3501 else
3502 ok(!(dwFlags &~1), "dwFlags = %x\n", dwFlags);
3504 ok(pHTMLWindow2 != NULL, "pHTMLWindow2 = NULL\n");
3506 return S_OK;
3509 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3510 IDocObjectService* This)
3512 ok(0, "unexpected call\n");
3513 return E_NOTIMPL;
3516 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3517 IDocObjectService* This)
3519 ok(0, "unexpected call\n");
3520 return E_NOTIMPL;
3523 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3524 IDocObjectService* This,
3525 IHTMLWindow2 *pHTMLWindow,
3526 DWORD dwFlags)
3528 CHECK_EXPECT(FireDocumentComplete);
3530 ok(pHTMLWindow != NULL, "pHTMLWindow == NULL\n");
3531 ok(!dwFlags, "dwFlags = %x\n", dwFlags);
3533 return S_OK;
3536 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3537 IDocObjectService* This,
3538 IHTMLWindow2 *pHTMLWindow)
3540 ok(0, "unexpected call\n");
3541 return E_NOTIMPL;
3544 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3545 IDocObjectService* This,
3546 BSTR *pbstrPendingUrl)
3548 if(!resetting_document)
3549 CHECK_EXPECT(GetPendingUrl);
3550 return E_NOTIMPL;
3553 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3554 IDocObjectService* This,
3555 IHTMLElement *pHTMLElement)
3557 CHECK_EXPECT2(ActiveElementChanged);
3558 return E_NOTIMPL;
3561 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3562 IDocObjectService* This,
3563 BSTR *pbstrSearch)
3565 ok(0, "unexpected call\n");
3566 return E_NOTIMPL;
3569 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3570 IDocObjectService* This,
3571 LPCWSTR lpszUrl,
3572 BOOL *pfIsError)
3574 CHECK_EXPECT2(IsErrorUrl);
3575 *pfIsError = FALSE;
3576 return S_OK;
3579 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3580 DocObjectService_QueryInterface,
3581 DocObjectService_AddRef,
3582 DocObjectService_Release,
3583 DocObjectService_FireBeforeNavigate2,
3584 DocObjectService_FireNavigateComplete2,
3585 DocObjectService_FireDownloadBegin,
3586 DocObjectService_FireDownloadComplete,
3587 DocObjectService_FireDocumentComplete,
3588 DocObjectService_UpdateDesktopComponent,
3589 DocObjectService_GetPendingUrl,
3590 DocObjectService_ActiveElementChanged,
3591 DocObjectService_GetUrlSearchComponent,
3592 DocObjectService_IsErrorUrl
3595 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3597 static HRESULT WINAPI ShellBrowser_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppv)
3599 return browserservice_qi(riid, ppv);
3602 static ULONG WINAPI ShellBrowser_AddRef(IShellBrowser *iface)
3604 return 2;
3607 static ULONG WINAPI ShellBrowser_Release(IShellBrowser *iface)
3609 return 1;
3612 static HRESULT WINAPI ShellBrowser_GetWindow(IShellBrowser *iface, HWND *phwnd)
3614 ok(0, "unexpected call\n");
3615 return E_NOTIMPL;
3618 static HRESULT WINAPI ShellBrowser_ContextSensitiveHelp(IShellBrowser *iface, BOOL fEnterMode)
3620 ok(0, "unexpected call\n");
3621 return E_NOTIMPL;
3624 static HRESULT WINAPI ShellBrowser_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
3626 ok(0, "unexpected call\n");
3627 return E_NOTIMPL;
3630 static HRESULT WINAPI ShellBrowser_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved,
3631 HWND hwndActiveObject)
3633 ok(0, "unexpected call\n");
3634 return E_NOTIMPL;
3637 static HRESULT WINAPI ShellBrowser_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
3639 ok(0, "unexpected call\n");
3640 return E_NOTIMPL;
3643 static HRESULT WINAPI ShellBrowser_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR pszStatusText)
3645 ok(0, "unexpected call\n");
3646 return E_NOTIMPL;
3649 static HRESULT WINAPI ShellBrowser_EnableModelessSB(IShellBrowser *iface, BOOL fEnable)
3651 ok(0, "unexpected call\n");
3652 return E_NOTIMPL;
3655 static HRESULT WINAPI ShellBrowser_TranslateAcceleratorSB(IShellBrowser *iface, MSG *pmsg, WORD wID)
3657 ok(0, "unexpected call\n");
3658 return E_NOTIMPL;
3661 static HRESULT WINAPI ShellBrowser_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
3663 ok(0, "unexpected call\n");
3664 return E_NOTIMPL;
3667 static HRESULT WINAPI ShellBrowser_GetViewStateStream(IShellBrowser *iface, DWORD grfMode, IStream **ppStrm)
3669 ok(0, "unexpected call\n");
3670 return E_NOTIMPL;
3673 static HRESULT WINAPI ShellBrowser_GetControlWindow(IShellBrowser *iface, UINT id, HWND *phwnd)
3675 ok(0, "unexpected call\n");
3676 return E_NOTIMPL;
3679 static HRESULT WINAPI ShellBrowser_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam,
3680 LPARAM lParam, LRESULT *pret)
3682 ok(0, "unexpected call\n");
3683 return E_NOTIMPL;
3686 static HRESULT WINAPI ShellBrowser_QueryActiveShellView(IShellBrowser *iface, IShellView **ppshv)
3688 ok(0, "unexpected call\n");
3689 return E_NOTIMPL;
3692 static HRESULT WINAPI ShellBrowser_OnViewWindowActive(IShellBrowser* iface, IShellView *pshv)
3694 ok(0, "unexpected call\n");
3695 return E_NOTIMPL;
3698 static HRESULT WINAPI ShellBrowser_SetToolbarItems(IShellBrowser *iface, LPTBBUTTONSB lpButtons,
3699 UINT nButtons, UINT uFlags)
3701 ok(0, "unexpected call\n");
3702 return E_NOTIMPL;
3705 static const IShellBrowserVtbl ShellBrowserVtbl = {
3706 ShellBrowser_QueryInterface,
3707 ShellBrowser_AddRef,
3708 ShellBrowser_Release,
3709 ShellBrowser_GetWindow,
3710 ShellBrowser_ContextSensitiveHelp,
3711 ShellBrowser_InsertMenusSB,
3712 ShellBrowser_SetMenuSB,
3713 ShellBrowser_RemoveMenusSB,
3714 ShellBrowser_SetStatusTextSB,
3715 ShellBrowser_EnableModelessSB,
3716 ShellBrowser_TranslateAcceleratorSB,
3717 ShellBrowser_BrowseObject,
3718 ShellBrowser_GetViewStateStream,
3719 ShellBrowser_GetControlWindow,
3720 ShellBrowser_SendControlMsg,
3721 ShellBrowser_QueryActiveShellView,
3722 ShellBrowser_OnViewWindowActive,
3723 ShellBrowser_SetToolbarItems
3726 static IShellBrowser ShellBrowser = { &ShellBrowserVtbl };
3728 static HRESULT WINAPI BrowserService_QueryInterface(IBrowserService *iface, REFIID riid, void **ppv)
3730 return browserservice_qi(riid, ppv);
3733 static ULONG WINAPI BrowserService_AddRef(
3734 IBrowserService* This)
3736 return 2;
3739 static ULONG WINAPI BrowserService_Release(
3740 IBrowserService* This)
3742 return 1;
3745 static HRESULT WINAPI BrowserService_GetParentSite(
3746 IBrowserService* This,
3747 IOleInPlaceSite **ppipsite)
3749 ok(0, "unexpected call\n");
3750 return E_NOTIMPL;
3753 static HRESULT WINAPI BrowserService_SetTitle(
3754 IBrowserService* This,
3755 IShellView *psv,
3756 LPCWSTR pszName)
3758 ok(0, "unexpected call\n");
3759 return E_NOTIMPL;
3762 static HRESULT WINAPI BrowserService_GetTitle(
3763 IBrowserService* This,
3764 IShellView *psv,
3765 LPWSTR pszName,
3766 DWORD cchName)
3768 ok(0, "unexpected call\n");
3769 return E_NOTIMPL;
3772 static HRESULT WINAPI BrowserService_GetOleObject(
3773 IBrowserService* This,
3774 IOleObject **ppobjv)
3776 ok(0, "unexpected call\n");
3777 return E_NOTIMPL;
3780 static HRESULT WINAPI BrowserService_GetTravelLog(IBrowserService* This, ITravelLog **pptl)
3782 CHECK_EXPECT(GetTravelLog);
3784 ok(pptl != NULL, "pptl = NULL\n");
3786 if(!support_wbapp)
3787 return E_NOTIMPL;
3789 *pptl = &TravelLog;
3790 return S_OK;
3793 static HRESULT WINAPI BrowserService_ShowControlWindow(
3794 IBrowserService* This,
3795 UINT id,
3796 BOOL fShow)
3798 ok(0, "unexpected call\n");
3799 return E_NOTIMPL;
3802 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3803 IBrowserService* This,
3804 UINT id,
3805 BOOL *pfShown)
3807 ok(0, "unexpected call\n");
3808 return E_NOTIMPL;
3811 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3812 IBrowserService* This,
3813 PCIDLIST_ABSOLUTE pidl,
3814 LPWSTR pwszName,
3815 UINT uFlags)
3817 ok(0, "unexpected call\n");
3818 return E_NOTIMPL;
3821 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3822 IBrowserService* This,
3823 UINT uiCP,
3824 LPCWSTR pwszPath,
3825 PIDLIST_ABSOLUTE *ppidlOut)
3827 ok(0, "unexpected call\n");
3828 return E_NOTIMPL;
3831 static HRESULT WINAPI BrowserService_DisplayParseError(
3832 IBrowserService* This,
3833 HRESULT hres,
3834 LPCWSTR pwszPath)
3836 ok(0, "unexpected call\n");
3837 return E_NOTIMPL;
3840 static HRESULT WINAPI BrowserService_NavigateToPidl(
3841 IBrowserService* This,
3842 PCIDLIST_ABSOLUTE pidl,
3843 DWORD grfHLNF)
3845 ok(0, "unexpected call\n");
3846 return E_NOTIMPL;
3849 static HRESULT WINAPI BrowserService_SetNavigateState(
3850 IBrowserService* This,
3851 BNSTATE bnstate)
3853 ok(0, "unexpected call\n");
3854 return E_NOTIMPL;
3857 static HRESULT WINAPI BrowserService_GetNavigateState(
3858 IBrowserService* This,
3859 BNSTATE *pbnstate)
3861 ok(0, "unexpected call\n");
3862 return E_NOTIMPL;
3865 static HRESULT WINAPI BrowserService_NotifyRedirect(
3866 IBrowserService* This,
3867 IShellView *psv,
3868 PCIDLIST_ABSOLUTE pidl,
3869 BOOL *pfDidBrowse)
3871 ok(0, "unexpected call\n");
3872 return E_NOTIMPL;
3875 static HRESULT WINAPI BrowserService_UpdateWindowList(
3876 IBrowserService* This)
3878 ok(0, "unexpected call\n");
3879 return E_NOTIMPL;
3882 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3883 IBrowserService* This)
3885 CHECK_EXPECT(UpdateBackForwardState);
3886 return S_OK;
3889 static HRESULT WINAPI BrowserService_SetFlags(
3890 IBrowserService* This,
3891 DWORD dwFlags,
3892 DWORD dwFlagMask)
3894 ok(0, "unexpected call\n");
3895 return E_NOTIMPL;
3898 static HRESULT WINAPI BrowserService_GetFlags(
3899 IBrowserService* This,
3900 DWORD *pdwFlags)
3902 ok(0, "unexpected call\n");
3903 return E_NOTIMPL;
3906 static HRESULT WINAPI BrowserService_CanNavigateNow(
3907 IBrowserService* This)
3909 ok(0, "unexpected call\n");
3910 return E_NOTIMPL;
3913 static HRESULT WINAPI BrowserService_GetPidl(
3914 IBrowserService* This,
3915 PIDLIST_ABSOLUTE *ppidl)
3917 ok(0, "unexpected call\n");
3918 return E_NOTIMPL;
3921 static HRESULT WINAPI BrowserService_SetReferrer(
3922 IBrowserService* This,
3923 PCIDLIST_ABSOLUTE pidl)
3925 ok(0, "unexpected call\n");
3926 return E_NOTIMPL;
3929 static DWORD WINAPI BrowserService_GetBrowserIndex(
3930 IBrowserService* This)
3932 ok(0, "unexpected call\n");
3933 return E_NOTIMPL;
3936 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3937 IBrowserService* This,
3938 DWORD dwID,
3939 IUnknown **ppunk)
3941 ok(0, "unexpected call\n");
3942 return E_NOTIMPL;
3945 static HRESULT WINAPI BrowserService_GetHistoryObject(
3946 IBrowserService* This,
3947 IOleObject **ppole,
3948 IStream **pstm,
3949 IBindCtx **ppbc)
3951 ok(0, "unexpected call\n");
3952 return E_NOTIMPL;
3955 static HRESULT WINAPI BrowserService_SetHistoryObject(
3956 IBrowserService* This,
3957 IOleObject *pole,
3958 BOOL fIsLocalAnchor)
3960 ok(0, "unexpected call\n");
3961 return E_NOTIMPL;
3964 static HRESULT WINAPI BrowserService_CacheOLEServer(
3965 IBrowserService* This,
3966 IOleObject *pole)
3968 ok(0, "unexpected call\n");
3969 return E_NOTIMPL;
3972 static HRESULT WINAPI BrowserService_GetSetCodePage(
3973 IBrowserService* This,
3974 VARIANT *pvarIn,
3975 VARIANT *pvarOut)
3977 ok(0, "unexpected call\n");
3978 return E_NOTIMPL;
3981 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3982 IBrowserService* This,
3983 IShellView *psv,
3984 BOOL fDone,
3985 VARIANT *pvarargIn,
3986 VARIANT *pvarargOut)
3988 ok(0, "unexpected call\n");
3989 return E_NOTIMPL;
3992 static HRESULT WINAPI BrowserService_GetPalette(
3993 IBrowserService* This,
3994 HPALETTE *hpal)
3996 ok(0, "unexpected call\n");
3997 return E_NOTIMPL;
4000 static HRESULT WINAPI BrowserService_RegisterWindow(
4001 IBrowserService* This,
4002 BOOL fForceRegister,
4003 int swc)
4005 ok(0, "unexpected call\n");
4006 return E_NOTIMPL;
4009 static IBrowserServiceVtbl BrowserServiceVtbl = {
4010 BrowserService_QueryInterface,
4011 BrowserService_AddRef,
4012 BrowserService_Release,
4013 BrowserService_GetParentSite,
4014 BrowserService_SetTitle,
4015 BrowserService_GetTitle,
4016 BrowserService_GetOleObject,
4017 BrowserService_GetTravelLog,
4018 BrowserService_ShowControlWindow,
4019 BrowserService_IsControlWindowShown,
4020 BrowserService_IEGetDisplayName,
4021 BrowserService_IEParseDisplayName,
4022 BrowserService_DisplayParseError,
4023 BrowserService_NavigateToPidl,
4024 BrowserService_SetNavigateState,
4025 BrowserService_GetNavigateState,
4026 BrowserService_NotifyRedirect,
4027 BrowserService_UpdateWindowList,
4028 BrowserService_UpdateBackForwardState,
4029 BrowserService_SetFlags,
4030 BrowserService_GetFlags,
4031 BrowserService_CanNavigateNow,
4032 BrowserService_GetPidl,
4033 BrowserService_SetReferrer,
4034 BrowserService_GetBrowserIndex,
4035 BrowserService_GetBrowserByIndex,
4036 BrowserService_GetHistoryObject,
4037 BrowserService_SetHistoryObject,
4038 BrowserService_CacheOLEServer,
4039 BrowserService_GetSetCodePage,
4040 BrowserService_OnHttpEquiv,
4041 BrowserService_GetPalette,
4042 BrowserService_RegisterWindow
4045 static IBrowserService BrowserService = { &BrowserServiceVtbl };
4047 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
4049 static HRESULT browserservice_qi(REFIID riid, void **ppv)
4051 if(IsEqualGUID(&IID_IShellBrowser, riid)) {
4052 *ppv = &ShellBrowser;
4053 return S_OK;
4056 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
4057 *ppv = &DocObjectService;
4058 return S_OK;
4061 if(IsEqualGUID(&IID_IBrowserService, riid)) {
4062 *ppv = &BrowserService;
4063 return S_OK;
4066 *ppv = NULL;
4067 return E_NOINTERFACE;
4070 static HRESULT WINAPI WBE2Sink_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
4072 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
4073 *ppv = iface;
4074 return S_OK;
4077 *ppv = NULL;
4078 ok(0, "unexpected riid: %s\n", wine_dbgstr_guid(riid));
4079 return E_NOINTERFACE;
4082 static HRESULT WINAPI WBE2Sink_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
4083 LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult,
4084 EXCEPINFO *pExcepInfo, UINT *puArgErr)
4086 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
4087 ok(pdp != NULL, "pDispParams == NULL\n");
4088 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
4089 ok(puArgErr == NULL, "puArgErr != NULL\n");
4090 ok(pVarResult == NULL, "pVarResult != NULL\n");
4091 ok(wFlags == DISPATCH_METHOD, "wFlags=%08x, expected DISPATCH_METHOD\n", wFlags);
4092 ok(!pdp->cNamedArgs, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
4093 ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs = %p\n", pdp->rgdispidNamedArgs);
4095 switch(dispIdMember) {
4096 case DISPID_WINDOWCLOSING: {
4097 VARIANT *is_child = pdp->rgvarg+1, *cancel = pdp->rgvarg;
4099 CHECK_EXPECT(WindowClosing);
4101 ok(pdp->cArgs == 2, "pdp->cArgs = %d\n", pdp->cArgs);
4102 ok(V_VT(is_child) == VT_BOOL, "V_VT(is_child) = %d\n", V_VT(is_child));
4103 ok(!V_BOOL(is_child), "V_BOOL(is_child) = %x\n", V_BOOL(is_child));
4104 ok(V_VT(cancel) == (VT_BYREF|VT_BOOL), "V_VT(cancel) = %d\n", V_VT(cancel));
4105 ok(!*V_BOOLREF(cancel), "*V_BOOLREF(cancel) = %x\n", *V_BOOLREF(cancel));
4107 *V_BOOLREF(cancel) = VARIANT_TRUE;
4108 return S_OK;
4110 default:
4111 ok(0, "unexpected id %d\n", dispIdMember);
4114 return E_NOTIMPL;
4117 static const IDispatchVtbl WBE2SinkVtbl = {
4118 WBE2Sink_QueryInterface,
4119 Dispatch_AddRef,
4120 Dispatch_Release,
4121 Dispatch_GetTypeInfoCount,
4122 Dispatch_GetTypeInfo,
4123 Dispatch_GetIDsOfNames,
4124 WBE2Sink_Invoke
4127 static IDispatch WBE2Sink = { &WBE2SinkVtbl };
4129 static HRESULT WINAPI EnumConnections_QueryInterface(IEnumConnections *iface, REFIID riid, LPVOID *ppv)
4131 ok(0, "unexpected call\n");
4132 return E_NOINTERFACE;
4135 static ULONG WINAPI EnumConnections_AddRef(IEnumConnections *iface)
4137 return 2;
4140 static ULONG WINAPI EnumConnections_Release(IEnumConnections *iface)
4142 return 1;
4145 static BOOL next_called;
4147 static HRESULT WINAPI EnumConnections_Next(IEnumConnections *iface, ULONG cConnections, CONNECTDATA *rgcd, ULONG *pcFetched)
4149 CHECK_EXPECT2(EnumConnections_Next);
4151 ok(cConnections == 1, "cConnections = %d\n", cConnections);
4152 ok(pcFetched != NULL, "pcFetched == NULL\n");
4154 if(next_called) {
4155 *pcFetched = 0;
4156 return S_FALSE;
4159 next_called = TRUE;
4160 rgcd->pUnk = (IUnknown*)&WBE2Sink;
4161 rgcd->dwCookie = 0xdeadbeef;
4162 *pcFetched = 1;
4163 return S_OK;
4166 static HRESULT WINAPI EnumConnections_Skip(IEnumConnections *iface, ULONG ulConnections)
4168 ok(0, "unexpected call\n");
4169 return E_NOINTERFACE;
4172 static HRESULT WINAPI EnumConnections_Reset(IEnumConnections *iface)
4174 ok(0, "unexpected call\n");
4175 return E_NOINTERFACE;
4178 static HRESULT WINAPI EnumConnections_Clone(IEnumConnections *iface, IEnumConnections **ppEnum)
4180 ok(0, "unexpected call\n");
4181 return E_NOINTERFACE;
4184 static const IEnumConnectionsVtbl EnumConnectionsVtbl = {
4185 EnumConnections_QueryInterface,
4186 EnumConnections_AddRef,
4187 EnumConnections_Release,
4188 EnumConnections_Next,
4189 EnumConnections_Skip,
4190 EnumConnections_Reset,
4191 EnumConnections_Clone
4194 static IEnumConnections EnumConnections = { &EnumConnectionsVtbl };
4196 static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, LPVOID *ppv)
4198 ok(0, "unexpected call\n");
4199 return E_NOINTERFACE;
4202 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
4204 return 2;
4207 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
4209 return 1;
4212 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
4214 ok(0, "unexpected call\n");
4215 return E_NOTIMPL;
4218 static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
4219 IConnectionPointContainer **ppCPC)
4221 ok(0, "unexpected call\n");
4222 return E_NOTIMPL;
4225 static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink, DWORD *pdwCookie)
4227 ok(0, "unexpected call\n");
4228 return E_NOTIMPL;
4231 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
4233 ok(0, "unexpected call\n");
4234 return E_NOTIMPL;
4237 static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface, IEnumConnections **ppEnum)
4239 CHECK_EXPECT(EnumConnections);
4241 *ppEnum = &EnumConnections;
4242 next_called = FALSE;
4243 return S_OK;
4246 static const IConnectionPointVtbl ConnectionPointVtbl =
4248 ConnectionPoint_QueryInterface,
4249 ConnectionPoint_AddRef,
4250 ConnectionPoint_Release,
4251 ConnectionPoint_GetConnectionInterface,
4252 ConnectionPoint_GetConnectionPointContainer,
4253 ConnectionPoint_Advise,
4254 ConnectionPoint_Unadvise,
4255 ConnectionPoint_EnumConnections
4258 static IConnectionPoint ConnectionPointWBE2 = { &ConnectionPointVtbl };
4260 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
4261 REFIID riid, void **ppv)
4263 ok(0, "unexpected call\n");
4264 return E_NOINTERFACE;
4267 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
4269 return 2;
4272 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
4274 return 1;
4277 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
4278 IEnumConnectionPoints **ppEnum)
4280 ok(0, "unexpected call\n");
4281 return E_NOTIMPL;
4284 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
4285 REFIID riid, IConnectionPoint **ppCP)
4287 CHECK_EXPECT(FindConnectionPoint);
4289 if(IsEqualGUID(riid, &DIID_DWebBrowserEvents2)) {
4290 *ppCP = &ConnectionPointWBE2;
4291 return S_OK;
4294 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
4295 return E_NOTIMPL;
4298 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
4299 ConnectionPointContainer_QueryInterface,
4300 ConnectionPointContainer_AddRef,
4301 ConnectionPointContainer_Release,
4302 ConnectionPointContainer_EnumConnectionPoints,
4303 ConnectionPointContainer_FindConnectionPoint
4306 static IConnectionPointContainer ConnectionPointContainer = { &ConnectionPointContainerVtbl };
4308 static void test_NavigateWithBindCtx(BSTR uri, VARIANT *flags, VARIANT *target_frame, VARIANT *post_data,
4309 VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment)
4311 ok(!lstrcmpW(uri, nav_url), "uri = %s\n", wine_dbgstr_w(uri));
4312 ok(V_VT(flags) == VT_I4, "V_VT(flags) = %d\n", V_VT(flags));
4313 ok(V_I4(flags) == navHyperlink, "V_I4(flags) = %x\n", V_I4(flags));
4314 ok(!target_frame, "target_frame != NULL\n");
4315 ok(!post_data, "post_data != NULL\n");
4316 ok(!headers, "headers != NULL\n");
4317 ok(bind_ctx != NULL, "bind_ctx == NULL\n");
4318 ok(!url_fragment, "url_dragment = %s\n", wine_dbgstr_w(url_fragment));
4321 static HRESULT wb_qi(REFIID riid, void **ppv);
4323 static HRESULT WINAPI WebBrowserPriv_QueryInterface(IWebBrowserPriv *iface, REFIID riid, void **ppv)
4325 return wb_qi(riid, ppv);
4328 static ULONG WINAPI WebBrowserPriv_AddRef(IWebBrowserPriv *iface)
4330 return 2;
4333 static ULONG WINAPI WebBrowserPriv_Release(IWebBrowserPriv *iface)
4335 return 1;
4338 static HRESULT WINAPI WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv *iface, VARIANT *uri, VARIANT *flags,
4339 VARIANT *target_frame, VARIANT *post_data, VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment)
4341 trace("NavigateWithBindCtx\n");
4343 CHECK_EXPECT(NavigateWithBindCtx);
4345 ok(V_VT(uri) == VT_BSTR, "V_VT(uri) = %d\n", V_VT(uri));
4346 test_NavigateWithBindCtx(V_BSTR(uri), flags, target_frame, post_data, headers, bind_ctx, url_fragment);
4347 return S_OK;
4350 static HRESULT WINAPI WebBrowserPriv_OnClose(IWebBrowserPriv *iface)
4352 ok(0, "unexpected call\n");
4353 return E_NOTIMPL;
4356 static const IWebBrowserPrivVtbl WebBrowserPrivVtbl = {
4357 WebBrowserPriv_QueryInterface,
4358 WebBrowserPriv_AddRef,
4359 WebBrowserPriv_Release,
4360 WebBrowserPriv_NavigateWithBindCtx,
4361 WebBrowserPriv_OnClose
4364 static IWebBrowserPriv WebBrowserPriv = { &WebBrowserPrivVtbl };
4366 static HRESULT WINAPI WebBrowserPriv2IE8_QueryInterface(IWebBrowserPriv2IE8 *iface, REFIID riid, void **ppv)
4368 return wb_qi(riid, ppv);
4371 static ULONG WINAPI WebBrowserPriv2IE8_AddRef(IWebBrowserPriv2IE8 *iface)
4373 return 2;
4376 static ULONG WINAPI WebBrowserPriv2IE8_Release(IWebBrowserPriv2IE8 *iface)
4378 return 1;
4381 static HRESULT WINAPI WebBrowserPriv2IE8_NavigateWithBindCtx2(IWebBrowserPriv2IE8 *iface, IUri *uri, VARIANT *flags,
4382 VARIANT *target_frame, VARIANT *post_data, VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment)
4384 BSTR str;
4385 HRESULT hres;
4387 trace("IE8: NavigateWithBindCtx2\n");
4389 CHECK_EXPECT(NavigateWithBindCtx);
4391 hres = IUri_GetDisplayUri(uri, &str);
4392 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
4393 test_NavigateWithBindCtx(str, flags, target_frame, post_data, headers, bind_ctx, url_fragment);
4394 SysFreeString(str);
4395 return S_OK;
4398 static HRESULT WINAPI WebBrowserPriv2IE8_SetBrowserFrameOptions(IWebBrowserPriv2IE8 *iface, DWORD opt1, DWORD opt2)
4400 ok(0, "unexpected call\n");
4401 return E_NOTIMPL;
4404 static HRESULT WINAPI WebBrowserPriv2IE8_DetachConnectionPoints(IWebBrowserPriv2IE8 *iface)
4406 ok(0, "unexpected call\n");
4407 return E_NOTIMPL;
4410 static HRESULT WINAPI WebBrowserPriv2IE8_GetProcessId(IWebBrowserPriv2IE8 *iface, DWORD *pid)
4412 ok(0, "unexpected call\n");
4413 return E_NOTIMPL;
4416 static HRESULT WINAPI WebBrowserPriv2IE8_CompatAttachEditEvents(IWebBrowserPriv2IE8 *iface)
4418 ok(0, "unexpected call\n");
4419 return E_NOTIMPL;
4422 static HRESULT WINAPI WebBrowserPriv2IE8_HandleOpenOptions(IWebBrowserPriv2IE8 *iface, IUnknown *obj, BSTR bstr, int options)
4424 ok(0, "unexpected call\n");
4425 return E_NOTIMPL;
4428 static HRESULT WINAPI WebBrowserPriv2IE8_SetSearchTerm(IWebBrowserPriv2IE8 *iface, BSTR term)
4430 ok(0, "unexpected call\n");
4431 return E_NOTIMPL;
4434 static HRESULT WINAPI WebBrowserPriv2IE8_GetSearchTerm(IWebBrowserPriv2IE8 *iface, BSTR *term)
4436 ok(0, "unexpected call\n");
4437 return E_NOTIMPL;
4440 static HRESULT WINAPI WebBrowserPriv2IE8_GetCurrentDocument(IWebBrowserPriv2IE8 *iface, IDispatch **doc)
4442 ok(0, "unexpected call\n");
4443 return E_NOTIMPL;
4446 static const IWebBrowserPriv2IE8Vtbl WebBrowserPriv2IE8Vtbl = {
4447 WebBrowserPriv2IE8_QueryInterface,
4448 WebBrowserPriv2IE8_AddRef,
4449 WebBrowserPriv2IE8_Release,
4450 WebBrowserPriv2IE8_NavigateWithBindCtx2,
4451 WebBrowserPriv2IE8_SetBrowserFrameOptions,
4452 WebBrowserPriv2IE8_DetachConnectionPoints,
4453 WebBrowserPriv2IE8_GetProcessId,
4454 WebBrowserPriv2IE8_CompatAttachEditEvents,
4455 WebBrowserPriv2IE8_HandleOpenOptions,
4456 WebBrowserPriv2IE8_SetSearchTerm,
4457 WebBrowserPriv2IE8_GetSearchTerm,
4458 WebBrowserPriv2IE8_GetCurrentDocument
4461 static IWebBrowserPriv2IE8 WebBrowserPriv2IE8 = { &WebBrowserPriv2IE8Vtbl };
4463 static HRESULT WINAPI WebBrowserPriv2IE9_QueryInterface(IWebBrowserPriv2IE9 *iface, REFIID riid, void **ppv)
4465 return wb_qi(riid, ppv);
4468 static ULONG WINAPI WebBrowserPriv2IE9_AddRef(IWebBrowserPriv2IE9 *iface)
4470 return 2;
4473 static ULONG WINAPI WebBrowserPriv2IE9_Release(IWebBrowserPriv2IE9 *iface)
4475 return 1;
4478 static HRESULT WINAPI WebBrowserPriv2IE9_NavigateWithBindCtx2(IWebBrowserPriv2IE9 *iface, IUri *uri, VARIANT *flags,
4479 VARIANT *target_frame, VARIANT *post_data, VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment, DWORD unknown)
4481 BSTR str;
4482 HRESULT hres;
4484 trace("IE9: NavigateWithBindCtx2\n");
4486 CHECK_EXPECT(NavigateWithBindCtx);
4488 hres = IUri_GetDisplayUri(uri, &str);
4489 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
4490 test_NavigateWithBindCtx(str, flags, target_frame, post_data, headers, bind_ctx, url_fragment);
4491 SysFreeString(str);
4492 return S_OK;
4495 static const IWebBrowserPriv2IE9Vtbl WebBrowserPriv2IE9Vtbl = {
4496 WebBrowserPriv2IE9_QueryInterface,
4497 WebBrowserPriv2IE9_AddRef,
4498 WebBrowserPriv2IE9_Release,
4499 WebBrowserPriv2IE9_NavigateWithBindCtx2
4502 static IWebBrowserPriv2IE9 WebBrowserPriv2IE9 = { &WebBrowserPriv2IE9Vtbl };
4504 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, void **ppv)
4506 return wb_qi(riid, ppv);
4509 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
4511 return 2;
4514 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
4516 return 1;
4519 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
4521 ok(0, "unexpected call\n");
4522 return E_NOTIMPL;
4525 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
4526 LPTYPEINFO *ppTInfo)
4528 ok(0, "unexpected call\n");
4529 return E_NOTIMPL;
4532 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
4533 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
4535 ok(0, "unexpected call\n");
4536 return E_NOTIMPL;
4539 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
4540 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
4541 EXCEPINFO *pExepInfo, UINT *puArgErr)
4543 ok(0, "unexpected call\n");
4544 return E_NOTIMPL;
4547 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
4549 ok(0, "unexpected call\n");
4550 return E_NOTIMPL;
4553 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
4555 ok(0, "unexpected call\n");
4556 return E_NOTIMPL;
4559 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
4561 ok(0, "unexpected call\n");
4562 return E_NOTIMPL;
4565 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
4567 ok(0, "unexpected call\n");
4568 return E_NOTIMPL;
4571 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
4572 VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
4574 ok(0, "unexpected call\n");
4575 return E_NOTIMPL;
4578 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
4580 ok(0, "unexpected call\n");
4581 return E_NOTIMPL;
4584 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
4586 ok(0, "unexpected call\n");
4587 return E_NOTIMPL;
4590 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
4592 ok(0, "unexpected call\n");
4593 return E_NOTIMPL;
4596 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
4598 ok(0, "unexpected call\n");
4599 return E_NOTIMPL;
4602 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
4604 ok(0, "unexpected call\n");
4605 return E_NOTIMPL;
4608 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
4610 ok(0, "unexpected call\n");
4611 return E_NOTIMPL;
4614 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
4616 ok(0, "unexpected call\n");
4617 return E_NOTIMPL;
4620 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4622 ok(0, "unexpected call\n");
4623 return E_NOTIMPL;
4626 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
4628 ok(0, "unexpected call\n");
4629 return E_NOTIMPL;
4632 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
4634 ok(0, "unexpected call\n");
4635 return E_NOTIMPL;
4638 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
4640 ok(0, "unexpected call\n");
4641 return E_NOTIMPL;
4644 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
4646 ok(0, "unexpected call\n");
4647 return E_NOTIMPL;
4650 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
4652 ok(0, "unexpected call\n");
4653 return E_NOTIMPL;
4656 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
4658 ok(0, "unexpected call\n");
4659 return E_NOTIMPL;
4662 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
4664 ok(0, "unexpected call\n");
4665 return E_NOTIMPL;
4668 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
4670 ok(0, "unexpected call\n");
4671 return E_NOTIMPL;
4674 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
4676 ok(0, "unexpected call\n");
4677 return E_NOTIMPL;
4680 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
4682 ok(0, "unexpected call\n");
4683 return E_NOTIMPL;
4686 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
4688 CHECK_EXPECT(get_LocationURL);
4689 return E_NOTIMPL;
4692 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4694 ok(0, "unexpected call\n");
4695 return E_NOTIMPL;
4698 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
4700 ok(0, "unexpected call\n");
4701 return E_NOTIMPL;
4704 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
4706 ok(0, "unexpected call\n");
4707 return E_NOTIMPL;
4710 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
4712 ok(0, "unexpected call\n");
4713 return E_NOTIMPL;
4716 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
4718 ok(0, "unexpected call\n");
4719 return E_NOTIMPL;
4722 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
4724 ok(0, "unexpected call\n");
4725 return E_NOTIMPL;
4728 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
4730 ok(0, "unexpected call\n");
4731 return E_NOTIMPL;
4734 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
4736 ok(0, "unexpected call\n");
4737 return E_NOTIMPL;
4740 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
4742 ok(0, "unexpected call\n");
4743 return E_NOTIMPL;
4746 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4748 ok(0, "unexpected call\n");
4749 return E_NOTIMPL;
4752 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
4754 ok(0, "unexpected call\n");
4755 return E_NOTIMPL;
4758 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
4760 ok(0, "unexpected call\n");
4761 return E_NOTIMPL;
4764 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4766 ok(0, "unexpected call\n");
4767 return E_NOTIMPL;
4770 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
4772 ok(0, "unexpected call\n");
4773 return E_NOTIMPL;
4776 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
4778 ok(0, "unexpected call\n");
4779 return E_NOTIMPL;
4782 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
4784 ok(0, "unexpected call\n");
4785 return E_NOTIMPL;
4788 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
4790 ok(0, "unexpected call\n");
4791 return E_NOTIMPL;
4794 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4796 ok(0, "unexpected call\n");
4797 return E_NOTIMPL;
4800 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4802 ok(0, "unexpected call\n");
4803 return E_NOTIMPL;
4806 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
4808 ok(0, "unexpected call\n");
4809 return E_NOTIMPL;
4812 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
4814 ok(0, "unexpected call\n");
4815 return E_NOTIMPL;
4818 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
4819 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
4821 ok(0, "unexpected call\n");
4822 return E_NOTIMPL;
4825 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
4827 ok(0, "unexpected call\n");
4828 return E_NOTIMPL;
4831 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
4832 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
4834 ok(0, "unexpected call\n");
4835 return E_NOTIMPL;
4838 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
4839 VARIANT *pvarShow, VARIANT *pvarSize)
4841 ok(0, "unexpected call\n");
4842 return E_NOTIMPL;
4845 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
4847 ok(0, "unexpected call\n");
4848 return E_NOTIMPL;
4851 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
4853 ok(0, "unexpected call\n");
4854 return E_NOTIMPL;
4857 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
4859 ok(0, "unexpected call\n");
4860 return E_NOTIMPL;
4863 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
4865 ok(0, "unexpected call\n");
4866 return E_NOTIMPL;
4869 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
4871 ok(0, "unexpected call\n");
4872 return E_NOTIMPL;
4875 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
4876 VARIANT_BOOL *pbRegister)
4878 ok(0, "unexpected call\n");
4879 return E_NOTIMPL;
4882 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
4883 VARIANT_BOOL bRegister)
4885 ok(0, "unexpected call\n");
4886 return E_NOTIMPL;
4889 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
4890 VARIANT_BOOL *pbRegister)
4892 ok(0, "unexpected call\n");
4893 return E_NOTIMPL;
4896 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
4897 VARIANT_BOOL bRegister)
4899 ok(0, "unexpected call\n");
4900 return E_NOTIMPL;
4903 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
4905 ok(0, "unexpected call\n");
4906 return E_NOTIMPL;
4909 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
4911 ok(0, "unexpected call\n");
4912 return E_NOTIMPL;
4915 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4917 trace("get_AddressBar: ignoring\n"); /* Some old IEs call it */
4918 return E_NOTIMPL;
4921 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4923 ok(0, "unexpected call\n");
4924 return E_NOTIMPL;
4927 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4929 ok(0, "unexpected call\n");
4930 return E_NOTIMPL;
4933 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
4935 ok(0, "unexpected call\n");
4936 return E_NOTIMPL;
4939 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
4941 WebBrowser_QueryInterface,
4942 WebBrowser_AddRef,
4943 WebBrowser_Release,
4944 WebBrowser_GetTypeInfoCount,
4945 WebBrowser_GetTypeInfo,
4946 WebBrowser_GetIDsOfNames,
4947 WebBrowser_Invoke,
4948 WebBrowser_GoBack,
4949 WebBrowser_GoForward,
4950 WebBrowser_GoHome,
4951 WebBrowser_GoSearch,
4952 WebBrowser_Navigate,
4953 WebBrowser_Refresh,
4954 WebBrowser_Refresh2,
4955 WebBrowser_Stop,
4956 WebBrowser_get_Application,
4957 WebBrowser_get_Parent,
4958 WebBrowser_get_Container,
4959 WebBrowser_get_Document,
4960 WebBrowser_get_TopLevelContainer,
4961 WebBrowser_get_Type,
4962 WebBrowser_get_Left,
4963 WebBrowser_put_Left,
4964 WebBrowser_get_Top,
4965 WebBrowser_put_Top,
4966 WebBrowser_get_Width,
4967 WebBrowser_put_Width,
4968 WebBrowser_get_Height,
4969 WebBrowser_put_Height,
4970 WebBrowser_get_LocationName,
4971 WebBrowser_get_LocationURL,
4972 WebBrowser_get_Busy,
4973 WebBrowser_Quit,
4974 WebBrowser_ClientToWindow,
4975 WebBrowser_PutProperty,
4976 WebBrowser_GetProperty,
4977 WebBrowser_get_Name,
4978 WebBrowser_get_HWND,
4979 WebBrowser_get_FullName,
4980 WebBrowser_get_Path,
4981 WebBrowser_get_Visible,
4982 WebBrowser_put_Visible,
4983 WebBrowser_get_StatusBar,
4984 WebBrowser_put_StatusBar,
4985 WebBrowser_get_StatusText,
4986 WebBrowser_put_StatusText,
4987 WebBrowser_get_ToolBar,
4988 WebBrowser_put_ToolBar,
4989 WebBrowser_get_MenuBar,
4990 WebBrowser_put_MenuBar,
4991 WebBrowser_get_FullScreen,
4992 WebBrowser_put_FullScreen,
4993 WebBrowser_Navigate2,
4994 WebBrowser_QueryStatusWB,
4995 WebBrowser_ExecWB,
4996 WebBrowser_ShowBrowserBar,
4997 WebBrowser_get_ReadyState,
4998 WebBrowser_get_Offline,
4999 WebBrowser_put_Offline,
5000 WebBrowser_get_Silent,
5001 WebBrowser_put_Silent,
5002 WebBrowser_get_RegisterAsBrowser,
5003 WebBrowser_put_RegisterAsBrowser,
5004 WebBrowser_get_RegisterAsDropTarget,
5005 WebBrowser_put_RegisterAsDropTarget,
5006 WebBrowser_get_TheaterMode,
5007 WebBrowser_put_TheaterMode,
5008 WebBrowser_get_AddressBar,
5009 WebBrowser_put_AddressBar,
5010 WebBrowser_get_Resizable,
5011 WebBrowser_put_Resizable
5014 static IWebBrowser2 WebBrowser2 = { &WebBrowser2Vtbl };
5016 static HRESULT wb_qi(REFIID riid, void **ppv)
5018 static const IID IID_IWebBrowserPriv2IE7 = {0x1af32b6c, 0xa3ba,0x48b9,{0xb2,0x4e,0x8a,0xa9,0xc4,0x1f,0x6e,0xcd}};
5019 static const IID IID_IWebBrowserPriv2IE8XP = {0x486f6159,0x9f3f,0x4827,{0x82,0xd4,0x28,0x3c,0xef,0x39,0x77,0x33}};
5020 static const IID IID_WB_undoc = {0xd9befc84,0xf21e,0x4166,{0x87,0x4b,0xa8,0xd3,0x01,0x0d,0xc7,0x64}};
5022 *ppv = NULL;
5024 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IWebBrowser, riid)
5025 || IsEqualGUID(&IID_IWebBrowserApp, riid) || IsEqualGUID(&IID_IWebBrowser2, riid)) {
5026 *ppv = &WebBrowser2;
5027 return S_OK;
5030 if(IsEqualGUID(riid, &IID_IOleObject))
5031 return E_NOINTERFACE; /* TODO */
5033 if(IsEqualGUID(riid, &IID_IConnectionPointContainer)) {
5034 *ppv = &ConnectionPointContainer;
5035 return S_OK;
5038 if(IsEqualGUID(riid, &IID_IWebBrowserPriv)) {
5039 *ppv = &WebBrowserPriv;
5040 return S_OK;
5043 if(IsEqualGUID(riid, &IID_IWebBrowserPriv2IE8)) {
5044 /* IE8 and IE9 versions use the same IID, but have different declarations. */
5045 *ppv = is_ie9plus ? (void*)&WebBrowserPriv2IE9 : (void*)&WebBrowserPriv2IE8;
5046 return S_OK;
5049 if(IsEqualGUID(riid, &IID_IWebBrowserPriv2IE7)) {
5050 trace("QI(IID_IWebBrowserPriv2IE7)\n");
5051 return E_NOINTERFACE;
5054 if(IsEqualGUID(riid, &IID_IWebBrowserPriv2IE8XP)) {
5055 trace("QI(IID_IWebBrowserPriv2IE8XP)\n");
5056 return E_NOINTERFACE;
5059 if(!IsEqualGUID(riid, &IID_WB_undoc))
5060 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
5061 return E_NOINTERFACE;
5064 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
5065 REFIID riid, void **ppv)
5067 return QueryInterface(riid, ppv);
5070 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
5072 return 2;
5075 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
5077 return 1;
5080 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
5081 REFIID riid, void **ppv)
5084 * Services used by HTMLDocument:
5086 * IOleUndoManager
5087 * IInternetSecurityManager
5088 * ITargetFrame
5089 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
5090 * HTMLFrameBase
5091 * IShellObject
5092 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
5093 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
5094 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
5095 * DefView (?)
5096 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
5097 * IElementBehaviorFactory
5098 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
5099 * STopLevelBrowser
5100 * IHTMLWindow2
5101 * IInternetProtocol
5102 * UrlHistory
5103 * IHTMLEditHost
5104 * IHlinkFrame
5107 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
5108 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
5109 *ppv = &HlinkFrame;
5110 return S_OK;
5113 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
5114 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
5115 *ppv = &NewWindowManager;
5116 return S_OK;
5119 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
5120 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
5121 *ppv = &BrowserService;
5122 return S_OK;
5125 if(support_wbapp && IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
5126 if(IsEqualGUID(riid, &IID_IWebBrowser2)) {
5127 *ppv = &WebBrowser2;
5128 return S_OK;
5130 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
5133 return E_NOINTERFACE;
5136 static const IServiceProviderVtbl ServiceProviderVtbl = {
5137 ServiceProvider_QueryInterface,
5138 ServiceProvider_AddRef,
5139 ServiceProvider_Release,
5140 ServiceProvider_QueryService
5143 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
5145 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
5146 REFIID riid, void **ppv)
5148 return QueryInterface(riid, ppv);
5151 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
5153 return 2;
5156 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
5158 return 1;
5161 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
5162 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
5164 ok(0, "unexpected call\n");
5167 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
5168 DWORD dwAspect, LONG lindex)
5170 ok(0, "unexpected call\n");
5173 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
5175 ok(0, "unexpected call\n");
5178 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
5180 ok(0, "unexpected call\n");
5183 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
5185 ok(0, "unexpected call\n");
5188 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
5190 ok(0, "unexpected call\n");
5193 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
5195 CHECK_EXPECT(Advise_Close);
5198 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
5199 AdviseSink_QueryInterface,
5200 AdviseSink_AddRef,
5201 AdviseSink_Release,
5202 AdviseSink_OnDataChange,
5203 AdviseSink_OnViewChange,
5204 AdviseSink_OnRename,
5205 AdviseSink_OnSave,
5206 ObjectAdviseSink_OnClose,
5207 AdviseSinkEx_OnViewStatusChange
5210 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
5212 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
5213 REFIID riid, void **ppv)
5215 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
5216 *ppv = iface;
5217 return S_OK;
5220 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
5221 *ppv = NULL;
5222 return E_NOINTERFACE;
5225 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
5226 DWORD dwAspect, LONG lindex)
5228 CHECK_EXPECT2(OnViewChange);
5230 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
5231 ok(lindex == -1, "lindex = %d\n", lindex);
5234 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
5235 ViewAdviseSink_QueryInterface,
5236 AdviseSink_AddRef,
5237 AdviseSink_Release,
5238 AdviseSink_OnDataChange,
5239 ViewAdviseSink_OnViewChange,
5240 AdviseSink_OnRename,
5241 AdviseSink_OnSave,
5242 AdviseSink_OnClose,
5243 AdviseSinkEx_OnViewStatusChange
5246 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
5248 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
5249 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
5250 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
5251 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
5252 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
5253 DEFINE_GUID(IID_unk5, 0x5f95accc,0xd7a1,0x4574,0xbc,0xcb,0x69,0x71,0x35,0xbc,0x41,0xde);
5255 static HRESULT QueryInterface(REFIID riid, void **ppv)
5257 *ppv = NULL;
5259 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
5260 *ppv = &ClientSite;
5261 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
5262 *ppv = &DocumentSite;
5263 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
5264 *ppv = &DocHostUIHandler;
5265 else if(IsEqualGUID(&IID_IOleContainer, riid))
5266 *ppv = &OleContainer;
5267 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
5268 *ppv = &InPlaceSiteWindowless;
5269 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
5270 *ppv = &OleCommandTarget;
5271 else if(IsEqualGUID(&IID_IDispatch, riid))
5272 *ppv = &Dispatch;
5273 else if(IsEqualGUID(&IID_IServiceProvider, riid))
5274 *ppv = &ServiceProvider;
5275 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
5276 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
5277 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
5278 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
5279 else if(IsEqualGUID(&IID_IOleControlSite, riid))
5280 *ppv = &OleControlSite;
5281 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
5282 return E_NOINTERFACE; /* TODO */
5283 else if(IsEqualGUID(&IID_IProxyManager, riid))
5284 return E_NOINTERFACE; /* ? */
5285 else if(IsEqualGUID(&IID_unk1, riid))
5286 return E_NOINTERFACE; /* HTMLWindow2 ? */
5287 else if(IsEqualGUID(&IID_IThumbnailView, riid))
5288 return E_NOINTERFACE; /* ? */
5289 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
5290 return E_NOINTERFACE; /* ? */
5291 else if(IsEqualGUID(&IID_unk4, riid))
5292 return E_NOINTERFACE; /* ? */
5293 else if(IsEqualGUID(&IID_unk5, riid))
5294 return E_NOINTERFACE; /* IE10 */
5295 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
5296 return E_NOINTERFACE; /* ? */
5297 else if(winetest_debug > 1)
5298 trace("QI(%s)\n", wine_dbgstr_guid(riid));
5300 if(*ppv)
5301 return S_OK;
5302 return E_NOINTERFACE;
5305 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
5307 if(msg == WM_CONTINUE_BINDING) {
5308 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
5309 continue_binding(callback);
5312 return DefWindowProcW(hwnd, msg, wParam, lParam);
5315 static void test_doscroll(IUnknown *unk)
5317 IHTMLDocument3 *doc;
5318 IHTMLElement2 *elem2;
5319 IHTMLElement *elem;
5320 VARIANT v;
5321 HRESULT hres;
5323 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
5324 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
5325 if(FAILED(hres))
5326 return;
5328 hres = IHTMLDocument3_get_documentElement(doc, &elem);
5329 IHTMLDocument3_Release(doc);
5330 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
5331 switch(load_state) {
5332 case LD_DOLOAD:
5333 case LD_NO:
5334 if(!nav_url && !editmode)
5335 ok(!elem, "elem != NULL\n");
5336 default:
5337 break;
5338 case LD_INTERACTIVE:
5339 case LD_COMPLETE:
5340 ok(elem != NULL, "elem == NULL\n");
5342 if(!elem)
5343 return;
5345 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
5346 IHTMLElement_Release(elem);
5347 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
5349 V_VT(&v) = VT_BSTR;
5350 V_BSTR(&v) = SysAllocString(L"left");
5351 hres = IHTMLElement2_doScroll(elem2, v);
5352 SysFreeString(V_BSTR(&v));
5353 IHTMLElement2_Release(elem2);
5355 if(inplace_deactivated)
5356 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
5357 else if(load_state == LD_COMPLETE)
5358 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
5359 else
5360 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
5363 static void _test_readyState(unsigned line, IUnknown *unk)
5365 IHTMLDocument2 *htmldoc;
5366 DISPPARAMS dispparams;
5367 IHTMLElement *elem;
5368 BSTR state;
5369 VARIANT out;
5370 HRESULT hres;
5372 static const LPCWSTR expected_state[] = {
5373 L"uninitialized",
5374 L"loading",
5375 NULL,
5376 L"interactive",
5377 L"complete",
5378 L"uninitialized"
5381 if(open_call || resetting_document)
5382 return; /* FIXME */
5384 if(!unk)
5385 unk = doc_unk;
5387 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
5388 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
5389 if(FAILED(hres))
5390 return;
5392 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
5393 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
5395 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
5396 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
5398 if(!lstrcmpW(state, L"interactive") && load_state == LD_LOADING)
5399 load_state = LD_INTERACTIVE;
5401 ok_(__FILE__, line)
5402 (!lstrcmpW(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
5403 wine_dbgstr_w(state), load_state);
5404 SysFreeString(state);
5406 hres = IHTMLDocument2_get_body(htmldoc, &elem);
5407 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
5408 if(elem) {
5409 IHTMLElement2 *elem2;
5410 VARIANT var;
5412 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
5413 IHTMLElement_Release(elem);
5414 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
5416 hres = IHTMLElement2_get_readyState(elem2, &var);
5417 IHTMLElement2_Release(elem2);
5418 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
5419 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
5420 ok(!lstrcmpW(V_BSTR(&var), L"complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
5421 VariantClear(&var);
5422 }else {
5423 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
5426 dispparams.cArgs = 0;
5427 dispparams.cNamedArgs = 0;
5428 dispparams.rgdispidNamedArgs = NULL;
5429 dispparams.rgvarg = NULL;
5431 VariantInit(&out);
5433 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
5434 &dispparams, &out, NULL, NULL);
5435 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
5437 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
5438 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
5440 test_doscroll((IUnknown*)htmldoc);
5442 IHTMLDocument2_Release(htmldoc);
5445 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
5447 IViewObject *view;
5448 HRESULT hres;
5450 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
5451 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
5453 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
5454 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
5456 IViewObject_Release(view);
5459 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
5461 IConnectionPointContainer *tmp_container = NULL;
5462 IConnectionPoint *cp;
5463 IID iid;
5464 HRESULT hres;
5465 DWORD cookie;
5467 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
5468 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
5469 if(FAILED(hres))
5470 return;
5472 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
5473 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
5474 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
5476 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
5477 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
5479 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
5480 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
5481 ok(tmp_container == container, "container != tmp_container\n");
5482 if(SUCCEEDED(hres))
5483 IConnectionPointContainer_Release(tmp_container);
5485 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
5486 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
5488 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
5489 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
5490 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5491 hres = IConnectionPoint_Unadvise(cp, cookie);
5492 ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
5493 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, NULL);
5494 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5495 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
5496 IEnumConnections *enum_conn;
5497 CONNECTDATA conn_data;
5498 ULONG fetched;
5500 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
5501 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5503 hres = IConnectionPoint_EnumConnections(cp, &enum_conn);
5504 ok(hres == S_OK, "EnumConnections failed: %08x\n", hres);
5506 fetched = 0;
5507 hres = IEnumConnections_Next(enum_conn, 1, &conn_data, &fetched);
5508 ok(hres == S_OK, "Next failed: %08x\n", hres);
5509 ok(conn_data.pUnk == (IUnknown*)&EventDispatch, "conn_data.pUnk == EventDispatch\n");
5510 ok(conn_data.dwCookie == cookie, "conn_data.dwCookie != cookie\n");
5511 IUnknown_Release(conn_data.pUnk);
5513 fetched = 0xdeadbeef;
5514 hres = IEnumConnections_Next(enum_conn, 1, &conn_data, &fetched);
5515 ok(hres == S_FALSE, "Next failed: %08x\n", hres);
5516 ok(!fetched, "fetched = %d\n", fetched);
5518 IEnumConnections_Release(enum_conn);
5521 IConnectionPoint_Release(cp);
5524 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
5526 IConnectionPointContainer *container;
5527 HRESULT hres;
5529 hres = IHTMLDocument2_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
5530 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
5531 if(FAILED(hres))
5532 return;
5534 test_ConnectionPoint(container, &IID_IDispatch);
5535 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
5536 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
5537 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
5539 IConnectionPointContainer_Release(container);
5542 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
5544 ICustomDoc *custom_doc;
5545 HRESULT hres;
5547 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
5548 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
5550 expect_uihandler_iface = uihandler;
5552 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
5553 ICustomDoc_Release(custom_doc);
5554 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
5557 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
5559 IBindCtx *bind;
5560 HRESULT hres;
5561 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
5563 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
5565 test_readyState((IUnknown*)persist);
5567 doc_mon = mon;
5569 CreateBindCtx(0, &bind);
5570 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
5571 (IUnknown*)&ClientSite);
5573 if(mon == &Moniker)
5574 SET_EXPECT(GetDisplayName);
5575 if(!set_clientsite) {
5576 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5577 SET_EXPECT(GetHostInfo);
5578 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5579 SET_EXPECT(Invoke_AMBIENT_SILENT);
5580 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5581 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5582 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5583 SET_EXPECT(GetOptionKeyPath);
5584 SET_EXPECT(GetOverrideKeyPath);
5585 SET_EXPECT(GetWindow);
5586 SET_EXPECT(Exec_DOCCANNAVIGATE);
5587 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
5588 SET_EXPECT(Exec_SETPROGRESSMAX);
5589 SET_EXPECT(Exec_SETPROGRESSPOS);
5590 SET_EXPECT(Exec_ShellDocView_37);
5592 if(!container_locked) {
5593 SET_EXPECT(GetContainer);
5594 SET_EXPECT(LockContainer);
5596 SET_EXPECT(OnChanged_READYSTATE);
5597 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5598 SET_EXPECT(IsSystemMoniker);
5599 if(!is_mhtml && mon == &Moniker)
5600 SET_EXPECT(BindToStorage);
5601 SET_EXPECT(SetActiveObject);
5602 if(set_clientsite) {
5603 SET_EXPECT(Invoke_AMBIENT_SILENT);
5604 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5605 SET_EXPECT(Exec_ShellDocView_37);
5606 SET_EXPECT(IsErrorUrl);
5607 }else {
5608 SET_EXPECT(GetTravelLog);
5610 SET_EXPECT(Exec_ShellDocView_84);
5611 SET_EXPECT(GetPendingUrl);
5612 if(is_mhtml) {
5613 SET_EXPECT(CreateInstance);
5614 SET_EXPECT(Start);
5615 SET_EXPECT(Protocol_Read);
5616 SET_EXPECT(LockRequest);
5617 SET_EXPECT(Terminate);
5618 SET_EXPECT(UnlockRequest);
5620 load_state = LD_DOLOAD;
5621 expect_LockContainer_fLock = TRUE;
5622 readystate_set_loading = TRUE;
5624 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
5625 ok(hres == S_OK, "Load failed: %08x\n", hres);
5627 if(mon == &Moniker)
5628 CHECK_CALLED(GetDisplayName);
5629 if(!set_clientsite) {
5630 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5631 CHECK_CALLED(GetHostInfo);
5632 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5633 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5634 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5635 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5636 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5637 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
5638 CHECK_CALLED(GetOverrideKeyPath);
5639 CHECK_CALLED(GetWindow);
5640 CHECK_CALLED(Exec_DOCCANNAVIGATE);
5641 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
5642 CHECK_CALLED(Exec_SETPROGRESSMAX);
5643 CHECK_CALLED(Exec_SETPROGRESSPOS);
5644 CHECK_CALLED(Exec_ShellDocView_37);
5646 if(!container_locked) {
5647 CHECK_CALLED(GetContainer);
5648 CHECK_CALLED(LockContainer);
5649 container_locked = TRUE;
5651 CHECK_CALLED(OnChanged_READYSTATE);
5652 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5653 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
5654 if(!is_mhtml && mon == &Moniker)
5655 CHECK_CALLED(BindToStorage);
5656 CLEAR_CALLED(SetActiveObject); /* FIXME */
5657 if(set_clientsite) {
5658 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5659 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5660 CHECK_CALLED(Exec_ShellDocView_37);
5661 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
5662 }else {
5663 CHECK_CALLED(GetTravelLog);
5665 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5666 todo_wine CHECK_CALLED(GetPendingUrl);
5667 if(is_mhtml) {
5668 CHECK_CALLED(CreateInstance);
5669 CHECK_CALLED(Start);
5670 CHECK_CALLED(Protocol_Read);
5671 CHECK_CALLED(LockRequest);
5672 CHECK_CALLED(Terminate);
5673 CHECK_CALLED(UnlockRequest);
5676 set_clientsite = container_locked = TRUE;
5678 if(!is_mhtml)
5679 test_GetCurMoniker((IUnknown*)persist, mon, NULL, FALSE);
5680 else
5681 test_GetCurMoniker((IUnknown*)persist, NULL, L"mhtml:winetest:doc", FALSE);
5683 IBindCtx_Release(bind);
5685 test_readyState((IUnknown*)persist);
5688 #define DWL_VERBDONE 0x0001
5689 #define DWL_CSS 0x0002
5690 #define DWL_TRYCSS 0x0004
5691 #define DWL_HTTP 0x0008
5692 #define DWL_EMPTY 0x0010
5693 #define DWL_JAVASCRIPT 0x0020
5694 #define DWL_ONREADY_LOADING 0x0040
5695 #define DWL_EXPECT_HISTUPDATE 0x0080
5696 #define DWL_FROM_HISTORY 0x0100
5697 #define DWL_REFRESH 0x0200
5698 #define DWL_EX_GETHOSTINFO 0x0400
5699 #define DWL_EXTERNAL 0x0800
5701 static void test_download(DWORD flags)
5703 const BOOL is_extern = (flags & DWL_EXTERNAL) != 0;
5704 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
5705 HWND hwnd;
5706 BOOL *b;
5707 MSG msg;
5709 if(is_js)
5710 b = &called_Exec_SETDOWNLOADSTATE_0;
5711 else if(is_extern)
5712 b = &called_NavigateWithBindCtx;
5713 else
5714 b = &called_Exec_HTTPEQUIV_DONE;
5715 is_refresh = (flags & DWL_REFRESH) != 0;
5717 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
5718 ok(hwnd != NULL, "Could not find hidden window\n");
5720 test_readyState(NULL);
5722 if(flags & DWL_REFRESH) {
5723 SET_EXPECT(Invoke_AMBIENT_SILENT);
5724 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5726 if(is_mhtml || (flags & (DWL_VERBDONE|DWL_HTTP)))
5727 SET_EXPECT(Exec_SETPROGRESSMAX);
5728 if(flags & DWL_EX_GETHOSTINFO)
5729 SET_EXPECT(GetHostInfo);
5730 SET_EXPECT(SetStatusText);
5731 if(!(flags & DWL_EMPTY))
5732 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
5733 if(is_js)
5734 SET_EXPECT(GetExternal);
5735 SET_EXPECT(OnViewChange);
5736 SET_EXPECT(GetDropTarget);
5737 if((flags & DWL_TRYCSS) && !(flags & DWL_EMPTY))
5738 SET_EXPECT(Exec_ShellDocView_84);
5739 if(flags & DWL_CSS) {
5740 SET_EXPECT(CreateInstance);
5741 SET_EXPECT(Start);
5742 SET_EXPECT(LockRequest);
5743 SET_EXPECT(Terminate);
5744 SET_EXPECT(Protocol_Read);
5745 SET_EXPECT(UnlockRequest);
5747 if(flags & DWL_ONREADY_LOADING)
5748 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5749 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
5750 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
5751 if(!is_js && !is_extern)
5752 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
5753 SET_EXPECT(Exec_Explorer_69);
5754 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
5755 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
5756 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
5757 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
5758 if((nav_url && !is_js && !is_extern) || (flags & (DWL_CSS|DWL_HTTP)))
5759 SET_EXPECT(Exec_ShellDocView_37);
5760 if(flags & DWL_HTTP) {
5761 if(!(flags & DWL_FROM_HISTORY))
5762 SET_EXPECT(OnChanged_1012);
5763 SET_EXPECT(Exec_HTTPEQUIV);
5764 SET_EXPECT(Exec_SETTITLE);
5766 if(!is_js && !is_extern)
5767 SET_EXPECT(OnChanged_1005);
5768 SET_EXPECT(OnChanged_READYSTATE);
5769 SET_EXPECT(Exec_SETPROGRESSPOS);
5770 if(!(flags & DWL_EMPTY))
5771 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
5772 SET_EXPECT(Exec_ShellDocView_103);
5773 SET_EXPECT(Exec_ShellDocView_105);
5774 SET_EXPECT(Exec_ShellDocView_140);
5775 if(!is_js && !is_extern) {
5776 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
5777 if(support_wbapp) /* Called on some Vista installations */
5778 SET_EXPECT(CountEntries);
5779 SET_EXPECT(Exec_HTTPEQUIV_DONE);
5781 if(nav_url || support_wbapp) {
5782 SET_EXPECT(UpdateUI);
5783 SET_EXPECT(Exec_UPDATECOMMANDS);
5784 SET_EXPECT(Exec_SETTITLE);
5785 if(flags & DWL_EXPECT_HISTUPDATE)
5786 SET_EXPECT(Exec_Explorer_38);
5787 SET_EXPECT(UpdateBackForwardState);
5789 if(!is_js && !is_extern) {
5790 if(!editmode && !(flags & DWL_REFRESH)) {
5791 if(!is_mhtml && !(flags & DWL_EMPTY))
5792 SET_EXPECT(FireNavigateComplete2);
5793 SET_EXPECT(FireDocumentComplete);
5795 SET_EXPECT(ActiveElementChanged);
5797 SET_EXPECT(IsErrorUrl);
5798 if(is_extern) {
5799 SET_EXPECT(Exec_ShellDocView_62);
5800 SET_EXPECT(Exec_DOCCANNAVIGATE_NULL);
5801 SET_EXPECT(NavigateWithBindCtx);
5802 SET_EXPECT(Exec_Explorer_38); /* todo_wine */
5804 if(editmode || is_refresh)
5805 SET_EXPECT(Exec_ShellDocView_138);
5806 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
5808 while(!*b && GetMessageW(&msg, NULL, 0, 0)) {
5809 TranslateMessage(&msg);
5810 DispatchMessageA(&msg);
5813 if(flags & DWL_REFRESH) {
5814 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5815 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5817 if(is_mhtml || (flags & DWL_VERBDONE))
5818 CHECK_CALLED(Exec_SETPROGRESSMAX);
5819 if(flags & DWL_HTTP)
5820 SET_CALLED(Exec_SETPROGRESSMAX);
5821 if(flags & DWL_EX_GETHOSTINFO) {
5822 todo_wine_if(nav_url)
5823 CHECK_CALLED(GetHostInfo);
5825 CHECK_CALLED(SetStatusText);
5826 if(!(flags & DWL_EMPTY))
5827 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
5828 if(is_js)
5829 CHECK_CALLED(GetExternal);
5830 CHECK_CALLED(OnViewChange);
5831 CLEAR_CALLED(GetDropTarget);
5832 if((flags & DWL_TRYCSS) && !(flags & DWL_EMPTY))
5833 todo_wine CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
5834 if(flags & DWL_CSS) {
5835 CHECK_CALLED(CreateInstance);
5836 CHECK_CALLED(Start);
5837 CHECK_CALLED(LockRequest);
5838 CHECK_CALLED(Terminate);
5839 CHECK_CALLED(Protocol_Read);
5840 CHECK_CALLED(UnlockRequest);
5842 if(flags & DWL_ONREADY_LOADING)
5843 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5844 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT))) {
5845 todo_wine_if(is_extern)
5846 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
5848 if(!is_js && !is_extern)
5849 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
5850 SET_CALLED(Exec_Explorer_69);
5851 SET_CALLED(EnableModeless_TRUE); /* IE7 */
5852 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
5853 SET_CALLED(EnableModeless_FALSE); /* IE7 */
5854 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
5855 if(nav_url && !is_js && !is_extern && !(flags & DWL_REFRESH))
5856 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
5857 else if(flags & (DWL_CSS|DWL_HTTP))
5858 CLEAR_CALLED(Exec_ShellDocView_37); /* Called by IE9 */
5859 if(flags & DWL_HTTP) {
5860 if(!(flags & DWL_FROM_HISTORY))
5861 todo_wine CHECK_CALLED(OnChanged_1012);
5862 todo_wine CHECK_CALLED(Exec_HTTPEQUIV);
5863 todo_wine_if(!(flags & DWL_REFRESH))
5864 CHECK_CALLED(Exec_SETTITLE);
5866 if(!is_js) {
5867 if(!is_extern)
5868 CHECK_CALLED(OnChanged_1005);
5869 CHECK_CALLED(OnChanged_READYSTATE);
5870 CHECK_CALLED(Exec_SETPROGRESSPOS);
5871 }else {
5872 CLEAR_CALLED(OnChanged_READYSTATE); /* sometimes called */
5873 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
5875 if(!(flags & DWL_EMPTY)) {
5876 todo_wine_if(is_extern)
5877 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
5879 CLEAR_CALLED(Exec_ShellDocView_103);
5880 CLEAR_CALLED(Exec_ShellDocView_105);
5881 CLEAR_CALLED(Exec_ShellDocView_140);
5882 if(!is_js && !is_extern) {
5883 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
5884 if(support_wbapp) /* Called on some Vista installations */
5885 CLEAR_CALLED(CountEntries);
5886 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
5888 SET_CALLED(SetStatusText);
5889 if(nav_url || support_wbapp) { /* avoiding race, FIXME: find better way */
5890 CLEAR_CALLED(UpdateUI);
5891 CLEAR_CALLED(Exec_UPDATECOMMANDS);
5892 CLEAR_CALLED(Exec_SETTITLE);
5893 if(flags & DWL_EXPECT_HISTUPDATE) {
5894 if(flags & DWL_FROM_HISTORY)
5895 CHECK_CALLED_BROKEN(Exec_Explorer_38); /* Some old IEs don't call it. */
5896 else
5897 CHECK_CALLED(Exec_Explorer_38);
5899 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
5901 if(!is_js && !is_extern) {
5902 if(!editmode && !(flags & DWL_REFRESH)) {
5903 if(!is_mhtml && !(flags & DWL_EMPTY)) {
5904 todo_wine_if(!support_wbapp)
5905 CHECK_CALLED(FireNavigateComplete2);
5907 CHECK_CALLED(FireDocumentComplete);
5909 todo_wine CHECK_CALLED(ActiveElementChanged);
5911 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
5912 if(is_extern) {
5913 CHECK_CALLED(Exec_ShellDocView_62);
5914 CHECK_CALLED(Exec_DOCCANNAVIGATE_NULL);
5915 CHECK_CALLED(NavigateWithBindCtx);
5916 todo_wine CHECK_NOT_CALLED(Exec_Explorer_38);
5918 if(editmode || is_refresh)
5919 CLEAR_CALLED(Exec_ShellDocView_138); /* IE11 */
5921 if(!is_extern)
5922 load_state = LD_COMPLETE;
5924 test_readyState(NULL);
5927 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
5929 IPersistMoniker *persist_mon;
5930 IPersistFile *persist_file;
5931 GUID guid;
5932 HRESULT hres;
5934 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
5935 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
5936 if(SUCCEEDED(hres)) {
5937 hres = IPersistFile_GetClassID(persist_file, NULL);
5938 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5940 hres = IPersistFile_GetClassID(persist_file, &guid);
5941 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5942 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5944 IPersistFile_Release(persist_file);
5947 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
5948 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
5949 if(SUCCEEDED(hres)) {
5950 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
5951 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
5953 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
5954 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
5955 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5957 if(load_state == LD_DOLOAD)
5958 test_Load(persist_mon, mon);
5960 test_readyState((IUnknown*)doc);
5962 IPersistMoniker_Release(persist_mon);
5966 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const WCHAR *href, const WCHAR *new_nav_url, BOOL is_js,
5967 BOOL is_hash, DWORD dwl_flags)
5969 const WCHAR *prev_nav_url = NULL;
5970 IHTMLPrivateWindow *priv_window;
5971 IHTMLLocation *location;
5972 IHTMLWindow2 *window;
5973 BSTR str, str2;
5974 HRESULT hres;
5976 trace("put_href %s...\n", wine_dbgstr_w(new_nav_url));
5978 loading_js = is_js;
5979 loading_hash = is_hash;
5981 location = NULL;
5982 hres = IHTMLDocument2_get_location(doc, &location);
5983 ok(hres == S_OK, "get_location failed: %08x\n", hres);
5984 ok(location != NULL, "location == NULL\n");
5986 prev_url = prev_nav_url = nav_url;
5987 nav_url = new_nav_url;
5988 if(!loading_hash)
5989 nav_serv_url = new_nav_url;
5990 if(!href)
5991 href = new_nav_url;
5993 str = SysAllocString(href);
5994 SET_EXPECT(TranslateUrl);
5995 if(support_wbapp) {
5996 SET_EXPECT(FireBeforeNavigate2);
5997 SET_EXPECT(Exec_ShellDocView_67);
5998 if(!is_hash) {
5999 SET_EXPECT(Invoke_AMBIENT_SILENT);
6000 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6001 SET_EXPECT(Exec_ShellDocView_63);
6002 SET_EXPECT(Exec_ShellDocView_84);
6003 }else {
6004 SET_EXPECT(FireNavigateComplete2);
6005 SET_EXPECT(FireDocumentComplete);
6007 }else {
6008 SET_EXPECT(Navigate);
6010 if(use_replace) {
6011 hres = IHTMLLocation_replace(location, str);
6012 ok(hres == S_OK, "put_href failed: %08x\n", hres);
6013 }else {
6014 hres = IHTMLLocation_put_href(location, str);
6015 if(is_js && hres == E_ACCESSDENIED)
6016 win_skip("put_href: got E_ACCESSDENIED\n");
6017 else
6018 ok(hres == S_OK, "put_href failed: %08x\n", hres);
6020 SysFreeString(str);
6021 if(hres == S_OK) {
6022 CHECK_CALLED(TranslateUrl);
6023 if(support_wbapp) {
6024 CHECK_CALLED(FireBeforeNavigate2);
6025 CLEAR_CALLED(Exec_ShellDocView_67); /* Not called by IE11 */
6026 if(!is_hash) {
6027 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6028 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6029 CHECK_CALLED(Exec_ShellDocView_63);
6030 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
6031 }else {
6032 CHECK_CALLED(FireNavigateComplete2);
6033 CHECK_CALLED(FireDocumentComplete);
6035 }else {
6036 CHECK_CALLED(Navigate);
6038 }else {
6039 CLEAR_CALLED(TranslateUrl);
6040 if(support_wbapp) {
6041 CLEAR_CALLED(FireBeforeNavigate2);
6042 SET_CALLED(Exec_ShellDocView_67);
6043 if(!is_hash) {
6044 CLEAR_CALLED(Invoke_AMBIENT_SILENT);
6045 CLEAR_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6046 CLEAR_CALLED(Exec_ShellDocView_63);
6047 todo_wine CLEAR_CALLED(Exec_ShellDocView_84);
6048 }else {
6049 CLEAR_CALLED(FireNavigateComplete2);
6050 CLEAR_CALLED(FireDocumentComplete);
6052 }else {
6053 CLEAR_CALLED(Navigate);
6057 IHTMLLocation_Release(location);
6059 if(is_js && hres == E_ACCESSDENIED) {
6060 nav_url = prev_nav_url;
6061 return;
6064 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6065 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6067 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
6068 IHTMLWindow2_Release(window);
6069 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
6071 if(!support_wbapp) {
6072 VARIANT vempty;
6074 readystate_set_loading = TRUE;
6075 SET_EXPECT(TranslateUrl);
6076 SET_EXPECT(Exec_ShellDocView_67);
6077 SET_EXPECT(Invoke_AMBIENT_SILENT);
6078 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6079 SET_EXPECT(Exec_ShellDocView_63);
6080 SET_EXPECT(Exec_ShellDocView_84);
6082 str = SysAllocString(nav_url);
6083 str2 = SysAllocString(L"");
6084 V_VT(&vempty) = VT_EMPTY;
6085 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
6086 SysFreeString(str);
6087 SysFreeString(str2);
6088 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
6090 CHECK_CALLED(TranslateUrl);
6091 CLEAR_CALLED(Exec_ShellDocView_67); /* Not called by IE11 */
6092 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6093 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6094 CHECK_CALLED(Exec_ShellDocView_63);
6095 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
6098 if(doc_mon) {
6099 test_GetCurMoniker(doc_unk, doc_mon, NULL, FALSE);
6100 doc_mon = NULL;
6103 if(!is_hash) {
6104 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
6105 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
6106 ok(!lstrcmpW(str2, prev_nav_url), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2),
6107 wine_dbgstr_w(prev_nav_url));
6108 SysFreeString(str2);
6110 if(is_js) {
6111 ignore_external_qi = TRUE;
6112 dwl_flags |= DWL_JAVASCRIPT;
6113 }else {
6114 if(!(dwl_flags & DWL_EXTERNAL))
6115 dwl_flags |= DWL_EX_GETHOSTINFO;
6116 dwl_flags |= DWL_ONREADY_LOADING;
6118 test_download(DWL_VERBDONE | dwl_flags);
6119 if(is_js)
6120 ignore_external_qi = FALSE;
6124 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
6125 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
6126 if(is_js)
6127 ok(!lstrcmpW(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
6128 else if (dwl_flags & DWL_EXTERNAL)
6129 todo_wine ok(!lstrcmpW(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
6130 else
6131 ok(!lstrcmpW(str2, nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
6132 SysFreeString(str2);
6133 IHTMLPrivateWindow_Release(priv_window);
6135 loading_js = FALSE;
6136 if(is_js)
6137 nav_url = prev_nav_url;
6140 static void test_load_history(IHTMLDocument2 *doc)
6142 IPersistHistory *per_hist;
6143 HRESULT hres;
6145 trace("LoadHistory...\n");
6147 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistHistory, (void**)&per_hist);
6148 ok(hres == S_OK, "Could not get IPersistHistory iface: %08x\n", hres);
6150 prev_url = nav_url;
6151 nav_url = L"http://test.winehq.org/tests/winehq_snapshot/#test";
6152 nav_serv_url = L"http://test.winehq.org/tests/winehq_snapshot/";
6154 SET_EXPECT(Exec_ShellDocView_138);
6155 SET_EXPECT(Exec_ShellDocView_67);
6156 SET_EXPECT(FireBeforeNavigate2);
6157 SET_EXPECT(Invoke_AMBIENT_SILENT);
6158 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6160 hres = IPersistHistory_LoadHistory(per_hist, history_stream, NULL);
6161 ok(hres == S_OK, "LoadHistory failed: %08x\n", hres);
6163 CLEAR_CALLED(Exec_ShellDocView_138); /* Not called by IE11 */
6164 CLEAR_CALLED(Exec_ShellDocView_67); /* Not called by IE11 */
6165 CHECK_CALLED(FireBeforeNavigate2);
6166 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6167 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6169 load_state = LD_LOADING;
6170 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
6172 test_download(DWL_VERBDONE|DWL_HTTP|DWL_EXPECT_HISTUPDATE|DWL_ONREADY_LOADING|DWL_FROM_HISTORY|DWL_EX_GETHOSTINFO);
6174 IPersistHistory_Release(per_hist);
6175 IStream_Release(history_stream);
6176 history_stream = NULL;
6179 static void test_OmHistory(IHTMLDocument2 *doc)
6181 IHTMLWindow2 *win;
6182 IOmHistory *hist;
6183 short len;
6184 HRESULT hres;
6186 hres = IHTMLDocument2_get_parentWindow(doc, &win);
6187 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6189 hres = IHTMLWindow2_get_history(win, &hist);
6190 ok(hres == S_OK, "get_history failed: %08x\n", hres);
6191 IHTMLWindow2_Release(win);
6193 SET_EXPECT(CountEntries);
6194 hres = IOmHistory_get_length(hist, &len);
6195 CHECK_CALLED(CountEntries);
6196 ok(hres == S_OK, "get_length failed: %08x\n", hres);
6197 ok(len == 0, "len = %d\n", len);
6199 IOmHistory_Release(hist);
6202 static void test_refresh(IHTMLDocument2 *doc)
6204 IOleCommandTarget *cmdtrg;
6205 VARIANT vin, vout;
6206 HRESULT hres;
6208 trace("Refresh...\n");
6210 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
6211 ok(hres == S_OK, "Could not get IOleCommandTarget iface: %08x\n", hres);
6213 V_VT(&vin) = VT_EMPTY;
6214 V_VT(&vout) = VT_EMPTY;
6215 SET_EXPECT(Exec_DocHostCommandHandler_2300);
6216 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_REFRESH, OLECMDEXECOPT_PROMPTUSER, &vin, &vout);
6217 ok(hres == S_OK, "Exec failed: %08x\n", hres);
6218 ok(V_VT(&vout) == VT_EMPTY, "V_VT(vout) = %d\n", V_VT(&vout));
6219 CHECK_CALLED(Exec_DocHostCommandHandler_2300);
6221 IOleCommandTarget_Release(cmdtrg);
6223 test_download(DWL_VERBDONE|DWL_HTTP|DWL_ONREADY_LOADING|DWL_REFRESH|DWL_EX_GETHOSTINFO);
6226 static void test_open_window(IHTMLDocument2 *doc, BOOL do_block)
6228 IHTMLWindow2 *window, *new_window;
6229 BSTR name, url;
6230 HRESULT hres;
6232 allow_new_window = !do_block;
6234 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6235 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6237 url = SysAllocString(nav_serv_url = nav_url = L"about:blank");
6238 name = SysAllocString(L"test");
6239 new_window = (void*)0xdeadbeef;
6241 trace("open...\n");
6242 open_call = TRUE;
6244 if(support_wbapp)
6245 SET_EXPECT(get_LocationURL);
6246 SET_EXPECT(TranslateUrl);
6247 SET_EXPECT(GetOverrideKeyPath);
6248 SET_EXPECT(EvaluateNewWindow);
6250 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
6251 open_call = FALSE;
6252 SysFreeString(url);
6253 SysFreeString(name);
6255 if(support_wbapp)
6256 todo_wine CHECK_CALLED_BROKEN(get_LocationURL);
6257 todo_wine
6258 CHECK_CALLED(TranslateUrl);
6259 CLEAR_CALLED(GetOverrideKeyPath);
6261 if(!called_EvaluateNewWindow) {
6262 win_skip("INewWindowManager not supported\n");
6263 if(SUCCEEDED(hres) && new_window)
6264 IHTMLWindow2_Release(new_window);
6265 IHTMLWindow2_Release(window);
6266 return;
6268 CHECK_CALLED(EvaluateNewWindow);
6270 ok(hres == S_OK, "open failed: %08x\n", hres);
6271 if (hres != S_OK) {
6272 IHTMLWindow2_Release(window);
6273 return;
6276 if(do_block) {
6277 ok(!new_window, "new_window != NULL\n");
6278 }else {
6279 ok(new_window != NULL, "new_window == NULL\n");
6281 hres = IHTMLWindow2_close(new_window);
6282 ok(hres == S_OK, "close failed: %08x\n", hres);
6283 IHTMLWindow2_Release(new_window);
6286 IHTMLWindow2_Release(window);
6289 static void test_window_close(IHTMLDocument2 *doc)
6291 IHTMLWindow2 *window;
6292 HRESULT hres;
6294 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6295 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6297 SET_EXPECT(FindConnectionPoint);
6298 SET_EXPECT(EnumConnections);
6299 SET_EXPECT(EnumConnections_Next);
6300 SET_EXPECT(WindowClosing);
6302 hres = IHTMLWindow2_close(window);
6303 ok(hres == S_OK, "close failed: %08x\n", hres);
6305 CHECK_CALLED(FindConnectionPoint);
6306 CHECK_CALLED(EnumConnections);
6307 CHECK_CALLED(EnumConnections_Next);
6308 CHECK_CALLED(WindowClosing);
6310 IHTMLWindow2_Release(window);
6313 static void test_elem_from_point(IHTMLDocument2 *doc)
6315 IHTMLElement *elem;
6316 BSTR tag;
6317 HRESULT hres;
6319 elem = NULL;
6320 hres = IHTMLDocument2_elementFromPoint(doc, 3, 3, &elem);
6321 ok(hres == S_OK, "elementFromPoint failed: %08x\n", hres);
6322 ok(elem != NULL, "elem == NULL\n");
6324 hres = IHTMLElement_get_tagName(elem, &tag);
6325 IHTMLElement_Release(elem);
6326 ok(hres == S_OK, "get_tagName failed: %08x\n", hres);
6327 ok(!lstrcmpW(tag, L"DIV"), "tag = %s\n", wine_dbgstr_w(tag));
6330 static void test_clear(IHTMLDocument2 *doc)
6332 HRESULT hres;
6334 hres = IHTMLDocument2_clear(doc);
6335 ok(hres == S_OK, "clear failed: %08x\n", hres);
6338 static const OLECMDF expect_cmds[] = {
6340 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
6341 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
6342 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
6343 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
6344 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
6345 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
6346 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
6347 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
6348 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
6349 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
6350 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
6351 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
6352 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
6353 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
6354 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
6355 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
6356 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
6357 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
6358 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
6359 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
6361 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
6362 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
6363 0,0,0,0,0,0,
6364 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
6365 0,0,
6366 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
6367 0,0,
6368 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
6369 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
6370 0,0,0,0,0,
6371 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
6372 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
6373 0,0,
6374 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
6375 0,0,0,
6376 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
6377 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
6380 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
6381 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
6383 IOleCommandTarget *cmdtrg;
6384 OLECMD olecmd = {cmdid, 0};
6385 HRESULT hres;
6387 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
6388 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
6389 if(FAILED(hres))
6390 return;
6392 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
6393 ok(hres == (cmdf ? S_OK : OLECMDERR_E_NOTSUPPORTED), "QueryStatus(%u) failed: %08x\n", cmdid, hres);
6395 IOleCommandTarget_Release(cmdtrg);
6397 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
6398 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
6401 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
6403 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
6405 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
6406 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
6407 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
6408 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
6409 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
6410 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
6411 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
6412 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
6413 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
6414 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
6415 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
6416 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
6417 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
6418 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
6419 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
6420 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
6423 static void test_OleCommandTarget(IHTMLDocument2 *doc)
6425 IOleCommandTarget *cmdtrg;
6426 OLECMD cmds[ARRAY_SIZE(expect_cmds)-1];
6427 int i;
6428 HRESULT hres;
6430 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
6431 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
6432 if(FAILED(hres))
6433 return;
6435 for(i=0; i < ARRAY_SIZE(cmds); i++) {
6436 cmds[i].cmdID = i+1;
6437 cmds[i].cmdf = 0xf0f0;
6440 SET_EXPECT(QueryStatus_OPEN);
6441 SET_EXPECT(QueryStatus_NEW);
6442 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, ARRAY_SIZE(cmds), cmds, NULL);
6443 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
6444 CHECK_CALLED(QueryStatus_OPEN);
6445 CHECK_CALLED(QueryStatus_NEW);
6447 for(i=0; i < ARRAY_SIZE(cmds); i++) {
6448 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
6449 if(i+1 == OLECMDID_FIND)
6450 continue;
6451 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
6452 i+1, cmds[i].cmdf, expect_cmds[i+1]);
6455 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
6456 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
6458 IOleCommandTarget_Release(cmdtrg);
6461 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
6463 IOleCommandTarget *cmdtrg;
6464 int i;
6465 HRESULT hres;
6467 OLECMD cmd[2] = {
6468 {OLECMDID_OPEN, 0xf0f0},
6469 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
6472 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
6473 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
6474 if(FAILED(hres))
6475 return;
6477 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
6478 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
6480 SET_EXPECT(QueryStatus_OPEN);
6481 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
6482 CHECK_CALLED(QueryStatus_OPEN);
6484 ok(hres == OLECMDERR_E_NOTSUPPORTED,
6485 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
6486 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
6487 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
6488 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
6489 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
6490 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
6492 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
6493 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
6494 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
6496 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
6497 if(!expect_cmds[i]) {
6498 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
6499 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6500 ok(hres == OLECMDERR_E_NOTSUPPORTED,
6501 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
6505 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
6506 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6507 ok(hres == OLECMDERR_E_NOTSUPPORTED,
6508 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
6510 IOleCommandTarget_Release(cmdtrg);
6513 static void test_exec_onunload(IHTMLDocument2 *doc)
6515 IOleCommandTarget *cmdtrg;
6516 VARIANT var;
6517 HRESULT hres;
6519 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
6520 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
6521 if(FAILED(hres))
6522 return;
6524 memset(&var, 0x0a, sizeof(var));
6525 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
6526 OLECMDEXECOPT_DODEFAULT, NULL, &var);
6527 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
6528 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
6529 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
6531 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
6532 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6533 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
6535 IOleCommandTarget_Release(cmdtrg);
6538 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
6540 IOleCommandTarget *cmdtrg;
6541 HRESULT hres;
6543 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
6544 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
6545 if(FAILED(hres))
6546 return;
6548 editmode = TRUE;
6550 if(loaded) {
6551 load_state = LD_DOLOAD;
6552 SET_EXPECT(GetClassID);
6554 SET_EXPECT(SetStatusText);
6555 SET_EXPECT(Exec_ShellDocView_37);
6556 SET_EXPECT(GetHostInfo);
6557 if(loaded)
6558 SET_EXPECT(GetDisplayName);
6559 SET_EXPECT(Invoke_AMBIENT_SILENT);
6560 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6561 SET_EXPECT(OnChanged_READYSTATE);
6562 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6563 SET_EXPECT(IsSystemMoniker);
6564 SET_EXPECT(Exec_ShellDocView_84);
6565 if(loaded)
6566 SET_EXPECT(BindToStorage);
6567 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6568 SET_EXPECT(HideUI);
6569 SET_EXPECT(ShowUI);
6570 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6572 expect_status_text = NULL;
6573 readystate_set_loading = TRUE;
6575 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
6576 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6577 ok(hres == S_OK, "Exec failed: %08x\n", hres);
6579 if(loaded)
6580 CHECK_CALLED(GetClassID);
6581 CHECK_CALLED(SetStatusText);
6582 CHECK_CALLED(Exec_ShellDocView_37);
6583 CHECK_CALLED(GetHostInfo);
6584 if(loaded)
6585 CHECK_CALLED(GetDisplayName);
6586 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6587 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6588 CHECK_CALLED(OnChanged_READYSTATE);
6589 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6590 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
6591 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
6592 if(loaded)
6593 CHECK_CALLED(BindToStorage);
6594 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6595 CHECK_CALLED(HideUI);
6596 CHECK_CALLED(ShowUI);
6597 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6599 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
6601 IOleCommandTarget_Release(cmdtrg);
6603 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
6604 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6605 ok(hres == S_OK, "Exec failed: %08x\n", hres);
6608 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
6610 IOleCommandTarget *cmdtrg;
6611 VARIANT *in = NULL, _in, *out = NULL, _out;
6612 HRESULT hres;
6614 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
6615 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
6616 if(FAILED(hres))
6617 return;
6619 if(name) {
6620 in = &_in;
6621 V_VT(in) = VT_BSTR;
6622 V_BSTR(in) = SysAllocString(name);
6625 if(exname) {
6626 out = &_out;
6627 V_VT(out) = VT_I4;
6628 V_I4(out) = 0xdeadbeef;
6631 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
6632 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
6634 if(in)
6635 VariantClear(in);
6637 if(out) {
6638 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
6639 if(V_VT(out) == VT_BSTR) {
6640 if(exname)
6641 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
6642 "unexpected fontname %s\n", wine_dbgstr_w(name));
6643 else
6644 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
6646 VariantClear(out);
6649 IOleCommandTarget_Release(cmdtrg);
6652 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
6654 IOleCommandTarget *cmdtrg;
6655 HRESULT hres;
6657 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
6658 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
6659 if(FAILED(hres))
6660 return;
6662 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
6663 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
6664 ok(hres == S_OK, "Exec failed: %08x\n", hres);
6666 IOleCommandTarget_Release(cmdtrg);
6669 static void test_exec_optical_zoom(IHTMLDocument2 *doc, int factor)
6671 IOleCommandTarget *cmdtrg;
6672 VARIANT v, out;
6673 HRESULT hres;
6675 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
6676 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
6677 if(FAILED(hres))
6678 return;
6680 V_VT(&v) = VT_I4;
6681 V_I4(&v) = factor;
6683 SET_EXPECT(GetOverrideKeyPath);
6684 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
6685 OLECMDEXECOPT_DODEFAULT, &v, &out);
6686 ok(hres == S_OK || broken(hres == OLECMDERR_E_NOTSUPPORTED) /* IE6 */, "Exec failed: %08x\n", hres);
6687 CLEAR_CALLED(GetOverrideKeyPath);
6689 if(hres != OLECMDERR_E_NOTSUPPORTED) {
6690 ok(V_VT(&out) == VT_I4, "V_VT(&out) = %d\n", V_VT(&out));
6691 ok(V_I4(&out) == factor, "V_I4(&out) = %d, expected %d\n", V_I4(&out), factor);
6693 SET_EXPECT(GetOverrideKeyPath);
6694 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_OPTICAL_ZOOM,
6695 OLECMDEXECOPT_DODEFAULT, NULL, &out);
6696 ok(hres == S_OK, "Exec failed: %08x\n", hres);
6697 ok(V_VT(&out) == VT_I4, "V_VT(&out) = %d\n", V_VT(&out));
6698 ok(V_I4(&out) == factor, "V_I4(&out) = %d, expected %d\n", V_I4(&out), factor);
6699 CLEAR_CALLED(GetOverrideKeyPath);
6702 IOleCommandTarget_Release(cmdtrg);
6704 test_QueryStatus((IUnknown*)doc, NULL, OLECMDID_OPTICAL_ZOOM, 0);
6707 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
6709 IPersistStreamInit *perinit;
6710 IPersistMoniker *permon;
6711 IPersistFile *perfile;
6712 HRESULT hres;
6714 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
6715 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
6716 if(SUCCEEDED(hres)) {
6717 hres = IPersistStreamInit_IsDirty(perinit);
6718 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
6719 IPersistStreamInit_Release(perinit);
6722 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
6723 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
6724 if(SUCCEEDED(hres)) {
6725 hres = IPersistMoniker_IsDirty(permon);
6726 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
6727 IPersistMoniker_Release(permon);
6730 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
6731 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
6732 if(SUCCEEDED(hres)) {
6733 hres = IPersistFile_IsDirty(perfile);
6734 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
6735 IPersistFile_Release(perfile);
6739 static HWND create_container_window(void)
6741 static const WCHAR wszHTMLDocumentTest[] =
6742 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
6743 static WNDCLASSEXW wndclass = {
6744 sizeof(WNDCLASSEXW),
6746 wnd_proc,
6747 0, 0, NULL, NULL, NULL, NULL, NULL,
6748 wszHTMLDocumentTest,
6749 NULL
6752 RegisterClassExW(&wndclass);
6753 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
6754 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
6755 515, 530, NULL, NULL, NULL, NULL);
6758 static void test_DoVerb(IOleObject *oleobj)
6760 RECT rect = {0,0,500,500};
6761 HRESULT hres;
6763 if(!container_locked) {
6764 SET_EXPECT(GetContainer);
6765 SET_EXPECT(LockContainer);
6767 SET_EXPECT(ActivateMe);
6768 expect_LockContainer_fLock = TRUE;
6770 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
6771 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
6773 if(!container_locked) {
6774 CHECK_CALLED(GetContainer);
6775 CHECK_CALLED(LockContainer);
6776 container_locked = TRUE;
6778 CHECK_CALLED(ActivateMe);
6781 #define CLIENTSITE_EXPECTPATH 0x00000001
6782 #define CLIENTSITE_SETNULL 0x00000002
6783 #define CLIENTSITE_DONTSET 0x00000004
6785 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
6787 IOleClientSite *clientsite;
6788 HRESULT hres;
6790 if(flags & CLIENTSITE_SETNULL) {
6791 hres = IOleObject_GetClientSite(oleobj, &clientsite);
6792 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6793 if(set_clientsite)
6794 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
6795 else
6796 ok(!clientsite, "clientsite != NULL\n");
6798 SET_EXPECT(GetOverrideKeyPath);
6799 hres = IOleObject_SetClientSite(oleobj, NULL);
6800 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6801 CLEAR_CALLED(GetOverrideKeyPath); /* IE9 sometimes calls it */
6803 set_clientsite = FALSE;
6806 if(flags & CLIENTSITE_DONTSET)
6807 return;
6809 if(!expect_uihandler_iface)
6810 expect_uihandler_iface = &DocHostUIHandler;
6812 hres = IOleObject_GetClientSite(oleobj, &clientsite);
6813 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
6814 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
6815 clientsite, set_clientsite ? &ClientSite : NULL);
6817 if(!set_clientsite) {
6818 if(expect_uihandler_iface)
6819 SET_EXPECT(GetHostInfo);
6820 if(flags & CLIENTSITE_EXPECTPATH) {
6821 SET_EXPECT(GetOptionKeyPath);
6822 SET_EXPECT(GetOverrideKeyPath);
6824 SET_EXPECT(GetWindow);
6825 if(flags & CLIENTSITE_EXPECTPATH)
6826 SET_EXPECT(Exec_DOCCANNAVIGATE);
6827 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
6828 SET_EXPECT(Exec_SETPROGRESSMAX);
6829 SET_EXPECT(Exec_SETPROGRESSPOS);
6830 SET_EXPECT(Invoke_AMBIENT_USERMODE);
6831 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6832 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6833 SET_EXPECT(Invoke_AMBIENT_SILENT);
6834 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6835 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6836 SET_EXPECT(GetOverrideKeyPath);
6837 SET_EXPECT(GetTravelLog);
6838 SET_EXPECT(Exec_ShellDocView_84);
6840 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
6841 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6843 if(expect_uihandler_iface)
6844 CHECK_CALLED(GetHostInfo);
6845 if(flags & CLIENTSITE_EXPECTPATH) {
6846 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
6847 CHECK_CALLED(GetOverrideKeyPath);
6849 CHECK_CALLED(GetWindow);
6850 if(flags & CLIENTSITE_EXPECTPATH)
6851 CHECK_CALLED(Exec_DOCCANNAVIGATE);
6852 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
6853 CHECK_CALLED(Exec_SETPROGRESSMAX);
6854 CHECK_CALLED(Exec_SETPROGRESSPOS);
6855 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
6856 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6857 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6858 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6859 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6860 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
6861 CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
6862 CHECK_CALLED(GetTravelLog);
6863 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
6865 set_clientsite = TRUE;
6868 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
6869 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6871 hres = IOleObject_GetClientSite(oleobj, &clientsite);
6872 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
6873 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
6876 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
6878 IOleControl *control = NULL;
6879 HRESULT hres;
6881 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleControl, (void**)&control);
6882 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
6883 if(FAILED(hres))
6884 return;
6886 SET_EXPECT(Invoke_AMBIENT_USERMODE);
6887 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
6888 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6889 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
6891 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6892 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
6893 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6894 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6896 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6897 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6898 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
6899 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6900 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6901 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6903 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6904 SET_EXPECT(Invoke_AMBIENT_SILENT);
6905 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
6906 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6907 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6908 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6910 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6911 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
6912 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6913 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6915 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6916 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
6917 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
6918 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
6920 IOleControl_Release(control);
6925 static void test_GetSetExtent(IHTMLDocument2 *doc)
6927 IOleObject *oleobj = NULL;
6928 HRESULT hres;
6929 SIZE extent;
6931 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6932 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6933 if(FAILED(hres))
6934 return;
6936 extent.cx = extent.cy = 0xdeadbeef;
6937 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
6938 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
6939 ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
6940 extent.cx, extent.cy);
6942 extent.cx = extent.cy = 0xdeadbeef;
6943 hres = IOleObject_GetExtent(oleobj, 0, &extent);
6944 ok(hres == E_INVALIDARG, "GetExtent failed: %08x\n", hres);
6945 ok(extent.cx == 0xdeadbeef && extent.cy == 0xdeadbeef, "size = {%d %d}\n", extent.cx, extent.cy);
6947 extent.cx = extent.cy = 0xdeadbeef;
6948 hres = IOleObject_GetExtent(oleobj, 7, &extent);
6949 ok(hres == E_INVALIDARG, "GetExtent failed: %08x\n", hres);
6950 ok(extent.cx == 0xdeadbeef && extent.cy == 0xdeadbeef, "size = {%d %d}\n", extent.cx, extent.cy);
6952 extent.cx = 800;
6953 extent.cy = 700;
6954 hres = IOleObject_SetExtent(oleobj, 0, &extent);
6955 ok(hres == E_INVALIDARG, "SetExtent failed: %08x\n", hres);
6957 extent.cx = extent.cy = 0xdeadbeef;
6958 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
6959 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
6960 ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
6961 extent.cx, extent.cy);
6963 extent.cx = 800;
6964 extent.cy = 700;
6965 hres = IOleObject_SetExtent(oleobj, 7, &extent);
6966 ok(hres == E_INVALIDARG, "SetExtent failed: %08x\n", hres);
6968 extent.cx = extent.cy = 0xdeadbeef;
6969 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
6970 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
6971 ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
6972 extent.cx, extent.cy);
6974 extent.cx = extent.cy = 0xdeadbeef;
6975 hres = IOleObject_SetExtent(oleobj, 0, &extent);
6976 todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
6978 extent.cx = extent.cy = 0xdeadbeef;
6979 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
6980 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
6981 ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
6982 extent.cx, extent.cy);
6984 extent.cx = extent.cy = 0xdeadbeef;
6985 hres = IOleObject_SetExtent(oleobj, 7, &extent);
6986 todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
6988 extent.cx = extent.cy = 0xdeadbeef;
6989 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
6990 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
6991 ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
6992 extent.cx, extent.cy);
6994 extent.cx = extent.cy = 0xdeadbeef;
6995 hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
6996 todo_wine ok(hres == E_FAIL, "SetExtent failed: %08x\n", hres);
6998 extent.cx = extent.cy = 0xdeadbeef;
6999 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
7000 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
7001 todo_wine ok(extent.cx == 1 && extent.cy == 1, "size = {%d %d} (expected {1 1})\n",
7002 extent.cx, extent.cy);
7004 extent.cx = 800;
7005 extent.cy = 700;
7006 hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
7007 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
7009 extent.cx = extent.cy = 0xdeadbeef;
7010 hres = IOleObject_GetExtent(oleobj, DVASPECT_CONTENT, &extent);
7011 ok(hres == S_OK, "GetExtent failed: %08x\n", hres);
7012 ok(extent.cx == 800 && extent.cy == 700, "size = {%d %d} (expected {800 700})\n",
7013 extent.cx, extent.cy );
7015 extent.cx = 1;
7016 extent.cy = 1;
7017 hres = IOleObject_SetExtent(oleobj, DVASPECT_CONTENT, &extent);
7018 ok(hres == S_OK, "SetExtent failed: %08x\n", hres);
7020 IOleObject_Release(oleobj);
7023 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
7025 IOleControl *control = NULL;
7026 HRESULT hres;
7028 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleControl, (void**)&control);
7029 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
7030 if(FAILED(hres))
7031 return;
7033 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
7034 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
7036 IOleControl_Release(control);
7039 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
7041 IOleObject *oleobj = NULL;
7042 HRESULT hres;
7044 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7045 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
7046 if(FAILED(hres))
7047 return;
7049 SET_EXPECT(GetContainer);
7050 SET_EXPECT(LockContainer);
7051 expect_LockContainer_fLock = FALSE;
7052 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
7053 ok(hres == S_OK, "Close failed: %08x\n", hres);
7054 CHECK_CALLED(GetContainer);
7055 CHECK_CALLED(LockContainer);
7056 container_locked = FALSE;
7058 if(set_client)
7059 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
7061 IOleObject_Release(oleobj);
7064 static void test_Advise(IHTMLDocument2 *doc)
7066 IOleObject *oleobj = NULL;
7067 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
7068 DWORD conn;
7069 HRESULT hres;
7071 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7072 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
7073 if(FAILED(hres))
7074 return;
7076 hres = IOleObject_Unadvise(oleobj, 0);
7077 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
7079 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
7080 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
7081 ok(enum_advise == NULL, "enum_advise != NULL\n");
7083 conn = -1;
7084 hres = IOleObject_Advise(oleobj, NULL, &conn);
7085 /* Old IE returns S_OK and sets conn to 1 */
7086 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
7087 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
7089 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
7090 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
7092 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
7093 ok(hres == S_OK, "Advise returned: %08x\n", hres);
7094 ok(conn == 1, "conn = %d\n", conn);
7096 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
7097 ok(hres == S_OK, "Advise returned: %08x\n", hres);
7098 ok(conn == 2, "conn = %d\n", conn);
7100 hres = IOleObject_Unadvise(oleobj, 1);
7101 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
7103 hres = IOleObject_Unadvise(oleobj, 1);
7104 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
7106 hres = IOleObject_Unadvise(oleobj, 2);
7107 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
7109 IOleObject_Release(oleobj);
7112 static void test_OnFrameWindowActivate(IUnknown *unk)
7114 IOleInPlaceActiveObject *inplaceact;
7115 HRESULT hres;
7117 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
7118 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
7119 if(FAILED(hres))
7120 return;
7122 if(set_clientsite) {
7123 expect_OnFrameWindowActivate_fActivate = TRUE;
7124 SET_EXPECT(OnFrameWindowActivate);
7125 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
7126 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7127 CHECK_CALLED(OnFrameWindowActivate);
7129 SET_EXPECT(OnFrameWindowActivate);
7130 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
7131 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7132 CHECK_CALLED(OnFrameWindowActivate);
7134 expect_OnFrameWindowActivate_fActivate = FALSE;
7135 SET_EXPECT(OnFrameWindowActivate);
7136 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
7137 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7138 CHECK_CALLED(OnFrameWindowActivate);
7140 expect_OnFrameWindowActivate_fActivate = TRUE;
7141 SET_EXPECT(OnFrameWindowActivate);
7142 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
7143 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7144 CHECK_CALLED(OnFrameWindowActivate);
7145 }else {
7146 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
7147 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7149 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
7150 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
7153 IOleInPlaceActiveObject_Release(inplaceact);
7156 static void test_object_rects(IHTMLDocument2 *doc)
7158 IOleInPlaceObjectWindowless *windowlessobj;
7159 IOleDocumentView *view;
7160 RECT r, doc_rect;
7161 HRESULT hres;
7163 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
7164 (void**)&windowlessobj);
7165 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
7167 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleDocumentView,
7168 (void**)&view);
7169 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
7171 r.top = 1;
7172 r.left = 2;
7173 r.bottom = 200;
7174 r.right = 201;
7175 hres = IOleInPlaceObjectWindowless_SetObjectRects(windowlessobj, &r, NULL);
7176 ok(hres == S_OK, "SetObjectRects failed: %08x\n", hres);
7178 GetWindowRect(doc_hwnd, &doc_rect);
7179 MapWindowPoints(HWND_DESKTOP, container_hwnd, (POINT*)&doc_rect, 2);
7180 ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
7181 wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
7183 memset(&doc_rect, 0xc0, sizeof(doc_rect));
7184 hres = IOleDocumentView_GetRect(view, &doc_rect);
7185 ok(hres == S_OK, "GetRect failed: %08x\n", hres);
7186 ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
7187 wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
7189 r.top = 3;
7190 r.left = 4;
7191 r.bottom = 205;
7192 r.right = 206;
7193 hres = IOleDocumentView_SetRect(view, &r);
7194 ok(hres == S_OK, "SetObjectRects failed: %08x\n", hres);
7196 GetWindowRect(doc_hwnd, &doc_rect);
7197 MapWindowPoints(HWND_DESKTOP, container_hwnd, (POINT*)&doc_rect, 2);
7198 ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
7199 wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
7201 memset(&doc_rect, 0xc0, sizeof(doc_rect));
7202 hres = IOleDocumentView_GetRect(view, &doc_rect);
7203 ok(hres == S_OK, "GetRect failed: %08x\n", hres);
7204 ok(EqualRect(&r, &doc_rect), "unexpected doc rect %s expected %s\n",
7205 wine_dbgstr_rect(&doc_rect), wine_dbgstr_rect(&r));
7207 IOleInPlaceObjectWindowless_Release(windowlessobj);
7208 IOleDocumentView_Release(view);
7211 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
7213 IOleInPlaceObjectWindowless *windowlessobj = NULL;
7214 HRESULT hres;
7216 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
7217 (void**)&windowlessobj);
7218 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
7219 if(FAILED(hres))
7220 return;
7222 if(expect_call) {
7223 SET_EXPECT(SetStatusText);
7224 SET_EXPECT(OnFocus_FALSE);
7225 if(ipsex)
7226 SET_EXPECT(OnInPlaceDeactivateEx);
7227 else
7228 SET_EXPECT(OnInPlaceDeactivate);
7230 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
7231 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
7232 if(expect_call) {
7233 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
7234 CHECK_CALLED(OnFocus_FALSE);
7235 if(ipsex)
7236 CHECK_CALLED(OnInPlaceDeactivateEx);
7237 else
7238 CHECK_CALLED(OnInPlaceDeactivate);
7241 IOleInPlaceObjectWindowless_Release(windowlessobj);
7244 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
7246 IOleObject *oleobj = NULL;
7247 IOleDocumentView *docview;
7248 GUID guid;
7249 HRESULT hres;
7251 last_hwnd = doc_hwnd;
7253 if(view)
7254 IOleDocumentView_Release(view);
7255 view = NULL;
7257 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7258 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
7260 hres = IOleObject_GetUserClassID(oleobj, NULL);
7261 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
7263 hres = IOleObject_GetUserClassID(oleobj, &guid);
7264 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
7265 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
7267 test_OnFrameWindowActivate((IUnknown*)doc);
7269 test_ClientSite(oleobj, flags);
7270 test_InPlaceDeactivate(doc, FALSE);
7271 test_DoVerb(oleobj);
7273 if(call_UIActivate == CallUIActivate_AfterShow) {
7274 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
7275 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
7277 SET_EXPECT(OnFocus_TRUE);
7278 SET_EXPECT(SetActiveObject);
7279 SET_EXPECT(ShowUI);
7280 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7281 SET_EXPECT(InPlaceFrame_SetBorderSpace);
7282 expect_status_text = NULL;
7284 hres = IOleDocumentView_UIActivate(docview, TRUE);
7285 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
7287 CHECK_CALLED(OnFocus_TRUE);
7288 CHECK_CALLED(SetActiveObject);
7289 CHECK_CALLED(ShowUI);
7290 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7291 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
7293 IOleDocumentView_Release(docview);
7296 IOleObject_Release(oleobj);
7298 test_OnFrameWindowActivate((IUnknown*)doc);
7301 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
7303 IOleInPlaceActiveObject *activeobject = NULL;
7304 HWND tmp_hwnd;
7305 HRESULT hres;
7307 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
7308 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
7309 if(FAILED(hres))
7310 return;
7312 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
7314 if(expect_success) {
7315 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
7316 ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
7317 }else {
7318 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
7319 ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
7322 IOleInPlaceActiveObject_Release(activeobject);
7325 static void test_CloseView(void)
7327 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
7328 HRESULT hres;
7330 if(!view)
7331 return;
7333 hres = IOleDocumentView_Show(view, FALSE);
7334 ok(hres == S_OK, "Show failed: %08x\n", hres);
7336 hres = IOleDocumentView_CloseView(view, 0);
7337 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
7339 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
7340 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
7342 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
7343 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
7344 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
7347 static void test_UIDeactivate(void)
7349 HRESULT hres;
7351 if(call_UIActivate == CallUIActivate_AfterShow) {
7352 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
7354 if(call_UIActivate != CallUIActivate_None) {
7355 SET_EXPECT(SetActiveObject_null);
7356 SET_EXPECT(HideUI);
7357 SET_EXPECT(OnUIDeactivate);
7360 hres = IOleDocumentView_UIActivate(view, FALSE);
7361 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
7363 if(call_UIActivate != CallUIActivate_None) {
7364 CHECK_CALLED(SetActiveObject_null);
7365 CHECK_CALLED(HideUI);
7366 CHECK_CALLED(OnUIDeactivate);
7368 if(call_UIActivate == CallUIActivate_AfterShow) {
7369 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
7373 static void test_Hide(void)
7375 HRESULT hres;
7377 if(!view)
7378 return;
7380 hres = IOleDocumentView_Show(view, FALSE);
7381 ok(hres == S_OK, "Show failed: %08x\n", hres);
7384 static IHTMLDocument2 *create_document(void)
7386 IHTMLDocument2 *doc;
7387 HRESULT hres;
7389 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
7390 &IID_IHTMLDocument2, (void**)&doc);
7391 #if !defined(__i386__) && !defined(__x86_64__)
7392 todo_wine
7393 #endif
7394 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
7395 if(FAILED(hres))
7396 return NULL;
7398 return doc;
7401 static void release_document(IHTMLDocument2 *doc)
7403 IUnknown *unk;
7404 ULONG ref;
7405 HRESULT hres;
7407 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
7408 * To workaround it, we release it via IUnknown iface */
7409 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
7410 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
7412 IHTMLDocument2_Release(doc);
7413 ref = IUnknown_Release(unk);
7414 ok(!ref, "ref = %d\n", ref);
7417 static void test_Navigate(IHTMLDocument2 *doc)
7419 IHlinkTarget *hlink;
7420 HRESULT hres;
7422 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
7423 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
7425 SET_EXPECT(ActivateMe);
7426 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
7427 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
7428 CHECK_CALLED(ActivateMe);
7430 IHlinkTarget_Release(hlink);
7433 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
7435 IDispatch *external;
7436 IHTMLWindow2 *htmlwin;
7437 HRESULT hres;
7439 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
7440 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
7442 if(initialized)
7443 SET_EXPECT(GetExternal);
7444 external = (void*)0xdeadbeef;
7445 hres = IHTMLWindow2_get_external(htmlwin, &external);
7446 if(initialized) {
7447 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
7448 CHECK_CALLED(GetExternal);
7449 ok(external != NULL, "external == NULL\n");
7450 }else {
7451 ok(hres == S_OK, "get_external failed: %08x\n", hres);
7452 ok(external == NULL, "external != NULL\n");
7455 IHTMLWindow2_Release(htmlwin);
7458 static void test_enum_objects(IOleContainer *container)
7460 IEnumUnknown *enum_unknown;
7461 IUnknown *buf[100] = {(void*)0xdeadbeef};
7462 ULONG fetched;
7463 HRESULT hres;
7465 enum_unknown = NULL;
7466 hres = IOleContainer_EnumObjects(container, OLECONTF_EMBEDDINGS, &enum_unknown);
7467 ok(hres == S_OK, "EnumObjects failed: %08x\n", hres);
7468 ok(enum_unknown != NULL, "enum_unknown == NULL\n");
7470 fetched = 0xdeadbeef;
7471 hres = IEnumUnknown_Next(enum_unknown, ARRAY_SIZE(buf), buf, &fetched);
7472 ok(hres == S_FALSE, "Next returned %08x\n", hres);
7473 ok(!fetched, "fetched = %d\n", fetched);
7474 ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
7476 fetched = 0xdeadbeef;
7477 hres = IEnumUnknown_Next(enum_unknown, 1, buf, &fetched);
7478 ok(hres == S_FALSE, "Next returned %08x\n", hres);
7479 ok(!fetched, "fetched = %d\n", fetched);
7481 hres = IEnumUnknown_Next(enum_unknown, 1, buf, NULL);
7482 ok(hres == S_FALSE, "Next returned %08x\n", hres);
7484 IEnumUnknown_Release(enum_unknown);
7487 static void test_target_container(IHTMLDocument2 *doc)
7489 IOleContainer *ole_container, *doc_ole_container;
7490 ITargetContainer *target_container;
7491 HRESULT hres;
7493 hres = IHTMLDocument2_QueryInterface(doc, &IID_ITargetContainer, (void**)&target_container);
7494 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
7496 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleContainer, (void**)&doc_ole_container);
7497 ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
7499 ole_container = (void*)0xdeadbeef;
7500 hres = ITargetContainer_GetFramesContainer(target_container, &ole_container);
7501 ok(hres == S_OK, "GetFramesContainer failed: %08x\n", hres);
7502 ok(ole_container != NULL, "ole_container == NULL\n");
7503 ok(iface_cmp((IUnknown*)ole_container, (IUnknown*)doc_ole_container), "ole_container != doc_ole_container\n");
7504 test_enum_objects(ole_container);
7505 IOleContainer_Release(ole_container);
7507 ITargetContainer_Release(target_container);
7508 IOleContainer_Release(doc_ole_container);
7511 static void test_travellog(IHTMLDocument2 *doc)
7513 ITravelLogClient *travellog_client;
7514 IHTMLWindow2 *window, *top_window;
7515 IUnknown *unk;
7516 HRESULT hres;
7518 window = NULL;
7519 hres = IHTMLDocument2_get_parentWindow(doc, &window);
7520 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
7521 ok(window != NULL, "window = NULL\n");
7523 hres = IHTMLWindow2_get_top(window, &top_window);
7524 IHTMLWindow2_Release(window);
7525 ok(hres == S_OK, "get_top failed: %08x\n", hres);
7527 hres = IHTMLWindow2_QueryInterface(top_window, &IID_ITravelLogClient, (void**)&travellog_client);
7528 IHTMLWindow2_Release(top_window);
7529 if(hres == E_NOINTERFACE) {
7530 win_skip("ITravelLogClient not supported\n");
7531 no_travellog = TRUE;
7532 return;
7534 ok(hres == S_OK, "Could not get ITraveLogClient iface: %08x\n", hres);
7536 unk = (void*)0xdeadbeef;
7537 hres = ITravelLogClient_FindWindowByIndex(travellog_client, 0, &unk);
7538 ok(hres == E_FAIL, "FindWindowByIndex failed: %08x\n", hres);
7539 ok(!unk, "unk != NULL\n");
7541 ITravelLogClient_Release(travellog_client);
7544 static void test_StreamLoad(IHTMLDocument2 *doc)
7546 IPersistStreamInit *init;
7547 HRESULT hres;
7549 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
7550 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
7551 if(FAILED(hres))
7552 return;
7554 SET_EXPECT(Invoke_AMBIENT_SILENT);
7555 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7556 SET_EXPECT(Exec_ShellDocView_37);
7557 SET_EXPECT(OnChanged_READYSTATE);
7558 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
7559 SET_EXPECT(Read);
7560 SET_EXPECT(GetPendingUrl);
7561 readystate_set_loading = TRUE;
7563 hres = IPersistStreamInit_Load(init, &Stream);
7564 ok(hres == S_OK, "Load failed: %08x\n", hres);
7566 CHECK_CALLED(Invoke_AMBIENT_SILENT);
7567 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7568 CHECK_CALLED(Exec_ShellDocView_37);
7569 CHECK_CALLED(OnChanged_READYSTATE);
7570 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
7571 CHECK_CALLED(Read);
7572 todo_wine CHECK_CALLED(GetPendingUrl);
7574 test_timer(EXPECT_SETTITLE);
7575 test_GetCurMoniker((IUnknown*)doc, NULL, L"about:blank", FALSE);
7577 IPersistStreamInit_Release(init);
7580 static void test_StreamInitNew(IHTMLDocument2 *doc)
7582 IPersistStreamInit *init;
7583 HRESULT hres;
7585 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
7586 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
7587 if(FAILED(hres))
7588 return;
7590 SET_EXPECT(Invoke_AMBIENT_SILENT);
7591 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7592 SET_EXPECT(Exec_ShellDocView_37);
7593 SET_EXPECT(OnChanged_READYSTATE);
7594 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
7595 SET_EXPECT(GetPendingUrl);
7596 readystate_set_loading = TRUE;
7598 hres = IPersistStreamInit_InitNew(init);
7599 ok(hres == S_OK, "Load failed: %08x\n", hres);
7601 CHECK_CALLED(Invoke_AMBIENT_SILENT);
7602 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
7603 CHECK_CALLED(Exec_ShellDocView_37);
7604 CHECK_CALLED(OnChanged_READYSTATE);
7605 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
7606 todo_wine CHECK_CALLED(GetPendingUrl);
7608 test_timer(EXPECT_SETTITLE);
7609 test_GetCurMoniker((IUnknown*)doc, NULL, L"about:blank", FALSE);
7611 IPersistStreamInit_Release(init);
7614 static void test_QueryInterface(IHTMLDocument2 *htmldoc)
7616 IUnknown *qi, *doc = (IUnknown*)htmldoc;
7617 HRESULT hres;
7619 static const IID IID_UndocumentedScriptIface =
7620 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
7622 qi = (void*)0xdeadbeef;
7623 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
7624 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7625 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
7627 qi = (void*)0xdeadbeef;
7628 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
7629 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7630 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7632 qi = (void*)0xdeadbeef;
7633 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
7634 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7635 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7637 qi = (void*)0xdeadbeef;
7638 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
7639 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7640 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7642 qi = (void*)0xdeadbeef;
7643 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
7644 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7645 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7647 qi = (void*)0xdeadbeef;
7648 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
7649 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7650 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7652 qi = (void*)0xdeadbeef;
7653 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
7654 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7655 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7657 qi = (void*)0xdeadbeef;
7658 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
7659 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7660 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7662 qi = (void*)0xdeadbeef;
7663 hres = IUnknown_QueryInterface(doc, &IID_ITargetFrame, (void**)&qi);
7664 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
7665 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
7667 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
7668 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
7669 ok(qi != doc, "disp == doc\n");
7670 IUnknown_Release(qi);
7673 static void init_test(enum load_state_t ls) {
7674 doc_unk = NULL;
7675 doc_hwnd = last_hwnd = NULL;
7676 set_clientsite = FALSE;
7677 load_from_stream = FALSE;
7678 call_UIActivate = CallUIActivate_None;
7679 load_state = ls;
7680 editmode = FALSE;
7681 stream_read = 0;
7682 protocol_read = 0;
7683 nav_url = NULL;
7684 ipsex = FALSE;
7685 inplace_deactivated = FALSE;
7686 complete = FALSE;
7687 testing_submit = FALSE;
7688 expect_uihandler_iface = &DocHostUIHandler;
7689 is_mhtml = FALSE;
7692 static void test_HTMLDocument(BOOL do_load, BOOL mime)
7694 IHTMLDocument2 *doc;
7696 trace("Testing HTMLDocument (%s, %s)...\n", (do_load ? "load" : "no load"),
7697 (report_mime ? "mime" : "no mime"));
7699 init_test(do_load ? LD_DOLOAD : LD_NO);
7700 report_mime = mime;
7702 doc = create_document();
7703 doc_unk = (IUnknown*)doc;
7705 test_QueryInterface(doc);
7706 test_GetSetExtent(doc);
7707 test_Advise(doc);
7708 test_IsDirty(doc, S_FALSE);
7709 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7710 test_external(doc, FALSE);
7711 test_ViewAdviseSink(doc);
7712 test_ConnectionPointContainer(doc);
7713 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
7714 test_Persist(doc, &Moniker);
7715 if(!do_load)
7716 test_OnAmbientPropertyChange2(doc);
7718 test_Activate(doc, CLIENTSITE_EXPECTPATH);
7720 if(do_load) {
7721 set_custom_uihandler(doc, &CustomDocHostUIHandler);
7722 test_download(DWL_CSS|DWL_TRYCSS);
7723 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL, FALSE);
7724 test_elem_from_point(doc);
7727 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7728 test_OleCommandTarget_fail(doc);
7729 test_OleCommandTarget(doc);
7730 test_exec_optical_zoom(doc, 200);
7731 test_exec_optical_zoom(doc, 100);
7732 test_OnAmbientPropertyChange(doc);
7733 test_Window(doc, TRUE);
7734 test_external(doc, TRUE);
7735 test_target_container(doc);
7736 test_object_rects(doc);
7738 test_UIDeactivate();
7739 test_OleCommandTarget(doc);
7740 test_Window(doc, TRUE);
7741 test_InPlaceDeactivate(doc, TRUE);
7743 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
7744 * MSHTML. It doesn't with Wine. */
7746 test_Window(doc, FALSE);
7747 test_Hide();
7748 test_InPlaceDeactivate(doc, FALSE);
7749 test_CloseView();
7750 test_Close(doc, FALSE);
7752 /* Activate HTMLDocument again */
7753 test_Activate(doc, CLIENTSITE_SETNULL);
7754 test_Window(doc, TRUE);
7755 test_OleCommandTarget(doc);
7756 test_UIDeactivate();
7757 test_InPlaceDeactivate(doc, TRUE);
7758 test_Close(doc, FALSE);
7760 /* Activate HTMLDocument again, this time without UIActivate */
7761 call_UIActivate = CallUIActivate_None;
7762 test_Activate(doc, CLIENTSITE_SETNULL);
7763 test_Window(doc, TRUE);
7765 test_external(doc, TRUE);
7766 set_custom_uihandler(doc, NULL);
7767 test_external(doc, FALSE);
7769 test_UIDeactivate();
7770 test_InPlaceDeactivate(doc, TRUE);
7771 test_CloseView();
7772 test_CloseView();
7773 test_Close(doc, TRUE);
7774 test_OnAmbientPropertyChange2(doc);
7775 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL, FALSE);
7777 if(!do_load) {
7778 /* Activate HTMLDocument again, calling UIActivate after showing the window */
7779 call_UIActivate = CallUIActivate_AfterShow;
7780 test_Activate(doc, 0);
7781 test_Window(doc, TRUE);
7782 test_OleCommandTarget(doc);
7783 test_UIDeactivate();
7784 test_InPlaceDeactivate(doc, TRUE);
7785 test_Close(doc, FALSE);
7786 call_UIActivate = CallUIActivate_None;
7789 if(view)
7790 IOleDocumentView_Release(view);
7791 view = NULL;
7793 ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
7794 release_document(doc);
7795 ok(!IsWindow(doc_hwnd), "hwnd is not destroyed\n");
7798 static void test_MHTMLDocument(void)
7800 IHTMLDocument2 *doc;
7801 IOleObject *oleobj;
7802 HRESULT hres;
7804 if(!is_ie9plus) {
7805 win_skip("Skipping MHTML document tests on too old IE.\n");
7806 return;
7809 trace("Testing MHTMLDocument...\n");
7811 init_test(LD_DOLOAD);
7812 is_mhtml = TRUE;
7813 nav_url = nav_serv_url = L"mhtml:winetest:doc";
7815 hres = CoCreateInstance(&CLSID_MHTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
7816 &IID_IHTMLDocument2, (void**)&doc);
7817 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
7819 doc_unk = (IUnknown*)doc;
7821 test_QueryInterface(doc);
7822 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7823 test_ViewAdviseSink(doc);
7824 test_ConnectionPointContainer(doc);
7826 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
7827 ok(hres == S_OK, "Could not get IOleObject iface: %08x\n", hres);
7828 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
7829 test_DoVerb(oleobj);
7830 IOleObject_Release(oleobj);
7832 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
7833 test_Persist(doc, &Moniker);
7834 set_custom_uihandler(doc, &CustomDocHostUIHandler);
7835 test_GetCurMoniker((IUnknown*)doc, NULL, L"mhtml:winetest:doc", FALSE);
7836 test_download(0);
7838 test_exec_onunload(doc);
7839 test_UIDeactivate();
7840 test_InPlaceDeactivate(doc, TRUE);
7841 test_InPlaceDeactivate(doc, FALSE);
7842 test_CloseView();
7843 test_Close(doc, TRUE);
7845 if(view)
7846 IOleDocumentView_Release(view);
7847 view = NULL;
7849 release_document(doc);
7852 static void test_HTMLDocument_hlink(DWORD status)
7854 IHTMLDocument2 *doc;
7856 trace("Testing HTMLDocument (hlink)...\n");
7858 init_test(LD_DOLOAD);
7859 ipsex = TRUE;
7861 doc = create_document();
7862 doc_unk = (IUnknown*)doc;
7864 set_custom_uihandler(doc, &CustomDocHostUIHandler);
7865 test_ViewAdviseSink(doc);
7866 test_ConnectionPointContainer(doc);
7867 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
7868 test_Persist(doc, &Moniker);
7869 test_Navigate(doc);
7871 status_code = status;
7872 test_download(DWL_CSS|DWL_TRYCSS);
7873 status_code = HTTP_STATUS_OK;
7875 test_IsDirty(doc, S_FALSE);
7876 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
7878 test_exec_onunload(doc);
7879 test_Window(doc, TRUE);
7880 test_InPlaceDeactivate(doc, TRUE);
7881 test_Close(doc, FALSE);
7882 test_IsDirty(doc, S_FALSE);
7883 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL, FALSE);
7884 test_clear(doc);
7885 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL, FALSE);
7887 if(view)
7888 IOleDocumentView_Release(view);
7889 view = NULL;
7891 release_document(doc);
7894 static void test_cookies(IHTMLDocument2 *doc)
7896 WCHAR buf[1024];
7897 DWORD size;
7898 BSTR str, str2;
7899 BOOL b;
7900 HRESULT hres;
7902 hres = IHTMLDocument2_get_cookie(doc, &str);
7903 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
7904 if(str) {
7905 size = ARRAY_SIZE(buf);
7906 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
7907 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
7908 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
7909 SysFreeString(str);
7912 str = SysAllocString(L"test=testval");
7913 hres = IHTMLDocument2_put_cookie(doc, str);
7914 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
7916 str2 = NULL;
7917 hres = IHTMLDocument2_get_cookie(doc, &str2);
7918 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
7919 ok(str2 != NULL, "cookie = NULL\n");
7920 size = ARRAY_SIZE(buf);
7921 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
7922 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
7923 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
7924 if(str2)
7925 ok(wcsstr(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
7926 SysFreeString(str);
7927 SysFreeString(str2);
7929 str = SysAllocString(L"test=testval2");
7930 hres = IHTMLDocument2_put_cookie(doc, str);
7931 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
7933 str2 = NULL;
7934 hres = IHTMLDocument2_get_cookie(doc, &str2);
7935 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
7936 ok(str2 != NULL, "cookie = NULL\n");
7937 size = ARRAY_SIZE(buf);
7938 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
7939 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
7940 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
7941 if(str2)
7942 ok(wcsstr(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
7943 SysFreeString(str);
7944 SysFreeString(str2);
7947 static void test_doc_domain(IHTMLDocument2 *doc)
7949 BSTR str;
7950 HRESULT hres;
7952 hres = IHTMLDocument2_get_domain(doc, &str);
7953 ok(hres == S_OK, "get_domain failed: %08x\n", hres);
7954 ok(!lstrcmpW(str, L"test.winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
7955 SysFreeString(str);
7957 str = SysAllocString(L"winehq.org");
7958 hres = IHTMLDocument2_put_domain(doc, str);
7959 ok(hres == S_OK, "put_domain failed: %08x\n", hres);
7960 SysFreeString(str);
7962 hres = IHTMLDocument2_get_domain(doc, &str);
7963 ok(hres == S_OK, "get_domain failed: %08x\n", hres);
7964 ok(!lstrcmpW(str, L"winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
7965 SysFreeString(str);
7967 str = SysAllocString(L"winehq.com");
7968 hres = IHTMLDocument2_put_domain(doc, str);
7969 ok(hres == E_INVALIDARG, "put_domain failed: %08x, expected E_INVALIDARG\n", hres);
7970 SysFreeString(str);
7972 hres = IHTMLDocument2_get_domain(doc, &str);
7973 ok(hres == S_OK, "get_domain failed: %08x\n", hres);
7974 ok(!lstrcmpW(str, L"winehq.org"), "domain = %s\n", wine_dbgstr_w(str));
7975 SysFreeString(str);
7978 static void test_HTMLDocument_http(BOOL with_wbapp)
7980 IMoniker *http_mon;
7981 IHTMLDocument2 *doc;
7982 ULONG ref;
7983 HRESULT hres;
7985 trace("Testing HTMLDocument (http%s)...\n", with_wbapp ? " with IWebBrowserApp" : "");
7987 support_wbapp = with_wbapp;
7989 if(!winetest_interactive && is_ie_hardened()) {
7990 win_skip("IE running in Enhanced Security Configuration\n");
7991 return;
7994 init_test(LD_DOLOAD);
7995 ipsex = TRUE;
7997 doc = create_document();
7998 doc_unk = (IUnknown*)doc;
8000 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
8001 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
8003 test_ViewAdviseSink(doc);
8004 test_ConnectionPointContainer(doc);
8005 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
8006 test_Persist(doc, http_mon);
8007 test_Navigate(doc);
8008 test_download(DWL_HTTP);
8009 test_cookies(doc);
8010 test_IsDirty(doc, S_FALSE);
8011 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8012 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL, FALSE);
8013 test_travellog(doc);
8014 test_binding_ui((IUnknown*)doc);
8015 test_doc_domain(doc);
8017 nav_url = nav_serv_url = L"http://test.winehq.org/tests/winehq_snapshot/"; /* for valid prev nav_url */
8018 if(support_wbapp) {
8019 test_put_href(doc, FALSE, L"#test", L"http://test.winehq.org/tests/winehq_snapshot/#test", FALSE, TRUE, 0);
8020 test_travellog(doc);
8021 test_refresh(doc);
8023 test_put_href(doc, FALSE, NULL, L"javascript:external%20&&undefined", TRUE, FALSE, 0);
8024 test_put_href(doc, FALSE, NULL, L"about:blank", FALSE, FALSE, support_wbapp ? DWL_EXPECT_HISTUPDATE : 0);
8025 test_put_href(doc, TRUE, NULL, L"about:replace", FALSE, FALSE, 0);
8026 if(support_wbapp) {
8027 test_load_history(doc);
8028 test_OmHistory(doc);
8029 test_put_href(doc, FALSE, NULL, L"about:blank", FALSE, FALSE, support_wbapp ? DWL_EXPECT_HISTUPDATE : 0);
8032 prev_url = nav_serv_url;
8033 test_open_window(doc, TRUE);
8034 if(!support_wbapp) /* FIXME */
8035 test_open_window(doc, FALSE);
8036 if(support_wbapp) {
8037 test_put_href(doc, FALSE, NULL, L"http://test.winehq.org/tests/file.winetest", FALSE, FALSE, DWL_EXTERNAL);
8038 test_window_close(doc);
8041 test_InPlaceDeactivate(doc, TRUE);
8042 test_Close(doc, FALSE);
8043 test_IsDirty(doc, S_FALSE);
8044 test_GetCurMoniker((IUnknown*)doc, NULL, prev_url, support_wbapp);
8046 if(view)
8047 IOleDocumentView_Release(view);
8048 view = NULL;
8050 release_document(doc);
8052 ref = IMoniker_Release(http_mon);
8053 ok(!ref, "ref=%d, expected 0\n", ref);
8056 static void put_inner_html(IHTMLElement *elem, const WCHAR *html)
8058 BSTR str = SysAllocString(html);
8059 HRESULT hres;
8061 hres = IHTMLElement_put_innerHTML(elem, str);
8062 ok(hres == S_OK, "put_innerHTML failed: %08x\n", hres);
8064 SysFreeString(str);
8067 static IHTMLElement *get_elem_by_id(IHTMLDocument2 *doc, const WCHAR *id)
8069 IHTMLDocument3 *doc3;
8070 BSTR str = SysAllocString(id);
8071 IHTMLElement *ret;
8072 HRESULT hres;
8074 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3);
8075 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
8077 hres = IHTMLDocument3_getElementById(doc3, str, &ret);
8078 ok(hres == S_OK, "getElementById failed: %08x\n", hres);
8080 IHTMLDocument3_Release(doc3);
8081 return ret;
8084 static void reset_document(IHTMLDocument2 *doc)
8086 IPersistStreamInit *init;
8087 HRESULT hres;
8089 hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
8090 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
8091 if(FAILED(hres))
8092 return;
8094 resetting_document = TRUE;
8096 hres = IPersistStreamInit_InitNew(init);
8097 ok(hres == S_OK, "Load failed: %08x\n", hres);
8099 resetting_document = FALSE;
8101 test_GetCurMoniker((IUnknown*)doc, NULL, L"about:blank", FALSE);
8103 IPersistStreamInit_Release(init);
8106 static void test_submit(void)
8108 IHTMLElement *body, *form_elem;
8109 IHTMLFormElement *form;
8110 IHTMLDocument2 *doc;
8111 HRESULT hres;
8113 if(no_travellog)
8114 return;
8116 trace("Testing submit...\n");
8118 support_wbapp = TRUE;
8120 if(!winetest_interactive && is_ie_hardened()) {
8121 win_skip("IE running in Enhanced Security Configuration\n");
8122 return;
8125 init_test(LD_DOLOAD);
8126 ipsex = TRUE;
8128 doc = create_document();
8129 doc_unk = (IUnknown*)doc;
8131 test_ConnectionPointContainer(doc);
8132 test_ViewAdviseSink(doc);
8133 test_Persist(doc, &Moniker);
8134 test_Navigate(doc);
8135 test_download(DWL_CSS|DWL_TRYCSS);
8137 hres = IHTMLDocument2_get_body(doc, &body);
8138 ok(hres == S_OK, "get_body failed: %08x\n", hres);
8139 ok(body != NULL, "body = NULL\n");
8141 put_inner_html(body, L"<form action='test_submit' method='post' id='fid'><input type='hidden' name='cmd' value='TEST'></form>");
8142 IHTMLElement_Release(body);
8144 form_elem = get_elem_by_id(doc, L"fid");
8145 ok(form_elem != NULL, "form = NULL\n");
8147 hres = IHTMLElement_QueryInterface(form_elem, &IID_IHTMLFormElement, (void**)&form);
8148 ok(hres == S_OK, "Could not get IHTMLFormElement: %08x\n", hres);
8149 IHTMLElement_Release(form_elem);
8151 nav_url = nav_serv_url = L"winetest:test_submit";
8152 testing_submit = TRUE;
8154 SET_EXPECT(TranslateUrl);
8155 SET_EXPECT(FireBeforeNavigate2);
8156 SET_EXPECT(Exec_ShellDocView_67);
8157 SET_EXPECT(Invoke_AMBIENT_SILENT);
8158 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8159 SET_EXPECT(Exec_ShellDocView_63);
8160 SET_EXPECT(Exec_ShellDocView_84);
8161 SET_EXPECT(CreateInstance);
8162 SET_EXPECT(Start);
8163 SET_EXPECT(Protocol_Read);
8164 SET_EXPECT(LockRequest);
8165 SET_EXPECT(GetClassID);
8166 SET_EXPECT(Exec_ShellDocView_138);
8167 SET_EXPECT(OnViewChange);
8169 SET_EXPECT(UnlockRequest);
8170 SET_EXPECT(Terminate);
8172 hres = IHTMLFormElement_submit(form);
8173 ok(hres == S_OK, "submit failed: %08x\n", hres);
8175 CHECK_CALLED(TranslateUrl);
8176 CHECK_CALLED(FireBeforeNavigate2);
8177 CLEAR_CALLED(Exec_ShellDocView_67); /* Not called by IE11 */
8178 CHECK_CALLED(Invoke_AMBIENT_SILENT);
8179 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8180 CHECK_CALLED(Exec_ShellDocView_63);
8181 CLEAR_CALLED(Exec_ShellDocView_84); /* Not called by IE11 */
8182 CHECK_CALLED(CreateInstance);
8183 CHECK_CALLED(Start);
8184 CHECK_CALLED(Protocol_Read);
8185 CHECK_CALLED(LockRequest);
8186 todo_wine CHECK_CALLED(GetClassID);
8187 CLEAR_CALLED(Exec_ShellDocView_138); /* called only by some versions */
8188 CLEAR_CALLED(OnViewChange); /* called only by some versions */
8190 todo_wine CHECK_NOT_CALLED(UnlockRequest);
8191 todo_wine CHECK_NOT_CALLED(Terminate);
8193 IHTMLFormElement_Release(form);
8195 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL, FALSE);
8197 SET_EXPECT(UnlockRequest);
8198 reset_document(doc);
8199 todo_wine CHECK_CALLED(UnlockRequest);
8201 test_InPlaceDeactivate(doc, TRUE);
8202 test_Close(doc, FALSE);
8204 if(view)
8205 IOleDocumentView_Release(view);
8206 view = NULL;
8208 release_document(doc);
8211 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
8213 IHTMLWindow2 *window, *sp_window;
8214 IServiceProvider *sp;
8215 IHlinkFrame *hf;
8216 HRESULT hres;
8218 hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
8219 ok(hres == S_OK, "QueryService returned %08x\n", hres);
8221 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
8222 if(!success) {
8223 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
8224 IServiceProvider_Release(sp);
8225 return;
8228 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
8229 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
8230 IHlinkFrame_Release(hf);
8232 IServiceProvider_Release(sp);
8234 hres = IHTMLDocument2_get_parentWindow(doc, &window);
8235 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
8237 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
8238 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
8240 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
8241 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
8242 /* FIXME: test returned window */
8243 IHTMLWindow2_Release(sp_window);
8245 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
8246 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
8247 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
8248 IHlinkFrame_Release(hf);
8250 IServiceProvider_Release(sp);
8251 IHTMLWindow2_Release(window);
8254 static void test_HTMLDocument_StreamLoad(void)
8256 IHTMLDocument2 *doc;
8257 IOleObject *oleobj;
8258 DWORD conn;
8259 HRESULT hres;
8261 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
8263 init_test(LD_DOLOAD);
8264 load_from_stream = TRUE;
8266 doc = create_document();
8267 doc_unk = (IUnknown*)doc;
8269 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
8270 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
8272 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
8273 ok(hres == S_OK, "Advise failed: %08x\n", hres);
8275 test_readyState((IUnknown*)doc);
8276 test_IsDirty(doc, S_FALSE);
8277 test_ViewAdviseSink(doc);
8278 test_ConnectionPointContainer(doc);
8279 test_QueryService(doc, FALSE);
8280 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
8281 test_QueryService(doc, TRUE);
8282 test_DoVerb(oleobj);
8283 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8285 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
8286 test_StreamLoad(doc);
8287 test_download(DWL_VERBDONE|DWL_TRYCSS);
8288 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8290 test_UIDeactivate();
8291 test_InPlaceDeactivate(doc, TRUE);
8292 SET_EXPECT(Advise_Close);
8293 test_Close(doc, TRUE);
8294 CHECK_CALLED(Advise_Close);
8295 test_external(doc, FALSE);
8296 test_IsDirty(doc, S_FALSE);
8298 set_custom_uihandler(doc, &CustomDocHostUIHandler);
8299 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
8300 test_external(doc, TRUE);
8301 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
8302 test_external(doc, TRUE);
8303 set_custom_uihandler(doc, NULL);
8304 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
8306 IOleObject_Release(oleobj);
8307 if(view) {
8308 IOleDocumentView_Release(view);
8309 view = NULL;
8312 release_document(doc);
8315 static void test_HTMLDocument_StreamInitNew(void)
8317 IHTMLDocument2 *doc;
8318 IOleObject *oleobj;
8319 DWORD conn;
8320 HRESULT hres;
8322 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
8324 init_test(LD_DOLOAD);
8325 load_from_stream = TRUE;
8327 doc = create_document();
8328 doc_unk = (IUnknown*)doc;
8330 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
8331 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
8333 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
8334 ok(hres == S_OK, "Advise failed: %08x\n", hres);
8336 test_readyState((IUnknown*)doc);
8337 test_IsDirty(doc, S_FALSE);
8338 test_ViewAdviseSink(doc);
8339 test_ConnectionPointContainer(doc);
8340 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
8341 test_DoVerb(oleobj);
8342 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8344 IOleObject_Release(oleobj);
8346 test_GetCurMoniker((IUnknown*)doc, NULL, NULL, FALSE);
8347 test_StreamInitNew(doc);
8349 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
8350 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
8351 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
8353 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8355 test_UIDeactivate();
8356 test_InPlaceDeactivate(doc, TRUE);
8357 SET_EXPECT(Advise_Close);
8358 test_Close(doc, FALSE);
8359 CHECK_CALLED(Advise_Close);
8360 test_IsDirty(doc, S_FALSE);
8362 if(view) {
8363 IOleDocumentView_Release(view);
8364 view = NULL;
8367 release_document(doc);
8370 static void test_edit_uiactivate(IOleObject *oleobj)
8372 IOleDocumentView *docview;
8373 HRESULT hres;
8375 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
8376 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
8378 SET_EXPECT(OnFocus_TRUE);
8379 SET_EXPECT(SetActiveObject);
8380 SET_EXPECT(ShowUI);
8381 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
8382 SET_EXPECT(InPlaceFrame_SetBorderSpace);
8383 expect_status_text = NULL;
8385 hres = IOleDocumentView_UIActivate(docview, TRUE);
8386 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
8388 CHECK_CALLED(OnFocus_TRUE);
8389 CHECK_CALLED(SetActiveObject);
8390 CHECK_CALLED(ShowUI);
8391 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
8392 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
8394 IOleDocumentView_Release(docview);
8397 static void test_editing_mode(BOOL do_load, BOOL use_design_mode)
8399 IHTMLDocument2 *doc;
8400 IUnknown *unk;
8401 IOleObject *oleobj;
8402 DWORD conn;
8403 HRESULT hres;
8405 trace("Testing HTMLDocument (edit%s%s)...\n", do_load ? " load" : "", use_design_mode ? " using designMode" : "");
8407 init_test(do_load ? LD_DOLOAD : LD_NO);
8408 call_UIActivate = CallUIActivate_AfterShow;
8410 doc = create_document();
8411 unk = doc_unk = (IUnknown*)doc;
8413 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
8414 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
8416 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
8417 ok(hres == S_OK, "Advise failed: %08x\n", hres);
8419 test_readyState((IUnknown*)doc);
8420 test_ViewAdviseSink(doc);
8421 test_ConnectionPointContainer(doc);
8422 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
8423 test_DoVerb(oleobj);
8424 test_edit_uiactivate(oleobj);
8426 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8427 if(do_load)
8428 test_Persist(doc, &Moniker);
8429 stream_read = protocol_read = 0;
8431 if(!use_design_mode) {
8432 test_exec_editmode(unk, do_load);
8433 test_UIDeactivate();
8434 call_UIActivate = CallUIActivate_None;
8435 }else {
8436 BSTR on;
8438 SET_EXPECT(Exec_SETTITLE);
8439 test_download(DWL_VERBDONE|DWL_CSS|DWL_TRYCSS);
8440 CLEAR_CALLED(Exec_SETTITLE);
8442 editmode = TRUE;
8443 load_state = LD_DOLOAD;
8444 readystate_set_loading = TRUE;
8446 SET_EXPECT(OnChanged_1005);
8447 SET_EXPECT(ActiveElementChanged);
8448 SET_EXPECT(GetClassID);
8449 SET_EXPECT(SetStatusText);
8450 SET_EXPECT(Exec_ShellDocView_37);
8451 SET_EXPECT(GetHostInfo);
8452 SET_EXPECT(GetDisplayName);
8453 SET_EXPECT(Invoke_AMBIENT_SILENT);
8454 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8455 SET_EXPECT(OnChanged_READYSTATE);
8456 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
8457 SET_EXPECT(IsSystemMoniker);
8458 SET_EXPECT(Exec_ShellDocView_84);
8459 SET_EXPECT(BindToStorage);
8460 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
8461 SET_EXPECT(HideUI);
8462 SET_EXPECT(ShowUI);
8463 SET_EXPECT(InPlaceFrame_SetBorderSpace);
8464 SET_EXPECT(OnChanged_1014);
8466 on = SysAllocString(L"On");
8467 hres = IHTMLDocument2_put_designMode(doc, on);
8468 SysFreeString(on);
8469 ok(hres == S_OK, "put_designMode failed: %08x\n", hres);
8471 todo_wine CHECK_CALLED(OnChanged_1005);
8472 todo_wine CHECK_CALLED(ActiveElementChanged);
8473 CHECK_CALLED(GetClassID);
8474 CHECK_CALLED(SetStatusText);
8475 CHECK_CALLED(Exec_ShellDocView_37);
8476 CHECK_CALLED(GetHostInfo);
8477 CHECK_CALLED(GetDisplayName);
8478 CHECK_CALLED(Invoke_AMBIENT_SILENT);
8479 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8480 CHECK_CALLED(OnChanged_READYSTATE);
8481 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
8482 CLEAR_CALLED(IsSystemMoniker); /* IE7 */
8483 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
8484 CHECK_CALLED(BindToStorage);
8485 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
8486 CHECK_CALLED(HideUI);
8487 CHECK_CALLED(ShowUI);
8488 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
8489 CHECK_CALLED(OnChanged_1014);
8491 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
8494 IOleObject_Release(oleobj);
8496 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
8497 test_download(DWL_VERBDONE | DWL_EX_GETHOSTINFO | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
8499 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
8500 test_timer(EXPECT_UPDATEUI);
8501 CLEAR_CALLED(SetStatusText);
8503 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
8505 if(!do_load) {
8506 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
8507 test_timer(EXPECT_UPDATEUI);
8508 test_exec_fontname(unk, NULL, wszArial);
8510 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
8511 test_timer(EXPECT_UPDATEUI);
8512 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
8513 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
8515 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
8516 test_timer(EXPECT_UPDATEUI);
8517 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
8518 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
8519 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
8520 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
8522 test_exec_noargs(unk, IDM_HORIZONTALLINE);
8523 test_timer(EXPECT_UPDATEUI);
8524 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
8525 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
8528 test_UIDeactivate();
8529 test_InPlaceDeactivate(doc, TRUE);
8530 SET_EXPECT(Advise_Close);
8531 test_Close(doc, FALSE);
8532 CHECK_CALLED(Advise_Close);
8534 if(view) {
8535 IOleDocumentView_Release(view);
8536 view = NULL;
8539 release_document(doc);
8542 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
8544 IHTMLDocument2 *doc;
8545 IOleObject *oleobj;
8546 IOleInPlaceSite *inplacesite;
8547 HRESULT hres;
8549 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
8551 init_test(do_load ? LD_DOLOAD : LD_NO);
8553 doc = create_document();
8554 doc_unk = (IUnknown*)doc;
8556 ipsex = use_ipsex;
8557 ipsw = use_ipsw;
8559 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
8560 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
8562 hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
8563 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
8565 SET_EXPECT(Invoke_AMBIENT_USERMODE);
8566 SET_EXPECT(GetHostInfo);
8567 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
8568 SET_EXPECT(Invoke_AMBIENT_SILENT);
8569 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8570 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
8571 SET_EXPECT(Invoke_AMBIENT_PALETTE);
8572 SET_EXPECT(GetOptionKeyPath);
8573 SET_EXPECT(GetOverrideKeyPath);
8574 SET_EXPECT(GetWindow);
8575 SET_EXPECT(Exec_DOCCANNAVIGATE);
8576 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
8577 SET_EXPECT(Exec_SETPROGRESSMAX);
8578 SET_EXPECT(Exec_SETPROGRESSPOS);
8579 SET_EXPECT(GetTravelLog);
8580 SET_EXPECT(Exec_ShellDocView_84);
8582 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
8583 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
8584 set_clientsite = TRUE;
8586 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
8587 CHECK_CALLED(GetHostInfo);
8588 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
8589 CHECK_CALLED(Invoke_AMBIENT_SILENT);
8590 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
8591 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
8592 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
8593 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
8594 CHECK_CALLED(GetOverrideKeyPath);
8595 CHECK_CALLED(GetWindow);
8596 CHECK_CALLED(Exec_DOCCANNAVIGATE);
8597 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
8598 CHECK_CALLED(Exec_SETPROGRESSMAX);
8599 CHECK_CALLED(Exec_SETPROGRESSPOS);
8600 CHECK_CALLED(GetTravelLog);
8601 CHECK_CALLED_BROKEN(Exec_ShellDocView_84);
8603 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
8604 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
8605 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
8607 SET_EXPECT(GetContainer);
8608 SET_EXPECT(LockContainer);
8609 SET_EXPECT(CanInPlaceActivate);
8610 SET_EXPECT(GetWindowContext);
8611 SET_EXPECT(GetWindow);
8612 if(use_ipsex) {
8613 SET_EXPECT(OnInPlaceActivateEx);
8614 SET_EXPECT(RequestUIActivate);
8616 else
8617 SET_EXPECT(OnInPlaceActivate);
8618 SET_EXPECT(OnUIActivate);
8619 SET_EXPECT(SetStatusText);
8620 SET_EXPECT(Exec_SETPROGRESSMAX);
8621 SET_EXPECT(Exec_SETPROGRESSPOS);
8622 SET_EXPECT(ShowUI);
8623 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
8624 SET_EXPECT(InPlaceFrame_SetBorderSpace);
8625 SET_EXPECT(OnFocus_TRUE);
8626 SET_EXPECT(SetActiveObject);
8627 expect_LockContainer_fLock = TRUE;
8629 hres = IOleDocumentView_UIActivate(view, TRUE);
8630 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
8632 CHECK_CALLED(GetContainer);
8633 CHECK_CALLED(LockContainer);
8634 CHECK_CALLED(CanInPlaceActivate);
8635 CHECK_CALLED(GetWindowContext);
8636 CHECK_CALLED(GetWindow);
8637 if(use_ipsex) {
8638 CHECK_CALLED(OnInPlaceActivateEx);
8639 SET_EXPECT(RequestUIActivate);
8641 else
8642 CHECK_CALLED(OnInPlaceActivate);
8643 CHECK_CALLED(OnUIActivate);
8644 CHECK_CALLED(SetStatusText);
8645 CHECK_CALLED(Exec_SETPROGRESSMAX);
8646 CHECK_CALLED(Exec_SETPROGRESSPOS);
8647 CHECK_CALLED(ShowUI);
8648 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
8649 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
8650 CHECK_CALLED(OnFocus_TRUE);
8651 CHECK_CALLED(SetActiveObject);
8652 container_locked = TRUE;
8654 SET_EXPECT(SetActiveObject_null);
8655 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
8656 SET_EXPECT(HideUI);
8657 SET_EXPECT(OnUIDeactivate);
8659 hres = IOleDocumentView_UIActivate(view, FALSE);
8660 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
8662 CHECK_CALLED(SetActiveObject_null);
8663 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
8664 CHECK_CALLED(HideUI);
8665 CHECK_CALLED(OnUIDeactivate);
8667 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
8668 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
8669 ok(inplacesite != NULL, "inplacesite = NULL\n");
8670 IOleInPlaceSite_Release(inplacesite);
8672 SET_EXPECT(SetStatusText);
8673 SET_EXPECT(OnFocus_FALSE);
8674 if(use_ipsex)
8675 SET_EXPECT(OnInPlaceDeactivateEx);
8676 else
8677 SET_EXPECT(OnInPlaceDeactivate);
8679 test_CloseView();
8681 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
8682 CHECK_CALLED(OnFocus_FALSE);
8683 if(use_ipsex)
8684 CHECK_CALLED(OnInPlaceDeactivateEx);
8685 else
8686 CHECK_CALLED(OnInPlaceDeactivate);
8688 test_Close(doc, TRUE);
8690 IOleObject_Release(oleobj);
8691 IOleDocumentView_Release(view);
8692 view = NULL;
8694 release_document(doc);
8697 static void register_protocol(void)
8699 IInternetSession *session;
8700 HRESULT hres;
8702 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
8704 hres = CoInternetGetSession(0, &session, 0);
8705 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
8707 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
8708 wsz_winetest, 0, NULL, 0);
8709 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
8711 IInternetSession_Release(session);
8714 static void test_HTMLDoc_ISupportErrorInfo(void)
8716 IHTMLDocument2 *doc;
8717 HRESULT hres;
8718 ISupportErrorInfo *sinfo;
8720 doc = create_document();
8722 hres = IHTMLDocument2_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
8723 ok(hres == S_OK, "got %x\n", hres);
8724 ok(sinfo != NULL, "got %p\n", sinfo);
8725 if(sinfo)
8727 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
8728 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
8729 ISupportErrorInfo_Release(sinfo);
8732 release_document(doc);
8735 static BOOL check_ie(void)
8737 IHTMLDocument2 *doc;
8738 IHTMLDocument5 *doc5;
8739 IHTMLDocument7 *doc7;
8740 HRESULT hres;
8742 doc = create_document();
8743 if(!doc)
8744 return FALSE;
8746 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
8747 if(SUCCEEDED(hres)) {
8748 is_ie9plus = TRUE;
8749 IHTMLDocument7_Release(doc7);
8752 trace("is_ie9plus %x\n", is_ie9plus);
8754 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
8755 if(SUCCEEDED(hres))
8756 IHTMLDocument5_Release(doc5);
8758 release_document(doc);
8759 return SUCCEEDED(hres);
8762 static void test_ServiceProvider(void)
8764 IHTMLDocument3 *doc3, *doc3_2;
8765 IServiceProvider *provider;
8766 IHTMLDocument2 *doc, *doc2;
8767 IUnknown *unk;
8768 HRESULT hres;
8770 doc = create_document();
8771 if(!doc)
8772 return;
8774 hres = IHTMLDocument2_QueryInterface(doc, &IID_IServiceProvider, (void**)&provider);
8775 ok(hres == S_OK, "got 0x%08x\n", hres);
8777 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc2);
8778 ok(hres == S_OK, "got 0x%08x\n", hres);
8779 ok(iface_cmp((IUnknown*)doc2, (IUnknown*)doc), "got wrong pointer\n");
8780 IHTMLDocument2_Release(doc2);
8782 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument3, (void**)&doc3);
8783 ok(hres == S_OK, "got 0x%08x\n", hres);
8784 ok(iface_cmp((IUnknown*)doc3, (IUnknown*)doc), "got wrong pointer\n");
8786 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument3, (void**)&doc3_2);
8787 ok(hres == S_OK, "got 0x%08x\n", hres);
8788 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc), "got wrong pointer\n");
8789 ok(iface_cmp((IUnknown*)doc3_2, (IUnknown*)doc3), "got wrong pointer\n");
8790 IHTMLDocument3_Release(doc3);
8791 IHTMLDocument3_Release(doc3_2);
8793 hres = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IUnknown, (void**)&unk);
8794 ok(hres == S_OK, "got 0x%08x\n", hres);
8795 ok(iface_cmp((IUnknown*)doc, unk), "got wrong pointer\n");
8796 IUnknown_Release(unk);
8798 hres = IServiceProvider_QueryService(provider, &SID_SHTMLEditServices, &IID_IHTMLEditServices, (void**)&unk);
8799 ok(hres == S_OK, "QueryService(HTMLEditServices) failed: %08x\n", hres);
8800 IUnknown_Release(unk);
8802 IServiceProvider_Release(provider);
8803 release_document(doc);
8806 static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
8808 if(IsEqualGUID(riid, &IID_IPersistMoniker)) {
8809 CHECK_EXPECT(outer_QI_IPersistMoniker);
8810 *ppv = NULL;
8811 return E_NOINTERFACE;
8813 if(IsEqualGUID(riid, &outer_test_iid)) {
8814 CHECK_EXPECT(outer_QI_test);
8815 *ppv = (IUnknown*)0xdeadbeef;
8816 return S_OK;
8818 ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid));
8819 return E_NOINTERFACE;
8822 static ULONG WINAPI outer_AddRef(IUnknown *iface)
8824 return 2;
8827 static ULONG WINAPI outer_Release(IUnknown *iface)
8829 return 1;
8832 static const IUnknownVtbl outer_vtbl = {
8833 outer_QueryInterface,
8834 outer_AddRef,
8835 outer_Release
8838 static void test_com_aggregation(const CLSID *clsid)
8840 IUnknown outer = { &outer_vtbl };
8841 IClassFactory *class_factory;
8842 IUnknown *unk, *unk2, *unk3;
8843 HRESULT hres;
8845 hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
8846 ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
8848 SET_EXPECT(outer_QI_IPersistMoniker); /* Some IE version QI for that. */
8849 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
8850 ok(hres == S_OK, "CreateInstance returned: %08x\n", hres);
8851 SET_CALLED(outer_QI_IPersistMoniker);
8853 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&unk2);
8854 ok(hres == S_OK, "Could not get IDispatch iface: %08x\n", hres);
8856 SET_EXPECT(outer_QI_test);
8857 hres = IUnknown_QueryInterface(unk2, &outer_test_iid, (void**)&unk3);
8858 CHECK_CALLED(outer_QI_test);
8859 ok(hres == S_OK, "Could not get IInternetProtocol iface: %08x\n", hres);
8860 ok(unk3 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
8862 IUnknown_Release(unk2);
8863 IUnknown_Release(unk);
8865 unk = (void*)0xdeadbeef;
8866 hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IDispatch, (void**)&unk);
8867 ok(hres == E_INVALIDARG, "CreateInstance returned: %08x\n", hres);
8868 ok(!unk, "unk = %p\n", unk);
8870 IClassFactory_Release(class_factory);
8873 START_TEST(htmldoc)
8875 CoInitialize(NULL);
8877 if(!check_ie()) {
8878 CoUninitialize();
8879 #if !defined(__i386__) && !defined(__x86_64__)
8880 todo_wine
8881 #endif
8882 win_skip("Too old IE\n");
8883 return;
8886 container_hwnd = create_container_window();
8887 register_protocol();
8889 asynchronous_binding = TRUE;
8890 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
8892 asynchronous_binding = FALSE;
8893 test_HTMLDocument_hlink(HTTP_STATUS_OK);
8894 test_HTMLDocument(FALSE, TRUE);
8895 test_HTMLDocument(TRUE, FALSE);
8896 test_HTMLDocument(TRUE, TRUE);
8897 test_HTMLDocument_StreamLoad();
8898 test_HTMLDocument_StreamInitNew();
8899 test_MHTMLDocument();
8900 test_editing_mode(FALSE, FALSE);
8901 test_editing_mode(TRUE, FALSE);
8902 test_editing_mode(TRUE, TRUE);
8903 test_HTMLDocument_http(FALSE);
8904 test_HTMLDocument_http(TRUE);
8905 test_submit();
8906 test_UIActivate(FALSE, FALSE, FALSE);
8907 test_UIActivate(FALSE, TRUE, FALSE);
8908 test_UIActivate(FALSE, TRUE, TRUE);
8909 test_UIActivate(TRUE, FALSE, FALSE);
8910 test_UIActivate(TRUE, TRUE, FALSE);
8911 test_UIActivate(TRUE, TRUE, TRUE);
8912 test_HTMLDoc_ISupportErrorInfo();
8913 test_ServiceProvider();
8914 test_com_aggregation(&CLSID_HTMLDocument);
8916 DestroyWindow(container_hwnd);
8917 CoUninitialize();