mshtml: Fixed remaining IE9 failures.
[wine/multimedia.git] / dlls / mshtml / tests / htmldoc.c
blob5a8e9ff8f478f811c9d4f237b869527d20c8f808
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 "mshtml_test.h"
46 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
47 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
48 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
56 #define SET_CALLED(func) \
57 called_ ## func = TRUE
59 #define CHECK_EXPECT2(func) \
60 do { \
61 ok(expect_ ##func, "unexpected call " #func "\n"); \
62 called_ ## func = TRUE; \
63 }while(0)
65 #define CHECK_EXPECT(func) \
66 do { \
67 CHECK_EXPECT2(func); \
68 expect_ ## func = FALSE; \
69 }while(0)
71 #define CHECK_CALLED(func) \
72 do { \
73 ok(called_ ## func, "expected " #func "\n"); \
74 expect_ ## func = called_ ## func = FALSE; \
75 }while(0)
77 #define CHECK_NOT_CALLED(func) \
78 do { \
79 ok(!called_ ## func, "unexpected " #func "\n"); \
80 expect_ ## func = called_ ## func = FALSE; \
81 }while(0)
83 #define CHECK_CALLED_BROKEN(func) \
84 do { \
85 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
86 expect_ ## func = called_ ## func = FALSE; \
87 }while(0)
89 #define CLEAR_CALLED(func) \
90 expect_ ## func = called_ ## func = FALSE
92 static IOleDocumentView *view = NULL;
93 static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL;
95 DEFINE_EXPECT(LockContainer);
96 DEFINE_EXPECT(SetActiveObject);
97 DEFINE_EXPECT(SetActiveObject_null);
98 DEFINE_EXPECT(GetWindow);
99 DEFINE_EXPECT(CanInPlaceActivate);
100 DEFINE_EXPECT(OnInPlaceActivate);
101 DEFINE_EXPECT(OnInPlaceActivateEx);
102 DEFINE_EXPECT(OnUIActivate);
103 DEFINE_EXPECT(GetWindowContext);
104 DEFINE_EXPECT(OnUIDeactivate);
105 DEFINE_EXPECT(OnInPlaceDeactivate);
106 DEFINE_EXPECT(OnInPlaceDeactivateEx);
107 DEFINE_EXPECT(GetContainer);
108 DEFINE_EXPECT(ShowUI);
109 DEFINE_EXPECT(ActivateMe);
110 DEFINE_EXPECT(GetHostInfo);
111 DEFINE_EXPECT(HideUI);
112 DEFINE_EXPECT(GetOptionKeyPath);
113 DEFINE_EXPECT(GetOverrideKeyPath);
114 DEFINE_EXPECT(SetStatusText);
115 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
116 DEFINE_EXPECT(QueryStatus_OPEN);
117 DEFINE_EXPECT(QueryStatus_NEW);
118 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
119 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
120 DEFINE_EXPECT(Exec_HTTPEQUIV_DONE);
121 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
122 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
123 DEFINE_EXPECT(Exec_ShellDocView_37);
124 DEFINE_EXPECT(Exec_ShellDocView_63);
125 DEFINE_EXPECT(Exec_ShellDocView_67);
126 DEFINE_EXPECT(Exec_ShellDocView_84);
127 DEFINE_EXPECT(Exec_ShellDocView_103);
128 DEFINE_EXPECT(Exec_ShellDocView_105);
129 DEFINE_EXPECT(Exec_ShellDocView_140);
130 DEFINE_EXPECT(Exec_UPDATECOMMANDS);
131 DEFINE_EXPECT(Exec_SETTITLE);
132 DEFINE_EXPECT(Exec_HTTPEQUIV);
133 DEFINE_EXPECT(Exec_MSHTML_PARSECOMPLETE);
134 DEFINE_EXPECT(Exec_Explorer_69);
135 DEFINE_EXPECT(Exec_DOCCANNAVIGATE);
136 DEFINE_EXPECT(Invoke_AMBIENT_USERMODE);
137 DEFINE_EXPECT(Invoke_AMBIENT_DLCONTROL);
138 DEFINE_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
139 DEFINE_EXPECT(Invoke_AMBIENT_SILENT);
140 DEFINE_EXPECT(Invoke_AMBIENT_USERAGENT);
141 DEFINE_EXPECT(Invoke_AMBIENT_PALETTE);
142 DEFINE_EXPECT(Invoke_OnReadyStateChange_Interactive);
143 DEFINE_EXPECT(Invoke_OnReadyStateChange_Loading);
144 DEFINE_EXPECT(Invoke_OnReadyStateChange_Complete);
145 DEFINE_EXPECT(GetDropTarget);
146 DEFINE_EXPECT(UpdateUI);
147 DEFINE_EXPECT(Navigate);
148 DEFINE_EXPECT(OnFrameWindowActivate);
149 DEFINE_EXPECT(OnChanged_READYSTATE);
150 DEFINE_EXPECT(OnChanged_1005);
151 DEFINE_EXPECT(OnChanged_1012);
152 DEFINE_EXPECT(GetDisplayName);
153 DEFINE_EXPECT(BindToStorage);
154 DEFINE_EXPECT(IsSystemMoniker);
155 DEFINE_EXPECT(GetBindResult);
156 DEFINE_EXPECT(GetClassID);
157 DEFINE_EXPECT(Abort);
158 DEFINE_EXPECT(Read);
159 DEFINE_EXPECT(CreateInstance);
160 DEFINE_EXPECT(Start);
161 DEFINE_EXPECT(Terminate);
162 DEFINE_EXPECT(Protocol_Read);
163 DEFINE_EXPECT(LockRequest);
164 DEFINE_EXPECT(UnlockRequest);
165 DEFINE_EXPECT(OnFocus_TRUE);
166 DEFINE_EXPECT(OnFocus_FALSE);
167 DEFINE_EXPECT(RequestUIActivate);
168 DEFINE_EXPECT(InPlaceFrame_SetBorderSpace);
169 DEFINE_EXPECT(InPlaceUIWindow_SetActiveObject);
170 DEFINE_EXPECT(GetExternal);
171 DEFINE_EXPECT(EnableModeless_TRUE);
172 DEFINE_EXPECT(EnableModeless_FALSE);
173 DEFINE_EXPECT(Frame_EnableModeless_TRUE);
174 DEFINE_EXPECT(Frame_EnableModeless_FALSE);
175 DEFINE_EXPECT(Frame_GetWindow);
176 DEFINE_EXPECT(TranslateUrl);
177 DEFINE_EXPECT(Advise_Close);
178 DEFINE_EXPECT(OnViewChange);
179 DEFINE_EXPECT(EvaluateNewWindow);
180 DEFINE_EXPECT(GetTravelLog);
181 DEFINE_EXPECT(UpdateBackForwardState);
182 DEFINE_EXPECT(FireBeforeNavigate2);
183 DEFINE_EXPECT(FireNavigateComplete2);
184 DEFINE_EXPECT(FireDocumentComplete);
185 DEFINE_EXPECT(GetPendingUrl);
186 DEFINE_EXPECT(ActiveElementChanged);
187 DEFINE_EXPECT(IsErrorUrl);
188 DEFINE_EXPECT(get_LocationURL);
190 static IUnknown *doc_unk;
191 static IMoniker *doc_mon;
192 static BOOL expect_LockContainer_fLock;
193 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
194 static BOOL ipsex, ipsw;
195 static BOOL set_clientsite, container_locked;
196 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
197 static BOOL editmode = FALSE, ignore_external_qi;
198 static BOOL inplace_deactivated, open_call;
199 static BOOL complete, loading_js, loading_hash;
200 static DWORD status_code = HTTP_STATUS_OK;
201 static BOOL asynchronous_binding = FALSE;
202 static BOOL support_wbapp;
203 static int stream_read, protocol_read;
204 static enum load_state_t {
205 LD_DOLOAD,
206 LD_LOADING,
207 LD_LOADED,
208 LD_INTERACTIVE,
209 LD_COMPLETE,
210 LD_NO
211 } load_state;
213 static LPCOLESTR expect_status_text = NULL;
214 static const char *nav_url, *nav_serv_url;
216 static const char html_page[] =
217 "<html>"
218 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
219 "<body><div>test</div></body>"
220 "</html>";
222 static const char css_data[] = "body {color: red; margin: 0}";
224 static const WCHAR http_urlW[] =
225 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
227 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
229 #define DOCHOST_DOCCANNAVIGATE 0
230 #define WM_CONTINUE_BINDING (WM_APP+1)
232 static HRESULT QueryInterface(REFIID riid, void **ppv);
233 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
235 #define test_readyState(u) _test_readyState(__LINE__,u)
236 static void _test_readyState(unsigned,IUnknown*);
238 static const WCHAR wszTimesNewRoman[] =
239 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
240 static const WCHAR wszArial[] =
241 {'A','r','i','a','l',0};
243 static const char *debugstr_guid(REFIID riid)
245 static char buf[50];
247 if(!riid)
248 return "(null)";
250 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
251 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
252 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
253 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
255 return buf;
258 static int strcmp_wa(LPCWSTR strw, const char *stra)
260 CHAR buf[512];
261 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
262 return lstrcmpA(stra, buf);
265 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
267 while (*str)
269 const WCHAR *p1 = str, *p2 = sub;
270 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
271 if (!*p2) return str;
272 str++;
274 return NULL;
277 static BSTR a2bstr(const char *str)
279 BSTR ret;
280 int len;
282 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
283 ret = SysAllocStringLen(NULL, len);
284 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
286 return ret;
289 /* Returns true if the user interface is in English. Note that this does not
290 * presume of the formatting of dates, numbers, etc.
292 static BOOL is_lang_english(void)
294 static HMODULE hkernel32 = NULL;
295 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
296 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
298 if (!hkernel32)
300 hkernel32 = GetModuleHandleA("kernel32.dll");
301 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
302 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
304 if (pGetThreadUILanguage)
305 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
306 if (pGetUserDefaultUILanguage)
307 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
309 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
312 #define EXPECT_UPDATEUI 1
313 #define EXPECT_SETTITLE 2
315 static void test_timer(DWORD flags)
317 BOOL *b = &called_Exec_SETTITLE;
318 MSG msg;
320 if(flags & EXPECT_UPDATEUI) {
321 SET_EXPECT(UpdateUI);
322 SET_EXPECT(Exec_UPDATECOMMANDS);
323 b = &called_UpdateUI;
325 if(flags & EXPECT_SETTITLE)
326 SET_EXPECT(Exec_SETTITLE);
328 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
329 TranslateMessage(&msg);
330 DispatchMessage(&msg);
333 if(flags & EXPECT_UPDATEUI) {
334 CHECK_CALLED(UpdateUI);
335 CHECK_CALLED(Exec_UPDATECOMMANDS);
337 if(flags & EXPECT_SETTITLE)
338 CHECK_CALLED(Exec_SETTITLE);
341 static IMoniker Moniker;
343 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
344 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
346 IHTMLDocument2 *doc;
347 IPersistMoniker *permon;
348 IMoniker *mon = (void*)0xdeadbeef;
349 BSTR doc_url = (void*)0xdeadbeef;
350 HRESULT hres;
352 if(open_call)
353 return; /* FIXME */
355 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
356 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
357 if(FAILED(hres))
358 return;
360 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
361 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
363 hres = IHTMLDocument2_get_URL(doc, &doc_url);
364 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
366 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
367 IPersistMoniker_Release(permon);
369 if(exmon) {
370 LPOLESTR url;
371 BOOL exb = expect_GetDisplayName;
372 BOOL clb = called_GetDisplayName;
374 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
375 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
377 if(mon == &Moniker)
378 SET_EXPECT(GetDisplayName);
379 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
380 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
381 if(mon == &Moniker)
382 CHECK_CALLED(GetDisplayName);
383 expect_GetDisplayName = exb;
384 called_GetDisplayName = clb;
386 if(!loading_hash)
387 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
388 else
389 ok(!strcmp_wa(url, nav_serv_url), "url = %s, expected %s\n", wine_dbgstr_w(url), nav_serv_url);
390 CoTaskMemFree(url);
391 }else if(exurl) {
392 LPOLESTR url;
394 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
396 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
397 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
399 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
400 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
402 CoTaskMemFree(url);
403 }else {
404 ok_(__FILE__,line)(hres == E_UNEXPECTED,
405 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
406 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
407 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
410 SysFreeString(doc_url);
411 IHTMLDocument_Release(doc);
412 if(mon && mon != (void*)0xdeadbeef)
413 IMoniker_Release(mon);
416 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
418 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
420 *ppv = NULL;
422 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
423 *ppv = iface;
424 return S_OK;
427 if(IsEqualGUID(&IID_IProxyManager, riid))
428 return E_NOINTERFACE; /* TODO */
429 if(IsEqualGUID(&IID_IDispatchEx, riid))
430 return E_NOINTERFACE; /* TODO */
431 if(IsEqualGUID(&IID_External_unk, riid))
432 return E_NOINTERFACE; /* TODO */
434 if(!ignore_external_qi)
435 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
436 return E_NOINTERFACE;
439 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
441 return 2;
444 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
446 return 1;
449 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
451 ok(0, "unexpected call\n");
452 return E_NOTIMPL;
455 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
456 ITypeInfo **ppTInfo)
458 ok(0, "unexpected call\n");
459 return E_NOTIMPL;
462 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
463 UINT cNames, LCID lcid, DISPID *rgDispId)
465 ok(0, "unexpected call\n");
466 return E_NOTIMPL;
469 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
470 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
471 EXCEPINFO *pExcepInfo, UINT *puArgErr)
473 ok(0, "unexpected call\n");
474 return E_NOTIMPL;
477 static const IDispatchVtbl ExternalVtbl = {
478 External_QueryInterface,
479 Dispatch_AddRef,
480 Dispatch_Release,
481 Dispatch_GetTypeInfoCount,
482 Dispatch_GetTypeInfo,
483 Dispatch_GetIDsOfNames,
484 External_Invoke
487 static IDispatch External = { &ExternalVtbl };
489 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
491 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
492 *ppv = iface;
493 return S_OK;
496 *ppv = NULL;
497 return E_NOINTERFACE;
500 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
502 return 2;
505 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
507 return 1;
510 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
511 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
512 DWORD grfPI, HANDLE_PTR dwReserved)
514 BINDINFO bindinfo;
515 DWORD bindf = 0;
516 HRESULT hres;
518 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
519 static const WCHAR empty_str = {0};
521 CHECK_EXPECT(Start);
523 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
524 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
525 ok(!grfPI, "grfPI = %x\n", grfPI);
526 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
528 memset(&bindinfo, 0, sizeof(bindinfo));
529 bindinfo.cbSize = sizeof(bindinfo);
530 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
531 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
532 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
533 "bindf = %x\n", bindf);
535 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
536 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
537 /* TODO: test stgmedData */
538 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
539 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
540 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
541 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
542 ok(bindinfo.dwOptions == 0x80000 ||
543 bindinfo.dwOptions == 0x4080000, /* win2k3 */
544 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
545 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
546 /* TODO: test dwCodePage */
547 /* TODO: test securityAttributes */
548 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
549 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
550 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
552 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
553 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
554 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
556 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
557 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
558 ok(hres == S_OK,
559 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
561 hres = IInternetProtocolSink_ReportData(pOIProtSink,
562 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
563 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
565 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
566 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
568 return S_OK;
571 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
572 PROTOCOLDATA *pProtocolData)
574 ok(0, "unexpected call\n");
575 return E_NOTIMPL;
578 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
579 DWORD dwOptions)
581 ok(0, "unexpected call\n");
582 return E_NOTIMPL;
585 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
587 CHECK_EXPECT(Terminate);
588 return S_OK;
591 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
593 ok(0, "unexpected call\n");
594 return E_NOTIMPL;
597 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
599 ok(0, "unexpected call\n");
600 return E_NOTIMPL;
603 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
604 ULONG cb, ULONG *pcbRead)
606 CHECK_EXPECT2(Protocol_Read);
608 ok(pv != NULL, "pv == NULL\n");
609 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
610 ok(pcbRead != NULL, "pcbRead == NULL\n");
611 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
613 if(protocol_read)
614 return S_FALSE;
616 protocol_read += *pcbRead = sizeof(css_data)-1;
617 memcpy(pv, css_data, sizeof(css_data)-1);
618 return S_OK;
621 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
622 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
624 ok(0, "unexpected call\n");
625 return E_NOTIMPL;
628 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
630 CHECK_EXPECT(LockRequest);
631 return S_OK;
634 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
636 CHECK_EXPECT(UnlockRequest);
637 return S_OK;
640 static const IInternetProtocolVtbl ProtocolVtbl = {
641 Protocol_QueryInterface,
642 Protocol_AddRef,
643 Protocol_Release,
644 Protocol_Start,
645 Protocol_Continue,
646 Protocol_Abort,
647 Protocol_Terminate,
648 Protocol_Suspend,
649 Protocol_Resume,
650 Protocol_Read,
651 Protocol_Seek,
652 Protocol_LockRequest,
653 Protocol_UnlockRequest
656 static IInternetProtocol Protocol = { &ProtocolVtbl };
658 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
660 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
661 ok(0, "unexpected call\n");
662 return E_NOINTERFACE;
665 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
667 return 2;
670 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
672 return 1;
675 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
676 REFIID riid, void **ppv)
678 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
679 return E_NOINTERFACE;
681 CHECK_EXPECT(CreateInstance);
682 ok(ppv != NULL, "ppv == NULL\n");
684 *ppv = &Protocol;
685 return S_OK;
688 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
690 ok(0, "unexpected call\n");
691 return S_OK;
694 static const IClassFactoryVtbl ClassFactoryVtbl = {
695 ClassFactory_QueryInterface,
696 ClassFactory_AddRef,
697 ClassFactory_Release,
698 ClassFactory_CreateInstance,
699 ClassFactory_LockServer
702 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
704 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
706 ok(0, "unexpected call\n");
707 return E_NOTIMPL;
710 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
712 return 2;
715 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
717 return 1;
720 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
721 IHlinkBrowseContext *pihlbc)
723 ok(0, "unexpected call\n");
724 return E_NOTIMPL;
727 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
728 IHlinkBrowseContext **ppihlbc)
730 ok(0, "unexpected call\n");
731 return E_NOTIMPL;
734 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
735 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
737 HRESULT hres;
739 CHECK_EXPECT(Navigate);
741 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
742 ok(pbc != NULL, "pbc == NULL\n");
743 ok(pibsc != NULL, "pubsc == NULL\n");
744 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
746 if(pihlNavigate) {
747 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
748 LPWSTR location = (LPWSTR)0xdeadbeef;
749 IHlinkSite *site;
750 IMoniker *mon = NULL;
751 DWORD site_data = 0xdeadbeef;
753 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
754 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
755 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
757 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
758 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
759 ok(location == NULL, "location = %p\n", location);
760 ok(mon != NULL, "mon == NULL\n");
762 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &location);
763 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
764 ok(!strcmp_wa(location, nav_url), "unexpected display name %s, expected %s\n", wine_dbgstr_w(location), nav_url);
765 CoTaskMemFree(location);
766 IMoniker_Release(mon);
768 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
769 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
770 ok(site == NULL, "site = %p\n, expected NULL\n", site);
771 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
774 return S_OK;
777 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
778 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
780 ok(0, "unexpected call\n");
781 return E_NOTIMPL;
784 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
785 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
787 ok(0, "unexpected call\n");
788 return E_NOTIMPL;
791 static const IHlinkFrameVtbl HlinkFrameVtbl = {
792 HlinkFrame_QueryInterface,
793 HlinkFrame_AddRef,
794 HlinkFrame_Release,
795 HlinkFrame_SetBrowseContext,
796 HlinkFrame_GetBrowseContext,
797 HlinkFrame_Navigate,
798 HlinkFrame_OnNavigate,
799 HlinkFrame_UpdateHlink
802 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
804 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
806 ok(0, "unexpected call\n");
807 return E_NOINTERFACE;
810 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
812 return 2;
815 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
817 return 1;
820 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
821 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
822 DWORD dwUserActionTime)
824 CHECK_EXPECT(EvaluateNewWindow);
826 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
827 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
828 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
829 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
830 ok(!fReplace, "fReplace = %x\n", fReplace);
831 ok(dwFlags == NWMF_FIRST, "dwFlags = %x\n", dwFlags);
832 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
834 return E_FAIL;
837 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
838 NewWindowManager_QueryInterface,
839 NewWindowManager_AddRef,
840 NewWindowManager_Release,
841 NewWindowManager_EvaluateNewWindow
844 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
846 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
847 REFIID riid, void**ppv)
849 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
850 *ppv = iface;
851 return S_OK;
854 ok(0, "unexpected call\n");
855 return E_NOINTERFACE;
858 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
860 return 2;
863 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
865 return 1;
868 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
870 switch(dispID) {
871 case DISPID_READYSTATE:
872 CHECK_EXPECT2(OnChanged_READYSTATE);
874 if(!readystate_set_interactive)
875 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
876 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
877 ? OLECMDF_ENABLED : 0));
879 if(readystate_set_loading) {
880 readystate_set_loading = FALSE;
881 load_state = LD_LOADING;
883 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
884 test_readyState(NULL);
885 return S_OK;
886 case 1005:
887 CHECK_EXPECT(OnChanged_1005);
888 if(!editmode)
889 test_readyState(NULL);
890 readystate_set_interactive = (load_state != LD_INTERACTIVE);
891 return S_OK;
892 case 1012:
893 CHECK_EXPECT(OnChanged_1012);
894 return S_OK;
895 case 1030:
896 case 3000022:
897 case 3000023:
898 case 3000024:
899 case 3000025:
900 case 3000028:
901 case 3000029:
902 case 3000030:
903 case 3000031:
904 /* TODO */
905 return S_OK;
908 ok(0, "unexpected id %d\n", dispID);
909 return E_NOTIMPL;
912 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
914 ok(0, "unexpected call\n");
915 return E_NOTIMPL;
918 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
919 PropertyNotifySink_QueryInterface,
920 PropertyNotifySink_AddRef,
921 PropertyNotifySink_Release,
922 PropertyNotifySink_OnChanged,
923 PropertyNotifySink_OnRequestEdit
926 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
928 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
930 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) {
931 *ppv = iface;
932 return S_OK;
935 ok(0, "unexpected call %s\n", debugstr_guid(riid));
936 *ppv = NULL;
937 return E_NOINTERFACE;
940 static ULONG WINAPI Stream_AddRef(IStream *iface)
942 return 2;
945 static ULONG WINAPI Stream_Release(IStream *iface)
947 return 1;
950 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
951 ULONG cb, ULONG *pcbRead)
953 CHECK_EXPECT2(Read);
954 ok(pv != NULL, "pv == NULL\n");
955 ok(cb > sizeof(html_page), "cb = %d\n", cb);
956 ok(pcbRead != NULL, "pcbRead == NULL\n");
957 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
959 if(stream_read)
960 return S_FALSE;
962 memcpy(pv, html_page, sizeof(html_page)-1);
963 stream_read += *pcbRead = sizeof(html_page)-1;
964 return S_OK;
967 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
968 ULONG cb, ULONG *pcbWritten)
970 ok(0, "unexpected call\n");
971 return E_NOTIMPL;
974 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
975 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
977 ok(0, "unexpected call\n");
978 return E_NOTIMPL;
981 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
983 ok(0, "unexpected call\n");
984 return E_NOTIMPL;
987 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
988 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
990 ok(0, "unexpected call\n");
991 return E_NOTIMPL;
994 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
996 ok(0, "unexpected call\n");
997 return E_NOTIMPL;
1000 static HRESULT WINAPI Stream_Revert(IStream *iface)
1002 ok(0, "unexpected call\n");
1003 return E_NOTIMPL;
1006 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
1007 ULARGE_INTEGER cb, DWORD dwLockType)
1009 ok(0, "unexpected call\n");
1010 return E_NOTIMPL;
1013 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
1014 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
1016 ok(0, "unexpected call\n");
1017 return E_NOTIMPL;
1020 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1021 DWORD dwStatFlag)
1023 ok(0, "unexpected call\n");
1024 return E_NOTIMPL;
1027 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1029 ok(0, "unexpected call\n");
1030 return E_NOTIMPL;
1033 static const IStreamVtbl StreamVtbl = {
1034 Stream_QueryInterface,
1035 Stream_AddRef,
1036 Stream_Release,
1037 Stream_Read,
1038 Stream_Write,
1039 Stream_Seek,
1040 Stream_SetSize,
1041 Stream_CopyTo,
1042 Stream_Commit,
1043 Stream_Revert,
1044 Stream_LockRegion,
1045 Stream_UnlockRegion,
1046 Stream_Stat,
1047 Stream_Clone
1050 static IStream Stream = { &StreamVtbl };
1052 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1053 IWinInetHttpInfo* This,
1054 REFIID riid,
1055 void **ppvObject)
1057 ok(0, "unexpected call\n");
1058 return E_NOINTERFACE;
1061 static ULONG WINAPI WinInetHttpInfo_AddRef(
1062 IWinInetHttpInfo* This)
1064 return 2;
1067 static ULONG WINAPI WinInetHttpInfo_Release(
1068 IWinInetHttpInfo* This)
1070 return 1;
1073 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1074 IWinInetHttpInfo* This,
1075 DWORD dwOption,
1076 LPVOID pBuffer,
1077 DWORD *pcbBuf)
1079 return E_NOTIMPL; /* TODO */
1082 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1083 IWinInetHttpInfo* This,
1084 DWORD dwOption,
1085 LPVOID pBuffer,
1086 DWORD *pcbBuf,
1087 DWORD *pdwFlags,
1088 DWORD *pdwReserved)
1090 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1092 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1093 ok(pBuffer != NULL, "pBuffer == NULL\n");
1094 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1095 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1096 *((DWORD*)pBuffer) = status_code;
1097 return S_OK;
1100 return E_NOTIMPL; /* TODO */
1103 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1104 WinInetHttpInfo_QueryInterface,
1105 WinInetHttpInfo_AddRef,
1106 WinInetHttpInfo_Release,
1107 WinInetHttpInfo_QueryOption,
1108 WinInetHttpInfo_QueryInfo
1111 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1113 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1115 if(IsEqualGUID(&IID_IUnknown, riid)) {
1116 *ppv = iface;
1117 return S_OK;
1120 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1121 *ppv = &WinInetHttpInfo;
1122 return S_OK;
1125 ok(0, "unexpected call\n");
1126 return E_NOINTERFACE;
1129 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1131 return 2;
1134 static ULONG WINAPI Binding_Release(IBinding *iface)
1136 return 1;
1139 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1141 CHECK_EXPECT(Abort);
1142 if(asynchronous_binding)
1143 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1144 return S_OK;
1147 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1149 ok(0, "unexpected call\n");
1150 return E_NOTIMPL;
1153 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1155 ok(0, "unexpected call\n");
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1161 ok(0, "unexpected call\n");
1162 return E_NOTIMPL;
1165 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1167 ok(0, "unexpected call\n");
1168 return E_NOTIMPL;
1171 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1172 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1174 CHECK_EXPECT(GetBindResult);
1175 return E_NOTIMPL;
1178 static const IBindingVtbl BindingVtbl = {
1179 Binding_QueryInterface,
1180 Binding_AddRef,
1181 Binding_Release,
1182 Binding_Abort,
1183 Binding_Suspend,
1184 Binding_Resume,
1185 Binding_SetPriority,
1186 Binding_GetPriority,
1187 Binding_GetBindResult
1190 static IBinding Binding = { &BindingVtbl };
1192 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1193 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1195 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1197 *ppv = NULL;
1199 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1200 return E_NOINTERFACE; /* TODO */
1201 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1202 return E_NOINTERFACE; /* TODO */
1204 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1205 return E_NOINTERFACE;
1208 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1210 return 2;
1213 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1215 return 1;
1218 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1220 CHECK_EXPECT(GetClassID);
1221 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1222 return E_FAIL;
1225 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1227 ok(0, "unexpected call\n");
1228 return E_NOTIMPL;
1231 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1233 ok(0, "unexpected call\n");
1234 return E_NOTIMPL;
1237 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1239 ok(0, "unexpected call\n");
1240 return E_NOTIMPL;
1243 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1245 ok(0, "unexpected call\n");
1246 return E_NOTIMPL;
1249 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1250 REFIID riidResult, void **ppvResult)
1252 ok(0, "unexpected call\n");
1253 return E_NOTIMPL;
1256 static void continue_binding(IBindStatusCallback *callback)
1258 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1259 STGMEDIUM stgmedium;
1260 HRESULT hres;
1262 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1264 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1265 wszTextHtml);
1266 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1268 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1269 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1270 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1271 if(status_code != HTTP_STATUS_OK) {
1272 CHECK_CALLED_BROKEN(IsErrorUrl);
1273 SET_EXPECT(IsErrorUrl);
1276 SET_EXPECT(Read);
1277 stgmedium.tymed = TYMED_ISTREAM;
1278 U(stgmedium).pstm = &Stream;
1279 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1280 hres = IBindStatusCallback_OnDataAvailable(callback,
1281 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1282 sizeof(html_page)-1, &formatetc, &stgmedium);
1283 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1284 CHECK_CALLED(Read);
1286 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1287 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1288 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1290 SET_EXPECT(GetBindResult);
1291 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1292 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1293 CLEAR_CALLED(GetBindResult); /* IE7 */
1295 IBindStatusCallback_Release(callback);
1298 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1299 REFIID riid, void **ppv)
1301 IBindStatusCallback *callback = NULL;
1302 BINDINFO bindinfo;
1303 DWORD bindf;
1304 HRESULT hres;
1306 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1308 CHECK_EXPECT(BindToStorage);
1310 load_state = LD_LOADING;
1312 ok(pbc != NULL, "pbc == NULL\n");
1313 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1314 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1315 ok(ppv != NULL, "ppv == NULL\n");
1316 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1318 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1319 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1320 ok(callback != NULL, "callback == NULL\n");
1322 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1323 bindinfo.cbSize = sizeof(bindinfo);
1325 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1326 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1327 ok((bindf & ~BINDF_HYPERLINK /* IE9 */) == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1328 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1329 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1330 /* TODO: test stgmedData */
1331 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1332 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1333 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1334 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1335 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1336 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1337 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1338 /* TODO: test dwCodePage */
1339 /* TODO: test securityAttributes */
1340 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1341 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1342 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1344 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1345 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1347 if(asynchronous_binding) {
1348 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1349 return MK_S_ASYNCHRONOUS;
1352 continue_binding(callback);
1353 return S_OK;
1356 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1357 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1359 ok(0, "unexpected call\n");
1360 return E_NOTIMPL;
1363 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1364 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1366 ok(0, "unexpected call\n");
1367 return E_NOTIMPL;
1370 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1372 ok(0, "unexpected call\n");
1373 return E_NOTIMPL;
1376 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1378 ok(0, "unexpected call\n");
1379 return E_NOTIMPL;
1382 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1384 ok(0, "unexpected call\n");
1385 return E_NOTIMPL;
1388 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1389 IMoniker *pmkNewlyRunning)
1391 ok(0, "unexpected call\n");
1392 return E_NOTIMPL;
1395 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1396 IMoniker *pmkToLeft, FILETIME *pFileTime)
1398 ok(0, "unexpected call\n");
1399 return E_NOTIMPL;
1402 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1404 ok(0, "unexpected call\n");
1405 return E_NOTIMPL;
1408 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1409 IMoniker **ppmkPrefix)
1411 ok(0, "unexpected call\n");
1412 return E_NOTIMPL;
1415 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1416 IMoniker **pmkRelPath)
1418 ok(0, "unexpected call\n");
1419 return E_NOTIMPL;
1422 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1423 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1425 CHECK_EXPECT2(GetDisplayName);
1427 /* ok(pbc != NULL, "pbc == NULL\n"); */
1428 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1429 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1431 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1432 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1434 return S_OK;
1437 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1438 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1440 ok(0, "unexpected call\n");
1441 return E_NOTIMPL;
1444 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1446 CHECK_EXPECT(IsSystemMoniker);
1447 return E_NOTIMPL;
1450 static const IMonikerVtbl MonikerVtbl = {
1451 Moniker_QueryInterface,
1452 Moniker_AddRef,
1453 Moniker_Release,
1454 Moniker_GetClassID,
1455 Moniker_IsDirty,
1456 Moniker_Load,
1457 Moniker_Save,
1458 Moniker_GetSizeMax,
1459 Moniker_BindToObject,
1460 Moniker_BindToStorage,
1461 Moniker_Reduce,
1462 Moniker_ComposeWith,
1463 Moniker_Enum,
1464 Moniker_IsEqual,
1465 Moniker_Hash,
1466 Moniker_IsRunning,
1467 Moniker_GetTimeOfLastChange,
1468 Moniker_Inverse,
1469 Moniker_CommonPrefixWith,
1470 Moniker_RelativePathTo,
1471 Moniker_GetDisplayName,
1472 Moniker_ParseDisplayName,
1473 Moniker_IsSystemMoniker
1476 static IMoniker Moniker = { &MonikerVtbl };
1478 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1480 return QueryInterface(riid, ppv);
1483 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1485 return 2;
1488 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1490 return 1;
1493 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1494 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1496 ok(0, "unexpected call\n");
1497 return E_NOTIMPL;
1500 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1501 IEnumUnknown **ppenum)
1503 ok(0, "unexpected call\n");
1504 return E_NOTIMPL;
1507 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1509 CHECK_EXPECT(LockContainer);
1510 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1511 return S_OK;
1514 static const IOleContainerVtbl OleContainerVtbl = {
1515 OleContainer_QueryInterface,
1516 OleContainer_AddRef,
1517 OleContainer_Release,
1518 OleContainer_ParseDisplayName,
1519 OleContainer_EnumObjects,
1520 OleContainer_LockContainer
1523 static IOleContainer OleContainer = { &OleContainerVtbl };
1525 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1527 return QueryInterface(riid, ppv);
1530 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1532 return 2;
1535 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1537 return 1;
1540 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1542 ok(0, "unexpected call\n");
1543 return E_NOTIMPL;
1546 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1547 IMoniker **ppmon)
1549 ok(0, "unexpected call\n");
1550 return E_NOTIMPL;
1553 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1555 CHECK_EXPECT(GetContainer);
1556 ok(ppContainer != NULL, "ppContainer = NULL\n");
1557 *ppContainer = &OleContainer;
1558 return S_OK;
1561 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1563 ok(0, "unexpected call\n");
1564 return E_NOTIMPL;
1567 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1569 ok(0, "unexpected call\n");
1570 return E_NOTIMPL;
1573 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1575 ok(0, "unexpected call\n");
1576 return E_NOTIMPL;
1579 static const IOleClientSiteVtbl ClientSiteVtbl = {
1580 ClientSite_QueryInterface,
1581 ClientSite_AddRef,
1582 ClientSite_Release,
1583 ClientSite_SaveObject,
1584 ClientSite_GetMoniker,
1585 ClientSite_GetContainer,
1586 ClientSite_ShowObject,
1587 ClientSite_OnShowWindow,
1588 ClientSite_RequestNewObjectLayout
1591 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1593 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1595 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1597 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1598 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1600 *ppv = NULL;
1601 return E_NOINTERFACE;
1604 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1606 return 2;
1609 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1611 return 1;
1614 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1616 CHECK_EXPECT(Frame_GetWindow);
1617 return E_NOTIMPL;
1620 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1622 ok(0, "unexpected call\n");
1623 return E_NOTIMPL;
1626 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1628 ok(0, "unexpected call\n");
1629 return E_NOTIMPL;
1632 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1633 LPCBORDERWIDTHS pborderwidths)
1635 ok(0, "unexpected call\n");
1636 return E_NOTIMPL;
1639 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1640 LPCBORDERWIDTHS pborderwidths)
1642 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1643 return S_OK;
1646 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1647 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1649 static const WCHAR wszHTML_Document[] =
1650 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1652 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1654 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1655 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1656 if(pActiveObject && is_lang_english())
1657 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1659 else {
1660 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1661 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1663 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1664 return S_OK;
1667 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1668 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1670 static const WCHAR wszHTML_Document[] =
1671 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1673 if(pActiveObject) {
1674 CHECK_EXPECT2(SetActiveObject);
1676 if(pActiveObject && is_lang_english())
1677 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1678 }else {
1679 CHECK_EXPECT(SetActiveObject_null);
1681 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1682 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1685 return S_OK;
1688 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1689 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1691 ok(0, "unexpected call\n");
1692 return E_NOTIMPL;
1695 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1696 HOLEMENU holemenu, HWND hwndActiveObject)
1698 ok(0, "unexpected call\n");
1699 return E_NOTIMPL;
1702 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1704 ok(0, "unexpected call\n");
1705 return E_NOTIMPL;
1708 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1710 CHECK_EXPECT2(SetStatusText);
1711 if(!expect_status_text)
1712 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1713 return S_OK;
1716 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1718 if(fEnable)
1719 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1720 else
1721 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1722 return E_NOTIMPL;
1725 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1727 ok(0, "unexpected call\n");
1728 return E_NOTIMPL;
1731 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1732 InPlaceFrame_QueryInterface,
1733 InPlaceFrame_AddRef,
1734 InPlaceFrame_Release,
1735 InPlaceFrame_GetWindow,
1736 InPlaceFrame_ContextSensitiveHelp,
1737 InPlaceFrame_GetBorder,
1738 InPlaceFrame_RequestBorderSpace,
1739 InPlaceFrame_SetBorderSpace,
1740 InPlaceFrame_SetActiveObject,
1741 InPlaceFrame_InsertMenus,
1742 InPlaceFrame_SetMenu,
1743 InPlaceFrame_RemoveMenus,
1744 InPlaceFrame_SetStatusText,
1745 InPlaceFrame_EnableModeless,
1746 InPlaceFrame_TranslateAccelerator
1749 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1751 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1752 InPlaceFrame_QueryInterface,
1753 InPlaceFrame_AddRef,
1754 InPlaceFrame_Release,
1755 InPlaceFrame_GetWindow,
1756 InPlaceFrame_ContextSensitiveHelp,
1757 InPlaceFrame_GetBorder,
1758 InPlaceFrame_RequestBorderSpace,
1759 InPlaceFrame_SetBorderSpace,
1760 InPlaceUIWindow_SetActiveObject,
1763 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1765 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1767 return QueryInterface(riid, ppv);
1770 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1772 return 2;
1775 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1777 return 1;
1780 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1781 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1783 IOleClientSite *client_site;
1784 IOleObject *ole_obj;
1785 HRESULT hres;
1787 CHECK_EXPECT2(GetWindow);
1788 ok(phwnd != NULL, "phwnd = NULL\n");
1789 *phwnd = container_hwnd;
1791 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1792 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1794 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1795 IOleObject_Release(ole_obj);
1796 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1797 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1798 IOleClientSite_Release(client_site);
1800 return S_OK;
1803 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1804 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1806 ok(0, "unexpected call\n");
1807 return E_NOTIMPL;
1810 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1811 IOleInPlaceSiteWindowless *iface)
1813 CHECK_EXPECT(CanInPlaceActivate);
1814 return S_OK;
1817 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1818 IOleInPlaceSiteWindowless *iface)
1820 CHECK_EXPECT(OnInPlaceActivate);
1821 inplace_deactivated = FALSE;
1822 return S_OK;
1825 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1826 IOleInPlaceSiteWindowless *iface)
1828 CHECK_EXPECT(OnUIActivate);
1829 return S_OK;
1832 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1833 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1834 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1835 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1837 static const RECT rect = {0,0,500,500};
1839 CHECK_EXPECT(GetWindowContext);
1841 ok(ppFrame != NULL, "ppFrame = NULL\n");
1842 if(ppFrame)
1843 *ppFrame = &InPlaceFrame;
1844 ok(ppDoc != NULL, "ppDoc = NULL\n");
1845 if(ppDoc)
1846 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1847 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1848 if(lprcPosRect)
1849 memcpy(lprcPosRect, &rect, sizeof(RECT));
1850 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1851 if(lprcClipRect)
1852 memcpy(lprcClipRect, &rect, sizeof(RECT));
1853 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1854 if(lpFrameInfo) {
1855 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1856 lpFrameInfo->fMDIApp = FALSE;
1857 lpFrameInfo->hwndFrame = container_hwnd;
1858 lpFrameInfo->haccel = NULL;
1859 lpFrameInfo->cAccelEntries = 0;
1862 return S_OK;
1865 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1866 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1868 ok(0, "unexpected call\n");
1869 return E_NOTIMPL;
1872 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1873 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1875 CHECK_EXPECT(OnUIDeactivate);
1876 ok(!fUndoable, "fUndoable = TRUE\n");
1877 return S_OK;
1880 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1881 IOleInPlaceSiteWindowless *iface)
1883 CHECK_EXPECT(OnInPlaceDeactivate);
1884 inplace_deactivated = TRUE;
1885 return S_OK;
1888 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1889 IOleInPlaceSiteWindowless *iface)
1891 ok(0, "unexpected call\n");
1892 return E_NOTIMPL;
1895 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1896 IOleInPlaceSiteWindowless *iface)
1898 ok(0, "unexpected call\n");
1899 return E_NOTIMPL;
1902 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1903 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1905 ok(0, "unexpected call\n");
1906 return E_NOTIMPL;
1909 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1910 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1912 CHECK_EXPECT(OnInPlaceActivateEx);
1914 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1915 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1916 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1918 return S_OK;
1921 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1922 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1924 CHECK_EXPECT(OnInPlaceDeactivateEx);
1926 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1928 return S_OK;
1931 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1932 IOleInPlaceSiteWindowless *iface)
1934 CHECK_EXPECT2(RequestUIActivate);
1935 return S_OK;
1938 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1939 IOleInPlaceSiteWindowless *iface)
1941 ok(0, "unexpected call\n");
1942 return E_NOTIMPL;
1945 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1946 IOleInPlaceSiteWindowless *iface)
1948 ok(0, "unexpected call\n");
1949 return E_NOTIMPL;
1952 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1953 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1955 ok(0, "unexpected call\n");
1956 return E_NOTIMPL;
1959 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1960 IOleInPlaceSiteWindowless *iface)
1962 ok(0, "unexpected call\n");
1963 return E_NOTIMPL;
1966 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
1967 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
1969 ok(0, "unexpected call\n");
1970 return E_NOTIMPL;
1973 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
1974 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
1975 DWORD grfFlags, HDC *phDC)
1977 ok(0, "unexpected call\n");
1978 return E_NOTIMPL;
1981 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
1982 IOleInPlaceSiteWindowless *iface, HDC hDC)
1984 ok(0, "unexpected call\n");
1985 return E_NOTIMPL;
1988 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
1989 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
1991 ok(0, "unexpected call\n");
1992 return E_NOTIMPL;
1995 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
1996 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
1998 ok(0, "unexpected call\n");
1999 return E_NOTIMPL;
2002 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
2003 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
2004 LPCRECT pRectScroll, LPCRECT pRectClip)
2006 ok(0, "unexpected call\n");
2007 return E_NOTIMPL;
2010 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
2011 IOleInPlaceSiteWindowless *iface, LPRECT prc)
2013 ok(0, "unexpected call\n");
2014 return E_NOTIMPL;
2017 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2018 IOleInPlaceSiteWindowless *iface, UINT msg,
2019 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2021 ok(0, "unexpected call\n");
2022 return E_NOTIMPL;
2025 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2026 InPlaceSiteWindowless_QueryInterface,
2027 InPlaceSiteWindowless_AddRef,
2028 InPlaceSiteWindowless_Release,
2029 InPlaceSiteWindowless_GetWindow,
2030 InPlaceSiteWindowless_ContextSensitiveHelp,
2031 InPlaceSiteWindowless_CanInPlaceActivate,
2032 InPlaceSiteWindowless_OnInPlaceActivate,
2033 InPlaceSiteWindowless_OnUIActivate,
2034 InPlaceSiteWindowless_GetWindowContext,
2035 InPlaceSiteWindowless_Scroll,
2036 InPlaceSiteWindowless_OnUIDeactivate,
2037 InPlaceSiteWindowless_OnInPlaceDeactivate,
2038 InPlaceSiteWindowless_DiscardUndoState,
2039 InPlaceSiteWindowless_DeactivateAndUndo,
2040 InPlaceSiteWindowless_OnPosRectChange,
2041 InPlaceSiteWindowless_OnInPlaceActivateEx,
2042 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2043 InPlaceSiteWindowless_RequestUIActivate,
2044 InPlaceSiteWindowless_CanWindowlessActivate,
2045 InPlaceSiteWindowless_GetCapture,
2046 InPlaceSiteWindowless_SetCapture,
2047 InPlaceSiteWindowless_GetFocus,
2048 InPlaceSiteWindowless_SetFocus,
2049 InPlaceSiteWindowless_GetDC,
2050 InPlaceSiteWindowless_ReleaseDC,
2051 InPlaceSiteWindowless_InvalidateRect,
2052 InPlaceSiteWindowless_InvalidateRgn,
2053 InPlaceSiteWindowless_ScrollRect,
2054 InPlaceSiteWindowless_AdjustRect,
2055 InPlaceSiteWindowless_OnDefWindowMessage
2058 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2060 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2062 return QueryInterface(riid, ppv);
2065 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2067 return 2;
2070 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2072 return 1;
2075 typedef enum
2077 CallUIActivate_None,
2078 CallUIActivate_ActivateMe,
2079 CallUIActivate_AfterShow,
2080 } CallUIActivate;
2082 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2083 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2085 IOleDocument *document;
2086 HRESULT hres;
2088 CHECK_EXPECT(ActivateMe);
2089 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2091 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2092 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2094 if(SUCCEEDED(hres)) {
2095 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2096 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2098 if(SUCCEEDED(hres)) {
2099 IOleInPlaceActiveObject *activeobj = NULL;
2100 IOleInPlaceSite *inplacesite = NULL;
2101 HWND tmp_hwnd = NULL;
2102 static RECT rect = {0,0,400,500};
2104 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2105 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2106 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2107 inplacesite, &InPlaceSiteWindowless);
2109 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2110 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2112 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2113 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2114 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2115 inplacesite, &InPlaceSiteWindowless);
2117 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2118 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2120 if(activeobj) {
2121 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2122 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2123 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2126 if(call_UIActivate == CallUIActivate_ActivateMe) {
2127 SET_EXPECT(CanInPlaceActivate);
2128 SET_EXPECT(GetWindowContext);
2129 SET_EXPECT(GetWindow);
2130 if(ipsex)
2131 SET_EXPECT(OnInPlaceActivateEx);
2132 else
2133 SET_EXPECT(OnInPlaceActivate);
2134 SET_EXPECT(SetStatusText);
2135 SET_EXPECT(Exec_SETPROGRESSMAX);
2136 SET_EXPECT(Exec_SETPROGRESSPOS);
2137 SET_EXPECT(OnUIActivate);
2138 SET_EXPECT(SetActiveObject);
2139 SET_EXPECT(ShowUI);
2140 expect_status_text = NULL;
2142 hres = IOleDocumentView_UIActivate(view, TRUE);
2143 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2145 CHECK_CALLED(CanInPlaceActivate);
2146 CHECK_CALLED(GetWindowContext);
2147 CHECK_CALLED(GetWindow);
2148 if(ipsex)
2149 CHECK_CALLED(OnInPlaceActivateEx);
2150 else
2151 CHECK_CALLED(OnInPlaceActivate);
2152 CHECK_CALLED(SetStatusText);
2153 CHECK_CALLED(Exec_SETPROGRESSMAX);
2154 CHECK_CALLED(Exec_SETPROGRESSPOS);
2155 CHECK_CALLED(OnUIActivate);
2156 CHECK_CALLED(SetActiveObject);
2157 CHECK_CALLED(ShowUI);
2159 if(activeobj) {
2160 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2161 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2162 ok(hwnd != NULL, "hwnd == NULL\n");
2163 if(last_hwnd)
2164 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2167 hres = IOleDocumentView_UIActivate(view, TRUE);
2168 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2170 if(activeobj) {
2171 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2172 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2173 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
2177 hres = IOleDocumentView_SetRect(view, &rect);
2178 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2180 if(call_UIActivate == CallUIActivate_ActivateMe) {
2181 hres = IOleDocumentView_Show(view, TRUE);
2182 ok(hres == S_OK, "Show failed: %08x\n", hres);
2183 }else {
2184 SET_EXPECT(CanInPlaceActivate);
2185 SET_EXPECT(GetWindowContext);
2186 SET_EXPECT(GetWindow);
2187 if(ipsex)
2188 SET_EXPECT(OnInPlaceActivateEx);
2189 else
2190 SET_EXPECT(OnInPlaceActivate);
2191 SET_EXPECT(SetStatusText);
2192 SET_EXPECT(Exec_SETPROGRESSMAX);
2193 SET_EXPECT(Exec_SETPROGRESSPOS);
2194 SET_EXPECT(OnUIActivate);
2195 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2197 hres = IOleDocumentView_Show(view, TRUE);
2198 ok(hres == S_OK, "Show failed: %08x\n", hres);
2200 CHECK_CALLED(CanInPlaceActivate);
2201 CHECK_CALLED(GetWindowContext);
2202 CHECK_CALLED(GetWindow);
2203 if(ipsex)
2204 CHECK_CALLED(OnInPlaceActivateEx);
2205 else
2206 CHECK_CALLED(OnInPlaceActivate);
2207 CHECK_CALLED(SetStatusText);
2208 CHECK_CALLED(Exec_SETPROGRESSMAX);
2209 CHECK_CALLED(Exec_SETPROGRESSPOS);
2211 if(activeobj) {
2212 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2213 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2214 ok(hwnd != NULL, "hwnd == NULL\n");
2215 if(last_hwnd)
2216 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2220 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2222 if(activeobj)
2223 IOleInPlaceActiveObject_Release(activeobj);
2226 IOleDocument_Release(document);
2229 return S_OK;
2232 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2233 DocumentSite_QueryInterface,
2234 DocumentSite_AddRef,
2235 DocumentSite_Release,
2236 DocumentSite_ActivateMe
2239 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2241 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2243 return QueryInterface(riid, ppv);
2246 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2248 return 2;
2251 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2253 return 1;
2256 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2258 ok(0, "unexpected call\n");
2259 return E_NOTIMPL;
2262 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2264 ok(0, "unexpected call\n");
2265 return E_NOTIMPL;
2268 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2270 ok(0, "unexpected call\n");
2271 return E_NOTIMPL;
2274 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2275 POINTF *pPtfContainer, DWORD dwFlags)
2277 ok(0, "unexpected call\n");
2278 return E_NOTIMPL;
2281 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2282 MSG *pMsg, DWORD grfModifiers)
2284 ok(0, "unexpected call\n");
2285 return E_NOTIMPL;
2288 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2290 if(fGotFocus)
2291 CHECK_EXPECT(OnFocus_TRUE);
2292 else
2293 CHECK_EXPECT2(OnFocus_FALSE);
2294 return S_OK;
2297 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2299 ok(0, "unexpected call\n");
2300 return E_NOTIMPL;
2303 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2304 OleControlSite_QueryInterface,
2305 OleControlSite_AddRef,
2306 OleControlSite_Release,
2307 OleControlSite_OnControlInfoChanged,
2308 OleControlSite_LockInPlaceActive,
2309 OleControlSite_GetExtendedControl,
2310 OleControlSite_TransformCoords,
2311 OleControlSite_TranslateAccelerator,
2312 OleControlSite_OnFocus,
2313 OleControlSite_ShowPropertyFrame
2316 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2318 static IDocHostUIHandler2 *expect_uihandler_iface;
2320 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2322 return QueryInterface(riid, ppv);
2325 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2327 return 2;
2330 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2332 return 1;
2335 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2336 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2338 ok(0, "unexpected call\n");
2339 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2340 return E_NOTIMPL;
2343 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2345 CHECK_EXPECT(GetHostInfo);
2346 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2347 ok(pInfo != NULL, "pInfo=NULL\n");
2348 if(pInfo) {
2349 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2350 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2351 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2352 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2353 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2354 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2355 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2356 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2358 return S_OK;
2361 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2362 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2363 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2365 CHECK_EXPECT(ShowUI);
2366 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2368 if (editmode)
2369 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2370 else
2371 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2372 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2373 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2374 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2375 if (expect_InPlaceUIWindow_SetActiveObject_active)
2376 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2377 else
2378 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2380 return S_OK;
2383 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2385 CHECK_EXPECT(HideUI);
2386 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2387 return S_OK;
2390 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2392 CHECK_EXPECT(UpdateUI);
2393 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2394 return S_OK;
2397 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2399 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2400 if(fEnable)
2401 CHECK_EXPECT2(EnableModeless_TRUE);
2402 else
2403 CHECK_EXPECT2(EnableModeless_FALSE);
2404 return E_NOTIMPL;
2407 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2409 ok(0, "unexpected call\n");
2410 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2411 return E_NOTIMPL;
2414 static BOOL expect_OnFrameWindowActivate_fActivate;
2415 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2417 CHECK_EXPECT2(OnFrameWindowActivate);
2418 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2419 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2420 return S_OK;
2423 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2424 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2426 ok(0, "unexpected call\n");
2427 return E_NOTIMPL;
2430 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2431 const GUID *pguidCmdGroup, DWORD nCmdID)
2433 ok(0, "unexpected call\n");
2434 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2435 return E_NOTIMPL;
2438 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2439 LPOLESTR *pchKey, DWORD dw)
2441 CHECK_EXPECT(GetOptionKeyPath);
2442 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2443 ok(pchKey != NULL, "pchKey = NULL\n");
2444 ok(!dw, "dw=%d, expected 0\n", dw);
2445 if(pchKey)
2446 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2447 return S_OK;
2450 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2451 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2453 CHECK_EXPECT(GetDropTarget);
2454 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2455 /* TODO */
2456 return E_NOTIMPL;
2459 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2461 CHECK_EXPECT(GetExternal);
2462 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2463 *ppDispatch = &External;
2464 return S_FALSE;
2467 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2468 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2470 CHECK_EXPECT(TranslateUrl);
2471 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2472 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2473 if(!loading_hash)
2474 ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2475 else
2476 todo_wine ok(!strcmp_wa(pchURLIn, nav_serv_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_serv_url);
2477 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2478 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2480 return S_FALSE;
2483 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2484 IDataObject **ppPORet)
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_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2492 LPOLESTR *pchKey, DWORD dw)
2494 CHECK_EXPECT(GetOverrideKeyPath);
2495 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2496 ok(pchKey != NULL, "pchKey = NULL\n");
2497 if(pchKey)
2498 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2499 ok(!dw, "dw=%d, xepected 0\n", dw);
2500 return S_OK;
2503 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2504 DocHostUIHandler_QueryInterface,
2505 DocHostUIHandler_AddRef,
2506 DocHostUIHandler_Release,
2507 DocHostUIHandler_ShowContextMenu,
2508 DocHostUIHandler_GetHostInfo,
2509 DocHostUIHandler_ShowUI,
2510 DocHostUIHandler_HideUI,
2511 DocHostUIHandler_UpdateUI,
2512 DocHostUIHandler_EnableModeless,
2513 DocHostUIHandler_OnDocWindowActivate,
2514 DocHostUIHandler_OnFrameWindowActivate,
2515 DocHostUIHandler_ResizeBorder,
2516 DocHostUIHandler_TranslateAccelerator,
2517 DocHostUIHandler_GetOptionKeyPath,
2518 DocHostUIHandler_GetDropTarget,
2519 DocHostUIHandler_GetExternal,
2520 DocHostUIHandler_TranslateUrl,
2521 DocHostUIHandler_FilterDataObject,
2522 DocHostUIHandler_GetOverrideKeyPath
2525 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2527 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2529 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2530 *ppv = iface;
2531 return S_OK;
2534 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2535 return E_NOINTERFACE;
2537 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2538 return E_NOINTERFACE; /* TODO */
2540 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2541 return E_NOINTERFACE;
2544 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2545 CustomDocHostUIHandler_QueryInterface,
2546 DocHostUIHandler_AddRef,
2547 DocHostUIHandler_Release,
2548 DocHostUIHandler_ShowContextMenu,
2549 DocHostUIHandler_GetHostInfo,
2550 DocHostUIHandler_ShowUI,
2551 DocHostUIHandler_HideUI,
2552 DocHostUIHandler_UpdateUI,
2553 DocHostUIHandler_EnableModeless,
2554 DocHostUIHandler_OnDocWindowActivate,
2555 DocHostUIHandler_OnFrameWindowActivate,
2556 DocHostUIHandler_ResizeBorder,
2557 DocHostUIHandler_TranslateAccelerator,
2558 DocHostUIHandler_GetOptionKeyPath,
2559 DocHostUIHandler_GetDropTarget,
2560 DocHostUIHandler_GetExternal,
2561 DocHostUIHandler_TranslateUrl,
2562 DocHostUIHandler_FilterDataObject,
2563 DocHostUIHandler_GetOverrideKeyPath
2566 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2568 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2569 REFIID riid, void **ppv)
2571 return QueryInterface(riid, ppv);
2574 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2576 return 2;
2579 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2581 return 1;
2584 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2585 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2587 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2588 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2589 ok(!pCmdText, "pCmdText != NULL\n");
2591 switch(prgCmds[0].cmdID) {
2592 case OLECMDID_SETPROGRESSTEXT:
2593 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2594 prgCmds[0].cmdf = OLECMDF_ENABLED;
2595 return S_OK;
2596 case OLECMDID_OPEN:
2597 CHECK_EXPECT(QueryStatus_OPEN);
2598 prgCmds[0].cmdf = 0;
2599 return S_OK;
2600 case OLECMDID_NEW:
2601 CHECK_EXPECT(QueryStatus_NEW);
2602 prgCmds[0].cmdf = 0;
2603 return S_OK;
2604 default:
2605 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2608 return E_FAIL;
2611 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2612 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2614 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2615 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2616 test_readyState(NULL);
2618 if(!pguidCmdGroup) {
2619 switch(nCmdID) {
2620 case OLECMDID_SETPROGRESSMAX:
2621 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2622 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2623 ok(pvaIn != NULL, "pvaIn == NULL\n");
2624 if(pvaIn) {
2625 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2626 if(load_state == LD_NO)
2627 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2629 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2630 return S_OK;
2631 case OLECMDID_SETPROGRESSPOS:
2632 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2633 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2634 ok(pvaIn != NULL, "pvaIn == NULL\n");
2635 if(pvaIn) {
2636 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2637 if(load_state == LD_NO)
2638 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2640 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2641 return S_OK;
2642 case OLECMDID_HTTPEQUIV_DONE:
2643 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2644 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2645 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2646 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2647 readystate_set_loading = FALSE;
2648 readystate_set_interactive = FALSE;
2649 load_state = LD_COMPLETE;
2650 return S_OK;
2651 case OLECMDID_SETDOWNLOADSTATE:
2652 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2653 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2654 ok(pvaIn != NULL, "pvaIn == NULL\n");
2655 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2657 switch(V_I4(pvaIn)) {
2658 case 0:
2659 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2660 if(!loading_js)
2661 load_state = LD_INTERACTIVE;
2662 break;
2663 case 1:
2664 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2665 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2666 break;
2667 default:
2668 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2671 return S_OK;
2672 case OLECMDID_UPDATECOMMANDS:
2673 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2674 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2675 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2676 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2677 return S_OK;
2678 case OLECMDID_SETTITLE:
2679 CHECK_EXPECT2(Exec_SETTITLE);
2680 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2681 ok(pvaIn != NULL, "pvaIn == NULL\n");
2682 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2683 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2684 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2685 return S_OK;
2686 case OLECMDID_HTTPEQUIV:
2687 CHECK_EXPECT2(Exec_HTTPEQUIV);
2688 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2689 ok(pvaIn != NULL, "pvaIn == NULL\n");
2690 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2691 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2692 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2693 test_readyState(NULL);
2694 return S_OK;
2695 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2696 case 6058:
2697 return E_FAIL; /* FIXME */
2698 default:
2699 ok(0, "unexpected command %d\n", nCmdID);
2700 return E_FAIL;
2704 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2705 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2707 switch(nCmdID) {
2708 case 37:
2709 CHECK_EXPECT2(Exec_ShellDocView_37);
2711 if(nav_url)
2712 test_GetCurMoniker(doc_unk, NULL, nav_url);
2713 else if(load_from_stream)
2714 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2715 else if(!editmode)
2716 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2718 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2719 ok(pvaIn != NULL, "pvaIn == NULL\n");
2720 if(pvaIn) {
2721 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2722 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2724 return S_OK;
2726 case 63: {
2727 IHTMLPrivateWindow *priv_window;
2728 HRESULT hres;
2730 CHECK_EXPECT(Exec_ShellDocView_63);
2731 ok(pvaIn != NULL, "pvaIn == NULL\n");
2732 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2733 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2734 ok(pvaOut != NULL, "pvaOut == NULL\n");
2735 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2737 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2738 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2739 if(SUCCEEDED(hres))
2740 IHTMLPrivateWindow_Release(priv_window);
2742 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2743 return S_OK; /* TODO */
2746 case 67:
2747 CHECK_EXPECT(Exec_ShellDocView_67);
2748 ok(pvaIn != NULL, "pvaIn == NULL\n");
2749 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2750 if(!loading_hash)
2751 ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2752 else
2753 todo_wine ok(!strcmp_wa(V_BSTR(pvaIn), nav_serv_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_serv_url);
2754 ok(pvaOut != NULL, "pvaOut == NULL\n");
2755 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2756 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2757 if(!loading_hash)
2758 load_state = LD_DOLOAD;
2759 return S_OK;
2761 case 84:
2762 CHECK_EXPECT2(Exec_ShellDocView_84);
2764 ok(pvaIn == NULL, "pvaIn != NULL\n");
2765 ok(pvaOut != NULL, "pvaOut == NULL\n");
2766 if(pvaIn)
2767 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2769 return E_NOTIMPL;
2771 case 103:
2772 CHECK_EXPECT2(Exec_ShellDocView_103);
2774 ok(pvaIn == NULL, "pvaIn != NULL\n");
2775 ok(pvaOut == NULL, "pvaOut != NULL\n");
2777 return E_NOTIMPL;
2779 case 105:
2780 CHECK_EXPECT2(Exec_ShellDocView_105);
2782 ok(pvaIn != NULL, "pvaIn == NULL\n");
2783 ok(pvaOut == NULL, "pvaOut != NULL\n");
2785 return E_NOTIMPL;
2787 case 140:
2788 CHECK_EXPECT2(Exec_ShellDocView_140);
2790 ok(pvaIn == NULL, "pvaIn != NULL\n");
2791 ok(pvaOut == NULL, "pvaOut != NULL\n");
2793 return E_NOTIMPL;
2795 case 143: /* TODO */
2796 case 144: /* TODO */
2797 return E_NOTIMPL;
2799 default:
2800 ok(0, "unexpected command %d\n", nCmdID);
2801 return E_FAIL;
2805 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2806 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2808 switch(nCmdID) {
2809 case IDM_PARSECOMPLETE:
2810 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2811 ok(pvaIn == NULL, "pvaIn != NULL\n");
2812 ok(pvaOut == NULL, "pvaOut != NULL\n");
2813 return S_OK;
2814 default:
2815 ok(0, "unexpected command %d\n", nCmdID);
2819 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2820 switch(nCmdID) {
2821 case DOCHOST_DOCCANNAVIGATE:
2822 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2823 ok(pvaIn != NULL, "pvaIn == NULL\n");
2824 ok(pvaOut == NULL, "pvaOut != NULL\n");
2825 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2826 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2827 return S_OK;
2828 case 1: {
2829 SAFEARRAY *sa;
2830 UINT dim;
2831 LONG ind=0;
2832 VARIANT var;
2833 HRESULT hres;
2835 ok(pvaIn != NULL, "pvaIn == NULL\n");
2836 ok(pvaOut != NULL, "pvaOut != NULL\n");
2837 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2838 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2839 sa = V_ARRAY(pvaIn);
2841 dim = SafeArrayGetDim(sa);
2842 ok(dim == 1, "dim = %d\n", dim);
2843 hres = SafeArrayGetLBound(sa, 1, &ind);
2844 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2845 ok(ind == 0, "Lower bound = %d\n", ind);
2846 hres = SafeArrayGetUBound(sa, 1, &ind);
2847 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2848 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2850 ind = 0;
2851 SafeArrayGetElement(sa, &ind, &var);
2852 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2853 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2854 VariantClear(&var);
2855 ind = 1;
2856 SafeArrayGetElement(sa, &ind, &var);
2857 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2858 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2859 VariantClear(&var);
2860 ind = 2;
2861 SafeArrayGetElement(sa, &ind, &var);
2862 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2863 VariantClear(&var);
2864 ind = 3;
2865 SafeArrayGetElement(sa, &ind, &var);
2866 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2867 VariantClear(&var);
2868 ind = 4;
2869 SafeArrayGetElement(sa, &ind, &var);
2870 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2871 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2872 VariantClear(&var);
2873 ind = 5;
2874 SafeArrayGetElement(sa, &ind, &var);
2875 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2876 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2877 VariantClear(&var);
2879 default:
2880 return E_FAIL; /* TODO */
2884 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2885 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2887 switch(nCmdID) {
2888 case 69:
2889 CHECK_EXPECT2(Exec_Explorer_69);
2890 ok(pvaIn == NULL, "pvaIn != NULL\n");
2891 ok(pvaOut != NULL, "pvaOut == NULL\n");
2892 return E_NOTIMPL;
2893 case 109: /* TODO */
2894 return E_NOTIMPL;
2895 default:
2896 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2898 return E_NOTIMPL;
2901 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2902 switch (nCmdID) {
2903 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2904 SET_EXPECT(SetStatusText);
2905 ok(pvaIn == NULL, "pvaIn != NULL\n");
2906 ok(pvaOut == NULL, "pvaOut != NULL\n");
2907 return S_OK;
2908 case OLECMDID_SHOWSCRIPTERROR:
2909 /* TODO */
2910 return S_OK;
2911 default:
2912 ok(0, "unexpected command %d\n", nCmdID);
2913 return E_FAIL;
2917 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2918 return E_NOTIMPL;
2921 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2922 OleCommandTarget_QueryInterface,
2923 OleCommandTarget_AddRef,
2924 OleCommandTarget_Release,
2925 OleCommandTarget_QueryStatus,
2926 OleCommandTarget_Exec
2929 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2931 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2933 return QueryInterface(riid, ppv);
2936 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2937 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2938 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2940 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2941 ok(pDispParams != NULL, "pDispParams == NULL\n");
2942 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2943 ok(puArgErr != NULL, "puArgErr == NULL\n");
2944 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2945 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2946 test_readyState(NULL);
2948 switch(dispIdMember) {
2949 case DISPID_AMBIENT_USERMODE:
2950 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2951 V_VT(pVarResult) = VT_BOOL;
2952 V_BOOL(pVarResult) = VARIANT_TRUE;
2953 return S_OK;
2954 case DISPID_AMBIENT_DLCONTROL:
2955 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2956 return E_FAIL;
2957 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2958 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2959 return E_FAIL;
2960 case DISPID_AMBIENT_SILENT:
2961 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2962 V_VT(pVarResult) = VT_BOOL;
2963 V_BOOL(pVarResult) = VARIANT_FALSE;
2964 return S_OK;
2965 case DISPID_AMBIENT_USERAGENT:
2966 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2967 return E_FAIL;
2968 case DISPID_AMBIENT_PALETTE:
2969 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2970 return E_FAIL;
2973 ok(0, "unexpected dispid %d\n", dispIdMember);
2974 return E_FAIL;
2977 static const IDispatchVtbl DispatchVtbl = {
2978 Dispatch_QueryInterface,
2979 Dispatch_AddRef,
2980 Dispatch_Release,
2981 Dispatch_GetTypeInfoCount,
2982 Dispatch_GetTypeInfo,
2983 Dispatch_GetIDsOfNames,
2984 Dispatch_Invoke
2987 static IDispatch Dispatch = { &DispatchVtbl };
2989 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2991 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
2992 *ppv = iface;
2993 return S_OK;
2996 ok(0, "Unexpected call\n");
2997 return E_NOINTERFACE;
3000 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
3001 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3002 EXCEPINFO *pExcepInfo, UINT *puArgErr)
3004 HRESULT hres;
3005 IHTMLDocument2 *doc;
3006 BSTR state;
3008 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
3009 ok(pDispParams != NULL, "pDispParams == NULL\n");
3010 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
3011 ok(puArgErr != NULL, "puArgErr == NULL\n");
3012 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
3013 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
3015 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
3016 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3018 switch(dispIdMember) {
3019 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
3020 hres = IHTMLDocument2_get_readyState(doc, &state);
3021 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3023 if(!strcmp_wa(state, "interactive"))
3024 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
3025 else if(!strcmp_wa(state, "loading"))
3026 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
3027 else if(!strcmp_wa(state, "complete")) {
3028 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
3029 complete = TRUE;
3030 } else
3031 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3033 SysFreeString(state);
3034 break;
3035 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3036 case 1026:
3037 case 1027:
3038 case 1034:
3039 case 1035:
3040 case 1037:
3041 case 1047:
3042 case 1045:
3043 case 1044:
3044 case 1048:
3045 case 1049:
3046 break; /* FIXME: Handle these events. */
3047 default:
3048 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3051 IHTMLDocument2_Release(doc);
3052 return S_OK;
3055 static const IDispatchVtbl EventDispatchVtbl = {
3056 EventDispatch_QueryInterface,
3057 Dispatch_AddRef,
3058 Dispatch_Release,
3059 Dispatch_GetTypeInfoCount,
3060 Dispatch_GetTypeInfo,
3061 Dispatch_GetIDsOfNames,
3062 EventDispatch_Invoke
3065 static IDispatch EventDispatch = { &EventDispatchVtbl };
3067 static HRESULT browserservice_qi(REFIID,void**);
3069 static HRESULT WINAPI DocObjectService_QueryInterface(IDocObjectService* This, REFIID riid, void **ppv)
3071 return browserservice_qi(riid, ppv);
3074 static ULONG WINAPI DocObjectService_AddRef(
3075 IDocObjectService* This)
3077 return 2;
3080 static ULONG WINAPI DocObjectService_Release(
3081 IDocObjectService* This)
3083 return 1;
3086 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(IDocObjectService *iface, IDispatch *pDispatch,
3087 LPCWSTR lpszUrl, DWORD dwFlags, LPCWSTR lpszFrameName, BYTE *pPostData, DWORD cbPostData,
3088 LPCWSTR lpszHeaders, BOOL fPlayNavSound, BOOL *pfCancel)
3090 CHECK_EXPECT(FireBeforeNavigate2);
3092 ok(!pDispatch, "pDispatch = %p\n", pDispatch);
3093 ok(!strcmp_wa(lpszUrl, nav_url), "lpszUrl = %s, expected %s\n", wine_dbgstr_w(lpszUrl), nav_url);
3094 ok(dwFlags == 0x40 || !dwFlags, "dwFlags = %x\n", dwFlags);
3095 ok(!lpszFrameName, "lpszFrameName = %s\n", wine_dbgstr_w(lpszFrameName));
3096 ok(!pPostData, "pPostData = %p\n", pPostData);
3097 ok(!cbPostData, "cbPostData = %d\n", cbPostData);
3098 ok(!lpszHeaders, "lpszHeaders = %s\n", wine_dbgstr_w(lpszHeaders));
3099 ok(fPlayNavSound, "fPlayNavSound = %x\n", fPlayNavSound);
3100 ok(pfCancel != NULL, "pfCancel = NULL\n");
3101 ok(!*pfCancel, "*pfCancel = %x\n", *pfCancel);
3103 return S_OK;
3106 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3107 IDocObjectService* This,
3108 IHTMLWindow2 *pHTMLWindow2,
3109 DWORD dwFlags)
3111 CHECK_EXPECT(FireNavigateComplete2);
3112 test_readyState(NULL);
3114 if(loading_hash)
3115 ok(dwFlags == 0x10 || broken(!dwFlags), "dwFlags = %x, expected 0x10\n", dwFlags);
3116 else
3117 ok(!(dwFlags &~1), "dwFlags = %x\n", dwFlags);
3119 ok(pHTMLWindow2 != NULL, "pHTMLWindow2 = NULL\n");
3121 return S_OK;
3124 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3125 IDocObjectService* This)
3127 ok(0, "unexpected call\n");
3128 return E_NOTIMPL;
3131 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3132 IDocObjectService* This)
3134 ok(0, "unexpected call\n");
3135 return E_NOTIMPL;
3138 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3139 IDocObjectService* This,
3140 IHTMLWindow2 *pHTMLWindow,
3141 DWORD dwFlags)
3143 CHECK_EXPECT(FireDocumentComplete);
3145 ok(pHTMLWindow != NULL, "pHTMLWindow == NULL\n");
3146 ok(!dwFlags, "dwFlags = %x\n", dwFlags);
3148 return S_OK;
3151 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3152 IDocObjectService* This,
3153 IHTMLWindow2 *pHTMLWindow)
3155 ok(0, "unexpected call\n");
3156 return E_NOTIMPL;
3159 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3160 IDocObjectService* This,
3161 BSTR *pbstrPendingUrl)
3163 CHECK_EXPECT(GetPendingUrl);
3164 return E_NOTIMPL;
3167 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3168 IDocObjectService* This,
3169 IHTMLElement *pHTMLElement)
3171 CHECK_EXPECT(ActiveElementChanged);
3172 return E_NOTIMPL;
3175 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3176 IDocObjectService* This,
3177 BSTR *pbstrSearch)
3179 ok(0, "unexpected call\n");
3180 return E_NOTIMPL;
3183 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3184 IDocObjectService* This,
3185 LPCWSTR lpszUrl,
3186 BOOL *pfIsError)
3188 CHECK_EXPECT(IsErrorUrl);
3189 *pfIsError = FALSE;
3190 return S_OK;
3193 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3194 DocObjectService_QueryInterface,
3195 DocObjectService_AddRef,
3196 DocObjectService_Release,
3197 DocObjectService_FireBeforeNavigate2,
3198 DocObjectService_FireNavigateComplete2,
3199 DocObjectService_FireDownloadBegin,
3200 DocObjectService_FireDownloadComplete,
3201 DocObjectService_FireDocumentComplete,
3202 DocObjectService_UpdateDesktopComponent,
3203 DocObjectService_GetPendingUrl,
3204 DocObjectService_ActiveElementChanged,
3205 DocObjectService_GetUrlSearchComponent,
3206 DocObjectService_IsErrorUrl
3209 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3211 static HRESULT WINAPI ShellBrowser_QueryInterface(IShellBrowser *iface, REFIID riid, void **ppv)
3213 return browserservice_qi(riid, ppv);
3216 static ULONG WINAPI ShellBrowser_AddRef(IShellBrowser *iface)
3218 return 2;
3221 static ULONG WINAPI ShellBrowser_Release(IShellBrowser *iface)
3223 return 1;
3226 static HRESULT WINAPI ShellBrowser_GetWindow(IShellBrowser *iface, HWND *phwnd)
3228 ok(0, "unexpected call\n");
3229 return E_NOTIMPL;
3232 static HRESULT WINAPI ShellBrowser_ContextSensitiveHelp(IShellBrowser *iface, BOOL fEnterMode)
3234 ok(0, "unexpected call\n");
3235 return E_NOTIMPL;
3238 static HRESULT WINAPI ShellBrowser_InsertMenusSB(IShellBrowser *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
3240 ok(0, "unexpected call\n");
3241 return E_NOTIMPL;
3244 static HRESULT WINAPI ShellBrowser_SetMenuSB(IShellBrowser *iface, HMENU hmenuShared, HOLEMENU holemenuReserved,
3245 HWND hwndActiveObject)
3247 ok(0, "unexpected call\n");
3248 return E_NOTIMPL;
3251 static HRESULT WINAPI ShellBrowser_RemoveMenusSB(IShellBrowser *iface, HMENU hmenuShared)
3253 ok(0, "unexpected call\n");
3254 return E_NOTIMPL;
3257 static HRESULT WINAPI ShellBrowser_SetStatusTextSB(IShellBrowser *iface, LPCOLESTR pszStatusText)
3259 ok(0, "unexpected call\n");
3260 return E_NOTIMPL;
3263 static HRESULT WINAPI ShellBrowser_EnableModelessSB(IShellBrowser *iface, BOOL fEnable)
3265 ok(0, "unexpected call\n");
3266 return E_NOTIMPL;
3269 static HRESULT WINAPI ShellBrowser_TranslateAcceleratorSB(IShellBrowser *iface, MSG *pmsg, WORD wID)
3271 ok(0, "unexpected call\n");
3272 return E_NOTIMPL;
3275 static HRESULT WINAPI ShellBrowser_BrowseObject(IShellBrowser *iface, LPCITEMIDLIST pidl, UINT wFlags)
3277 ok(0, "unexpected call\n");
3278 return E_NOTIMPL;
3281 static HRESULT WINAPI ShellBrowser_GetViewStateStream(IShellBrowser *iface, DWORD grfMode, IStream **ppStrm)
3283 ok(0, "unexpected call\n");
3284 return E_NOTIMPL;
3287 static HRESULT WINAPI ShellBrowser_GetControlWindow(IShellBrowser *iface, UINT id, HWND *phwnd)
3289 ok(0, "unexpected call\n");
3290 return E_NOTIMPL;
3293 static HRESULT WINAPI ShellBrowser_SendControlMsg(IShellBrowser *iface, UINT id, UINT uMsg, WPARAM wParam,
3294 LPARAM lParam, LRESULT *pret)
3296 ok(0, "unexpected call\n");
3297 return E_NOTIMPL;
3300 static HRESULT WINAPI ShellBrowser_QueryActiveShellView(IShellBrowser *iface, IShellView **ppshv)
3302 ok(0, "unexpected call\n");
3303 return E_NOTIMPL;
3306 static HRESULT WINAPI ShellBrowser_OnViewWindowActive(IShellBrowser* iface, IShellView *pshv)
3308 ok(0, "unexpected call\n");
3309 return E_NOTIMPL;
3312 static HRESULT WINAPI ShellBrowser_SetToolbarItems(IShellBrowser *iface, LPTBBUTTONSB lpButtons,
3313 UINT nButtons, UINT uFlags)
3315 ok(0, "unexpected call\n");
3316 return E_NOTIMPL;
3319 static const IShellBrowserVtbl ShellBrowserVtbl = {
3320 ShellBrowser_QueryInterface,
3321 ShellBrowser_AddRef,
3322 ShellBrowser_Release,
3323 ShellBrowser_GetWindow,
3324 ShellBrowser_ContextSensitiveHelp,
3325 ShellBrowser_InsertMenusSB,
3326 ShellBrowser_SetMenuSB,
3327 ShellBrowser_RemoveMenusSB,
3328 ShellBrowser_SetStatusTextSB,
3329 ShellBrowser_EnableModelessSB,
3330 ShellBrowser_TranslateAcceleratorSB,
3331 ShellBrowser_BrowseObject,
3332 ShellBrowser_GetViewStateStream,
3333 ShellBrowser_GetControlWindow,
3334 ShellBrowser_SendControlMsg,
3335 ShellBrowser_QueryActiveShellView,
3336 ShellBrowser_OnViewWindowActive,
3337 ShellBrowser_SetToolbarItems
3340 static IShellBrowser ShellBrowser = { &ShellBrowserVtbl };
3342 static HRESULT WINAPI BrowserService_QueryInterface(IBrowserService *iface, REFIID riid, void **ppv)
3344 return browserservice_qi(riid, ppv);
3347 static ULONG WINAPI BrowserService_AddRef(
3348 IBrowserService* This)
3350 return 2;
3353 static ULONG WINAPI BrowserService_Release(
3354 IBrowserService* This)
3356 return 1;
3359 static HRESULT WINAPI BrowserService_GetParentSite(
3360 IBrowserService* This,
3361 IOleInPlaceSite **ppipsite)
3363 ok(0, "unexpected call\n");
3364 return E_NOTIMPL;
3367 static HRESULT WINAPI BrowserService_SetTitle(
3368 IBrowserService* This,
3369 IShellView *psv,
3370 LPCWSTR pszName)
3372 ok(0, "unexpected call\n");
3373 return E_NOTIMPL;
3376 static HRESULT WINAPI BrowserService_GetTitle(
3377 IBrowserService* This,
3378 IShellView *psv,
3379 LPWSTR pszName,
3380 DWORD cchName)
3382 ok(0, "unexpected call\n");
3383 return E_NOTIMPL;
3386 static HRESULT WINAPI BrowserService_GetOleObject(
3387 IBrowserService* This,
3388 IOleObject **ppobjv)
3390 ok(0, "unexpected call\n");
3391 return E_NOTIMPL;
3394 static HRESULT WINAPI BrowserService_GetTravelLog(
3395 IBrowserService* This,
3396 ITravelLog **pptl)
3398 CHECK_EXPECT(GetTravelLog);
3399 return E_NOTIMPL;
3402 static HRESULT WINAPI BrowserService_ShowControlWindow(
3403 IBrowserService* This,
3404 UINT id,
3405 BOOL fShow)
3407 ok(0, "unexpected call\n");
3408 return E_NOTIMPL;
3411 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3412 IBrowserService* This,
3413 UINT id,
3414 BOOL *pfShown)
3416 ok(0, "unexpected call\n");
3417 return E_NOTIMPL;
3420 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3421 IBrowserService* This,
3422 PCIDLIST_ABSOLUTE pidl,
3423 LPWSTR pwszName,
3424 UINT uFlags)
3426 ok(0, "unexpected call\n");
3427 return E_NOTIMPL;
3430 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3431 IBrowserService* This,
3432 UINT uiCP,
3433 LPCWSTR pwszPath,
3434 PIDLIST_ABSOLUTE *ppidlOut)
3436 ok(0, "unexpected call\n");
3437 return E_NOTIMPL;
3440 static HRESULT WINAPI BrowserService_DisplayParseError(
3441 IBrowserService* This,
3442 HRESULT hres,
3443 LPCWSTR pwszPath)
3445 ok(0, "unexpected call\n");
3446 return E_NOTIMPL;
3449 static HRESULT WINAPI BrowserService_NavigateToPidl(
3450 IBrowserService* This,
3451 PCIDLIST_ABSOLUTE pidl,
3452 DWORD grfHLNF)
3454 ok(0, "unexpected call\n");
3455 return E_NOTIMPL;
3458 static HRESULT WINAPI BrowserService_SetNavigateState(
3459 IBrowserService* This,
3460 BNSTATE bnstate)
3462 ok(0, "unexpected call\n");
3463 return E_NOTIMPL;
3466 static HRESULT WINAPI BrowserService_GetNavigateState(
3467 IBrowserService* This,
3468 BNSTATE *pbnstate)
3470 ok(0, "unexpected call\n");
3471 return E_NOTIMPL;
3474 static HRESULT WINAPI BrowserService_NotifyRedirect(
3475 IBrowserService* This,
3476 IShellView *psv,
3477 PCIDLIST_ABSOLUTE pidl,
3478 BOOL *pfDidBrowse)
3480 ok(0, "unexpected call\n");
3481 return E_NOTIMPL;
3484 static HRESULT WINAPI BrowserService_UpdateWindowList(
3485 IBrowserService* This)
3487 ok(0, "unexpected call\n");
3488 return E_NOTIMPL;
3491 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3492 IBrowserService* This)
3494 CHECK_EXPECT(UpdateBackForwardState);
3495 return S_OK;
3498 static HRESULT WINAPI BrowserService_SetFlags(
3499 IBrowserService* This,
3500 DWORD dwFlags,
3501 DWORD dwFlagMask)
3503 ok(0, "unexpected call\n");
3504 return E_NOTIMPL;
3507 static HRESULT WINAPI BrowserService_GetFlags(
3508 IBrowserService* This,
3509 DWORD *pdwFlags)
3511 ok(0, "unexpected call\n");
3512 return E_NOTIMPL;
3515 static HRESULT WINAPI BrowserService_CanNavigateNow(
3516 IBrowserService* This)
3518 ok(0, "unexpected call\n");
3519 return E_NOTIMPL;
3522 static HRESULT WINAPI BrowserService_GetPidl(
3523 IBrowserService* This,
3524 PIDLIST_ABSOLUTE *ppidl)
3526 ok(0, "unexpected call\n");
3527 return E_NOTIMPL;
3530 static HRESULT WINAPI BrowserService_SetReferrer(
3531 IBrowserService* This,
3532 PCIDLIST_ABSOLUTE pidl)
3534 ok(0, "unexpected call\n");
3535 return E_NOTIMPL;
3538 static DWORD WINAPI BrowserService_GetBrowserIndex(
3539 IBrowserService* This)
3541 ok(0, "unexpected call\n");
3542 return E_NOTIMPL;
3545 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3546 IBrowserService* This,
3547 DWORD dwID,
3548 IUnknown **ppunk)
3550 ok(0, "unexpected call\n");
3551 return E_NOTIMPL;
3554 static HRESULT WINAPI BrowserService_GetHistoryObject(
3555 IBrowserService* This,
3556 IOleObject **ppole,
3557 IStream **pstm,
3558 IBindCtx **ppbc)
3560 ok(0, "unexpected call\n");
3561 return E_NOTIMPL;
3564 static HRESULT WINAPI BrowserService_SetHistoryObject(
3565 IBrowserService* This,
3566 IOleObject *pole,
3567 BOOL fIsLocalAnchor)
3569 ok(0, "unexpected call\n");
3570 return E_NOTIMPL;
3573 static HRESULT WINAPI BrowserService_CacheOLEServer(
3574 IBrowserService* This,
3575 IOleObject *pole)
3577 ok(0, "unexpected call\n");
3578 return E_NOTIMPL;
3581 static HRESULT WINAPI BrowserService_GetSetCodePage(
3582 IBrowserService* This,
3583 VARIANT *pvarIn,
3584 VARIANT *pvarOut)
3586 ok(0, "unexpected call\n");
3587 return E_NOTIMPL;
3590 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3591 IBrowserService* This,
3592 IShellView *psv,
3593 BOOL fDone,
3594 VARIANT *pvarargIn,
3595 VARIANT *pvarargOut)
3597 ok(0, "unexpected call\n");
3598 return E_NOTIMPL;
3601 static HRESULT WINAPI BrowserService_GetPalette(
3602 IBrowserService* This,
3603 HPALETTE *hpal)
3605 ok(0, "unexpected call\n");
3606 return E_NOTIMPL;
3609 static HRESULT WINAPI BrowserService_RegisterWindow(
3610 IBrowserService* This,
3611 BOOL fForceRegister,
3612 int swc)
3614 ok(0, "unexpected call\n");
3615 return E_NOTIMPL;
3618 static IBrowserServiceVtbl BrowserServiceVtbl = {
3619 BrowserService_QueryInterface,
3620 BrowserService_AddRef,
3621 BrowserService_Release,
3622 BrowserService_GetParentSite,
3623 BrowserService_SetTitle,
3624 BrowserService_GetTitle,
3625 BrowserService_GetOleObject,
3626 BrowserService_GetTravelLog,
3627 BrowserService_ShowControlWindow,
3628 BrowserService_IsControlWindowShown,
3629 BrowserService_IEGetDisplayName,
3630 BrowserService_IEParseDisplayName,
3631 BrowserService_DisplayParseError,
3632 BrowserService_NavigateToPidl,
3633 BrowserService_SetNavigateState,
3634 BrowserService_GetNavigateState,
3635 BrowserService_NotifyRedirect,
3636 BrowserService_UpdateWindowList,
3637 BrowserService_UpdateBackForwardState,
3638 BrowserService_SetFlags,
3639 BrowserService_GetFlags,
3640 BrowserService_CanNavigateNow,
3641 BrowserService_GetPidl,
3642 BrowserService_SetReferrer,
3643 BrowserService_GetBrowserIndex,
3644 BrowserService_GetBrowserByIndex,
3645 BrowserService_GetHistoryObject,
3646 BrowserService_SetHistoryObject,
3647 BrowserService_CacheOLEServer,
3648 BrowserService_GetSetCodePage,
3649 BrowserService_OnHttpEquiv,
3650 BrowserService_GetPalette,
3651 BrowserService_RegisterWindow
3654 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3656 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3658 static HRESULT browserservice_qi(REFIID riid, void **ppv)
3660 if(IsEqualGUID(&IID_IShellBrowser, riid)) {
3661 *ppv = &ShellBrowser;
3662 return S_OK;
3665 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3666 *ppv = &DocObjectService;
3667 return S_OK;
3670 if(IsEqualGUID(&IID_IBrowserService, riid)) {
3671 *ppv = &BrowserService;
3672 return S_OK;
3675 *ppv = NULL;
3676 return E_NOINTERFACE;
3679 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, void **ppv)
3681 *ppv = NULL;
3683 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IWebBrowser, riid)
3684 || IsEqualGUID(&IID_IWebBrowserApp, riid) || IsEqualGUID(&IID_IWebBrowser2, riid)) {
3685 *ppv = iface;
3686 return S_OK;
3689 if(IsEqualGUID(riid, &IID_IOleObject))
3690 return E_NOINTERFACE; /* TODO */
3692 ok(0, "unexpected call %s\n", debugstr_guid(riid));
3693 return E_NOINTERFACE;
3696 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
3698 return 2;
3701 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
3703 return 1;
3706 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
3708 ok(0, "unexpected call\n");
3709 return E_NOTIMPL;
3712 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
3713 LPTYPEINFO *ppTInfo)
3715 ok(0, "unexpected call\n");
3716 return E_NOTIMPL;
3719 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
3720 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
3722 ok(0, "unexpected call\n");
3723 return E_NOTIMPL;
3726 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
3727 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
3728 EXCEPINFO *pExepInfo, UINT *puArgErr)
3730 ok(0, "unexpected call\n");
3731 return E_NOTIMPL;
3734 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
3736 ok(0, "unexpected call\n");
3737 return E_NOTIMPL;
3740 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
3742 ok(0, "unexpected call\n");
3743 return E_NOTIMPL;
3746 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
3748 ok(0, "unexpected call\n");
3749 return E_NOTIMPL;
3752 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
3754 ok(0, "unexpected call\n");
3755 return E_NOTIMPL;
3758 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
3759 VARIANT *Flags, VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
3761 ok(0, "unexpected call\n");
3762 return E_NOTIMPL;
3765 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
3767 ok(0, "unexpected call\n");
3768 return E_NOTIMPL;
3771 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
3773 ok(0, "unexpected call\n");
3774 return E_NOTIMPL;
3777 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
3779 ok(0, "unexpected call\n");
3780 return E_NOTIMPL;
3783 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
3785 ok(0, "unexpected call\n");
3786 return E_NOTIMPL;
3789 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
3791 ok(0, "unexpected call\n");
3792 return E_NOTIMPL;
3795 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
3797 ok(0, "unexpected call\n");
3798 return E_NOTIMPL;
3801 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
3803 ok(0, "unexpected call\n");
3804 return E_NOTIMPL;
3807 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
3809 ok(0, "unexpected call\n");
3810 return E_NOTIMPL;
3813 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
3815 ok(0, "unexpected call\n");
3816 return E_NOTIMPL;
3819 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
3821 ok(0, "unexpected call\n");
3822 return E_NOTIMPL;
3825 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
3827 ok(0, "unexpected call\n");
3828 return E_NOTIMPL;
3831 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
3833 ok(0, "unexpected call\n");
3834 return E_NOTIMPL;
3837 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
3839 ok(0, "unexpected call\n");
3840 return E_NOTIMPL;
3843 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
3845 ok(0, "unexpected call\n");
3846 return E_NOTIMPL;
3849 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
3851 ok(0, "unexpected call\n");
3852 return E_NOTIMPL;
3855 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
3857 ok(0, "unexpected call\n");
3858 return E_NOTIMPL;
3861 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
3863 ok(0, "unexpected call\n");
3864 return E_NOTIMPL;
3867 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
3869 ok(0, "unexpected call\n");
3870 return E_NOTIMPL;
3873 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
3875 CHECK_EXPECT(get_LocationURL);
3876 return E_NOTIMPL;
3879 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
3881 ok(0, "unexpected call\n");
3882 return E_NOTIMPL;
3885 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
3887 ok(0, "unexpected call\n");
3888 return E_NOTIMPL;
3891 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
3893 ok(0, "unexpected call\n");
3894 return E_NOTIMPL;
3897 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
3899 ok(0, "unexpected call\n");
3900 return E_NOTIMPL;
3903 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
3905 ok(0, "unexpected call\n");
3906 return E_NOTIMPL;
3909 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
3911 ok(0, "unexpected call\n");
3912 return E_NOTIMPL;
3915 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, LONG *pHWND)
3917 ok(0, "unexpected call\n");
3918 return E_NOTIMPL;
3921 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
3923 ok(0, "unexpected call\n");
3924 return E_NOTIMPL;
3927 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
3929 ok(0, "unexpected call\n");
3930 return E_NOTIMPL;
3933 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
3935 ok(0, "unexpected call\n");
3936 return E_NOTIMPL;
3939 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
3941 ok(0, "unexpected call\n");
3942 return E_NOTIMPL;
3945 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
3947 ok(0, "unexpected call\n");
3948 return E_NOTIMPL;
3951 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
3953 ok(0, "unexpected call\n");
3954 return E_NOTIMPL;
3957 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
3959 ok(0, "unexpected call\n");
3960 return E_NOTIMPL;
3963 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
3965 ok(0, "unexpected call\n");
3966 return E_NOTIMPL;
3969 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
3971 ok(0, "unexpected call\n");
3972 return E_NOTIMPL;
3975 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
3977 ok(0, "unexpected call\n");
3978 return E_NOTIMPL;
3981 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
3983 ok(0, "unexpected call\n");
3984 return E_NOTIMPL;
3987 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
3989 ok(0, "unexpected call\n");
3990 return E_NOTIMPL;
3993 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
3995 ok(0, "unexpected call\n");
3996 return E_NOTIMPL;
3999 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
4001 ok(0, "unexpected call\n");
4002 return E_NOTIMPL;
4005 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
4006 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
4008 ok(0, "unexpected call\n");
4009 return E_NOTIMPL;
4012 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
4014 ok(0, "unexpected call\n");
4015 return E_NOTIMPL;
4018 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
4019 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
4021 ok(0, "unexpected call\n");
4022 return E_NOTIMPL;
4025 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
4026 VARIANT *pvarShow, VARIANT *pvarSize)
4028 ok(0, "unexpected call\n");
4029 return E_NOTIMPL;
4032 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
4034 ok(0, "unexpected call\n");
4035 return E_NOTIMPL;
4038 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
4040 ok(0, "unexpected call\n");
4041 return E_NOTIMPL;
4044 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
4046 ok(0, "unexpected call\n");
4047 return E_NOTIMPL;
4050 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
4052 ok(0, "unexpected call\n");
4053 return E_NOTIMPL;
4056 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
4058 ok(0, "unexpected call\n");
4059 return E_NOTIMPL;
4062 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
4063 VARIANT_BOOL *pbRegister)
4065 ok(0, "unexpected call\n");
4066 return E_NOTIMPL;
4069 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
4070 VARIANT_BOOL bRegister)
4072 ok(0, "unexpected call\n");
4073 return E_NOTIMPL;
4076 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
4077 VARIANT_BOOL *pbRegister)
4079 ok(0, "unexpected call\n");
4080 return E_NOTIMPL;
4083 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
4084 VARIANT_BOOL bRegister)
4086 ok(0, "unexpected call\n");
4087 return E_NOTIMPL;
4090 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
4092 ok(0, "unexpected call\n");
4093 return E_NOTIMPL;
4096 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
4098 ok(0, "unexpected call\n");
4099 return E_NOTIMPL;
4102 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4104 ok(0, "unexpected call\n");
4105 return E_NOTIMPL;
4108 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
4110 ok(0, "unexpected call\n");
4111 return E_NOTIMPL;
4114 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
4116 ok(0, "unexpected call\n");
4117 return E_NOTIMPL;
4120 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
4122 ok(0, "unexpected call\n");
4123 return E_NOTIMPL;
4126 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
4128 WebBrowser_QueryInterface,
4129 WebBrowser_AddRef,
4130 WebBrowser_Release,
4131 WebBrowser_GetTypeInfoCount,
4132 WebBrowser_GetTypeInfo,
4133 WebBrowser_GetIDsOfNames,
4134 WebBrowser_Invoke,
4135 WebBrowser_GoBack,
4136 WebBrowser_GoForward,
4137 WebBrowser_GoHome,
4138 WebBrowser_GoSearch,
4139 WebBrowser_Navigate,
4140 WebBrowser_Refresh,
4141 WebBrowser_Refresh2,
4142 WebBrowser_Stop,
4143 WebBrowser_get_Application,
4144 WebBrowser_get_Parent,
4145 WebBrowser_get_Container,
4146 WebBrowser_get_Document,
4147 WebBrowser_get_TopLevelContainer,
4148 WebBrowser_get_Type,
4149 WebBrowser_get_Left,
4150 WebBrowser_put_Left,
4151 WebBrowser_get_Top,
4152 WebBrowser_put_Top,
4153 WebBrowser_get_Width,
4154 WebBrowser_put_Width,
4155 WebBrowser_get_Height,
4156 WebBrowser_put_Height,
4157 WebBrowser_get_LocationName,
4158 WebBrowser_get_LocationURL,
4159 WebBrowser_get_Busy,
4160 WebBrowser_Quit,
4161 WebBrowser_ClientToWindow,
4162 WebBrowser_PutProperty,
4163 WebBrowser_GetProperty,
4164 WebBrowser_get_Name,
4165 WebBrowser_get_HWND,
4166 WebBrowser_get_FullName,
4167 WebBrowser_get_Path,
4168 WebBrowser_get_Visible,
4169 WebBrowser_put_Visible,
4170 WebBrowser_get_StatusBar,
4171 WebBrowser_put_StatusBar,
4172 WebBrowser_get_StatusText,
4173 WebBrowser_put_StatusText,
4174 WebBrowser_get_ToolBar,
4175 WebBrowser_put_ToolBar,
4176 WebBrowser_get_MenuBar,
4177 WebBrowser_put_MenuBar,
4178 WebBrowser_get_FullScreen,
4179 WebBrowser_put_FullScreen,
4180 WebBrowser_Navigate2,
4181 WebBrowser_QueryStatusWB,
4182 WebBrowser_ExecWB,
4183 WebBrowser_ShowBrowserBar,
4184 WebBrowser_get_ReadyState,
4185 WebBrowser_get_Offline,
4186 WebBrowser_put_Offline,
4187 WebBrowser_get_Silent,
4188 WebBrowser_put_Silent,
4189 WebBrowser_get_RegisterAsBrowser,
4190 WebBrowser_put_RegisterAsBrowser,
4191 WebBrowser_get_RegisterAsDropTarget,
4192 WebBrowser_put_RegisterAsDropTarget,
4193 WebBrowser_get_TheaterMode,
4194 WebBrowser_put_TheaterMode,
4195 WebBrowser_get_AddressBar,
4196 WebBrowser_put_AddressBar,
4197 WebBrowser_get_Resizable,
4198 WebBrowser_put_Resizable
4201 static IWebBrowser2 WebBrowser2 = { &WebBrowser2Vtbl };
4203 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
4204 REFIID riid, void **ppv)
4206 return QueryInterface(riid, ppv);
4209 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
4211 return 2;
4214 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
4216 return 1;
4219 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
4220 REFIID riid, void **ppv)
4223 * Services used by HTMLDocument:
4225 * IOleUndoManager
4226 * IInternetSecurityManager
4227 * ITargetFrame
4228 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
4229 * HTMLFrameBase
4230 * IShellObject
4231 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
4232 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
4233 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
4234 * DefView (?)
4235 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
4236 * IElementBehaviorFactory
4237 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
4238 * STopLevelBrowser
4239 * IHTMLWindow2
4240 * IInternetProtocol
4241 * UrlHostory
4242 * IHTMLEditHost
4243 * IHlinkFrame
4246 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
4247 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
4248 *ppv = &HlinkFrame;
4249 return S_OK;
4252 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
4253 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
4254 *ppv = &NewWindowManager;
4255 return S_OK;
4258 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
4259 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
4260 *ppv = &BrowserService;
4261 return S_OK;
4264 if(support_wbapp && IsEqualGUID(&IID_IWebBrowserApp, guidService)) {
4265 if(IsEqualGUID(riid, &IID_IWebBrowser2)) {
4266 *ppv = &WebBrowser2;
4267 return S_OK;
4269 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4272 return E_NOINTERFACE;
4275 static const IServiceProviderVtbl ServiceProviderVtbl = {
4276 ServiceProvider_QueryInterface,
4277 ServiceProvider_AddRef,
4278 ServiceProvider_Release,
4279 ServiceProvider_QueryService
4282 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
4284 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
4285 REFIID riid, void **ppv)
4287 return QueryInterface(riid, ppv);
4290 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
4292 return 2;
4295 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
4297 return 1;
4300 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
4301 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
4303 ok(0, "unexpected call\n");
4306 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
4307 DWORD dwAspect, LONG lindex)
4309 ok(0, "unexpected call\n");
4312 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
4314 ok(0, "unexpected call\n");
4317 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
4319 ok(0, "unexpected call\n");
4322 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
4324 ok(0, "unexpected call\n");
4327 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
4329 ok(0, "unexpected call\n");
4332 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
4334 CHECK_EXPECT(Advise_Close);
4337 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
4338 AdviseSink_QueryInterface,
4339 AdviseSink_AddRef,
4340 AdviseSink_Release,
4341 AdviseSink_OnDataChange,
4342 AdviseSink_OnViewChange,
4343 AdviseSink_OnRename,
4344 AdviseSink_OnSave,
4345 ObjectAdviseSink_OnClose,
4346 AdviseSinkEx_OnViewStatusChange
4349 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
4351 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
4352 REFIID riid, void **ppv)
4354 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
4355 *ppv = iface;
4356 return S_OK;
4359 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4360 *ppv = NULL;
4361 return E_NOINTERFACE;
4364 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
4365 DWORD dwAspect, LONG lindex)
4367 CHECK_EXPECT2(OnViewChange);
4369 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
4370 ok(lindex == -1, "lindex = %d\n", lindex);
4373 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
4374 ViewAdviseSink_QueryInterface,
4375 AdviseSink_AddRef,
4376 AdviseSink_Release,
4377 AdviseSink_OnDataChange,
4378 ViewAdviseSink_OnViewChange,
4379 AdviseSink_OnRename,
4380 AdviseSink_OnSave,
4381 AdviseSink_OnClose,
4382 AdviseSinkEx_OnViewStatusChange
4385 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
4387 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
4388 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
4389 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
4390 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
4391 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
4393 static HRESULT QueryInterface(REFIID riid, void **ppv)
4395 *ppv = NULL;
4397 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
4398 *ppv = &ClientSite;
4399 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
4400 *ppv = &DocumentSite;
4401 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
4402 *ppv = &DocHostUIHandler;
4403 else if(IsEqualGUID(&IID_IOleContainer, riid))
4404 *ppv = &OleContainer;
4405 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
4406 *ppv = &InPlaceSiteWindowless;
4407 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
4408 *ppv = &OleCommandTarget;
4409 else if(IsEqualGUID(&IID_IDispatch, riid))
4410 *ppv = &Dispatch;
4411 else if(IsEqualGUID(&IID_IServiceProvider, riid))
4412 *ppv = &ServiceProvider;
4413 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
4414 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
4415 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
4416 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
4417 else if(IsEqualGUID(&IID_IOleControlSite, riid))
4418 *ppv = &OleControlSite;
4419 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
4420 return E_NOINTERFACE; /* TODO */
4421 else if(IsEqualGUID(&IID_IProxyManager, riid))
4422 return E_NOINTERFACE; /* ? */
4423 else if(IsEqualGUID(&IID_unk1, riid))
4424 return E_NOINTERFACE; /* HTMLWindow2 ? */
4425 else if(IsEqualGUID(&IID_IThumbnailView, riid))
4426 return E_NOINTERFACE; /* ? */
4427 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
4428 return E_NOINTERFACE; /* ? */
4429 else if(IsEqualGUID(&IID_unk4, riid))
4430 return E_NOINTERFACE; /* ? */
4431 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
4432 return E_NOINTERFACE; /* ? */
4433 else
4434 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
4436 if(*ppv)
4437 return S_OK;
4438 return E_NOINTERFACE;
4441 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
4443 if(msg == WM_CONTINUE_BINDING) {
4444 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
4445 continue_binding(callback);
4448 return DefWindowProc(hwnd, msg, wParam, lParam);
4451 static void test_doscroll(IUnknown *unk)
4453 IHTMLDocument3 *doc;
4454 IHTMLElement2 *elem2;
4455 IHTMLElement *elem;
4456 VARIANT v;
4457 HRESULT hres;
4459 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
4460 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
4461 if(FAILED(hres))
4462 return;
4464 hres = IHTMLDocument3_get_documentElement(doc, &elem);
4465 IHTMLDocument3_Release(doc);
4466 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
4467 switch(load_state) {
4468 case LD_DOLOAD:
4469 case LD_NO:
4470 if(!nav_url)
4471 ok(!elem, "elem != NULL\n");
4472 default:
4473 break;
4474 case LD_INTERACTIVE:
4475 case LD_COMPLETE:
4476 ok(elem != NULL, "elem == NULL\n");
4478 if(!elem)
4479 return;
4481 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4482 IHTMLElement_Release(elem);
4483 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4485 V_VT(&v) = VT_BSTR;
4486 V_BSTR(&v) = a2bstr("left");
4487 hres = IHTMLElement2_doScroll(elem2, v);
4488 SysFreeString(V_BSTR(&v));
4489 IHTMLElement2_Release(elem2);
4491 if(inplace_deactivated)
4492 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
4493 else if(load_state == LD_COMPLETE)
4494 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
4495 else
4496 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
4499 static void _test_readyState(unsigned line, IUnknown *unk)
4501 IHTMLDocument2 *htmldoc;
4502 DISPPARAMS dispparams;
4503 IHTMLElement *elem;
4504 BSTR state;
4505 VARIANT out;
4506 HRESULT hres;
4508 static const LPCSTR expected_state[] = {
4509 "uninitialized",
4510 "loading",
4511 NULL,
4512 "interactive",
4513 "complete",
4514 "uninitialized"
4517 if(open_call)
4518 return; /* FIXME */
4520 if(!unk)
4521 unk = doc_unk;
4523 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
4524 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
4525 if(FAILED(hres))
4526 return;
4528 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
4529 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
4531 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
4532 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
4534 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
4535 load_state = LD_INTERACTIVE;
4537 ok_(__FILE__, line)
4538 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
4539 wine_dbgstr_w(state), load_state);
4540 SysFreeString(state);
4542 hres = IHTMLDocument2_get_body(htmldoc, &elem);
4543 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
4544 if(elem) {
4545 IHTMLElement2 *elem2;
4546 VARIANT var;
4548 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
4549 IHTMLElement_Release(elem);
4550 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
4552 hres = IHTMLElement2_get_readyState(elem2, &var);
4553 IHTMLElement2_Release(elem2);
4554 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
4555 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
4556 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
4557 VariantClear(&var);
4558 }else {
4559 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
4562 dispparams.cArgs = 0;
4563 dispparams.cNamedArgs = 0;
4564 dispparams.rgdispidNamedArgs = NULL;
4565 dispparams.rgvarg = NULL;
4567 VariantInit(&out);
4569 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
4570 &dispparams, &out, NULL, NULL);
4571 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
4573 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
4574 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
4576 test_doscroll((IUnknown*)htmldoc);
4578 IHTMLDocument2_Release(htmldoc);
4581 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
4583 IViewObject *view;
4584 HRESULT hres;
4586 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
4587 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
4589 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
4590 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
4592 IViewObject_Release(view);
4595 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
4597 IConnectionPointContainer *tmp_container = NULL;
4598 IConnectionPoint *cp;
4599 IID iid;
4600 HRESULT hres;
4601 DWORD cookie;
4603 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
4604 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
4605 if(FAILED(hres))
4606 return;
4608 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
4609 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
4610 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
4612 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
4613 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
4615 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
4616 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
4617 ok(tmp_container == container, "container != tmp_container\n");
4618 if(SUCCEEDED(hres))
4619 IConnectionPointContainer_Release(tmp_container);
4621 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
4622 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
4624 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
4625 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
4626 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4627 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
4628 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
4629 ok(hres == S_OK, "Advise failed: %08x\n", hres);
4632 IConnectionPoint_Release(cp);
4635 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
4637 IConnectionPointContainer *container;
4638 HRESULT hres;
4640 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
4641 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
4642 if(FAILED(hres))
4643 return;
4645 test_ConnectionPoint(container, &IID_IDispatch);
4646 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
4647 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
4648 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
4650 IConnectionPointContainer_Release(container);
4653 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
4655 ICustomDoc *custom_doc;
4656 HRESULT hres;
4658 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
4659 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
4661 expect_uihandler_iface = uihandler;
4663 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
4664 ICustomDoc_Release(custom_doc);
4665 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
4668 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
4670 IBindCtx *bind;
4671 HRESULT hres;
4672 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
4674 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
4676 test_readyState((IUnknown*)persist);
4678 doc_mon = mon;
4680 CreateBindCtx(0, &bind);
4681 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
4682 (IUnknown*)&ClientSite);
4684 if(mon == &Moniker)
4685 SET_EXPECT(GetDisplayName);
4686 if(!set_clientsite) {
4687 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4688 SET_EXPECT(GetHostInfo);
4689 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4690 SET_EXPECT(Invoke_AMBIENT_SILENT);
4691 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4692 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4693 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4694 SET_EXPECT(GetOptionKeyPath);
4695 SET_EXPECT(GetOverrideKeyPath);
4696 SET_EXPECT(GetWindow);
4697 SET_EXPECT(Exec_DOCCANNAVIGATE);
4698 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4699 SET_EXPECT(Exec_SETPROGRESSMAX);
4700 SET_EXPECT(Exec_SETPROGRESSPOS);
4701 SET_EXPECT(Exec_ShellDocView_37);
4703 if(!container_locked) {
4704 SET_EXPECT(GetContainer);
4705 SET_EXPECT(LockContainer);
4707 SET_EXPECT(OnChanged_READYSTATE);
4708 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4709 SET_EXPECT(Exec_ShellDocView_84);
4710 SET_EXPECT(IsSystemMoniker);
4711 if(mon == &Moniker)
4712 SET_EXPECT(BindToStorage);
4713 SET_EXPECT(SetActiveObject);
4714 if(set_clientsite) {
4715 SET_EXPECT(Invoke_AMBIENT_SILENT);
4716 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4717 SET_EXPECT(Exec_ShellDocView_37);
4718 SET_EXPECT(IsErrorUrl);
4720 else
4721 SET_EXPECT(GetTravelLog);
4722 SET_EXPECT(GetPendingUrl);
4723 load_state = LD_DOLOAD;
4724 expect_LockContainer_fLock = TRUE;
4725 readystate_set_loading = TRUE;
4727 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
4728 ok(hres == S_OK, "Load failed: %08x\n", hres);
4730 if(mon == &Moniker)
4731 CHECK_CALLED(GetDisplayName);
4732 if(!set_clientsite) {
4733 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4734 CHECK_CALLED(GetHostInfo);
4735 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4736 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4737 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4738 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4739 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
4740 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
4741 CHECK_CALLED(GetOverrideKeyPath);
4742 CHECK_CALLED(GetWindow);
4743 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4744 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4745 CHECK_CALLED(Exec_SETPROGRESSMAX);
4746 CHECK_CALLED(Exec_SETPROGRESSPOS);
4747 CHECK_CALLED(Exec_ShellDocView_37);
4749 if(!container_locked) {
4750 CHECK_CALLED(GetContainer);
4751 CHECK_CALLED(LockContainer);
4752 container_locked = TRUE;
4754 CHECK_CALLED(OnChanged_READYSTATE);
4755 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4756 SET_CALLED(IsSystemMoniker); /* IE7 */
4757 SET_CALLED(Exec_ShellDocView_84);
4758 if(mon == &Moniker)
4759 CHECK_CALLED(BindToStorage);
4760 CLEAR_CALLED(SetActiveObject); /* FIXME */
4761 if(set_clientsite) {
4762 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4763 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4764 CHECK_CALLED(Exec_ShellDocView_37);
4765 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4767 else
4768 todo_wine CHECK_CALLED(GetTravelLog);
4769 todo_wine CHECK_CALLED(GetPendingUrl);
4771 set_clientsite = container_locked = TRUE;
4773 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
4775 IBindCtx_Release(bind);
4777 test_readyState((IUnknown*)persist);
4780 #define DWL_VERBDONE 0x0001
4781 #define DWL_CSS 0x0002
4782 #define DWL_TRYCSS 0x0004
4783 #define DWL_HTTP 0x0008
4784 #define DWL_EMPTY 0x0010
4785 #define DWL_JAVASCRIPT 0x0020
4786 #define DWL_ONREADY_LOADING 0x0040
4788 static void test_download(DWORD flags)
4790 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
4791 HWND hwnd;
4792 BOOL *b;
4793 MSG msg;
4795 b = is_js ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Exec_HTTPEQUIV_DONE;
4797 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
4798 ok(hwnd != NULL, "Could not find hidden window\n");
4800 test_readyState(NULL);
4802 if(flags & (DWL_VERBDONE|DWL_HTTP))
4803 SET_EXPECT(Exec_SETPROGRESSMAX);
4804 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js)
4805 SET_EXPECT(GetHostInfo);
4806 SET_EXPECT(SetStatusText);
4807 if(!(flags & DWL_EMPTY))
4808 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
4809 if(is_js)
4810 SET_EXPECT(GetExternal);
4811 SET_EXPECT(OnViewChange);
4812 SET_EXPECT(GetDropTarget);
4813 if(flags & DWL_TRYCSS)
4814 SET_EXPECT(Exec_ShellDocView_84);
4815 if(flags & DWL_CSS) {
4816 SET_EXPECT(CreateInstance);
4817 SET_EXPECT(Start);
4818 SET_EXPECT(LockRequest);
4819 SET_EXPECT(Terminate);
4820 SET_EXPECT(Protocol_Read);
4821 SET_EXPECT(UnlockRequest);
4823 if(flags & DWL_ONREADY_LOADING)
4824 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4825 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4826 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
4827 if(!is_js)
4828 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
4829 SET_EXPECT(Exec_Explorer_69);
4830 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
4831 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
4832 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
4833 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
4834 if((nav_url && !is_js) || (flags & (DWL_CSS|DWL_HTTP)))
4835 SET_EXPECT(Exec_ShellDocView_37);
4836 if(flags & DWL_HTTP) {
4837 SET_EXPECT(OnChanged_1012);
4838 SET_EXPECT(Exec_HTTPEQUIV);
4839 SET_EXPECT(Exec_SETTITLE);
4841 if(!is_js)
4842 SET_EXPECT(OnChanged_1005);
4843 SET_EXPECT(OnChanged_READYSTATE);
4844 SET_EXPECT(Exec_SETPROGRESSPOS);
4845 if(!(flags & DWL_EMPTY))
4846 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
4847 SET_EXPECT(Exec_ShellDocView_103);
4848 SET_EXPECT(Exec_ShellDocView_105);
4849 SET_EXPECT(Exec_ShellDocView_140);
4850 if(!is_js) {
4851 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
4852 SET_EXPECT(Exec_HTTPEQUIV_DONE);
4854 SET_EXPECT(SetStatusText);
4855 if(nav_url || support_wbapp) {
4856 SET_EXPECT(UpdateUI);
4857 SET_EXPECT(Exec_UPDATECOMMANDS);
4858 SET_EXPECT(Exec_SETTITLE);
4859 SET_EXPECT(UpdateBackForwardState);
4861 if(!is_js) {
4862 if(!editmode) {
4863 if(!(flags & DWL_EMPTY))
4864 SET_EXPECT(FireNavigateComplete2);
4865 SET_EXPECT(FireDocumentComplete);
4867 SET_EXPECT(ActiveElementChanged);
4869 SET_EXPECT(IsErrorUrl);
4870 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
4872 while(!*b && GetMessage(&msg, NULL, 0, 0)) {
4873 TranslateMessage(&msg);
4874 DispatchMessage(&msg);
4877 if(flags & DWL_VERBDONE)
4878 CHECK_CALLED(Exec_SETPROGRESSMAX);
4879 if(flags & DWL_HTTP)
4880 SET_CALLED(Exec_SETPROGRESSMAX);
4881 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js) {
4882 if(nav_url)
4883 todo_wine CHECK_CALLED(GetHostInfo);
4884 else
4885 CHECK_CALLED(GetHostInfo);
4887 CHECK_CALLED(SetStatusText);
4888 if(!(flags & DWL_EMPTY))
4889 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
4890 if(is_js)
4891 CHECK_CALLED(GetExternal);
4892 CHECK_CALLED(OnViewChange);
4893 SET_CALLED(GetDropTarget);
4894 if(flags & DWL_TRYCSS)
4895 SET_CALLED(Exec_ShellDocView_84);
4896 if(flags & DWL_CSS) {
4897 CHECK_CALLED(CreateInstance);
4898 CHECK_CALLED(Start);
4899 CHECK_CALLED(LockRequest);
4900 CHECK_CALLED(Terminate);
4901 CHECK_CALLED(Protocol_Read);
4902 CHECK_CALLED(UnlockRequest);
4904 if(flags & DWL_ONREADY_LOADING)
4905 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4906 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4907 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
4908 if(!is_js)
4909 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
4910 SET_CALLED(Exec_Explorer_69);
4911 SET_CALLED(EnableModeless_TRUE); /* IE7 */
4912 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
4913 SET_CALLED(EnableModeless_FALSE); /* IE7 */
4914 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
4915 if(nav_url && !is_js)
4916 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
4917 else if(flags & (DWL_CSS|DWL_HTTP))
4918 CLEAR_CALLED(Exec_ShellDocView_37); /* Called by IE9 */
4919 if(flags & DWL_HTTP) {
4920 todo_wine CHECK_CALLED(OnChanged_1012);
4921 todo_wine CHECK_CALLED(Exec_HTTPEQUIV);
4922 if(support_wbapp)
4923 CHECK_CALLED(Exec_SETTITLE);
4924 else
4925 todo_wine CHECK_CALLED(Exec_SETTITLE);
4927 if(!is_js) {
4928 CHECK_CALLED(OnChanged_1005);
4929 CHECK_CALLED(OnChanged_READYSTATE);
4930 CHECK_CALLED(Exec_SETPROGRESSPOS);
4931 }else {
4932 SET_CALLED(OnChanged_READYSTATE); /* sometimes called */
4933 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
4935 if(!(flags & DWL_EMPTY))
4936 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
4937 SET_CALLED(Exec_ShellDocView_103);
4938 SET_CALLED(Exec_ShellDocView_105);
4939 SET_CALLED(Exec_ShellDocView_140);
4940 if(!is_js) {
4941 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
4942 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
4944 SET_CALLED(SetStatusText);
4945 if(nav_url || support_wbapp) { /* avoiding race, FIXME: find better way */
4946 SET_CALLED(UpdateUI);
4947 SET_CALLED(Exec_UPDATECOMMANDS);
4948 SET_CALLED(Exec_SETTITLE);
4949 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
4951 if(!is_js) {
4952 if(!editmode) {
4953 if(!(flags & DWL_EMPTY)) {
4954 if(support_wbapp)
4955 CHECK_CALLED(FireNavigateComplete2);
4956 else
4957 todo_wine CHECK_CALLED(FireNavigateComplete2);
4959 CHECK_CALLED(FireDocumentComplete);
4961 todo_wine CHECK_CALLED(ActiveElementChanged);
4963 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4965 load_state = LD_COMPLETE;
4967 test_readyState(NULL);
4970 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
4972 IPersistMoniker *persist_mon;
4973 IPersistFile *persist_file;
4974 GUID guid;
4975 HRESULT hres;
4977 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
4978 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
4979 if(SUCCEEDED(hres)) {
4980 hres = IPersist_GetClassID(persist_file, NULL);
4981 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4983 hres = IPersist_GetClassID(persist_file, &guid);
4984 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4985 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4987 IPersist_Release(persist_file);
4990 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
4991 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
4992 if(SUCCEEDED(hres)) {
4993 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
4994 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4996 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
4997 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4998 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
5000 if(load_state == LD_DOLOAD)
5001 test_Load(persist_mon, mon);
5003 test_readyState((IUnknown*)doc);
5005 IPersistMoniker_Release(persist_mon);
5009 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const char *href, const char *new_nav_url, BOOL is_js, BOOL is_hash)
5011 const char *prev_nav_url = NULL;
5012 IHTMLPrivateWindow *priv_window;
5013 IHTMLLocation *location;
5014 IHTMLWindow2 *window;
5015 BSTR str, str2;
5016 HRESULT hres;
5018 trace("put_href %s...\n", new_nav_url);
5020 loading_js = is_js;
5021 loading_hash = is_hash;
5023 location = NULL;
5024 hres = IHTMLDocument2_get_location(doc, &location);
5025 ok(hres == S_OK, "get_location failed: %08x\n", hres);
5026 ok(location != NULL, "location == NULL\n");
5028 prev_nav_url = nav_url;
5029 nav_url = new_nav_url;
5030 if(!loading_hash)
5031 nav_serv_url = new_nav_url;
5032 if(!href)
5033 href = new_nav_url;
5035 str = a2bstr(href);
5036 SET_EXPECT(TranslateUrl);
5037 if(support_wbapp) {
5038 SET_EXPECT(FireBeforeNavigate2);
5039 SET_EXPECT(Exec_ShellDocView_67);
5040 if(!is_hash) {
5041 SET_EXPECT(Invoke_AMBIENT_SILENT);
5042 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5043 SET_EXPECT(Exec_ShellDocView_63);
5044 }else {
5045 SET_EXPECT(FireNavigateComplete2);
5046 SET_EXPECT(FireDocumentComplete);
5048 }else {
5049 SET_EXPECT(Navigate);
5051 if(use_replace) {
5052 hres = IHTMLLocation_replace(location, str);
5053 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5054 }else {
5055 hres = IHTMLLocation_put_href(location, str);
5056 if(is_js && hres == E_ACCESSDENIED)
5057 win_skip("put_href: got E_ACCESSDENIED\n");
5058 else
5059 ok(hres == S_OK, "put_href failed: %08x\n", hres);
5061 SysFreeString(str);
5062 if(hres == S_OK) {
5063 CHECK_CALLED(TranslateUrl);
5064 if(support_wbapp) {
5065 CHECK_CALLED(FireBeforeNavigate2);
5066 CHECK_CALLED(Exec_ShellDocView_67);
5067 if(!is_hash) {
5068 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5069 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5070 CHECK_CALLED(Exec_ShellDocView_63);
5071 }else {
5072 CHECK_CALLED(FireNavigateComplete2);
5073 CHECK_CALLED(FireDocumentComplete);
5075 }else {
5076 CHECK_CALLED(Navigate);
5078 }else {
5079 SET_CALLED(TranslateUrl);
5080 if(support_wbapp) {
5081 SET_CALLED(FireBeforeNavigate2);
5082 SET_CALLED(Exec_ShellDocView_67);
5083 if(!is_hash) {
5084 SET_CALLED(Invoke_AMBIENT_SILENT);
5085 SET_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5086 SET_CALLED(Exec_ShellDocView_63);
5087 }else {
5088 SET_CALLED(FireNavigateComplete2);
5089 SET_CALLED(FireDocumentComplete);
5091 }else {
5092 SET_CALLED(Navigate);
5096 IHTMLLocation_Release(location);
5098 if(is_js && hres == E_ACCESSDENIED) {
5099 nav_url = prev_nav_url;
5100 return;
5103 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5104 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5106 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
5107 IHTMLWindow2_Release(window);
5108 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
5110 if(!support_wbapp) {
5111 VARIANT vempty;
5113 readystate_set_loading = TRUE;
5114 SET_EXPECT(TranslateUrl);
5115 SET_EXPECT(Exec_ShellDocView_67);
5116 SET_EXPECT(Invoke_AMBIENT_SILENT);
5117 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5118 SET_EXPECT(Exec_ShellDocView_63);
5120 str = a2bstr(nav_url);
5121 str2 = a2bstr("");
5122 V_VT(&vempty) = VT_EMPTY;
5123 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
5124 SysFreeString(str);
5125 SysFreeString(str2);
5126 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
5128 CHECK_CALLED(TranslateUrl);
5129 CHECK_CALLED(Exec_ShellDocView_67);
5130 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5131 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5132 CHECK_CALLED(Exec_ShellDocView_63);
5135 if(doc_mon) {
5136 test_GetCurMoniker(doc_unk, doc_mon, NULL);
5137 doc_mon = NULL;
5140 if(!is_hash) {
5141 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5142 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5143 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s, expected %s\n", wine_dbgstr_w(str2), prev_nav_url);
5144 SysFreeString(str2);
5146 if(is_js)
5147 ignore_external_qi = TRUE;
5148 test_download(DWL_VERBDONE | (is_js ? DWL_JAVASCRIPT : DWL_ONREADY_LOADING));
5149 if(is_js)
5150 ignore_external_qi = FALSE;
5154 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
5155 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
5156 if(is_js)
5157 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5158 else
5159 ok(!strcmp_wa(str2, nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
5160 SysFreeString(str2);
5161 IHTMLPrivateWindow_Release(priv_window);
5163 loading_js = FALSE;
5164 if(is_js)
5165 nav_url = prev_nav_url;
5168 static void test_open_window(IHTMLDocument2 *doc)
5170 IHTMLWindow2 *window, *new_window;
5171 BSTR name, url;
5172 HRESULT hres;
5174 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5175 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5177 url = a2bstr(nav_serv_url = nav_url = "about:blank");
5178 name = a2bstr("test");
5179 new_window = (void*)0xdeadbeef;
5181 trace("open...\n");
5182 open_call = TRUE;
5184 if(support_wbapp)
5185 SET_EXPECT(get_LocationURL);
5186 SET_EXPECT(TranslateUrl);
5187 SET_EXPECT(EvaluateNewWindow);
5189 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
5190 open_call = FALSE;
5191 SysFreeString(url);
5192 SysFreeString(name);
5194 if(support_wbapp)
5195 todo_wine CHECK_CALLED_BROKEN(get_LocationURL);
5196 todo_wine
5197 CHECK_CALLED(TranslateUrl);
5199 if(!called_EvaluateNewWindow) {
5200 todo_wine
5201 win_skip("INewWindowManager not supported\n");
5202 if(SUCCEEDED(hres) && new_window)
5203 IHTMLWindow2_Release(new_window);
5204 IHTMLWindow2_Release(window);
5205 return;
5207 todo_wine
5208 CHECK_CALLED(EvaluateNewWindow);
5210 todo_wine
5211 ok(hres == S_OK, "open failed: %08x\n", hres);
5212 todo_wine
5213 ok(new_window == NULL, "new_window != NULL\n");
5215 IHTMLWindow2_Release(window);
5218 static void test_elem_from_point(IHTMLDocument2 *doc)
5220 IHTMLElement *elem;
5221 BSTR tag;
5222 HRESULT hres;
5224 elem = NULL;
5225 hres = IHTMLDocument2_elementFromPoint(doc, 3, 3, &elem);
5226 ok(hres == S_OK, "elementFromPoint failed: %08x\n", hres);
5227 ok(elem != NULL, "elem == NULL\n");
5229 hres = IHTMLElement_get_tagName(elem, &tag);
5230 IHTMLElement_Release(elem);
5231 ok(hres == S_OK, "get_tagName failed: %08x\n", hres);
5232 ok(!strcmp_wa(tag, "DIV"), "tag = %s\n", wine_dbgstr_w(tag));
5235 static void test_clear(IHTMLDocument2 *doc)
5237 HRESULT hres;
5239 hres = IHTMLDocument2_clear(doc);
5240 ok(hres == S_OK, "clear failed: %08x\n", hres);
5243 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
5245 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
5246 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
5247 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
5248 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
5249 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
5250 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
5251 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
5252 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
5253 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
5254 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
5255 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
5256 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
5257 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
5258 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
5259 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
5260 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
5261 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
5262 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
5263 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
5264 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
5266 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
5267 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
5268 0,0,0,0,0,0,
5269 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
5270 0,0,
5271 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
5272 0,0,
5273 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
5274 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
5275 0,0,0,0,0,
5276 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
5277 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
5278 0,0,
5279 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
5280 0,0,0,
5281 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
5282 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
5285 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
5286 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
5288 IOleCommandTarget *cmdtrg;
5289 OLECMD olecmd = {cmdid, 0};
5290 HRESULT hres;
5292 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5293 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5294 if(FAILED(hres))
5295 return;
5297 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
5298 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
5300 IOleCommandTarget_Release(cmdtrg);
5302 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
5303 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
5306 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
5308 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
5310 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
5311 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
5312 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
5313 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
5314 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
5315 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
5316 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
5317 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
5318 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
5319 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
5320 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
5321 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
5322 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
5323 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
5324 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
5325 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
5328 static void test_OleCommandTarget(IHTMLDocument2 *doc)
5330 IOleCommandTarget *cmdtrg;
5331 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
5332 int i;
5333 HRESULT hres;
5335 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5336 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
5337 if(FAILED(hres))
5338 return;
5340 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5341 cmds[i].cmdID = i+1;
5342 cmds[i].cmdf = 0xf0f0;
5345 SET_EXPECT(QueryStatus_OPEN);
5346 SET_EXPECT(QueryStatus_NEW);
5347 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
5348 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5349 CHECK_CALLED(QueryStatus_OPEN);
5350 CHECK_CALLED(QueryStatus_NEW);
5352 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5353 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
5354 if(i+1 == OLECMDID_FIND)
5355 continue;
5356 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
5357 i+1, cmds[i].cmdf, expect_cmds[i+1]);
5360 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
5361 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
5363 IOleCommandTarget_Release(cmdtrg);
5366 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
5368 IOleCommandTarget *cmdtrg;
5369 int i;
5370 HRESULT hres;
5372 OLECMD cmd[2] = {
5373 {OLECMDID_OPEN, 0xf0f0},
5374 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
5377 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5378 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
5379 if(FAILED(hres))
5380 return;
5382 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
5383 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
5385 SET_EXPECT(QueryStatus_OPEN);
5386 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
5387 CHECK_CALLED(QueryStatus_OPEN);
5389 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5390 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5391 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
5392 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
5393 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
5394 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
5395 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
5397 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
5398 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
5399 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
5401 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
5402 if(!expect_cmds[i]) {
5403 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
5404 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5405 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5406 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5410 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
5411 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5412 ok(hres == OLECMDERR_E_NOTSUPPORTED,
5413 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
5415 IOleCommandTarget_Release(cmdtrg);
5418 static void test_exec_onunload(IHTMLDocument2 *doc)
5420 IOleCommandTarget *cmdtrg;
5421 VARIANT var;
5422 HRESULT hres;
5424 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
5425 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5426 if(FAILED(hres))
5427 return;
5429 memset(&var, 0x0a, sizeof(var));
5430 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5431 OLECMDEXECOPT_DODEFAULT, NULL, &var);
5432 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5433 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
5434 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
5436 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
5437 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5438 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
5440 IOleCommandTarget_Release(cmdtrg);
5443 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
5445 IOleCommandTarget *cmdtrg;
5446 HRESULT hres;
5448 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5449 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5450 if(FAILED(hres))
5451 return;
5453 editmode = TRUE;
5455 if(loaded)
5456 load_state = LD_DOLOAD;
5458 if(loaded)
5459 SET_EXPECT(GetClassID);
5460 SET_EXPECT(SetStatusText);
5461 SET_EXPECT(Exec_ShellDocView_37);
5462 SET_EXPECT(GetHostInfo);
5463 if(loaded)
5464 SET_EXPECT(GetDisplayName);
5465 SET_EXPECT(Invoke_AMBIENT_SILENT);
5466 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5467 SET_EXPECT(OnChanged_READYSTATE);
5468 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5469 SET_EXPECT(IsSystemMoniker);
5470 SET_EXPECT(Exec_ShellDocView_84);
5471 if(loaded)
5472 SET_EXPECT(BindToStorage);
5473 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5474 SET_EXPECT(HideUI);
5475 SET_EXPECT(ShowUI);
5476 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5478 expect_status_text = NULL;
5479 readystate_set_loading = TRUE;
5481 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5482 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5483 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5485 if(loaded)
5486 CHECK_CALLED(GetClassID);
5487 CHECK_CALLED(SetStatusText);
5488 CHECK_CALLED(Exec_ShellDocView_37);
5489 CHECK_CALLED(GetHostInfo);
5490 if(loaded)
5491 CHECK_CALLED(GetDisplayName);
5492 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5493 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5494 CHECK_CALLED(OnChanged_READYSTATE);
5495 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5496 SET_CALLED(IsSystemMoniker); /* IE7 */
5497 SET_CALLED(Exec_ShellDocView_84);
5498 if(loaded)
5499 CHECK_CALLED(BindToStorage);
5500 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5501 CHECK_CALLED(HideUI);
5502 CHECK_CALLED(ShowUI);
5503 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5505 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
5507 IOleCommandTarget_Release(cmdtrg);
5509 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
5510 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5511 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5514 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
5516 IOleCommandTarget *cmdtrg;
5517 VARIANT *in = NULL, _in, *out = NULL, _out;
5518 HRESULT hres;
5520 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5521 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
5522 if(FAILED(hres))
5523 return;
5525 if(name) {
5526 in = &_in;
5527 V_VT(in) = VT_BSTR;
5528 V_BSTR(in) = SysAllocString(name);
5531 if(exname) {
5532 out = &_out;
5533 V_VT(out) = VT_I4;
5534 V_I4(out) = 0xdeadbeef;
5537 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
5538 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
5540 if(in)
5541 VariantClear(in);
5543 if(out) {
5544 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
5545 if(V_VT(out) == VT_BSTR) {
5546 if(exname)
5547 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
5548 "unexpected fontname %s\n", wine_dbgstr_w(name));
5549 else
5550 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
5552 VariantClear(out);
5555 IOleCommandTarget_Release(cmdtrg);
5558 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
5560 IOleCommandTarget *cmdtrg;
5561 HRESULT hres;
5563 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
5564 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
5565 if(FAILED(hres))
5566 return;
5568 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
5569 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
5570 ok(hres == S_OK, "Exec failed: %08x\n", hres);
5572 IOleCommandTarget_Release(cmdtrg);
5575 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
5577 IPersistStreamInit *perinit;
5578 IPersistMoniker *permon;
5579 IPersistFile *perfile;
5580 HRESULT hres;
5582 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
5583 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
5584 if(SUCCEEDED(hres)) {
5585 hres = IPersistStreamInit_IsDirty(perinit);
5586 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5587 IPersistStreamInit_Release(perinit);
5590 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
5591 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
5592 if(SUCCEEDED(hres)) {
5593 hres = IPersistMoniker_IsDirty(permon);
5594 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5595 IPersistMoniker_Release(permon);
5598 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
5599 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
5600 if(SUCCEEDED(hres)) {
5601 hres = IPersistFile_IsDirty(perfile);
5602 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
5603 IPersistFile_Release(perfile);
5607 static HWND create_container_window(void)
5609 static const WCHAR wszHTMLDocumentTest[] =
5610 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
5611 static WNDCLASSEXW wndclass = {
5612 sizeof(WNDCLASSEXW),
5614 wnd_proc,
5615 0, 0, NULL, NULL, NULL, NULL, NULL,
5616 wszHTMLDocumentTest,
5617 NULL
5620 RegisterClassExW(&wndclass);
5621 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
5622 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
5623 515, 530, NULL, NULL, NULL, NULL);
5626 static void test_DoVerb(IOleObject *oleobj)
5628 RECT rect = {0,0,500,500};
5629 HRESULT hres;
5631 if(!container_locked) {
5632 SET_EXPECT(GetContainer);
5633 SET_EXPECT(LockContainer);
5635 SET_EXPECT(ActivateMe);
5636 expect_LockContainer_fLock = TRUE;
5638 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
5639 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
5641 if(!container_locked) {
5642 CHECK_CALLED(GetContainer);
5643 CHECK_CALLED(LockContainer);
5644 container_locked = TRUE;
5646 CHECK_CALLED(ActivateMe);
5649 #define CLIENTSITE_EXPECTPATH 0x00000001
5650 #define CLIENTSITE_SETNULL 0x00000002
5651 #define CLIENTSITE_DONTSET 0x00000004
5653 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
5655 IOleClientSite *clientsite;
5656 HRESULT hres;
5658 if(flags & CLIENTSITE_SETNULL) {
5659 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5660 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5661 if(set_clientsite)
5662 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
5663 else
5664 ok(!clientsite, "clientsite != NULL\n");
5666 SET_EXPECT(GetOverrideKeyPath);
5667 hres = IOleObject_SetClientSite(oleobj, NULL);
5668 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5669 CLEAR_CALLED(GetOverrideKeyPath); /* IE9 sometimes calls it */
5671 set_clientsite = FALSE;
5674 if(flags & CLIENTSITE_DONTSET)
5675 return;
5677 if(!expect_uihandler_iface)
5678 expect_uihandler_iface = &DocHostUIHandler;
5680 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5681 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5682 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
5683 clientsite, set_clientsite ? &ClientSite : NULL);
5685 if(!set_clientsite) {
5686 if(expect_uihandler_iface)
5687 SET_EXPECT(GetHostInfo);
5688 if(flags & CLIENTSITE_EXPECTPATH) {
5689 SET_EXPECT(GetOptionKeyPath);
5690 SET_EXPECT(GetOverrideKeyPath);
5692 SET_EXPECT(GetWindow);
5693 if(flags & CLIENTSITE_EXPECTPATH)
5694 SET_EXPECT(Exec_DOCCANNAVIGATE);
5695 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
5696 SET_EXPECT(Exec_SETPROGRESSMAX);
5697 SET_EXPECT(Exec_SETPROGRESSPOS);
5698 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5699 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5700 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5701 SET_EXPECT(Invoke_AMBIENT_SILENT);
5702 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5703 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5704 SET_EXPECT(GetOverrideKeyPath);
5705 SET_EXPECT(GetTravelLog);
5707 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5708 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5710 if(expect_uihandler_iface)
5711 CHECK_CALLED(GetHostInfo);
5712 if(flags & CLIENTSITE_EXPECTPATH) {
5713 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
5714 CHECK_CALLED(GetOverrideKeyPath);
5716 CHECK_CALLED(GetWindow);
5717 if(flags & CLIENTSITE_EXPECTPATH)
5718 CHECK_CALLED(Exec_DOCCANNAVIGATE);
5719 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
5720 CHECK_CALLED(Exec_SETPROGRESSMAX);
5721 CHECK_CALLED(Exec_SETPROGRESSPOS);
5722 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5723 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5724 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5725 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5726 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5727 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5728 CLEAR_CALLED(GetOverrideKeyPath); /* Called by IE9 */
5729 todo_wine CHECK_CALLED(GetTravelLog);
5731 set_clientsite = TRUE;
5734 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
5735 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
5737 hres = IOleObject_GetClientSite(oleobj, &clientsite);
5738 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
5739 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
5742 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
5744 IOleControl *control = NULL;
5745 HRESULT hres;
5747 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5748 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5749 if(FAILED(hres))
5750 return;
5752 SET_EXPECT(Invoke_AMBIENT_USERMODE);
5753 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
5754 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5755 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
5757 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5758 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
5759 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5760 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5762 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5763 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5764 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
5765 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5766 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5767 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5769 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
5770 SET_EXPECT(Invoke_AMBIENT_SILENT);
5771 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
5772 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5773 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
5774 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5776 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
5777 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
5778 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5779 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
5781 SET_EXPECT(Invoke_AMBIENT_PALETTE);
5782 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
5783 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
5784 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
5786 IOleControl_Release(control);
5791 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
5793 IOleControl *control = NULL;
5794 HRESULT hres;
5796 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5797 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5798 if(FAILED(hres))
5799 return;
5801 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
5802 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
5804 IOleControl_Release(control);
5807 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
5809 IOleObject *oleobj = NULL;
5810 HRESULT hres;
5812 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5813 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5814 if(FAILED(hres))
5815 return;
5817 SET_EXPECT(GetContainer);
5818 SET_EXPECT(LockContainer);
5819 expect_LockContainer_fLock = FALSE;
5820 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
5821 ok(hres == S_OK, "Close failed: %08x\n", hres);
5822 CHECK_CALLED(GetContainer);
5823 CHECK_CALLED(LockContainer);
5824 container_locked = FALSE;
5826 if(set_client)
5827 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5829 IOleObject_Release(oleobj);
5832 static void test_Advise(IHTMLDocument2 *doc)
5834 IOleObject *oleobj = NULL;
5835 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
5836 DWORD conn;
5837 HRESULT hres;
5839 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5840 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5841 if(FAILED(hres))
5842 return;
5844 hres = IOleObject_Unadvise(oleobj, 0);
5845 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5847 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
5848 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
5849 ok(enum_advise == NULL, "enum_advise != NULL\n");
5851 conn = -1;
5852 hres = IOleObject_Advise(oleobj, NULL, &conn);
5853 /* Old IE returns S_OK and sets conn to 1 */
5854 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
5855 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
5857 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
5858 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
5860 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5861 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5862 ok(conn == 1, "conn = %d\n", conn);
5864 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5865 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5866 ok(conn == 2, "conn = %d\n", conn);
5868 hres = IOleObject_Unadvise(oleobj, 1);
5869 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5871 hres = IOleObject_Unadvise(oleobj, 1);
5872 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5874 hres = IOleObject_Unadvise(oleobj, 2);
5875 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5877 IOleObject_Release(oleobj);
5880 static void test_OnFrameWindowActivate(IUnknown *unk)
5882 IOleInPlaceActiveObject *inplaceact;
5883 HRESULT hres;
5885 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
5886 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
5887 if(FAILED(hres))
5888 return;
5890 if(set_clientsite) {
5891 expect_OnFrameWindowActivate_fActivate = TRUE;
5892 SET_EXPECT(OnFrameWindowActivate);
5893 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5894 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5895 CHECK_CALLED(OnFrameWindowActivate);
5897 SET_EXPECT(OnFrameWindowActivate);
5898 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5899 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5900 CHECK_CALLED(OnFrameWindowActivate);
5902 expect_OnFrameWindowActivate_fActivate = FALSE;
5903 SET_EXPECT(OnFrameWindowActivate);
5904 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5905 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5906 CHECK_CALLED(OnFrameWindowActivate);
5908 expect_OnFrameWindowActivate_fActivate = TRUE;
5909 SET_EXPECT(OnFrameWindowActivate);
5910 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5911 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5912 CHECK_CALLED(OnFrameWindowActivate);
5913 }else {
5914 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5915 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5917 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5918 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5921 IOleInPlaceActiveObject_Release(inplaceact);
5924 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
5926 IOleInPlaceObjectWindowless *windowlessobj = NULL;
5927 HRESULT hres;
5929 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
5930 (void**)&windowlessobj);
5931 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
5932 if(FAILED(hres))
5933 return;
5935 if(expect_call) {
5936 SET_EXPECT(SetStatusText);
5937 SET_EXPECT(OnFocus_FALSE);
5938 if(ipsex)
5939 SET_EXPECT(OnInPlaceDeactivateEx);
5940 else
5941 SET_EXPECT(OnInPlaceDeactivate);
5943 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
5944 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
5945 if(expect_call) {
5946 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
5947 CHECK_CALLED(OnFocus_FALSE);
5948 if(ipsex)
5949 CHECK_CALLED(OnInPlaceDeactivateEx);
5950 else
5951 CHECK_CALLED(OnInPlaceDeactivate);
5954 IOleInPlaceObjectWindowless_Release(windowlessobj);
5957 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
5959 IOleObject *oleobj = NULL;
5960 IOleDocumentView *docview;
5961 GUID guid;
5962 HRESULT hres;
5964 last_hwnd = hwnd;
5966 if(view)
5967 IOleDocumentView_Release(view);
5968 view = NULL;
5970 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5971 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5973 hres = IOleObject_GetUserClassID(oleobj, NULL);
5974 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
5976 hres = IOleObject_GetUserClassID(oleobj, &guid);
5977 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
5978 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
5980 test_OnFrameWindowActivate((IUnknown*)doc);
5982 test_ClientSite(oleobj, flags);
5983 test_InPlaceDeactivate(doc, FALSE);
5984 test_DoVerb(oleobj);
5986 if(call_UIActivate == CallUIActivate_AfterShow) {
5987 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5988 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5990 SET_EXPECT(OnFocus_TRUE);
5991 SET_EXPECT(SetActiveObject);
5992 SET_EXPECT(ShowUI);
5993 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5994 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5995 expect_status_text = NULL;
5997 hres = IOleDocumentView_UIActivate(docview, TRUE);
5998 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
6000 CHECK_CALLED(OnFocus_TRUE);
6001 CHECK_CALLED(SetActiveObject);
6002 CHECK_CALLED(ShowUI);
6003 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6004 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6006 IOleDocumentView_Release(docview);
6009 IOleObject_Release(oleobj);
6011 test_OnFrameWindowActivate((IUnknown*)doc);
6014 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
6016 IOleInPlaceActiveObject *activeobject = NULL;
6017 HWND tmp_hwnd;
6018 HRESULT hres;
6020 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
6021 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
6022 if(FAILED(hres))
6023 return;
6025 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
6027 if(expect_success) {
6028 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
6029 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
6030 }else {
6031 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
6032 ok(IsWindow(hwnd), "hwnd is destroyed\n");
6035 IOleInPlaceActiveObject_Release(activeobject);
6038 static void test_CloseView(void)
6040 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
6041 HRESULT hres;
6043 if(!view)
6044 return;
6046 hres = IOleDocumentView_Show(view, FALSE);
6047 ok(hres == S_OK, "Show failed: %08x\n", hres);
6049 hres = IOleDocumentView_CloseView(view, 0);
6050 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
6052 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
6053 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6055 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6056 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
6057 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
6060 static void test_UIDeactivate(void)
6062 HRESULT hres;
6064 if(call_UIActivate == CallUIActivate_AfterShow) {
6065 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6067 if(call_UIActivate != CallUIActivate_None) {
6068 SET_EXPECT(SetActiveObject_null);
6069 SET_EXPECT(HideUI);
6070 SET_EXPECT(OnUIDeactivate);
6073 hres = IOleDocumentView_UIActivate(view, FALSE);
6074 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6076 if(call_UIActivate != CallUIActivate_None) {
6077 CHECK_CALLED(SetActiveObject_null);
6078 CHECK_CALLED(HideUI);
6079 CHECK_CALLED(OnUIDeactivate);
6081 if(call_UIActivate == CallUIActivate_AfterShow) {
6082 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6086 static void test_Hide(void)
6088 HRESULT hres;
6090 if(!view)
6091 return;
6093 hres = IOleDocumentView_Show(view, FALSE);
6094 ok(hres == S_OK, "Show failed: %08x\n", hres);
6097 static IHTMLDocument2 *create_document(void)
6099 IHTMLDocument2 *doc;
6100 HRESULT hres;
6102 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
6103 &IID_IHTMLDocument2, (void**)&doc);
6104 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
6105 if(FAILED(hres))
6106 return NULL;
6108 return doc;
6111 static void release_document(IHTMLDocument2 *doc)
6113 IUnknown *unk;
6114 ULONG ref;
6115 HRESULT hres;
6117 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
6118 * To workaround it, we release it via IUnknown iface */
6119 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
6120 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
6122 IHTMLDocument2_Release(doc);
6123 ref = IUnknown_Release(unk);
6124 ok(!ref, "ref = %d\n", ref);
6127 static void test_Navigate(IHTMLDocument2 *doc)
6129 IHlinkTarget *hlink;
6130 HRESULT hres;
6132 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
6133 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
6135 SET_EXPECT(ActivateMe);
6136 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
6137 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
6138 CHECK_CALLED(ActivateMe);
6140 IHlinkTarget_Release(hlink);
6143 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
6145 IDispatch *external;
6146 IHTMLWindow2 *htmlwin;
6147 HRESULT hres;
6149 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
6150 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6152 if(initialized)
6153 SET_EXPECT(GetExternal);
6154 external = (void*)0xdeadbeef;
6155 hres = IHTMLWindow2_get_external(htmlwin, &external);
6156 if(initialized) {
6157 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
6158 CHECK_CALLED(GetExternal);
6159 ok(external != NULL, "external == NULL\n");
6160 }else {
6161 ok(hres == S_OK, "get_external failed: %08x\n", hres);
6162 ok(external == NULL, "external != NULL\n");
6165 IHTMLWindow2_Release(htmlwin);
6168 static void test_StreamLoad(IHTMLDocument2 *doc)
6170 IPersistStreamInit *init;
6171 HRESULT hres;
6173 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6174 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6175 if(FAILED(hres))
6176 return;
6178 SET_EXPECT(Invoke_AMBIENT_SILENT);
6179 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6180 SET_EXPECT(Exec_ShellDocView_37);
6181 SET_EXPECT(OnChanged_READYSTATE);
6182 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6183 SET_EXPECT(Read);
6184 SET_EXPECT(GetPendingUrl);
6185 readystate_set_loading = TRUE;
6187 hres = IPersistStreamInit_Load(init, &Stream);
6188 ok(hres == S_OK, "Load failed: %08x\n", hres);
6190 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6191 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6192 CHECK_CALLED(Exec_ShellDocView_37);
6193 CHECK_CALLED(OnChanged_READYSTATE);
6194 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6195 CHECK_CALLED(Read);
6196 todo_wine CHECK_CALLED(GetPendingUrl);
6198 test_timer(EXPECT_SETTITLE);
6199 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6201 IPersistStreamInit_Release(init);
6204 static void test_StreamInitNew(IHTMLDocument2 *doc)
6206 IPersistStreamInit *init;
6207 HRESULT hres;
6209 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
6210 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
6211 if(FAILED(hres))
6212 return;
6214 SET_EXPECT(Invoke_AMBIENT_SILENT);
6215 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6216 SET_EXPECT(Exec_ShellDocView_37);
6217 SET_EXPECT(OnChanged_READYSTATE);
6218 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
6219 SET_EXPECT(GetPendingUrl);
6220 readystate_set_loading = TRUE;
6222 hres = IPersistStreamInit_InitNew(init);
6223 ok(hres == S_OK, "Load failed: %08x\n", hres);
6225 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6226 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6227 CHECK_CALLED(Exec_ShellDocView_37);
6228 CHECK_CALLED(OnChanged_READYSTATE);
6229 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
6230 todo_wine CHECK_CALLED(GetPendingUrl);
6232 test_timer(EXPECT_SETTITLE);
6233 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
6235 IPersistStreamInit_Release(init);
6238 static void test_QueryInterface(IHTMLDocument2 *doc)
6240 IUnknown *qi;
6241 HRESULT hres;
6243 static const IID IID_UndocumentedScriptIface =
6244 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
6246 qi = (void*)0xdeadbeef;
6247 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
6248 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6249 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
6251 qi = (void*)0xdeadbeef;
6252 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
6253 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6254 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6256 qi = (void*)0xdeadbeef;
6257 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
6258 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6259 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6261 qi = (void*)0xdeadbeef;
6262 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
6263 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6264 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6266 qi = (void*)0xdeadbeef;
6267 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
6268 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6269 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6271 qi = (void*)0xdeadbeef;
6272 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
6273 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6274 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6276 qi = (void*)0xdeadbeef;
6277 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
6278 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6279 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6281 qi = (void*)0xdeadbeef;
6282 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
6283 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
6284 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
6286 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
6287 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
6288 ok(qi != (IUnknown*)doc, "disp == doc\n");
6289 IUnknown_Release(qi);
6292 static void init_test(enum load_state_t ls) {
6293 doc_unk = NULL;
6294 hwnd = last_hwnd = NULL;
6295 set_clientsite = FALSE;
6296 load_from_stream = FALSE;
6297 call_UIActivate = CallUIActivate_None;
6298 load_state = ls;
6299 editmode = FALSE;
6300 stream_read = 0;
6301 protocol_read = 0;
6302 nav_url = NULL;
6303 ipsex = FALSE;
6304 inplace_deactivated = FALSE;
6305 complete = FALSE;
6306 expect_uihandler_iface = &DocHostUIHandler;
6309 static void test_HTMLDocument(BOOL do_load)
6311 IHTMLDocument2 *doc;
6313 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
6315 init_test(do_load ? LD_DOLOAD : LD_NO);
6317 doc = create_document();
6318 doc_unk = (IUnknown*)doc;
6320 test_QueryInterface(doc);
6321 test_Advise(doc);
6322 test_IsDirty(doc, S_FALSE);
6323 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6324 test_external(doc, FALSE);
6325 test_ViewAdviseSink(doc);
6326 test_ConnectionPointContainer(doc);
6327 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6328 test_Persist(doc, &Moniker);
6329 if(!do_load)
6330 test_OnAmbientPropertyChange2(doc);
6332 test_Activate(doc, CLIENTSITE_EXPECTPATH);
6334 if(do_load) {
6335 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6336 test_download(DWL_CSS|DWL_TRYCSS);
6337 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6338 test_elem_from_point(doc);
6341 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6342 test_OleCommandTarget_fail(doc);
6343 test_OleCommandTarget(doc);
6344 test_OnAmbientPropertyChange(doc);
6345 test_Window(doc, TRUE);
6346 test_external(doc, TRUE);
6348 test_UIDeactivate();
6349 test_OleCommandTarget(doc);
6350 test_Window(doc, TRUE);
6351 test_InPlaceDeactivate(doc, TRUE);
6353 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
6354 * MSHTML. It doesn't with Wine. */
6356 test_Window(doc, FALSE);
6357 test_Hide();
6358 test_InPlaceDeactivate(doc, FALSE);
6359 test_CloseView();
6360 test_Close(doc, FALSE);
6362 /* Activate HTMLDocument again */
6363 test_Activate(doc, CLIENTSITE_SETNULL);
6364 test_Window(doc, TRUE);
6365 test_OleCommandTarget(doc);
6366 test_UIDeactivate();
6367 test_InPlaceDeactivate(doc, TRUE);
6368 test_Close(doc, FALSE);
6370 /* Activate HTMLDocument again, this time without UIActivate */
6371 call_UIActivate = CallUIActivate_None;
6372 test_Activate(doc, CLIENTSITE_SETNULL);
6373 test_Window(doc, TRUE);
6375 test_external(doc, TRUE);
6376 set_custom_uihandler(doc, NULL);
6377 test_external(doc, FALSE);
6379 test_UIDeactivate();
6380 test_InPlaceDeactivate(doc, TRUE);
6381 test_CloseView();
6382 test_CloseView();
6383 test_Close(doc, TRUE);
6384 test_OnAmbientPropertyChange2(doc);
6385 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
6387 if(!do_load) {
6388 /* Activate HTMLDocument again, calling UIActivate after showing the window */
6389 call_UIActivate = CallUIActivate_AfterShow;
6390 test_Activate(doc, 0);
6391 test_Window(doc, TRUE);
6392 test_OleCommandTarget(doc);
6393 test_UIDeactivate();
6394 test_InPlaceDeactivate(doc, TRUE);
6395 test_Close(doc, FALSE);
6396 call_UIActivate = CallUIActivate_None;
6399 if(view)
6400 IOleDocumentView_Release(view);
6401 view = NULL;
6403 ok(IsWindow(hwnd), "hwnd is destroyed\n");
6404 release_document(doc);
6405 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
6408 static void test_HTMLDocument_hlink(DWORD status)
6410 IHTMLDocument2 *doc;
6412 trace("Testing HTMLDocument (hlink)...\n");
6414 init_test(LD_DOLOAD);
6415 ipsex = TRUE;
6417 doc = create_document();
6418 doc_unk = (IUnknown*)doc;
6420 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6421 test_ViewAdviseSink(doc);
6422 test_ConnectionPointContainer(doc);
6423 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6424 test_Persist(doc, &Moniker);
6425 test_Navigate(doc);
6427 status_code = status;
6428 test_download(DWL_CSS|DWL_TRYCSS);
6429 status_code = HTTP_STATUS_OK;
6431 test_IsDirty(doc, S_FALSE);
6432 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6434 test_exec_onunload(doc);
6435 test_Window(doc, TRUE);
6436 test_InPlaceDeactivate(doc, TRUE);
6437 test_Close(doc, FALSE);
6438 test_IsDirty(doc, S_FALSE);
6439 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6440 test_clear(doc);
6441 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
6443 if(view)
6444 IOleDocumentView_Release(view);
6445 view = NULL;
6447 release_document(doc);
6450 static void test_cookies(IHTMLDocument2 *doc)
6452 WCHAR buf[1024];
6453 DWORD size;
6454 BSTR str, str2;
6455 BOOL b;
6456 HRESULT hres;
6458 hres = IHTMLDocument2_get_cookie(doc, &str);
6459 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6460 if(str) {
6461 size = sizeof(buf)/sizeof(WCHAR);
6462 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6463 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6464 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
6465 SysFreeString(str);
6468 str = a2bstr("test=testval");
6469 hres = IHTMLDocument2_put_cookie(doc, str);
6470 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6472 str2 = NULL;
6473 hres = IHTMLDocument2_get_cookie(doc, &str2);
6474 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6475 ok(str2 != NULL, "cookie = NULL\n");
6476 size = sizeof(buf)/sizeof(WCHAR);
6477 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6478 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6479 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6480 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6481 SysFreeString(str);
6482 SysFreeString(str2);
6484 str = a2bstr("test=testval2");
6485 hres = IHTMLDocument2_put_cookie(doc, str);
6486 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
6488 str2 = NULL;
6489 hres = IHTMLDocument2_get_cookie(doc, &str2);
6490 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
6491 ok(str2 != NULL, "cookie = NULL\n");
6492 size = sizeof(buf)/sizeof(WCHAR);
6493 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
6494 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
6495 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
6496 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
6497 SysFreeString(str);
6498 SysFreeString(str2);
6501 static void test_HTMLDocument_http(BOOL with_wbapp)
6503 IMoniker *http_mon;
6504 IHTMLDocument2 *doc;
6505 ULONG ref;
6506 HRESULT hres;
6508 trace("Testing HTMLDocument (http%s)...\n", with_wbapp ? " with IWebBrowserApp" : "");
6510 support_wbapp = with_wbapp;
6512 if(!winetest_interactive && is_ie_hardened()) {
6513 win_skip("IE running in Enhanced Security Configuration\n");
6514 return;
6517 init_test(LD_DOLOAD);
6518 ipsex = TRUE;
6520 doc = create_document();
6521 doc_unk = (IUnknown*)doc;
6523 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
6524 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
6526 test_ViewAdviseSink(doc);
6527 test_ConnectionPointContainer(doc);
6528 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6529 test_Persist(doc, http_mon);
6530 test_Navigate(doc);
6531 test_download(DWL_HTTP);
6532 test_cookies(doc);
6533 test_IsDirty(doc, S_FALSE);
6534 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6535 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
6537 nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */
6538 if(support_wbapp)
6539 test_put_href(doc, FALSE, "#test", "http://www.winehq.org/#test", FALSE, TRUE);
6540 test_put_href(doc, FALSE, NULL, "javascript:external&&undefined", TRUE, FALSE);
6542 test_put_href(doc, FALSE, NULL, "about:blank", FALSE, FALSE);
6543 test_put_href(doc, TRUE, NULL, "about:replace", FALSE, FALSE);
6545 test_open_window(doc);
6547 test_InPlaceDeactivate(doc, TRUE);
6548 test_Close(doc, FALSE);
6549 test_IsDirty(doc, S_FALSE);
6550 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
6552 if(view)
6553 IOleDocumentView_Release(view);
6554 view = NULL;
6556 release_document(doc);
6558 ref = IMoniker_Release(http_mon);
6559 ok(!ref, "ref=%d, expected 0\n", ref);
6562 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
6564 IHTMLWindow2 *window, *sp_window;
6565 IServiceProvider *sp;
6566 IHlinkFrame *hf;
6567 HRESULT hres;
6569 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
6570 ok(hres == S_OK, "QueryService returned %08x\n", hres);
6572 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6573 if(!success) {
6574 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
6575 IServiceProvider_Release(sp);
6576 return;
6579 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6580 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6581 IHlinkFrame_Release(hf);
6583 IServiceProvider_Release(sp);
6585 hres = IHTMLDocument2_get_parentWindow(doc, &window);
6586 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
6588 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
6589 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
6591 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
6592 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
6593 /* FIXME: test returned window */
6594 IHTMLWindow2_Release(sp_window);
6596 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
6597 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
6598 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
6599 IHlinkFrame_Release(hf);
6601 IServiceProvider_Release(sp);
6602 IHTMLWindow2_Release(window);
6605 static void test_HTMLDocument_StreamLoad(void)
6607 IHTMLDocument2 *doc;
6608 IOleObject *oleobj;
6609 DWORD conn;
6610 HRESULT hres;
6612 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
6614 init_test(LD_DOLOAD);
6615 load_from_stream = TRUE;
6617 doc = create_document();
6618 doc_unk = (IUnknown*)doc;
6620 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6621 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6623 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6624 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6626 test_readyState((IUnknown*)doc);
6627 test_IsDirty(doc, S_FALSE);
6628 test_ViewAdviseSink(doc);
6629 test_ConnectionPointContainer(doc);
6630 test_QueryService(doc, FALSE);
6631 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6632 test_QueryService(doc, TRUE);
6633 test_DoVerb(oleobj);
6634 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6636 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6637 test_StreamLoad(doc);
6638 test_download(DWL_VERBDONE|DWL_TRYCSS);
6639 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6641 test_UIDeactivate();
6642 test_InPlaceDeactivate(doc, TRUE);
6643 SET_EXPECT(Advise_Close);
6644 test_Close(doc, TRUE);
6645 CHECK_CALLED(Advise_Close);
6646 test_external(doc, FALSE);
6647 test_IsDirty(doc, S_FALSE);
6649 set_custom_uihandler(doc, &CustomDocHostUIHandler);
6650 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
6651 test_external(doc, TRUE);
6652 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6653 test_external(doc, TRUE);
6654 set_custom_uihandler(doc, NULL);
6655 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
6657 IOleObject_Release(oleobj);
6658 if(view) {
6659 IOleDocumentView_Release(view);
6660 view = NULL;
6663 release_document(doc);
6666 static void test_HTMLDocument_StreamInitNew(void)
6668 IHTMLDocument2 *doc;
6669 IOleObject *oleobj;
6670 DWORD conn;
6671 HRESULT hres;
6673 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
6675 init_test(LD_DOLOAD);
6676 load_from_stream = TRUE;
6678 doc = create_document();
6679 doc_unk = (IUnknown*)doc;
6681 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6682 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6684 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6685 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6687 test_readyState((IUnknown*)doc);
6688 test_IsDirty(doc, S_FALSE);
6689 test_ViewAdviseSink(doc);
6690 test_ConnectionPointContainer(doc);
6691 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6692 test_DoVerb(oleobj);
6693 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6695 IOleObject_Release(oleobj);
6697 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
6698 test_StreamInitNew(doc);
6700 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
6701 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
6702 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
6704 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6706 test_UIDeactivate();
6707 test_InPlaceDeactivate(doc, TRUE);
6708 SET_EXPECT(Advise_Close);
6709 test_Close(doc, FALSE);
6710 CHECK_CALLED(Advise_Close);
6711 test_IsDirty(doc, S_FALSE);
6713 if(view) {
6714 IOleDocumentView_Release(view);
6715 view = NULL;
6718 release_document(doc);
6721 static void test_edit_uiactivate(IOleObject *oleobj)
6723 IOleDocumentView *docview;
6724 HRESULT hres;
6726 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
6727 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
6729 SET_EXPECT(OnFocus_TRUE);
6730 SET_EXPECT(SetActiveObject);
6731 SET_EXPECT(ShowUI);
6732 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6733 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6734 expect_status_text = NULL;
6736 hres = IOleDocumentView_UIActivate(docview, TRUE);
6737 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
6739 CHECK_CALLED(OnFocus_TRUE);
6740 CHECK_CALLED(SetActiveObject);
6741 CHECK_CALLED(ShowUI);
6742 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6743 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6745 IOleDocumentView_Release(docview);
6748 static void test_editing_mode(BOOL do_load)
6750 IHTMLDocument2 *doc;
6751 IUnknown *unk;
6752 IOleObject *oleobj;
6753 DWORD conn;
6754 HRESULT hres;
6756 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
6758 init_test(do_load ? LD_DOLOAD : LD_NO);
6759 call_UIActivate = CallUIActivate_AfterShow;
6761 doc = create_document();
6762 unk = doc_unk = (IUnknown*)doc;
6764 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6765 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
6767 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
6768 ok(hres == S_OK, "Advise failed: %08x\n", hres);
6770 test_readyState((IUnknown*)doc);
6771 test_ViewAdviseSink(doc);
6772 test_ConnectionPointContainer(doc);
6773 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
6774 test_DoVerb(oleobj);
6775 test_edit_uiactivate(oleobj);
6777 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6778 if(do_load)
6779 test_Persist(doc, &Moniker);
6780 stream_read = protocol_read = 0;
6781 test_exec_editmode(unk, do_load);
6782 test_UIDeactivate();
6783 call_UIActivate = CallUIActivate_None;
6784 IOleObject_Release(oleobj);
6786 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
6787 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
6789 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
6790 test_timer(EXPECT_UPDATEUI);
6791 SET_CALLED(SetStatusText);
6793 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
6795 if(!do_load) {
6796 test_exec_fontname(unk, NULL, wszTimesNewRoman);
6797 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
6798 test_timer(EXPECT_UPDATEUI);
6799 test_exec_fontname(unk, NULL, wszArial);
6801 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
6802 test_timer(EXPECT_UPDATEUI);
6803 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
6804 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
6806 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
6807 test_timer(EXPECT_UPDATEUI);
6808 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
6809 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
6810 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
6811 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
6813 test_exec_noargs(unk, IDM_HORIZONTALLINE);
6814 test_timer(EXPECT_UPDATEUI);
6815 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
6816 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
6819 test_UIDeactivate();
6820 test_InPlaceDeactivate(doc, TRUE);
6821 SET_EXPECT(Advise_Close);
6822 test_Close(doc, FALSE);
6823 CHECK_CALLED(Advise_Close);
6825 if(view) {
6826 IOleDocumentView_Release(view);
6827 view = NULL;
6830 release_document(doc);
6833 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
6835 IHTMLDocument2 *doc;
6836 IOleObject *oleobj;
6837 IOleInPlaceSite *inplacesite;
6838 HRESULT hres;
6840 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
6842 init_test(do_load ? LD_DOLOAD : LD_NO);
6844 doc = create_document();
6845 doc_unk = (IUnknown*)doc;
6847 ipsex = use_ipsex;
6848 ipsw = use_ipsw;
6850 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6851 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6853 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
6854 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
6856 SET_EXPECT(Invoke_AMBIENT_USERMODE);
6857 SET_EXPECT(GetHostInfo);
6858 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6859 SET_EXPECT(Invoke_AMBIENT_SILENT);
6860 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6861 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6862 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6863 SET_EXPECT(GetOptionKeyPath);
6864 SET_EXPECT(GetOverrideKeyPath);
6865 SET_EXPECT(GetWindow);
6866 SET_EXPECT(Exec_DOCCANNAVIGATE);
6867 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
6868 SET_EXPECT(Exec_SETPROGRESSMAX);
6869 SET_EXPECT(Exec_SETPROGRESSPOS);
6870 SET_EXPECT(GetTravelLog);
6872 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
6873 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6874 set_clientsite = TRUE;
6876 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
6877 CHECK_CALLED(GetHostInfo);
6878 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6879 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6880 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6881 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6882 CLEAR_CALLED(Invoke_AMBIENT_PALETTE); /* not called on IE9 */
6883 CLEAR_CALLED(GetOptionKeyPath); /* not called on some IE9 */
6884 CHECK_CALLED(GetOverrideKeyPath);
6885 CHECK_CALLED(GetWindow);
6886 CHECK_CALLED(Exec_DOCCANNAVIGATE);
6887 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
6888 CHECK_CALLED(Exec_SETPROGRESSMAX);
6889 CHECK_CALLED(Exec_SETPROGRESSPOS);
6890 todo_wine CHECK_CALLED(GetTravelLog);
6892 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6893 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6894 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
6896 SET_EXPECT(GetContainer);
6897 SET_EXPECT(LockContainer);
6898 SET_EXPECT(CanInPlaceActivate);
6899 SET_EXPECT(GetWindowContext);
6900 SET_EXPECT(GetWindow);
6901 if(use_ipsex) {
6902 SET_EXPECT(OnInPlaceActivateEx);
6903 SET_EXPECT(RequestUIActivate);
6905 else
6906 SET_EXPECT(OnInPlaceActivate);
6907 SET_EXPECT(OnUIActivate);
6908 SET_EXPECT(SetStatusText);
6909 SET_EXPECT(Exec_SETPROGRESSMAX);
6910 SET_EXPECT(Exec_SETPROGRESSPOS);
6911 SET_EXPECT(ShowUI);
6912 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6913 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6914 SET_EXPECT(OnFocus_TRUE);
6915 SET_EXPECT(SetActiveObject);
6916 expect_LockContainer_fLock = TRUE;
6918 hres = IOleDocumentView_UIActivate(view, TRUE);
6919 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6921 CHECK_CALLED(GetContainer);
6922 CHECK_CALLED(LockContainer);
6923 CHECK_CALLED(CanInPlaceActivate);
6924 CHECK_CALLED(GetWindowContext);
6925 CHECK_CALLED(GetWindow);
6926 if(use_ipsex) {
6927 CHECK_CALLED(OnInPlaceActivateEx);
6928 SET_EXPECT(RequestUIActivate);
6930 else
6931 CHECK_CALLED(OnInPlaceActivate);
6932 CHECK_CALLED(OnUIActivate);
6933 CHECK_CALLED(SetStatusText);
6934 CHECK_CALLED(Exec_SETPROGRESSMAX);
6935 CHECK_CALLED(Exec_SETPROGRESSPOS);
6936 CHECK_CALLED(ShowUI);
6937 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6938 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6939 CHECK_CALLED(OnFocus_TRUE);
6940 CHECK_CALLED(SetActiveObject);
6941 container_locked = TRUE;
6943 SET_EXPECT(SetActiveObject_null);
6944 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6945 SET_EXPECT(HideUI);
6946 SET_EXPECT(OnUIDeactivate);
6948 hres = IOleDocumentView_UIActivate(view, FALSE);
6949 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6951 CHECK_CALLED(SetActiveObject_null);
6952 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6953 CHECK_CALLED(HideUI);
6954 CHECK_CALLED(OnUIDeactivate);
6956 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6957 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6958 ok(inplacesite != NULL, "inplacesite = NULL\n");
6959 IOleInPlaceSite_Release(inplacesite);
6961 SET_EXPECT(SetStatusText);
6962 SET_EXPECT(OnFocus_FALSE);
6963 if(use_ipsex)
6964 SET_EXPECT(OnInPlaceDeactivateEx);
6965 else
6966 SET_EXPECT(OnInPlaceDeactivate);
6968 test_CloseView();
6970 CLEAR_CALLED(SetStatusText); /* Called by IE9 */
6971 CHECK_CALLED(OnFocus_FALSE);
6972 if(use_ipsex)
6973 CHECK_CALLED(OnInPlaceDeactivateEx);
6974 else
6975 CHECK_CALLED(OnInPlaceDeactivate);
6977 test_Close(doc, TRUE);
6979 IOleObject_Release(oleobj);
6980 IOleDocumentView_Release(view);
6981 view = NULL;
6983 release_document(doc);
6986 static void register_protocol(void)
6988 IInternetSession *session;
6989 HRESULT hres;
6991 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
6993 hres = CoInternetGetSession(0, &session, 0);
6994 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
6996 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
6997 wsz_winetest, 0, NULL, 0);
6998 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
7000 IInternetSession_Release(session);
7003 static void test_HTMLDoc_ISupportErrorInfo(void)
7005 IHTMLDocument2 *doc;
7006 HRESULT hres;
7007 ISupportErrorInfo *sinfo;
7009 doc = create_document();
7011 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
7012 ok(hres == S_OK, "got %x\n", hres);
7013 ok(sinfo != NULL, "got %p\n", sinfo);
7014 if(sinfo)
7016 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
7017 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
7018 IUnknown_Release(sinfo);
7021 release_document(doc);
7024 static void test_IPersistHistory(void)
7026 IHTMLDocument2 *doc;
7027 HRESULT hres;
7028 IPersistHistory *phist;
7030 doc = create_document();
7032 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
7033 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
7034 if(hres == S_OK)
7035 IPersistHistory_Release(phist);
7037 release_document(doc);
7040 static BOOL check_ie(void)
7042 IHTMLDocument2 *doc;
7043 IHTMLDocument5 *doc5;
7044 HRESULT hres;
7046 doc = create_document();
7047 if(!doc)
7048 return FALSE;
7050 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
7051 if(SUCCEEDED(hres))
7052 IHTMLDocument5_Release(doc5);
7054 release_document(doc);
7055 return SUCCEEDED(hres);
7058 START_TEST(htmldoc)
7060 CoInitialize(NULL);
7062 if(!check_ie()) {
7063 CoUninitialize();
7064 win_skip("Too old IE\n");
7065 return;
7068 container_hwnd = create_container_window();
7069 register_protocol();
7071 asynchronous_binding = TRUE;
7072 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
7074 asynchronous_binding = FALSE;
7075 test_HTMLDocument_hlink(HTTP_STATUS_OK);
7076 test_HTMLDocument(FALSE);
7077 test_HTMLDocument(TRUE);
7078 test_HTMLDocument_StreamLoad();
7079 test_HTMLDocument_StreamInitNew();
7080 test_editing_mode(FALSE);
7081 test_editing_mode(TRUE);
7082 test_HTMLDocument_http(FALSE);
7083 test_HTMLDocument_http(TRUE);
7084 test_UIActivate(FALSE, FALSE, FALSE);
7085 test_UIActivate(FALSE, TRUE, FALSE);
7086 test_UIActivate(FALSE, TRUE, TRUE);
7087 test_UIActivate(TRUE, FALSE, FALSE);
7088 test_UIActivate(TRUE, TRUE, FALSE);
7089 test_UIActivate(TRUE, TRUE, TRUE);
7090 test_HTMLDoc_ISupportErrorInfo();
7091 test_IPersistHistory();
7093 DestroyWindow(container_hwnd);
7094 CoUninitialize();