2 * Copyright 2005-2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <wine/test.h>
32 #include "docobjectservice.h"
41 #include "shdeprecated.h"
44 #include "mshtml_test.h"
46 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
47 DEFINE_GUID(IID_IProxyManager,0x00000008,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
48 DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
56 #define SET_CALLED(func) \
57 called_ ## func = TRUE
59 #define CHECK_EXPECT2(func) \
61 ok(expect_ ##func, "unexpected call " #func "\n"); \
62 called_ ## func = TRUE; \
65 #define CHECK_EXPECT(func) \
67 CHECK_EXPECT2(func); \
68 expect_ ## func = FALSE; \
71 #define CHECK_CALLED(func) \
73 ok(called_ ## func, "expected " #func "\n"); \
74 expect_ ## func = called_ ## func = FALSE; \
77 #define CHECK_NOT_CALLED(func) \
79 ok(!called_ ## func, "unexpected " #func "\n"); \
80 expect_ ## func = called_ ## func = FALSE; \
83 #define CHECK_CALLED_BROKEN(func) \
85 ok(called_ ## func || broken(!called_ ## func), "expected " #func "\n"); \
86 expect_ ## func = called_ ## func = FALSE; \
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);
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(FireNavigateComplete2);
183 DEFINE_EXPECT(FireDocumentComplete);
184 DEFINE_EXPECT(GetPendingUrl);
185 DEFINE_EXPECT(ActiveElementChanged);
186 DEFINE_EXPECT(IsErrorUrl);
188 static IUnknown *doc_unk;
189 static IMoniker *doc_mon;
190 static BOOL expect_LockContainer_fLock;
191 static BOOL expect_InPlaceUIWindow_SetActiveObject_active = TRUE;
192 static BOOL ipsex, ipsw;
193 static BOOL set_clientsite, container_locked;
194 static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
195 static BOOL editmode = FALSE, ignore_external_qi;
196 static BOOL inplace_deactivated, open_call;
197 static BOOL complete, loading_js;
198 static DWORD status_code = HTTP_STATUS_OK;
199 static BOOL asynchronous_binding = FALSE;
200 static int stream_read, protocol_read;
201 static enum load_state_t {
210 static LPCOLESTR expect_status_text = NULL;
211 static const char *nav_url;
213 static const char html_page[] =
215 "<head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\"></head>"
216 "<body><div>test</div></body>"
219 static const char css_data[] = "body {color: red; margin: 0}";
221 static const WCHAR http_urlW[] =
222 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
224 static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0};
226 #define DOCHOST_DOCCANNAVIGATE 0
227 #define WM_CONTINUE_BINDING (WM_APP+1)
229 static HRESULT QueryInterface(REFIID riid, void **ppv);
230 static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
232 #define test_readyState(u) _test_readyState(__LINE__,u)
233 static void _test_readyState(unsigned,IUnknown*);
235 static const WCHAR wszTimesNewRoman[] =
236 {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0};
237 static const WCHAR wszArial[] =
238 {'A','r','i','a','l',0};
240 static const char *debugstr_guid(REFIID riid)
247 sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
248 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
249 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
250 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
255 static int strcmp_wa(LPCWSTR strw, const char *stra)
258 WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
259 return lstrcmpA(stra, buf);
262 static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
266 const WCHAR *p1 = str, *p2 = sub;
267 while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
268 if (!*p2) return str;
274 static BSTR a2bstr(const char *str)
279 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
280 ret = SysAllocStringLen(NULL, len);
281 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
286 /* Returns true if the user interface is in English. Note that this does not
287 * presume of the formatting of dates, numbers, etc.
289 static BOOL is_lang_english(void)
291 static HMODULE hkernel32 = NULL;
292 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
293 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
297 hkernel32 = GetModuleHandleA("kernel32.dll");
298 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
299 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
301 if (pGetThreadUILanguage)
302 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
303 if (pGetUserDefaultUILanguage)
304 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
306 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
309 #define EXPECT_UPDATEUI 1
310 #define EXPECT_SETTITLE 2
312 static void test_timer(DWORD flags)
314 BOOL *b = &called_Exec_SETTITLE;
317 if(flags & EXPECT_UPDATEUI) {
318 SET_EXPECT(UpdateUI);
319 SET_EXPECT(Exec_UPDATECOMMANDS);
320 b = &called_UpdateUI;
322 if(flags & EXPECT_SETTITLE)
323 SET_EXPECT(Exec_SETTITLE);
325 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
326 TranslateMessage(&msg);
327 DispatchMessage(&msg);
330 if(flags & EXPECT_UPDATEUI) {
331 CHECK_CALLED(UpdateUI);
332 CHECK_CALLED(Exec_UPDATECOMMANDS);
334 if(flags & EXPECT_SETTITLE)
335 CHECK_CALLED(Exec_SETTITLE);
338 static IMoniker Moniker;
340 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
341 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
344 IPersistMoniker *permon;
345 IMoniker *mon = (void*)0xdeadbeef;
346 BSTR doc_url = (void*)0xdeadbeef;
352 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
353 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
357 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
358 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
360 hres = IHTMLDocument2_get_URL(doc, &doc_url);
361 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
363 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
364 IPersistMoniker_Release(permon);
368 BOOL exb = expect_GetDisplayName;
369 BOOL clb = called_GetDisplayName;
371 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
372 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
375 SET_EXPECT(GetDisplayName);
376 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
377 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
379 CHECK_CALLED(GetDisplayName);
380 expect_GetDisplayName = exb;
381 called_GetDisplayName = clb;
383 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
388 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
390 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
391 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
393 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
394 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
398 ok_(__FILE__,line)(hres == E_UNEXPECTED,
399 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
400 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
401 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
404 SysFreeString(doc_url);
405 IHTMLDocument_Release(doc);
406 if(mon && mon != (void*)0xdeadbeef)
407 IMoniker_Release(mon);
410 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
412 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
416 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
421 if(IsEqualGUID(&IID_IProxyManager, riid))
422 return E_NOINTERFACE; /* TODO */
423 if(IsEqualGUID(&IID_IDispatchEx, riid))
424 return E_NOINTERFACE; /* TODO */
425 if(IsEqualGUID(&IID_External_unk, riid))
426 return E_NOINTERFACE; /* TODO */
428 if(!ignore_external_qi)
429 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
430 return E_NOINTERFACE;
433 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
438 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
443 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
445 ok(0, "unexpected call\n");
449 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
452 ok(0, "unexpected call\n");
456 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
457 UINT cNames, LCID lcid, DISPID *rgDispId)
459 ok(0, "unexpected call\n");
463 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
464 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
465 EXCEPINFO *pExcepInfo, UINT *puArgErr)
467 ok(0, "unexpected call\n");
471 static const IDispatchVtbl ExternalVtbl = {
472 External_QueryInterface,
475 Dispatch_GetTypeInfoCount,
476 Dispatch_GetTypeInfo,
477 Dispatch_GetIDsOfNames,
481 static IDispatch External = { &ExternalVtbl };
483 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
485 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
491 return E_NOINTERFACE;
494 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
499 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
504 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
505 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
506 DWORD grfPI, HANDLE_PTR dwReserved)
512 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
513 static const WCHAR empty_str = {0};
517 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
518 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
519 ok(!grfPI, "grfPI = %x\n", grfPI);
520 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
522 memset(&bindinfo, 0, sizeof(bindinfo));
523 bindinfo.cbSize = sizeof(bindinfo);
524 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
525 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
526 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
527 "bindf = %x\n", bindf);
529 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
530 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
531 /* TODO: test stgmedData */
532 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
533 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
534 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
535 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
536 ok(bindinfo.dwOptions == 0x80000 ||
537 bindinfo.dwOptions == 0x4080000, /* win2k3 */
538 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
539 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
540 /* TODO: test dwCodePage */
541 /* TODO: test securityAttributes */
542 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
543 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
544 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
546 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
547 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
548 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
550 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
551 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
553 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
555 hres = IInternetProtocolSink_ReportData(pOIProtSink,
556 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
557 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
559 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
560 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
565 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
566 PROTOCOLDATA *pProtocolData)
568 ok(0, "unexpected call\n");
572 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
575 ok(0, "unexpected call\n");
579 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
581 CHECK_EXPECT(Terminate);
585 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
587 ok(0, "unexpected call\n");
591 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
593 ok(0, "unexpected call\n");
597 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
598 ULONG cb, ULONG *pcbRead)
600 CHECK_EXPECT2(Protocol_Read);
602 ok(pv != NULL, "pv == NULL\n");
603 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
604 ok(pcbRead != NULL, "pcbRead == NULL\n");
605 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
610 protocol_read += *pcbRead = sizeof(css_data)-1;
611 memcpy(pv, css_data, sizeof(css_data)-1);
615 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
616 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
618 ok(0, "unexpected call\n");
622 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
624 CHECK_EXPECT(LockRequest);
628 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
630 CHECK_EXPECT(UnlockRequest);
634 static const IInternetProtocolVtbl ProtocolVtbl = {
635 Protocol_QueryInterface,
646 Protocol_LockRequest,
647 Protocol_UnlockRequest
650 static IInternetProtocol Protocol = { &ProtocolVtbl };
652 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
654 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
655 ok(0, "unexpected call\n");
656 return E_NOINTERFACE;
659 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
664 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
669 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
670 REFIID riid, void **ppv)
672 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
673 return E_NOINTERFACE;
675 CHECK_EXPECT(CreateInstance);
676 ok(ppv != NULL, "ppv == NULL\n");
682 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
684 ok(0, "unexpected call\n");
688 static const IClassFactoryVtbl ClassFactoryVtbl = {
689 ClassFactory_QueryInterface,
691 ClassFactory_Release,
692 ClassFactory_CreateInstance,
693 ClassFactory_LockServer
696 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
698 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
700 ok(0, "unexpected call\n");
704 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
709 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
714 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
715 IHlinkBrowseContext *pihlbc)
717 ok(0, "unexpected call\n");
721 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
722 IHlinkBrowseContext **ppihlbc)
724 ok(0, "unexpected call\n");
728 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
729 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
733 CHECK_EXPECT(Navigate);
735 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
736 ok(pbc != NULL, "pbc == NULL\n");
737 ok(pibsc != NULL, "pubsc == NULL\n");
738 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
741 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
742 LPWSTR location = (LPWSTR)0xdeadbeef;
744 IMoniker *mon = NULL;
745 DWORD site_data = 0xdeadbeef;
747 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
748 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
749 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
751 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
752 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
753 ok(location == NULL, "location = %p\n", location);
754 ok(mon != NULL, "mon == NULL\n");
756 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
757 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
758 ok(site == NULL, "site = %p\n, expected NULL\n", site);
759 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
765 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
766 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
768 ok(0, "unexpected call\n");
772 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
773 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
775 ok(0, "unexpected call\n");
779 static const IHlinkFrameVtbl HlinkFrameVtbl = {
780 HlinkFrame_QueryInterface,
783 HlinkFrame_SetBrowseContext,
784 HlinkFrame_GetBrowseContext,
786 HlinkFrame_OnNavigate,
787 HlinkFrame_UpdateHlink
790 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
792 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
794 ok(0, "unexpected call\n");
795 return E_NOINTERFACE;
798 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
803 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
808 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
809 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
810 DWORD dwUserActionTime)
812 CHECK_EXPECT(EvaluateNewWindow);
814 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
815 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
816 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
817 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
818 ok(!fReplace, "fReplace = %x\n", fReplace);
819 ok(dwFlags == NWMF_FIRST, "dwFlags = %x\n", dwFlags);
820 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
825 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
826 NewWindowManager_QueryInterface,
827 NewWindowManager_AddRef,
828 NewWindowManager_Release,
829 NewWindowManager_EvaluateNewWindow
832 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
834 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
835 REFIID riid, void**ppv)
837 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
842 ok(0, "unexpected call\n");
843 return E_NOINTERFACE;
846 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
851 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
856 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
859 case DISPID_READYSTATE:
860 CHECK_EXPECT2(OnChanged_READYSTATE);
862 if(!readystate_set_interactive)
863 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
864 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
865 ? OLECMDF_ENABLED : 0));
867 if(readystate_set_loading) {
868 readystate_set_loading = FALSE;
869 load_state = LD_LOADING;
871 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
872 test_readyState(NULL);
875 CHECK_EXPECT(OnChanged_1005);
877 test_readyState(NULL);
878 readystate_set_interactive = (load_state != LD_INTERACTIVE);
881 CHECK_EXPECT(OnChanged_1012);
896 ok(0, "unexpected id %d\n", dispID);
900 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
902 ok(0, "unexpected call\n");
906 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
907 PropertyNotifySink_QueryInterface,
908 PropertyNotifySink_AddRef,
909 PropertyNotifySink_Release,
910 PropertyNotifySink_OnChanged,
911 PropertyNotifySink_OnRequestEdit
914 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
916 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
918 ok(0, "unexpected call\n");
919 return E_NOINTERFACE;
922 static ULONG WINAPI Stream_AddRef(IStream *iface)
927 static ULONG WINAPI Stream_Release(IStream *iface)
932 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
933 ULONG cb, ULONG *pcbRead)
936 ok(pv != NULL, "pv == NULL\n");
937 ok(cb > sizeof(html_page), "cb = %d\n", cb);
938 ok(pcbRead != NULL, "pcbRead == NULL\n");
939 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
944 memcpy(pv, html_page, sizeof(html_page)-1);
945 stream_read += *pcbRead = sizeof(html_page)-1;
949 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
950 ULONG cb, ULONG *pcbWritten)
952 ok(0, "unexpected call\n");
956 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
957 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
959 ok(0, "unexpected call\n");
963 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
965 ok(0, "unexpected call\n");
969 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
970 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
972 ok(0, "unexpected call\n");
976 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
978 ok(0, "unexpected call\n");
982 static HRESULT WINAPI Stream_Revert(IStream *iface)
984 ok(0, "unexpected call\n");
988 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
989 ULARGE_INTEGER cb, DWORD dwLockType)
991 ok(0, "unexpected call\n");
995 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
996 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
998 ok(0, "unexpected call\n");
1002 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
1005 ok(0, "unexpected call\n");
1009 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1011 ok(0, "unexpected call\n");
1015 static const IStreamVtbl StreamVtbl = {
1016 Stream_QueryInterface,
1027 Stream_UnlockRegion,
1032 static IStream Stream = { &StreamVtbl };
1034 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1035 IWinInetHttpInfo* This,
1039 ok(0, "unexpected call\n");
1040 return E_NOINTERFACE;
1043 static ULONG WINAPI WinInetHttpInfo_AddRef(
1044 IWinInetHttpInfo* This)
1049 static ULONG WINAPI WinInetHttpInfo_Release(
1050 IWinInetHttpInfo* This)
1055 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1056 IWinInetHttpInfo* This,
1061 return E_NOTIMPL; /* TODO */
1064 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1065 IWinInetHttpInfo* This,
1072 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1074 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1075 ok(pBuffer != NULL, "pBuffer == NULL\n");
1076 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1077 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1078 *((DWORD*)pBuffer) = status_code;
1082 return E_NOTIMPL; /* TODO */
1085 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1086 WinInetHttpInfo_QueryInterface,
1087 WinInetHttpInfo_AddRef,
1088 WinInetHttpInfo_Release,
1089 WinInetHttpInfo_QueryOption,
1090 WinInetHttpInfo_QueryInfo
1093 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1095 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1097 if(IsEqualGUID(&IID_IUnknown, riid)) {
1102 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1103 *ppv = &WinInetHttpInfo;
1107 ok(0, "unexpected call\n");
1108 return E_NOINTERFACE;
1111 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1116 static ULONG WINAPI Binding_Release(IBinding *iface)
1121 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1123 CHECK_EXPECT(Abort);
1124 if(asynchronous_binding)
1125 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1129 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1131 ok(0, "unexpected call\n");
1135 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1137 ok(0, "unexpected call\n");
1141 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1143 ok(0, "unexpected call\n");
1147 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1149 ok(0, "unexpected call\n");
1153 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1154 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1156 CHECK_EXPECT(GetBindResult);
1160 static const IBindingVtbl BindingVtbl = {
1161 Binding_QueryInterface,
1167 Binding_SetPriority,
1168 Binding_GetPriority,
1169 Binding_GetBindResult
1172 static IBinding Binding = { &BindingVtbl };
1174 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1175 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1177 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1181 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1182 return E_NOINTERFACE; /* TODO */
1183 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1184 return E_NOINTERFACE; /* TODO */
1186 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1187 return E_NOINTERFACE;
1190 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1195 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1200 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1202 CHECK_EXPECT(GetClassID);
1203 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1207 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1209 ok(0, "unexpected call\n");
1213 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1215 ok(0, "unexpected call\n");
1219 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1221 ok(0, "unexpected call\n");
1225 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1227 ok(0, "unexpected call\n");
1231 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1232 REFIID riidResult, void **ppvResult)
1234 ok(0, "unexpected call\n");
1238 static void continue_binding(IBindStatusCallback *callback)
1240 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1241 STGMEDIUM stgmedium;
1244 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1246 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1248 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1250 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1251 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1252 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1253 if(status_code != HTTP_STATUS_OK) {
1254 CHECK_CALLED_BROKEN(IsErrorUrl);
1255 SET_EXPECT(IsErrorUrl);
1259 stgmedium.tymed = TYMED_ISTREAM;
1260 U(stgmedium).pstm = &Stream;
1261 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1262 hres = IBindStatusCallback_OnDataAvailable(callback,
1263 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1264 sizeof(html_page)-1, &formatetc, &stgmedium);
1265 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1268 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1269 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1270 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1272 SET_EXPECT(GetBindResult);
1273 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1274 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1275 SET_CALLED(GetBindResult); /* IE7 */
1277 IBindStatusCallback_Release(callback);
1280 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1281 REFIID riid, void **ppv)
1283 IBindStatusCallback *callback = NULL;
1288 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1290 CHECK_EXPECT(BindToStorage);
1292 load_state = LD_LOADING;
1294 ok(pbc != NULL, "pbc == NULL\n");
1295 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1296 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1297 ok(ppv != NULL, "ppv == NULL\n");
1298 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1300 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1301 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1302 ok(callback != NULL, "callback == NULL\n");
1304 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1305 bindinfo.cbSize = sizeof(bindinfo);
1307 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1308 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1309 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1310 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1311 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1312 /* TODO: test stgmedData */
1313 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1314 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1315 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1316 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1317 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1318 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1319 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1320 /* TODO: test dwCodePage */
1321 /* TODO: test securityAttributes */
1322 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1323 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1324 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1326 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1327 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1329 if(asynchronous_binding) {
1330 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1331 return MK_S_ASYNCHRONOUS;
1334 continue_binding(callback);
1338 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1339 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1341 ok(0, "unexpected call\n");
1345 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1346 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1348 ok(0, "unexpected call\n");
1352 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1354 ok(0, "unexpected call\n");
1358 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1360 ok(0, "unexpected call\n");
1364 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1366 ok(0, "unexpected call\n");
1370 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1371 IMoniker *pmkNewlyRunning)
1373 ok(0, "unexpected call\n");
1377 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1378 IMoniker *pmkToLeft, FILETIME *pFileTime)
1380 ok(0, "unexpected call\n");
1384 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1386 ok(0, "unexpected call\n");
1390 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1391 IMoniker **ppmkPrefix)
1393 ok(0, "unexpected call\n");
1397 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1398 IMoniker **pmkRelPath)
1400 ok(0, "unexpected call\n");
1404 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1405 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1407 CHECK_EXPECT2(GetDisplayName);
1409 /* ok(pbc != NULL, "pbc == NULL\n"); */
1410 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1411 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1413 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1414 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1419 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1420 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1422 ok(0, "unexpected call\n");
1426 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1428 CHECK_EXPECT(IsSystemMoniker);
1432 static const IMonikerVtbl MonikerVtbl = {
1433 Moniker_QueryInterface,
1441 Moniker_BindToObject,
1442 Moniker_BindToStorage,
1444 Moniker_ComposeWith,
1449 Moniker_GetTimeOfLastChange,
1451 Moniker_CommonPrefixWith,
1452 Moniker_RelativePathTo,
1453 Moniker_GetDisplayName,
1454 Moniker_ParseDisplayName,
1455 Moniker_IsSystemMoniker
1458 static IMoniker Moniker = { &MonikerVtbl };
1460 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1462 return QueryInterface(riid, ppv);
1465 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1470 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1475 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1476 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1478 ok(0, "unexpected call\n");
1482 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1483 IEnumUnknown **ppenum)
1485 ok(0, "unexpected call\n");
1489 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1491 CHECK_EXPECT(LockContainer);
1492 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1496 static const IOleContainerVtbl OleContainerVtbl = {
1497 OleContainer_QueryInterface,
1498 OleContainer_AddRef,
1499 OleContainer_Release,
1500 OleContainer_ParseDisplayName,
1501 OleContainer_EnumObjects,
1502 OleContainer_LockContainer
1505 static IOleContainer OleContainer = { &OleContainerVtbl };
1507 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1509 return QueryInterface(riid, ppv);
1512 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1517 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1522 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1524 ok(0, "unexpected call\n");
1528 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1531 ok(0, "unexpected call\n");
1535 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1537 CHECK_EXPECT(GetContainer);
1538 ok(ppContainer != NULL, "ppContainer = NULL\n");
1539 *ppContainer = &OleContainer;
1543 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1545 ok(0, "unexpected call\n");
1549 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1551 ok(0, "unexpected call\n");
1555 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1557 ok(0, "unexpected call\n");
1561 static const IOleClientSiteVtbl ClientSiteVtbl = {
1562 ClientSite_QueryInterface,
1565 ClientSite_SaveObject,
1566 ClientSite_GetMoniker,
1567 ClientSite_GetContainer,
1568 ClientSite_ShowObject,
1569 ClientSite_OnShowWindow,
1570 ClientSite_RequestNewObjectLayout
1573 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1575 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1577 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1579 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1580 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1583 return E_NOINTERFACE;
1586 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1591 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1596 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1598 CHECK_EXPECT(Frame_GetWindow);
1602 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1604 ok(0, "unexpected call\n");
1608 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1610 ok(0, "unexpected call\n");
1614 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1615 LPCBORDERWIDTHS pborderwidths)
1617 ok(0, "unexpected call\n");
1621 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1622 LPCBORDERWIDTHS pborderwidths)
1624 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1628 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1629 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1631 static const WCHAR wszHTML_Document[] =
1632 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1634 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1636 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1637 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1638 if(pActiveObject && is_lang_english())
1639 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1642 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1643 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1645 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1649 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1650 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1652 static const WCHAR wszHTML_Document[] =
1653 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1656 CHECK_EXPECT2(SetActiveObject);
1658 if(pActiveObject && is_lang_english())
1659 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1661 CHECK_EXPECT(SetActiveObject_null);
1663 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1664 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1670 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1671 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1673 ok(0, "unexpected call\n");
1677 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1678 HOLEMENU holemenu, HWND hwndActiveObject)
1680 ok(0, "unexpected call\n");
1684 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1686 ok(0, "unexpected call\n");
1690 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1692 CHECK_EXPECT2(SetStatusText);
1693 if(!expect_status_text)
1694 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1698 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1701 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1703 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1707 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1709 ok(0, "unexpected call\n");
1713 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1714 InPlaceFrame_QueryInterface,
1715 InPlaceFrame_AddRef,
1716 InPlaceFrame_Release,
1717 InPlaceFrame_GetWindow,
1718 InPlaceFrame_ContextSensitiveHelp,
1719 InPlaceFrame_GetBorder,
1720 InPlaceFrame_RequestBorderSpace,
1721 InPlaceFrame_SetBorderSpace,
1722 InPlaceFrame_SetActiveObject,
1723 InPlaceFrame_InsertMenus,
1724 InPlaceFrame_SetMenu,
1725 InPlaceFrame_RemoveMenus,
1726 InPlaceFrame_SetStatusText,
1727 InPlaceFrame_EnableModeless,
1728 InPlaceFrame_TranslateAccelerator
1731 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1733 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1734 InPlaceFrame_QueryInterface,
1735 InPlaceFrame_AddRef,
1736 InPlaceFrame_Release,
1737 InPlaceFrame_GetWindow,
1738 InPlaceFrame_ContextSensitiveHelp,
1739 InPlaceFrame_GetBorder,
1740 InPlaceFrame_RequestBorderSpace,
1741 InPlaceFrame_SetBorderSpace,
1742 InPlaceUIWindow_SetActiveObject,
1745 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1747 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1749 return QueryInterface(riid, ppv);
1752 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1757 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1762 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1763 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1765 IOleClientSite *client_site;
1766 IOleObject *ole_obj;
1769 CHECK_EXPECT2(GetWindow);
1770 ok(phwnd != NULL, "phwnd = NULL\n");
1771 *phwnd = container_hwnd;
1773 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1774 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1776 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1777 IOleObject_Release(ole_obj);
1778 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1779 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1780 IOleClientSite_Release(client_site);
1785 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1786 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1788 ok(0, "unexpected call\n");
1792 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1793 IOleInPlaceSiteWindowless *iface)
1795 CHECK_EXPECT(CanInPlaceActivate);
1799 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1800 IOleInPlaceSiteWindowless *iface)
1802 CHECK_EXPECT(OnInPlaceActivate);
1803 inplace_deactivated = FALSE;
1807 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1808 IOleInPlaceSiteWindowless *iface)
1810 CHECK_EXPECT(OnUIActivate);
1814 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1815 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1816 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1817 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1819 static const RECT rect = {0,0,500,500};
1821 CHECK_EXPECT(GetWindowContext);
1823 ok(ppFrame != NULL, "ppFrame = NULL\n");
1825 *ppFrame = &InPlaceFrame;
1826 ok(ppDoc != NULL, "ppDoc = NULL\n");
1828 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1829 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1831 memcpy(lprcPosRect, &rect, sizeof(RECT));
1832 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1834 memcpy(lprcClipRect, &rect, sizeof(RECT));
1835 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1837 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1838 lpFrameInfo->fMDIApp = FALSE;
1839 lpFrameInfo->hwndFrame = container_hwnd;
1840 lpFrameInfo->haccel = NULL;
1841 lpFrameInfo->cAccelEntries = 0;
1847 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1848 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1850 ok(0, "unexpected call\n");
1854 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1855 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1857 CHECK_EXPECT(OnUIDeactivate);
1858 ok(!fUndoable, "fUndoable = TRUE\n");
1862 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1863 IOleInPlaceSiteWindowless *iface)
1865 CHECK_EXPECT(OnInPlaceDeactivate);
1866 inplace_deactivated = TRUE;
1870 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1871 IOleInPlaceSiteWindowless *iface)
1873 ok(0, "unexpected call\n");
1877 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1878 IOleInPlaceSiteWindowless *iface)
1880 ok(0, "unexpected call\n");
1884 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1885 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1887 ok(0, "unexpected call\n");
1891 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1892 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1894 CHECK_EXPECT(OnInPlaceActivateEx);
1896 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1897 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1898 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1903 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1904 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1906 CHECK_EXPECT(OnInPlaceDeactivateEx);
1908 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1913 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1914 IOleInPlaceSiteWindowless *iface)
1916 CHECK_EXPECT2(RequestUIActivate);
1920 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1921 IOleInPlaceSiteWindowless *iface)
1923 ok(0, "unexpected call\n");
1927 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1928 IOleInPlaceSiteWindowless *iface)
1930 ok(0, "unexpected call\n");
1934 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1935 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1937 ok(0, "unexpected call\n");
1941 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1942 IOleInPlaceSiteWindowless *iface)
1944 ok(0, "unexpected call\n");
1948 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
1949 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
1951 ok(0, "unexpected call\n");
1955 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
1956 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
1957 DWORD grfFlags, HDC *phDC)
1959 ok(0, "unexpected call\n");
1963 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
1964 IOleInPlaceSiteWindowless *iface, HDC hDC)
1966 ok(0, "unexpected call\n");
1970 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
1971 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
1973 ok(0, "unexpected call\n");
1977 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
1978 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
1980 ok(0, "unexpected call\n");
1984 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
1985 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
1986 LPCRECT pRectScroll, LPCRECT pRectClip)
1988 ok(0, "unexpected call\n");
1992 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
1993 IOleInPlaceSiteWindowless *iface, LPRECT prc)
1995 ok(0, "unexpected call\n");
1999 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
2000 IOleInPlaceSiteWindowless *iface, UINT msg,
2001 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
2003 ok(0, "unexpected call\n");
2007 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2008 InPlaceSiteWindowless_QueryInterface,
2009 InPlaceSiteWindowless_AddRef,
2010 InPlaceSiteWindowless_Release,
2011 InPlaceSiteWindowless_GetWindow,
2012 InPlaceSiteWindowless_ContextSensitiveHelp,
2013 InPlaceSiteWindowless_CanInPlaceActivate,
2014 InPlaceSiteWindowless_OnInPlaceActivate,
2015 InPlaceSiteWindowless_OnUIActivate,
2016 InPlaceSiteWindowless_GetWindowContext,
2017 InPlaceSiteWindowless_Scroll,
2018 InPlaceSiteWindowless_OnUIDeactivate,
2019 InPlaceSiteWindowless_OnInPlaceDeactivate,
2020 InPlaceSiteWindowless_DiscardUndoState,
2021 InPlaceSiteWindowless_DeactivateAndUndo,
2022 InPlaceSiteWindowless_OnPosRectChange,
2023 InPlaceSiteWindowless_OnInPlaceActivateEx,
2024 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2025 InPlaceSiteWindowless_RequestUIActivate,
2026 InPlaceSiteWindowless_CanWindowlessActivate,
2027 InPlaceSiteWindowless_GetCapture,
2028 InPlaceSiteWindowless_SetCapture,
2029 InPlaceSiteWindowless_GetFocus,
2030 InPlaceSiteWindowless_SetFocus,
2031 InPlaceSiteWindowless_GetDC,
2032 InPlaceSiteWindowless_ReleaseDC,
2033 InPlaceSiteWindowless_InvalidateRect,
2034 InPlaceSiteWindowless_InvalidateRgn,
2035 InPlaceSiteWindowless_ScrollRect,
2036 InPlaceSiteWindowless_AdjustRect,
2037 InPlaceSiteWindowless_OnDefWindowMessage
2040 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2042 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2044 return QueryInterface(riid, ppv);
2047 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2052 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2059 CallUIActivate_None,
2060 CallUIActivate_ActivateMe,
2061 CallUIActivate_AfterShow,
2064 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2065 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2067 IOleDocument *document;
2070 CHECK_EXPECT(ActivateMe);
2071 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2073 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2074 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2076 if(SUCCEEDED(hres)) {
2077 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2078 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2080 if(SUCCEEDED(hres)) {
2081 IOleInPlaceActiveObject *activeobj = NULL;
2082 IOleInPlaceSite *inplacesite = NULL;
2083 HWND tmp_hwnd = NULL;
2084 static RECT rect = {0,0,400,500};
2086 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2087 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2088 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2089 inplacesite, &InPlaceSiteWindowless);
2091 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2092 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2094 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2095 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2096 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2097 inplacesite, &InPlaceSiteWindowless);
2099 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2100 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2103 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2104 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2105 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2108 if(call_UIActivate == CallUIActivate_ActivateMe) {
2109 SET_EXPECT(CanInPlaceActivate);
2110 SET_EXPECT(GetWindowContext);
2111 SET_EXPECT(GetWindow);
2113 SET_EXPECT(OnInPlaceActivateEx);
2115 SET_EXPECT(OnInPlaceActivate);
2116 SET_EXPECT(SetStatusText);
2117 SET_EXPECT(Exec_SETPROGRESSMAX);
2118 SET_EXPECT(Exec_SETPROGRESSPOS);
2119 SET_EXPECT(OnUIActivate);
2120 SET_EXPECT(SetActiveObject);
2122 expect_status_text = NULL;
2124 hres = IOleDocumentView_UIActivate(view, TRUE);
2125 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2127 CHECK_CALLED(CanInPlaceActivate);
2128 CHECK_CALLED(GetWindowContext);
2129 CHECK_CALLED(GetWindow);
2131 CHECK_CALLED(OnInPlaceActivateEx);
2133 CHECK_CALLED(OnInPlaceActivate);
2134 CHECK_CALLED(SetStatusText);
2135 CHECK_CALLED(Exec_SETPROGRESSMAX);
2136 CHECK_CALLED(Exec_SETPROGRESSPOS);
2137 CHECK_CALLED(OnUIActivate);
2138 CHECK_CALLED(SetActiveObject);
2139 CHECK_CALLED(ShowUI);
2142 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2143 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2144 ok(hwnd != NULL, "hwnd == NULL\n");
2146 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2149 hres = IOleDocumentView_UIActivate(view, TRUE);
2150 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2153 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2154 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2155 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
2159 hres = IOleDocumentView_SetRect(view, &rect);
2160 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2162 if(call_UIActivate == CallUIActivate_ActivateMe) {
2163 hres = IOleDocumentView_Show(view, TRUE);
2164 ok(hres == S_OK, "Show failed: %08x\n", hres);
2166 SET_EXPECT(CanInPlaceActivate);
2167 SET_EXPECT(GetWindowContext);
2168 SET_EXPECT(GetWindow);
2170 SET_EXPECT(OnInPlaceActivateEx);
2172 SET_EXPECT(OnInPlaceActivate);
2173 SET_EXPECT(SetStatusText);
2174 SET_EXPECT(Exec_SETPROGRESSMAX);
2175 SET_EXPECT(Exec_SETPROGRESSPOS);
2176 SET_EXPECT(OnUIActivate);
2177 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2179 hres = IOleDocumentView_Show(view, TRUE);
2180 ok(hres == S_OK, "Show failed: %08x\n", hres);
2182 CHECK_CALLED(CanInPlaceActivate);
2183 CHECK_CALLED(GetWindowContext);
2184 CHECK_CALLED(GetWindow);
2186 CHECK_CALLED(OnInPlaceActivateEx);
2188 CHECK_CALLED(OnInPlaceActivate);
2189 CHECK_CALLED(SetStatusText);
2190 CHECK_CALLED(Exec_SETPROGRESSMAX);
2191 CHECK_CALLED(Exec_SETPROGRESSPOS);
2194 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2195 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2196 ok(hwnd != NULL, "hwnd == NULL\n");
2198 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2202 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2205 IOleInPlaceActiveObject_Release(activeobj);
2208 IOleDocument_Release(document);
2214 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2215 DocumentSite_QueryInterface,
2216 DocumentSite_AddRef,
2217 DocumentSite_Release,
2218 DocumentSite_ActivateMe
2221 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2223 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2225 return QueryInterface(riid, ppv);
2228 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2233 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2238 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2240 ok(0, "unexpected call\n");
2244 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2246 ok(0, "unexpected call\n");
2250 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2252 ok(0, "unexpected call\n");
2256 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2257 POINTF *pPtfContainer, DWORD dwFlags)
2259 ok(0, "unexpected call\n");
2263 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2264 MSG *pMsg, DWORD grfModifiers)
2266 ok(0, "unexpected call\n");
2270 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2273 CHECK_EXPECT(OnFocus_TRUE);
2275 CHECK_EXPECT2(OnFocus_FALSE);
2279 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2281 ok(0, "unexpected call\n");
2285 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2286 OleControlSite_QueryInterface,
2287 OleControlSite_AddRef,
2288 OleControlSite_Release,
2289 OleControlSite_OnControlInfoChanged,
2290 OleControlSite_LockInPlaceActive,
2291 OleControlSite_GetExtendedControl,
2292 OleControlSite_TransformCoords,
2293 OleControlSite_TranslateAccelerator,
2294 OleControlSite_OnFocus,
2295 OleControlSite_ShowPropertyFrame
2298 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2300 static IDocHostUIHandler2 *expect_uihandler_iface;
2302 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2304 return QueryInterface(riid, ppv);
2307 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2312 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2317 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2318 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2320 ok(0, "unexpected call\n");
2321 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2325 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2327 CHECK_EXPECT(GetHostInfo);
2328 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2329 ok(pInfo != NULL, "pInfo=NULL\n");
2331 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2332 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2333 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2334 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2335 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2336 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2337 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2338 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2343 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2344 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2345 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2347 CHECK_EXPECT(ShowUI);
2348 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2351 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2353 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2354 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2355 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2356 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2357 if (expect_InPlaceUIWindow_SetActiveObject_active)
2358 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2360 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2365 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2367 CHECK_EXPECT(HideUI);
2368 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2372 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2374 CHECK_EXPECT(UpdateUI);
2375 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2379 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2381 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2383 CHECK_EXPECT2(EnableModeless_TRUE);
2385 CHECK_EXPECT2(EnableModeless_FALSE);
2389 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2391 ok(0, "unexpected call\n");
2392 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2396 static BOOL expect_OnFrameWindowActivate_fActivate;
2397 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2399 CHECK_EXPECT2(OnFrameWindowActivate);
2400 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2401 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2405 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2406 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2408 ok(0, "unexpected call\n");
2412 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2413 const GUID *pguidCmdGroup, DWORD nCmdID)
2415 ok(0, "unexpected call\n");
2416 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2420 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2421 LPOLESTR *pchKey, DWORD dw)
2423 CHECK_EXPECT(GetOptionKeyPath);
2424 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2425 ok(pchKey != NULL, "pchKey = NULL\n");
2426 ok(!dw, "dw=%d, expected 0\n", dw);
2428 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2432 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2433 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2435 CHECK_EXPECT(GetDropTarget);
2436 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2441 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2443 CHECK_EXPECT(GetExternal);
2444 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2445 *ppDispatch = &External;
2449 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2450 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2452 CHECK_EXPECT(TranslateUrl);
2453 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2454 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2455 ok(!strcmp_wa(pchURLIn, nav_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_url);
2456 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2457 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2462 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2463 IDataObject **ppPORet)
2465 ok(0, "unexpected call\n");
2466 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2470 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2471 LPOLESTR *pchKey, DWORD dw)
2473 CHECK_EXPECT(GetOverrideKeyPath);
2474 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2475 ok(pchKey != NULL, "pchKey = NULL\n");
2477 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2478 ok(!dw, "dw=%d, xepected 0\n", dw);
2482 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2483 DocHostUIHandler_QueryInterface,
2484 DocHostUIHandler_AddRef,
2485 DocHostUIHandler_Release,
2486 DocHostUIHandler_ShowContextMenu,
2487 DocHostUIHandler_GetHostInfo,
2488 DocHostUIHandler_ShowUI,
2489 DocHostUIHandler_HideUI,
2490 DocHostUIHandler_UpdateUI,
2491 DocHostUIHandler_EnableModeless,
2492 DocHostUIHandler_OnDocWindowActivate,
2493 DocHostUIHandler_OnFrameWindowActivate,
2494 DocHostUIHandler_ResizeBorder,
2495 DocHostUIHandler_TranslateAccelerator,
2496 DocHostUIHandler_GetOptionKeyPath,
2497 DocHostUIHandler_GetDropTarget,
2498 DocHostUIHandler_GetExternal,
2499 DocHostUIHandler_TranslateUrl,
2500 DocHostUIHandler_FilterDataObject,
2501 DocHostUIHandler_GetOverrideKeyPath
2504 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2506 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2508 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2513 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2514 return E_NOINTERFACE;
2516 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2517 return E_NOINTERFACE; /* TODO */
2519 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2520 return E_NOINTERFACE;
2523 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2524 CustomDocHostUIHandler_QueryInterface,
2525 DocHostUIHandler_AddRef,
2526 DocHostUIHandler_Release,
2527 DocHostUIHandler_ShowContextMenu,
2528 DocHostUIHandler_GetHostInfo,
2529 DocHostUIHandler_ShowUI,
2530 DocHostUIHandler_HideUI,
2531 DocHostUIHandler_UpdateUI,
2532 DocHostUIHandler_EnableModeless,
2533 DocHostUIHandler_OnDocWindowActivate,
2534 DocHostUIHandler_OnFrameWindowActivate,
2535 DocHostUIHandler_ResizeBorder,
2536 DocHostUIHandler_TranslateAccelerator,
2537 DocHostUIHandler_GetOptionKeyPath,
2538 DocHostUIHandler_GetDropTarget,
2539 DocHostUIHandler_GetExternal,
2540 DocHostUIHandler_TranslateUrl,
2541 DocHostUIHandler_FilterDataObject,
2542 DocHostUIHandler_GetOverrideKeyPath
2545 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2547 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2548 REFIID riid, void **ppv)
2550 return QueryInterface(riid, ppv);
2553 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2558 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2563 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2564 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2566 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2567 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2568 ok(!pCmdText, "pCmdText != NULL\n");
2570 switch(prgCmds[0].cmdID) {
2571 case OLECMDID_SETPROGRESSTEXT:
2572 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2573 prgCmds[0].cmdf = OLECMDF_ENABLED;
2576 CHECK_EXPECT(QueryStatus_OPEN);
2577 prgCmds[0].cmdf = 0;
2580 CHECK_EXPECT(QueryStatus_NEW);
2581 prgCmds[0].cmdf = 0;
2584 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2590 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2591 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2593 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2594 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2595 test_readyState(NULL);
2597 if(!pguidCmdGroup) {
2599 case OLECMDID_SETPROGRESSMAX:
2600 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2601 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2602 ok(pvaIn != NULL, "pvaIn == NULL\n");
2604 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2605 if(load_state == LD_NO)
2606 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2608 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2610 case OLECMDID_SETPROGRESSPOS:
2611 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2612 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2613 ok(pvaIn != NULL, "pvaIn == NULL\n");
2615 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2616 if(load_state == LD_NO)
2617 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2619 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2621 case OLECMDID_HTTPEQUIV_DONE:
2622 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2623 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2624 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2625 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2626 readystate_set_loading = FALSE;
2627 readystate_set_interactive = FALSE;
2628 load_state = LD_COMPLETE;
2630 case OLECMDID_SETDOWNLOADSTATE:
2631 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2632 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2633 ok(pvaIn != NULL, "pvaIn == NULL\n");
2634 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2636 switch(V_I4(pvaIn)) {
2638 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2640 load_state = LD_INTERACTIVE;
2643 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2644 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2647 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2651 case OLECMDID_UPDATECOMMANDS:
2652 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2653 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2654 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2655 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2657 case OLECMDID_SETTITLE:
2658 CHECK_EXPECT2(Exec_SETTITLE);
2659 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2660 ok(pvaIn != NULL, "pvaIn == NULL\n");
2661 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2662 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2663 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2665 case OLECMDID_HTTPEQUIV:
2666 CHECK_EXPECT2(Exec_HTTPEQUIV);
2667 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2668 ok(pvaIn != NULL, "pvaIn == NULL\n");
2669 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2670 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2671 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2672 test_readyState(NULL);
2674 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2675 return E_FAIL; /* FIXME */
2677 ok(0, "unexpected command %d\n", nCmdID);
2682 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2683 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2687 CHECK_EXPECT2(Exec_ShellDocView_37);
2690 test_GetCurMoniker(doc_unk, NULL, nav_url);
2691 else if(load_from_stream)
2692 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2694 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2696 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2697 ok(pvaIn != NULL, "pvaIn == NULL\n");
2699 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2700 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2705 IHTMLPrivateWindow *priv_window;
2708 CHECK_EXPECT(Exec_ShellDocView_63);
2709 ok(pvaIn != NULL, "pvaIn == NULL\n");
2710 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2711 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2712 ok(pvaOut != NULL, "pvaOut == NULL\n");
2713 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2715 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2716 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2718 IHTMLPrivateWindow_Release(priv_window);
2720 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2721 return S_OK; /* TODO */
2725 CHECK_EXPECT(Exec_ShellDocView_67);
2726 ok(pvaIn != NULL, "pvaIn == NULL\n");
2727 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2728 ok(!strcmp_wa(V_BSTR(pvaIn), nav_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_url);
2729 ok(pvaOut != NULL, "pvaOut == NULL\n");
2730 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2731 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2732 load_state = LD_DOLOAD;
2736 CHECK_EXPECT2(Exec_ShellDocView_84);
2738 ok(pvaIn == NULL, "pvaIn != NULL\n");
2739 ok(pvaOut != NULL, "pvaOut == NULL\n");
2741 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2746 CHECK_EXPECT2(Exec_ShellDocView_103);
2748 ok(pvaIn == NULL, "pvaIn != NULL\n");
2749 ok(pvaOut == NULL, "pvaOut != NULL\n");
2754 CHECK_EXPECT2(Exec_ShellDocView_105);
2756 ok(pvaIn != NULL, "pvaIn == NULL\n");
2757 ok(pvaOut == NULL, "pvaOut != NULL\n");
2762 CHECK_EXPECT2(Exec_ShellDocView_140);
2764 ok(pvaIn == NULL, "pvaIn != NULL\n");
2765 ok(pvaOut == NULL, "pvaOut != NULL\n");
2770 ok(0, "unexpected command %d\n", nCmdID);
2775 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2776 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2779 case IDM_PARSECOMPLETE:
2780 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2781 ok(pvaIn == NULL, "pvaIn != NULL\n");
2782 ok(pvaOut == NULL, "pvaOut != NULL\n");
2785 ok(0, "unexpected command %d\n", nCmdID);
2789 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2791 case DOCHOST_DOCCANNAVIGATE:
2792 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2793 ok(pvaIn != NULL, "pvaIn == NULL\n");
2794 ok(pvaOut == NULL, "pvaOut != NULL\n");
2795 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2796 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2805 ok(pvaIn != NULL, "pvaIn == NULL\n");
2806 ok(pvaOut != NULL, "pvaOut != NULL\n");
2807 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2808 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2809 sa = V_ARRAY(pvaIn);
2811 dim = SafeArrayGetDim(sa);
2812 ok(dim == 1, "dim = %d\n", dim);
2813 hres = SafeArrayGetLBound(sa, 1, &ind);
2814 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2815 ok(ind == 0, "Lower bound = %d\n", ind);
2816 hres = SafeArrayGetUBound(sa, 1, &ind);
2817 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2818 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2821 SafeArrayGetElement(sa, &ind, &var);
2822 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2823 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2826 SafeArrayGetElement(sa, &ind, &var);
2827 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2828 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2831 SafeArrayGetElement(sa, &ind, &var);
2832 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2835 SafeArrayGetElement(sa, &ind, &var);
2836 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2839 SafeArrayGetElement(sa, &ind, &var);
2840 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2841 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2844 SafeArrayGetElement(sa, &ind, &var);
2845 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2846 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2850 return E_FAIL; /* TODO */
2854 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2855 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2859 CHECK_EXPECT2(Exec_Explorer_69);
2860 ok(pvaIn == NULL, "pvaIn != NULL\n");
2861 ok(pvaOut != NULL, "pvaOut == NULL\n");
2864 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2869 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2871 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2872 SET_EXPECT(SetStatusText);
2873 ok(pvaIn == NULL, "pvaIn != NULL\n");
2874 ok(pvaOut == NULL, "pvaOut != NULL\n");
2876 case OLECMDID_SHOWSCRIPTERROR:
2880 ok(0, "unexpected command %d\n", nCmdID);
2885 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2889 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2890 OleCommandTarget_QueryInterface,
2891 OleCommandTarget_AddRef,
2892 OleCommandTarget_Release,
2893 OleCommandTarget_QueryStatus,
2894 OleCommandTarget_Exec
2897 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2899 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2901 return QueryInterface(riid, ppv);
2904 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2905 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2906 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2908 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2909 ok(pDispParams != NULL, "pDispParams == NULL\n");
2910 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2911 ok(puArgErr != NULL, "puArgErr == NULL\n");
2912 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2913 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2914 test_readyState(NULL);
2916 switch(dispIdMember) {
2917 case DISPID_AMBIENT_USERMODE:
2918 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2919 V_VT(pVarResult) = VT_BOOL;
2920 V_BOOL(pVarResult) = VARIANT_TRUE;
2922 case DISPID_AMBIENT_DLCONTROL:
2923 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2925 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2926 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2928 case DISPID_AMBIENT_SILENT:
2929 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2930 V_VT(pVarResult) = VT_BOOL;
2931 V_BOOL(pVarResult) = VARIANT_FALSE;
2933 case DISPID_AMBIENT_USERAGENT:
2934 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2936 case DISPID_AMBIENT_PALETTE:
2937 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2941 ok(0, "unexpected dispid %d\n", dispIdMember);
2945 static const IDispatchVtbl DispatchVtbl = {
2946 Dispatch_QueryInterface,
2949 Dispatch_GetTypeInfoCount,
2950 Dispatch_GetTypeInfo,
2951 Dispatch_GetIDsOfNames,
2955 static IDispatch Dispatch = { &DispatchVtbl };
2957 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2959 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
2964 ok(0, "Unexpected call\n");
2965 return E_NOINTERFACE;
2968 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2969 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2970 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2973 IHTMLDocument2 *doc;
2976 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
2977 ok(pDispParams != NULL, "pDispParams == NULL\n");
2978 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
2979 ok(puArgErr != NULL, "puArgErr == NULL\n");
2980 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
2981 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
2983 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
2984 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2986 switch(dispIdMember) {
2987 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
2988 hres = IHTMLDocument2_get_readyState(doc, &state);
2989 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2991 if(!strcmp_wa(state, "interactive"))
2992 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
2993 else if(!strcmp_wa(state, "loading"))
2994 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
2995 else if(!strcmp_wa(state, "complete")) {
2996 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
2999 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
3001 SysFreeString(state);
3003 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3014 break; /* FIXME: Handle these events. */
3016 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3019 IHTMLDocument2_Release(doc);
3023 static const IDispatchVtbl EventDispatchVtbl = {
3024 EventDispatch_QueryInterface,
3027 Dispatch_GetTypeInfoCount,
3028 Dispatch_GetTypeInfo,
3029 Dispatch_GetIDsOfNames,
3030 EventDispatch_Invoke
3033 static IDispatch EventDispatch = { &EventDispatchVtbl };
3035 static HRESULT WINAPI DocObjectService_QueryInterface(
3036 IDocObjectService* This,
3040 /* F62D9369-75EF-4578-8856-232802C76468 (ITridentService2) */
3044 static ULONG WINAPI DocObjectService_AddRef(
3045 IDocObjectService* This)
3050 static ULONG WINAPI DocObjectService_Release(
3051 IDocObjectService* This)
3056 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
3057 IDocObjectService* This,
3058 IDispatch *pDispatch,
3061 LPCWSTR lpszFrameName,
3064 LPCWSTR lpszHeaders,
3068 ok(0, "unexpected call\n");
3072 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3073 IDocObjectService* This,
3074 IHTMLWindow2 *pHTMLWindow2,
3077 CHECK_EXPECT(FireNavigateComplete2);
3081 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3082 IDocObjectService* This)
3084 ok(0, "unexpected call\n");
3088 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3089 IDocObjectService* This)
3091 ok(0, "unexpected call\n");
3095 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3096 IDocObjectService* This,
3097 IHTMLWindow2 *pHTMLWindow,
3100 CHECK_EXPECT(FireDocumentComplete);
3104 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3105 IDocObjectService* This,
3106 IHTMLWindow2 *pHTMLWindow)
3108 ok(0, "unexpected call\n");
3112 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3113 IDocObjectService* This,
3114 BSTR *pbstrPendingUrl)
3116 CHECK_EXPECT(GetPendingUrl);
3120 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3121 IDocObjectService* This,
3122 IHTMLElement *pHTMLElement)
3124 CHECK_EXPECT(ActiveElementChanged);
3128 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3129 IDocObjectService* This,
3132 ok(0, "unexpected call\n");
3136 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3137 IDocObjectService* This,
3141 CHECK_EXPECT(IsErrorUrl);
3146 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3147 DocObjectService_QueryInterface,
3148 DocObjectService_AddRef,
3149 DocObjectService_Release,
3150 DocObjectService_FireBeforeNavigate2,
3151 DocObjectService_FireNavigateComplete2,
3152 DocObjectService_FireDownloadBegin,
3153 DocObjectService_FireDownloadComplete,
3154 DocObjectService_FireDocumentComplete,
3155 DocObjectService_UpdateDesktopComponent,
3156 DocObjectService_GetPendingUrl,
3157 DocObjectService_ActiveElementChanged,
3158 DocObjectService_GetUrlSearchComponent,
3159 DocObjectService_IsErrorUrl
3162 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3164 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3166 static HRESULT WINAPI BrowserService_QueryInterface(
3167 IBrowserService* This,
3173 if(IsEqualGUID(&IID_IShellBrowser, riid))
3174 return E_NOINTERFACE; /* TODO */
3176 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3177 *ppvObject = &DocObjectService;
3181 if(IsEqualGUID(&IID_ITabBrowserService, riid))
3182 return E_NOINTERFACE; /* TODO */
3184 ok(0, "unexpected call\n");
3185 return E_NOINTERFACE;
3188 static ULONG WINAPI BrowserService_AddRef(
3189 IBrowserService* This)
3194 static ULONG WINAPI BrowserService_Release(
3195 IBrowserService* This)
3200 static HRESULT WINAPI BrowserService_GetParentSite(
3201 IBrowserService* This,
3202 IOleInPlaceSite **ppipsite)
3204 ok(0, "unexpected call\n");
3208 static HRESULT WINAPI BrowserService_SetTitle(
3209 IBrowserService* This,
3213 ok(0, "unexpected call\n");
3217 static HRESULT WINAPI BrowserService_GetTitle(
3218 IBrowserService* This,
3223 ok(0, "unexpected call\n");
3227 static HRESULT WINAPI BrowserService_GetOleObject(
3228 IBrowserService* This,
3229 IOleObject **ppobjv)
3231 ok(0, "unexpected call\n");
3235 static HRESULT WINAPI BrowserService_GetTravelLog(
3236 IBrowserService* This,
3239 CHECK_EXPECT(GetTravelLog);
3243 static HRESULT WINAPI BrowserService_ShowControlWindow(
3244 IBrowserService* This,
3248 ok(0, "unexpected call\n");
3252 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3253 IBrowserService* This,
3257 ok(0, "unexpected call\n");
3261 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3262 IBrowserService* This,
3263 PCIDLIST_ABSOLUTE pidl,
3267 ok(0, "unexpected call\n");
3271 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3272 IBrowserService* This,
3275 PIDLIST_ABSOLUTE *ppidlOut)
3277 ok(0, "unexpected call\n");
3281 static HRESULT WINAPI BrowserService_DisplayParseError(
3282 IBrowserService* This,
3286 ok(0, "unexpected call\n");
3290 static HRESULT WINAPI BrowserService_NavigateToPidl(
3291 IBrowserService* This,
3292 PCIDLIST_ABSOLUTE pidl,
3295 ok(0, "unexpected call\n");
3299 static HRESULT WINAPI BrowserService_SetNavigateState(
3300 IBrowserService* This,
3303 ok(0, "unexpected call\n");
3307 static HRESULT WINAPI BrowserService_GetNavigateState(
3308 IBrowserService* This,
3311 ok(0, "unexpected call\n");
3315 static HRESULT WINAPI BrowserService_NotifyRedirect(
3316 IBrowserService* This,
3318 PCIDLIST_ABSOLUTE pidl,
3321 ok(0, "unexpected call\n");
3325 static HRESULT WINAPI BrowserService_UpdateWindowList(
3326 IBrowserService* This)
3328 ok(0, "unexpected call\n");
3332 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3333 IBrowserService* This)
3335 CHECK_EXPECT(UpdateBackForwardState);
3339 static HRESULT WINAPI BrowserService_SetFlags(
3340 IBrowserService* This,
3344 ok(0, "unexpected call\n");
3348 static HRESULT WINAPI BrowserService_GetFlags(
3349 IBrowserService* This,
3352 ok(0, "unexpected call\n");
3356 static HRESULT WINAPI BrowserService_CanNavigateNow(
3357 IBrowserService* This)
3359 ok(0, "unexpected call\n");
3363 static HRESULT WINAPI BrowserService_GetPidl(
3364 IBrowserService* This,
3365 PIDLIST_ABSOLUTE *ppidl)
3367 ok(0, "unexpected call\n");
3371 static HRESULT WINAPI BrowserService_SetReferrer(
3372 IBrowserService* This,
3373 PCIDLIST_ABSOLUTE pidl)
3375 ok(0, "unexpected call\n");
3379 static DWORD WINAPI BrowserService_GetBrowserIndex(
3380 IBrowserService* This)
3382 ok(0, "unexpected call\n");
3386 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3387 IBrowserService* This,
3391 ok(0, "unexpected call\n");
3395 static HRESULT WINAPI BrowserService_GetHistoryObject(
3396 IBrowserService* This,
3401 ok(0, "unexpected call\n");
3405 static HRESULT WINAPI BrowserService_SetHistoryObject(
3406 IBrowserService* This,
3408 BOOL fIsLocalAnchor)
3410 ok(0, "unexpected call\n");
3414 static HRESULT WINAPI BrowserService_CacheOLEServer(
3415 IBrowserService* This,
3418 ok(0, "unexpected call\n");
3422 static HRESULT WINAPI BrowserService_GetSetCodePage(
3423 IBrowserService* This,
3427 ok(0, "unexpected call\n");
3431 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3432 IBrowserService* This,
3436 VARIANT *pvarargOut)
3438 ok(0, "unexpected call\n");
3442 static HRESULT WINAPI BrowserService_GetPalette(
3443 IBrowserService* This,
3446 ok(0, "unexpected call\n");
3450 static HRESULT WINAPI BrowserService_RegisterWindow(
3451 IBrowserService* This,
3452 BOOL fForceRegister,
3455 ok(0, "unexpected call\n");
3459 static IBrowserServiceVtbl BrowserServiceVtbl = {
3460 BrowserService_QueryInterface,
3461 BrowserService_AddRef,
3462 BrowserService_Release,
3463 BrowserService_GetParentSite,
3464 BrowserService_SetTitle,
3465 BrowserService_GetTitle,
3466 BrowserService_GetOleObject,
3467 BrowserService_GetTravelLog,
3468 BrowserService_ShowControlWindow,
3469 BrowserService_IsControlWindowShown,
3470 BrowserService_IEGetDisplayName,
3471 BrowserService_IEParseDisplayName,
3472 BrowserService_DisplayParseError,
3473 BrowserService_NavigateToPidl,
3474 BrowserService_SetNavigateState,
3475 BrowserService_GetNavigateState,
3476 BrowserService_NotifyRedirect,
3477 BrowserService_UpdateWindowList,
3478 BrowserService_UpdateBackForwardState,
3479 BrowserService_SetFlags,
3480 BrowserService_GetFlags,
3481 BrowserService_CanNavigateNow,
3482 BrowserService_GetPidl,
3483 BrowserService_SetReferrer,
3484 BrowserService_GetBrowserIndex,
3485 BrowserService_GetBrowserByIndex,
3486 BrowserService_GetHistoryObject,
3487 BrowserService_SetHistoryObject,
3488 BrowserService_CacheOLEServer,
3489 BrowserService_GetSetCodePage,
3490 BrowserService_OnHttpEquiv,
3491 BrowserService_GetPalette,
3492 BrowserService_RegisterWindow
3495 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3497 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
3498 REFIID riid, void **ppv)
3500 return QueryInterface(riid, ppv);
3503 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
3508 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
3513 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
3514 REFIID riid, void **ppv)
3517 * Services used by HTMLDocument:
3520 * IInternetSecurityManager
3522 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
3525 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
3526 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
3527 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
3529 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
3530 * IElementBehaviorFactory
3531 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
3541 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
3542 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
3547 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
3548 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
3549 *ppv = &NewWindowManager;
3553 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
3554 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
3555 *ppv = &BrowserService;
3559 return E_NOINTERFACE;
3562 static const IServiceProviderVtbl ServiceProviderVtbl = {
3563 ServiceProvider_QueryInterface,
3564 ServiceProvider_AddRef,
3565 ServiceProvider_Release,
3566 ServiceProvider_QueryService
3569 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
3571 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
3572 REFIID riid, void **ppv)
3574 return QueryInterface(riid, ppv);
3577 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
3582 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
3587 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
3588 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
3590 ok(0, "unexpected call\n");
3593 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
3594 DWORD dwAspect, LONG lindex)
3596 ok(0, "unexpected call\n");
3599 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
3601 ok(0, "unexpected call\n");
3604 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
3606 ok(0, "unexpected call\n");
3609 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
3611 ok(0, "unexpected call\n");
3614 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
3616 ok(0, "unexpected call\n");
3619 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
3621 CHECK_EXPECT(Advise_Close);
3624 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
3625 AdviseSink_QueryInterface,
3628 AdviseSink_OnDataChange,
3629 AdviseSink_OnViewChange,
3630 AdviseSink_OnRename,
3632 ObjectAdviseSink_OnClose,
3633 AdviseSinkEx_OnViewStatusChange
3636 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
3638 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
3639 REFIID riid, void **ppv)
3641 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
3646 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3648 return E_NOINTERFACE;
3651 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
3652 DWORD dwAspect, LONG lindex)
3654 CHECK_EXPECT2(OnViewChange);
3656 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
3657 ok(lindex == -1, "lindex = %d\n", lindex);
3660 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
3661 ViewAdviseSink_QueryInterface,
3664 AdviseSink_OnDataChange,
3665 ViewAdviseSink_OnViewChange,
3666 AdviseSink_OnRename,
3669 AdviseSinkEx_OnViewStatusChange
3672 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
3674 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
3675 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
3676 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
3677 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
3678 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
3680 static HRESULT QueryInterface(REFIID riid, void **ppv)
3684 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
3686 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
3687 *ppv = &DocumentSite;
3688 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
3689 *ppv = &DocHostUIHandler;
3690 else if(IsEqualGUID(&IID_IOleContainer, riid))
3691 *ppv = &OleContainer;
3692 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
3693 *ppv = &InPlaceSiteWindowless;
3694 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
3695 *ppv = &OleCommandTarget;
3696 else if(IsEqualGUID(&IID_IDispatch, riid))
3698 else if(IsEqualGUID(&IID_IServiceProvider, riid))
3699 *ppv = &ServiceProvider;
3700 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
3701 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
3702 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
3703 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
3704 else if(IsEqualGUID(&IID_IOleControlSite, riid))
3705 *ppv = &OleControlSite;
3706 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
3707 return E_NOINTERFACE; /* TODO */
3708 else if(IsEqualGUID(&IID_IProxyManager, riid))
3709 return E_NOINTERFACE; /* ? */
3710 else if(IsEqualGUID(&IID_unk1, riid))
3711 return E_NOINTERFACE; /* HTMLWindow2 ? */
3712 else if(IsEqualGUID(&IID_IThumbnailView, riid))
3713 return E_NOINTERFACE; /* ? */
3714 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
3715 return E_NOINTERFACE; /* ? */
3716 else if(IsEqualGUID(&IID_unk4, riid))
3717 return E_NOINTERFACE; /* ? */
3718 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
3719 return E_NOINTERFACE; /* ? */
3721 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3725 return E_NOINTERFACE;
3728 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3730 if(msg == WM_CONTINUE_BINDING) {
3731 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
3732 continue_binding(callback);
3735 return DefWindowProc(hwnd, msg, wParam, lParam);
3738 static void test_doscroll(IUnknown *unk)
3740 IHTMLDocument3 *doc;
3741 IHTMLElement2 *elem2;
3746 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
3747 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
3751 hres = IHTMLDocument3_get_documentElement(doc, &elem);
3752 IHTMLDocument3_Release(doc);
3753 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
3754 switch(load_state) {
3758 ok(!elem, "elem != NULL\n");
3761 case LD_INTERACTIVE:
3763 ok(elem != NULL, "elem == NULL\n");
3768 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3769 IHTMLElement_Release(elem);
3770 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3773 V_BSTR(&v) = a2bstr("left");
3774 hres = IHTMLElement2_doScroll(elem2, v);
3775 SysFreeString(V_BSTR(&v));
3776 IHTMLElement2_Release(elem2);
3778 if(inplace_deactivated)
3779 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
3780 else if(load_state == LD_COMPLETE)
3781 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
3783 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
3786 static void _test_readyState(unsigned line, IUnknown *unk)
3788 IHTMLDocument2 *htmldoc;
3789 DISPPARAMS dispparams;
3795 static const LPCSTR expected_state[] = {
3810 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
3811 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3815 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
3816 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
3818 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
3819 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
3821 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
3822 load_state = LD_INTERACTIVE;
3825 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
3826 wine_dbgstr_w(state), load_state);
3827 SysFreeString(state);
3829 hres = IHTMLDocument2_get_body(htmldoc, &elem);
3830 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
3832 IHTMLElement2 *elem2;
3835 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3836 IHTMLElement_Release(elem);
3837 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3839 hres = IHTMLElement2_get_readyState(elem2, &var);
3840 IHTMLElement2_Release(elem2);
3841 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3842 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
3843 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
3846 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
3849 dispparams.cArgs = 0;
3850 dispparams.cNamedArgs = 0;
3851 dispparams.rgdispidNamedArgs = NULL;
3852 dispparams.rgvarg = NULL;
3856 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
3857 &dispparams, &out, NULL, NULL);
3858 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
3860 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
3861 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
3863 test_doscroll((IUnknown*)htmldoc);
3865 IHTMLDocument2_Release(htmldoc);
3868 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
3873 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
3874 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
3876 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
3877 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
3879 IViewObject_Release(view);
3882 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
3884 IConnectionPointContainer *tmp_container = NULL;
3885 IConnectionPoint *cp;
3890 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3891 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3895 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
3896 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
3897 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
3899 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
3900 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
3902 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
3903 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
3904 ok(tmp_container == container, "container != tmp_container\n");
3906 IConnectionPointContainer_Release(tmp_container);
3908 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
3909 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
3911 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3912 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
3913 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3914 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
3915 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
3916 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3919 IConnectionPoint_Release(cp);
3922 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
3924 IConnectionPointContainer *container;
3927 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
3928 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3932 test_ConnectionPoint(container, &IID_IDispatch);
3933 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
3934 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
3935 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
3937 IConnectionPointContainer_Release(container);
3940 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
3942 ICustomDoc *custom_doc;
3945 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
3946 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
3948 expect_uihandler_iface = uihandler;
3950 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
3951 ICustomDoc_Release(custom_doc);
3952 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
3955 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
3959 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
3961 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
3963 test_readyState((IUnknown*)persist);
3967 CreateBindCtx(0, &bind);
3968 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
3969 (IUnknown*)&ClientSite);
3972 SET_EXPECT(GetDisplayName);
3973 if(!set_clientsite) {
3974 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3975 SET_EXPECT(GetHostInfo);
3976 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3977 SET_EXPECT(Invoke_AMBIENT_SILENT);
3978 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3979 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3980 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3981 SET_EXPECT(GetOptionKeyPath);
3982 SET_EXPECT(GetOverrideKeyPath);
3983 SET_EXPECT(GetWindow);
3984 SET_EXPECT(Exec_DOCCANNAVIGATE);
3985 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3986 SET_EXPECT(Exec_SETPROGRESSMAX);
3987 SET_EXPECT(Exec_SETPROGRESSPOS);
3988 SET_EXPECT(Exec_ShellDocView_37);
3990 if(!container_locked) {
3991 SET_EXPECT(GetContainer);
3992 SET_EXPECT(LockContainer);
3994 SET_EXPECT(OnChanged_READYSTATE);
3995 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
3996 SET_EXPECT(Exec_ShellDocView_84);
3997 SET_EXPECT(IsSystemMoniker);
3999 SET_EXPECT(BindToStorage);
4000 SET_EXPECT(SetActiveObject);
4001 if(set_clientsite) {
4002 SET_EXPECT(Invoke_AMBIENT_SILENT);
4003 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4004 SET_EXPECT(Exec_ShellDocView_37);
4005 SET_EXPECT(IsErrorUrl);
4008 SET_EXPECT(GetTravelLog);
4009 SET_EXPECT(GetPendingUrl);
4010 load_state = LD_DOLOAD;
4011 expect_LockContainer_fLock = TRUE;
4012 readystate_set_loading = TRUE;
4014 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
4015 ok(hres == S_OK, "Load failed: %08x\n", hres);
4018 CHECK_CALLED(GetDisplayName);
4019 if(!set_clientsite) {
4020 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4021 CHECK_CALLED(GetHostInfo);
4022 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4023 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4024 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4025 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4026 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4027 CHECK_CALLED(GetOptionKeyPath);
4028 CHECK_CALLED(GetOverrideKeyPath);
4029 CHECK_CALLED(GetWindow);
4030 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4031 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4032 CHECK_CALLED(Exec_SETPROGRESSMAX);
4033 CHECK_CALLED(Exec_SETPROGRESSPOS);
4034 CHECK_CALLED(Exec_ShellDocView_37);
4036 if(!container_locked) {
4037 CHECK_CALLED(GetContainer);
4038 CHECK_CALLED(LockContainer);
4039 container_locked = TRUE;
4041 CHECK_CALLED(OnChanged_READYSTATE);
4042 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4043 SET_CALLED(IsSystemMoniker); /* IE7 */
4044 SET_CALLED(Exec_ShellDocView_84);
4046 CHECK_CALLED(BindToStorage);
4047 SET_CALLED(SetActiveObject); /* FIXME */
4048 if(set_clientsite) {
4049 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4050 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4051 CHECK_CALLED(Exec_ShellDocView_37);
4052 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4055 todo_wine CHECK_CALLED(GetTravelLog);
4056 todo_wine CHECK_CALLED(GetPendingUrl);
4058 set_clientsite = container_locked = TRUE;
4060 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
4062 IBindCtx_Release(bind);
4064 test_readyState((IUnknown*)persist);
4067 #define DWL_VERBDONE 0x0001
4068 #define DWL_CSS 0x0002
4069 #define DWL_TRYCSS 0x0004
4070 #define DWL_HTTP 0x0008
4071 #define DWL_EMPTY 0x0010
4072 #define DWL_JAVASCRIPT 0x0020
4074 static void test_download(DWORD flags)
4076 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
4081 b = is_js ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Exec_HTTPEQUIV_DONE;
4083 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
4084 ok(hwnd != NULL, "Could not find hidden window\n");
4086 test_readyState(NULL);
4088 if(flags & (DWL_VERBDONE|DWL_HTTP))
4089 SET_EXPECT(Exec_SETPROGRESSMAX);
4090 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js)
4091 SET_EXPECT(GetHostInfo);
4092 SET_EXPECT(SetStatusText);
4093 if(!(flags & DWL_EMPTY))
4094 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
4096 SET_EXPECT(GetExternal);
4097 SET_EXPECT(OnViewChange);
4098 SET_EXPECT(GetDropTarget);
4099 if(flags & DWL_TRYCSS)
4100 SET_EXPECT(Exec_ShellDocView_84);
4101 if(flags & DWL_CSS) {
4102 SET_EXPECT(CreateInstance);
4104 SET_EXPECT(LockRequest);
4105 SET_EXPECT(Terminate);
4106 SET_EXPECT(Protocol_Read);
4107 SET_EXPECT(UnlockRequest);
4109 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4110 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
4112 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
4113 SET_EXPECT(Exec_Explorer_69);
4114 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
4115 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
4116 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
4117 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
4118 if(nav_url && !is_js)
4119 SET_EXPECT(Exec_ShellDocView_37);
4120 if(flags & DWL_HTTP) {
4121 SET_EXPECT(OnChanged_1012);
4122 SET_EXPECT(Exec_HTTPEQUIV);
4123 SET_EXPECT(Exec_SETTITLE);
4126 SET_EXPECT(OnChanged_1005);
4127 SET_EXPECT(OnChanged_READYSTATE);
4128 SET_EXPECT(Exec_SETPROGRESSPOS);
4129 if(!(flags & DWL_EMPTY))
4130 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
4131 SET_EXPECT(Exec_ShellDocView_103);
4132 SET_EXPECT(Exec_ShellDocView_105);
4133 SET_EXPECT(Exec_ShellDocView_140);
4135 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
4136 SET_EXPECT(Exec_HTTPEQUIV_DONE);
4138 SET_EXPECT(SetStatusText);
4140 SET_EXPECT(UpdateUI);
4141 SET_EXPECT(Exec_UPDATECOMMANDS);
4142 SET_EXPECT(Exec_SETTITLE);
4143 SET_EXPECT(UpdateBackForwardState);
4147 if(!(flags & DWL_EMPTY))
4148 SET_EXPECT(FireNavigateComplete2);
4149 SET_EXPECT(FireDocumentComplete);
4151 SET_EXPECT(ActiveElementChanged);
4153 SET_EXPECT(IsErrorUrl);
4154 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
4156 while(!*b && GetMessage(&msg, NULL, 0, 0)) {
4157 TranslateMessage(&msg);
4158 DispatchMessage(&msg);
4161 if(flags & DWL_VERBDONE)
4162 CHECK_CALLED(Exec_SETPROGRESSMAX);
4163 if(flags & DWL_HTTP)
4164 SET_CALLED(Exec_SETPROGRESSMAX);
4165 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js) {
4167 todo_wine CHECK_CALLED(GetHostInfo);
4169 CHECK_CALLED(GetHostInfo);
4171 CHECK_CALLED(SetStatusText);
4172 if(!(flags & DWL_EMPTY))
4173 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
4175 CHECK_CALLED(GetExternal);
4176 CHECK_CALLED(OnViewChange);
4177 SET_CALLED(GetDropTarget);
4178 if(flags & DWL_TRYCSS)
4179 SET_CALLED(Exec_ShellDocView_84);
4180 if(flags & DWL_CSS) {
4181 CHECK_CALLED(CreateInstance);
4182 CHECK_CALLED(Start);
4183 CHECK_CALLED(LockRequest);
4184 CHECK_CALLED(Terminate);
4185 CHECK_CALLED(Protocol_Read);
4186 CHECK_CALLED(UnlockRequest);
4188 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4189 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
4191 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
4192 SET_CALLED(Exec_Explorer_69);
4193 SET_CALLED(EnableModeless_TRUE); /* IE7 */
4194 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
4195 SET_CALLED(EnableModeless_FALSE); /* IE7 */
4196 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
4197 if(nav_url && !is_js)
4198 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
4199 if(flags & DWL_HTTP) todo_wine {
4200 CHECK_CALLED(OnChanged_1012);
4201 CHECK_CALLED(Exec_HTTPEQUIV);
4202 CHECK_CALLED(Exec_SETTITLE);
4205 CHECK_CALLED(OnChanged_1005);
4206 CHECK_CALLED(OnChanged_READYSTATE);
4207 CHECK_CALLED(Exec_SETPROGRESSPOS);
4209 SET_CALLED(OnChanged_READYSTATE); /* sometimes called */
4210 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
4212 if(!(flags & DWL_EMPTY))
4213 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
4214 SET_CALLED(Exec_ShellDocView_103);
4215 SET_CALLED(Exec_ShellDocView_105);
4216 SET_CALLED(Exec_ShellDocView_140);
4218 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
4219 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
4221 SET_CALLED(SetStatusText);
4222 if(nav_url) { /* avoiding race, FIXME: find better way */
4223 SET_CALLED(UpdateUI);
4224 SET_CALLED(Exec_UPDATECOMMANDS);
4225 SET_CALLED(Exec_SETTITLE);
4226 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
4230 if(!(flags & DWL_EMPTY))
4231 todo_wine CHECK_CALLED(FireNavigateComplete2);
4232 CHECK_CALLED(FireDocumentComplete);
4234 todo_wine CHECK_CALLED(ActiveElementChanged);
4236 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4238 load_state = LD_COMPLETE;
4240 test_readyState(NULL);
4243 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
4245 IPersistMoniker *persist_mon;
4246 IPersistFile *persist_file;
4250 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
4251 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
4252 if(SUCCEEDED(hres)) {
4253 hres = IPersist_GetClassID(persist_file, NULL);
4254 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4256 hres = IPersist_GetClassID(persist_file, &guid);
4257 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4258 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4260 IPersist_Release(persist_file);
4263 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
4264 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
4265 if(SUCCEEDED(hres)) {
4266 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
4267 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4269 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
4270 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4271 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4273 if(load_state == LD_DOLOAD)
4274 test_Load(persist_mon, mon);
4276 test_readyState((IUnknown*)doc);
4278 IPersistMoniker_Release(persist_mon);
4282 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const char *new_nav_url, BOOL is_js)
4284 IHTMLPrivateWindow *priv_window;
4285 const char *prev_nav_url;
4286 IHTMLWindow2 *window;
4287 IHTMLLocation *location;
4292 trace("put_href %s...\n", new_nav_url);
4297 hres = IHTMLDocument2_get_location(doc, &location);
4298 ok(hres == S_OK, "get_location failed: %08x\n", hres);
4299 ok(location != NULL, "location == NULL\n");
4301 prev_nav_url = nav_url;
4302 str = a2bstr(nav_url = new_nav_url);
4303 SET_EXPECT(TranslateUrl);
4304 SET_EXPECT(Navigate);
4306 hres = IHTMLLocation_replace(location, str);
4307 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4309 hres = IHTMLLocation_put_href(location, str);
4310 if(is_js && hres == E_ACCESSDENIED)
4311 win_skip("put_href: got E_ACCESSDENIED\n");
4313 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4316 CHECK_CALLED(TranslateUrl);
4317 CHECK_CALLED(Navigate);
4319 SET_CALLED(TranslateUrl);
4320 SET_CALLED(Navigate);
4323 IHTMLLocation_Release(location);
4325 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4326 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4328 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
4329 IHTMLWindow2_Release(window);
4330 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
4332 readystate_set_loading = TRUE;
4333 SET_EXPECT(TranslateUrl);
4334 SET_EXPECT(Exec_ShellDocView_67);
4335 SET_EXPECT(Invoke_AMBIENT_SILENT);
4336 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4337 SET_EXPECT(Exec_ShellDocView_63);
4340 V_VT(&vempty) = VT_EMPTY;
4341 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
4342 SysFreeString(str2);
4343 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
4345 CHECK_CALLED(TranslateUrl);
4346 CHECK_CALLED(Exec_ShellDocView_67);
4347 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4348 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4349 CHECK_CALLED(Exec_ShellDocView_63);
4352 test_GetCurMoniker(doc_unk, doc_mon, NULL);
4355 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4356 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4357 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4358 SysFreeString(str2);
4361 ignore_external_qi = TRUE;
4363 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4364 test_download(DWL_VERBDONE | (is_js ? DWL_JAVASCRIPT : 0));
4366 ignore_external_qi = FALSE;
4368 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4370 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4371 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4373 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4375 ok(!lstrcmpW(str2, str), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4376 SysFreeString(str2);
4378 IHTMLPrivateWindow_Release(priv_window);
4382 nav_url = prev_nav_url;
4385 static void test_open_window(IHTMLDocument2 *doc)
4387 IHTMLWindow2 *window, *new_window;
4391 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4392 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4394 url = a2bstr(nav_url = "about:blank");
4395 name = a2bstr("test");
4396 new_window = (void*)0xdeadbeef;
4400 SET_EXPECT(TranslateUrl);
4401 SET_EXPECT(EvaluateNewWindow);
4403 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
4406 SysFreeString(name);
4409 CHECK_CALLED(TranslateUrl);
4411 if(!called_EvaluateNewWindow) {
4413 win_skip("INewWindowManager not supported\n");
4414 if(SUCCEEDED(hres) && new_window)
4415 IHTMLWindow2_Release(new_window);
4416 IHTMLWindow2_Release(window);
4421 CHECK_CALLED(EvaluateNewWindow);
4424 ok(hres == S_OK, "open failed: %08x\n", hres);
4426 ok(new_window == NULL, "new_window != NULL\n");
4428 IHTMLWindow2_Release(window);
4431 static void test_elem_from_point(IHTMLDocument2 *doc)
4438 hres = IHTMLDocument2_elementFromPoint(doc, 3, 3, &elem);
4439 ok(hres == S_OK, "elementFromPoint failed: %08x\n", hres);
4440 ok(elem != NULL, "elem == NULL\n");
4442 hres = IHTMLElement_get_tagName(elem, &tag);
4443 IHTMLElement_Release(elem);
4444 ok(hres == S_OK, "get_tagName failed: %08x\n", hres);
4445 ok(!strcmp_wa(tag, "DIV"), "tag = %s\n", wine_dbgstr_w(tag));
4448 static void test_clear(IHTMLDocument2 *doc)
4452 hres = IHTMLDocument2_clear(doc);
4453 ok(hres == S_OK, "clear failed: %08x\n", hres);
4456 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
4458 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
4459 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
4460 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
4461 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
4462 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
4463 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
4464 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
4465 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
4466 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
4467 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
4468 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
4469 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
4470 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
4471 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
4472 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
4473 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
4474 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
4475 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
4476 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
4477 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
4479 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
4480 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
4482 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
4484 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
4486 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
4487 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
4489 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
4490 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
4492 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
4494 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
4495 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
4498 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
4499 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
4501 IOleCommandTarget *cmdtrg;
4502 OLECMD olecmd = {cmdid, 0};
4505 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4506 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4510 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
4511 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
4513 IOleCommandTarget_Release(cmdtrg);
4515 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
4516 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
4519 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
4521 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
4523 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
4524 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
4525 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
4526 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
4527 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
4528 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
4529 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
4530 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
4531 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
4532 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
4533 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
4534 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
4535 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
4536 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
4537 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
4538 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
4541 static void test_OleCommandTarget(IHTMLDocument2 *doc)
4543 IOleCommandTarget *cmdtrg;
4544 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
4548 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4549 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4553 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4554 cmds[i].cmdID = i+1;
4555 cmds[i].cmdf = 0xf0f0;
4558 SET_EXPECT(QueryStatus_OPEN);
4559 SET_EXPECT(QueryStatus_NEW);
4560 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
4561 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4562 CHECK_CALLED(QueryStatus_OPEN);
4563 CHECK_CALLED(QueryStatus_NEW);
4565 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4566 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
4567 if(i+1 == OLECMDID_FIND)
4569 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
4570 i+1, cmds[i].cmdf, expect_cmds[i+1]);
4573 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
4574 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
4576 IOleCommandTarget_Release(cmdtrg);
4579 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
4581 IOleCommandTarget *cmdtrg;
4586 {OLECMDID_OPEN, 0xf0f0},
4587 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
4590 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4591 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
4595 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
4596 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4598 SET_EXPECT(QueryStatus_OPEN);
4599 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
4600 CHECK_CALLED(QueryStatus_OPEN);
4602 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4603 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4604 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
4605 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
4606 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
4607 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
4608 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
4610 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
4611 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
4612 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
4614 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4615 if(!expect_cmds[i]) {
4616 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
4617 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4618 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4619 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4623 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
4624 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4625 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4626 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4628 IOleCommandTarget_Release(cmdtrg);
4631 static void test_exec_onunload(IHTMLDocument2 *doc)
4633 IOleCommandTarget *cmdtrg;
4637 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4638 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4642 memset(&var, 0x0a, sizeof(var));
4643 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4644 OLECMDEXECOPT_DODEFAULT, NULL, &var);
4645 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4646 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
4647 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
4649 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4650 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4651 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4653 IOleCommandTarget_Release(cmdtrg);
4656 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
4658 IOleCommandTarget *cmdtrg;
4661 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4662 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4669 load_state = LD_DOLOAD;
4672 SET_EXPECT(GetClassID);
4673 SET_EXPECT(SetStatusText);
4674 SET_EXPECT(Exec_ShellDocView_37);
4675 SET_EXPECT(GetHostInfo);
4677 SET_EXPECT(GetDisplayName);
4678 SET_EXPECT(Invoke_AMBIENT_SILENT);
4679 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4680 SET_EXPECT(OnChanged_READYSTATE);
4681 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4682 SET_EXPECT(IsSystemMoniker);
4683 SET_EXPECT(Exec_ShellDocView_84);
4685 SET_EXPECT(BindToStorage);
4686 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4689 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4691 expect_status_text = NULL;
4692 readystate_set_loading = TRUE;
4694 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4695 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4696 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4699 CHECK_CALLED(GetClassID);
4700 CHECK_CALLED(SetStatusText);
4701 CHECK_CALLED(Exec_ShellDocView_37);
4702 CHECK_CALLED(GetHostInfo);
4704 CHECK_CALLED(GetDisplayName);
4705 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4706 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4707 CHECK_CALLED(OnChanged_READYSTATE);
4708 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4709 SET_CALLED(IsSystemMoniker); /* IE7 */
4710 SET_CALLED(Exec_ShellDocView_84);
4712 CHECK_CALLED(BindToStorage);
4713 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4714 CHECK_CALLED(HideUI);
4715 CHECK_CALLED(ShowUI);
4716 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4718 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
4720 IOleCommandTarget_Release(cmdtrg);
4722 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4723 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4724 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4727 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
4729 IOleCommandTarget *cmdtrg;
4730 VARIANT *in = NULL, _in, *out = NULL, _out;
4733 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4734 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
4741 V_BSTR(in) = SysAllocString(name);
4747 V_I4(out) = 0xdeadbeef;
4750 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
4751 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
4757 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
4758 if(V_VT(out) == VT_BSTR) {
4760 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
4761 "unexpected fontname %s\n", wine_dbgstr_w(name));
4763 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
4768 IOleCommandTarget_Release(cmdtrg);
4771 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
4773 IOleCommandTarget *cmdtrg;
4776 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4777 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4781 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
4782 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4783 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4785 IOleCommandTarget_Release(cmdtrg);
4788 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
4790 IPersistStreamInit *perinit;
4791 IPersistMoniker *permon;
4792 IPersistFile *perfile;
4795 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
4796 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
4797 if(SUCCEEDED(hres)) {
4798 hres = IPersistStreamInit_IsDirty(perinit);
4799 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4800 IPersistStreamInit_Release(perinit);
4803 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
4804 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
4805 if(SUCCEEDED(hres)) {
4806 hres = IPersistMoniker_IsDirty(permon);
4807 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4808 IPersistMoniker_Release(permon);
4811 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
4812 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
4813 if(SUCCEEDED(hres)) {
4814 hres = IPersistFile_IsDirty(perfile);
4815 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4816 IPersistFile_Release(perfile);
4820 static HWND create_container_window(void)
4822 static const WCHAR wszHTMLDocumentTest[] =
4823 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
4824 static WNDCLASSEXW wndclass = {
4825 sizeof(WNDCLASSEXW),
4828 0, 0, NULL, NULL, NULL, NULL, NULL,
4829 wszHTMLDocumentTest,
4833 RegisterClassExW(&wndclass);
4834 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
4835 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
4836 515, 530, NULL, NULL, NULL, NULL);
4839 static void test_DoVerb(IOleObject *oleobj)
4841 RECT rect = {0,0,500,500};
4844 if(!container_locked) {
4845 SET_EXPECT(GetContainer);
4846 SET_EXPECT(LockContainer);
4848 SET_EXPECT(ActivateMe);
4849 expect_LockContainer_fLock = TRUE;
4851 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
4852 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
4854 if(!container_locked) {
4855 CHECK_CALLED(GetContainer);
4856 CHECK_CALLED(LockContainer);
4857 container_locked = TRUE;
4859 CHECK_CALLED(ActivateMe);
4862 #define CLIENTSITE_EXPECTPATH 0x00000001
4863 #define CLIENTSITE_SETNULL 0x00000002
4864 #define CLIENTSITE_DONTSET 0x00000004
4866 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
4868 IOleClientSite *clientsite;
4871 if(flags & CLIENTSITE_SETNULL) {
4872 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4873 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4875 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
4877 ok(!clientsite, "clientsite != NULL\n");
4879 hres = IOleObject_SetClientSite(oleobj, NULL);
4880 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4882 set_clientsite = FALSE;
4885 if(flags & CLIENTSITE_DONTSET)
4888 if(!expect_uihandler_iface)
4889 expect_uihandler_iface = &DocHostUIHandler;
4891 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4892 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4893 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
4894 clientsite, set_clientsite ? &ClientSite : NULL);
4896 if(!set_clientsite) {
4897 if(expect_uihandler_iface)
4898 SET_EXPECT(GetHostInfo);
4899 if(flags & CLIENTSITE_EXPECTPATH) {
4900 SET_EXPECT(GetOptionKeyPath);
4901 SET_EXPECT(GetOverrideKeyPath);
4903 SET_EXPECT(GetWindow);
4904 if(flags & CLIENTSITE_EXPECTPATH)
4905 SET_EXPECT(Exec_DOCCANNAVIGATE);
4906 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4907 SET_EXPECT(Exec_SETPROGRESSMAX);
4908 SET_EXPECT(Exec_SETPROGRESSPOS);
4909 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4910 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4911 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4912 SET_EXPECT(Invoke_AMBIENT_SILENT);
4913 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4914 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4915 SET_EXPECT(GetTravelLog);
4917 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4918 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4920 if(expect_uihandler_iface)
4921 CHECK_CALLED(GetHostInfo);
4922 if(flags & CLIENTSITE_EXPECTPATH) {
4923 CHECK_CALLED(GetOptionKeyPath);
4924 CHECK_CALLED(GetOverrideKeyPath);
4926 CHECK_CALLED(GetWindow);
4927 if(flags & CLIENTSITE_EXPECTPATH)
4928 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4929 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4930 CHECK_CALLED(Exec_SETPROGRESSMAX);
4931 CHECK_CALLED(Exec_SETPROGRESSPOS);
4932 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4933 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4934 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4935 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4936 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4937 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4938 todo_wine CHECK_CALLED(GetTravelLog);
4940 set_clientsite = TRUE;
4943 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4944 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4946 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4947 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4948 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
4951 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
4953 IOleControl *control = NULL;
4956 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
4957 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
4961 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4962 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
4963 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4964 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4966 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4967 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
4968 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4969 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4971 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4972 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4973 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
4974 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4975 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4976 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4978 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4979 SET_EXPECT(Invoke_AMBIENT_SILENT);
4980 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
4981 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4982 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4983 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4985 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4986 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
4987 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4988 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4990 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4991 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
4992 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4993 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4995 IOleControl_Release(control);
5000 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
5002 IOleControl *control = NULL;
5005 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
5006 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
5010 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
5011 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
5013 IOleControl_Release(control);
5016 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
5018 IOleObject *oleobj = NULL;
5021 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5022 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5026 SET_EXPECT(GetContainer);
5027 SET_EXPECT(LockContainer);
5028 expect_LockContainer_fLock = FALSE;
5029 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
5030 ok(hres == S_OK, "Close failed: %08x\n", hres);
5031 CHECK_CALLED(GetContainer);
5032 CHECK_CALLED(LockContainer);
5033 container_locked = FALSE;
5036 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5038 IOleObject_Release(oleobj);
5041 static void test_Advise(IHTMLDocument2 *doc)
5043 IOleObject *oleobj = NULL;
5044 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
5048 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5049 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5053 hres = IOleObject_Unadvise(oleobj, 0);
5054 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5056 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
5057 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
5058 ok(enum_advise == NULL, "enum_advise != NULL\n");
5061 hres = IOleObject_Advise(oleobj, NULL, &conn);
5062 /* Old IE returns S_OK and sets conn to 1 */
5063 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
5064 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
5066 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
5067 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
5069 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5070 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5071 ok(conn == 1, "conn = %d\n", conn);
5073 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5074 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5075 ok(conn == 2, "conn = %d\n", conn);
5077 hres = IOleObject_Unadvise(oleobj, 1);
5078 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5080 hres = IOleObject_Unadvise(oleobj, 1);
5081 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5083 hres = IOleObject_Unadvise(oleobj, 2);
5084 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5086 IOleObject_Release(oleobj);
5089 static void test_OnFrameWindowActivate(IUnknown *unk)
5091 IOleInPlaceActiveObject *inplaceact;
5094 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
5095 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
5099 if(set_clientsite) {
5100 expect_OnFrameWindowActivate_fActivate = TRUE;
5101 SET_EXPECT(OnFrameWindowActivate);
5102 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5103 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5104 CHECK_CALLED(OnFrameWindowActivate);
5106 SET_EXPECT(OnFrameWindowActivate);
5107 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5108 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5109 CHECK_CALLED(OnFrameWindowActivate);
5111 expect_OnFrameWindowActivate_fActivate = FALSE;
5112 SET_EXPECT(OnFrameWindowActivate);
5113 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5114 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5115 CHECK_CALLED(OnFrameWindowActivate);
5117 expect_OnFrameWindowActivate_fActivate = TRUE;
5118 SET_EXPECT(OnFrameWindowActivate);
5119 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5120 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5121 CHECK_CALLED(OnFrameWindowActivate);
5123 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5124 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5126 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5127 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5130 IOleInPlaceActiveObject_Release(inplaceact);
5133 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
5135 IOleInPlaceObjectWindowless *windowlessobj = NULL;
5138 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
5139 (void**)&windowlessobj);
5140 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
5145 SET_EXPECT(OnFocus_FALSE);
5147 SET_EXPECT(OnInPlaceDeactivateEx);
5149 SET_EXPECT(OnInPlaceDeactivate);
5151 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
5152 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
5154 CHECK_CALLED(OnFocus_FALSE);
5156 CHECK_CALLED(OnInPlaceDeactivateEx);
5158 CHECK_CALLED(OnInPlaceDeactivate);
5161 IOleInPlaceObjectWindowless_Release(windowlessobj);
5164 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
5166 IOleObject *oleobj = NULL;
5167 IOleDocumentView *docview;
5174 IOleDocumentView_Release(view);
5177 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5178 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5180 hres = IOleObject_GetUserClassID(oleobj, NULL);
5181 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
5183 hres = IOleObject_GetUserClassID(oleobj, &guid);
5184 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
5185 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
5187 test_OnFrameWindowActivate((IUnknown*)doc);
5189 test_ClientSite(oleobj, flags);
5190 test_InPlaceDeactivate(doc, FALSE);
5191 test_DoVerb(oleobj);
5193 if(call_UIActivate == CallUIActivate_AfterShow) {
5194 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5195 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5197 SET_EXPECT(OnFocus_TRUE);
5198 SET_EXPECT(SetActiveObject);
5200 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5201 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5202 expect_status_text = NULL;
5204 hres = IOleDocumentView_UIActivate(docview, TRUE);
5205 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5207 CHECK_CALLED(OnFocus_TRUE);
5208 CHECK_CALLED(SetActiveObject);
5209 CHECK_CALLED(ShowUI);
5210 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5211 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5213 IOleDocumentView_Release(docview);
5216 IOleObject_Release(oleobj);
5218 test_OnFrameWindowActivate((IUnknown*)doc);
5221 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
5223 IOleInPlaceActiveObject *activeobject = NULL;
5227 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
5228 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
5232 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
5234 if(expect_success) {
5235 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
5236 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
5238 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
5239 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5242 IOleInPlaceActiveObject_Release(activeobject);
5245 static void test_CloseView(void)
5247 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
5253 hres = IOleDocumentView_Show(view, FALSE);
5254 ok(hres == S_OK, "Show failed: %08x\n", hres);
5256 hres = IOleDocumentView_CloseView(view, 0);
5257 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
5259 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
5260 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5262 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
5263 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5264 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
5267 static void test_UIDeactivate(void)
5271 if(call_UIActivate == CallUIActivate_AfterShow) {
5272 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5274 if(call_UIActivate != CallUIActivate_None) {
5275 SET_EXPECT(SetActiveObject_null);
5277 SET_EXPECT(OnUIDeactivate);
5280 hres = IOleDocumentView_UIActivate(view, FALSE);
5281 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
5283 if(call_UIActivate != CallUIActivate_None) {
5284 CHECK_CALLED(SetActiveObject_null);
5285 CHECK_CALLED(HideUI);
5286 CHECK_CALLED(OnUIDeactivate);
5288 if(call_UIActivate == CallUIActivate_AfterShow) {
5289 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5293 static void test_Hide(void)
5300 hres = IOleDocumentView_Show(view, FALSE);
5301 ok(hres == S_OK, "Show failed: %08x\n", hres);
5304 static IHTMLDocument2 *create_document(void)
5306 IHTMLDocument2 *doc;
5309 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
5310 &IID_IHTMLDocument2, (void**)&doc);
5311 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
5318 static void release_document(IHTMLDocument2 *doc)
5324 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
5325 * To workaround it, we release it via IUnknown iface */
5326 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
5327 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
5329 IHTMLDocument2_Release(doc);
5330 ref = IUnknown_Release(unk);
5331 ok(!ref, "ref = %d\n", ref);
5334 static void test_Navigate(IHTMLDocument2 *doc)
5336 IHlinkTarget *hlink;
5339 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
5340 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
5342 SET_EXPECT(ActivateMe);
5343 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
5344 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
5345 CHECK_CALLED(ActivateMe);
5347 IHlinkTarget_Release(hlink);
5350 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
5352 IDispatch *external;
5353 IHTMLWindow2 *htmlwin;
5356 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
5357 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5360 SET_EXPECT(GetExternal);
5361 external = (void*)0xdeadbeef;
5362 hres = IHTMLWindow2_get_external(htmlwin, &external);
5364 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
5365 CHECK_CALLED(GetExternal);
5366 ok(external != NULL, "external == NULL\n");
5368 ok(hres == S_OK, "get_external failed: %08x\n", hres);
5369 ok(external == NULL, "external != NULL\n");
5372 IHTMLWindow2_Release(htmlwin);
5375 static void test_StreamLoad(IHTMLDocument2 *doc)
5377 IPersistStreamInit *init;
5380 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5381 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5385 SET_EXPECT(Invoke_AMBIENT_SILENT);
5386 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5387 SET_EXPECT(Exec_ShellDocView_37);
5388 SET_EXPECT(OnChanged_READYSTATE);
5389 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5391 SET_EXPECT(GetPendingUrl);
5392 readystate_set_loading = TRUE;
5394 hres = IPersistStreamInit_Load(init, &Stream);
5395 ok(hres == S_OK, "Load failed: %08x\n", hres);
5397 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5398 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5399 CHECK_CALLED(Exec_ShellDocView_37);
5400 CHECK_CALLED(OnChanged_READYSTATE);
5401 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5403 todo_wine CHECK_CALLED(GetPendingUrl);
5405 test_timer(EXPECT_SETTITLE);
5406 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5408 IPersistStreamInit_Release(init);
5411 static void test_StreamInitNew(IHTMLDocument2 *doc)
5413 IPersistStreamInit *init;
5416 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5417 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5421 SET_EXPECT(Invoke_AMBIENT_SILENT);
5422 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5423 SET_EXPECT(Exec_ShellDocView_37);
5424 SET_EXPECT(OnChanged_READYSTATE);
5425 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5426 SET_EXPECT(GetPendingUrl);
5427 readystate_set_loading = TRUE;
5429 hres = IPersistStreamInit_InitNew(init);
5430 ok(hres == S_OK, "Load failed: %08x\n", hres);
5432 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5433 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5434 CHECK_CALLED(Exec_ShellDocView_37);
5435 CHECK_CALLED(OnChanged_READYSTATE);
5436 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5437 todo_wine CHECK_CALLED(GetPendingUrl);
5439 test_timer(EXPECT_SETTITLE);
5440 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5442 IPersistStreamInit_Release(init);
5445 static void test_QueryInterface(IHTMLDocument2 *doc)
5450 static const IID IID_UndocumentedScriptIface =
5451 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
5453 qi = (void*)0xdeadbeef;
5454 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
5455 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5456 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
5458 qi = (void*)0xdeadbeef;
5459 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
5460 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5461 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5463 qi = (void*)0xdeadbeef;
5464 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
5465 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5466 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5468 qi = (void*)0xdeadbeef;
5469 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
5470 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5471 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5473 qi = (void*)0xdeadbeef;
5474 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
5475 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5476 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5478 qi = (void*)0xdeadbeef;
5479 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
5480 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5481 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5483 qi = (void*)0xdeadbeef;
5484 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
5485 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5486 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5488 qi = (void*)0xdeadbeef;
5489 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
5490 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5491 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5493 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
5494 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
5495 ok(qi != (IUnknown*)doc, "disp == doc\n");
5496 IUnknown_Release(qi);
5499 static void init_test(enum load_state_t ls) {
5501 hwnd = last_hwnd = NULL;
5502 set_clientsite = FALSE;
5503 load_from_stream = FALSE;
5504 call_UIActivate = CallUIActivate_None;
5511 inplace_deactivated = FALSE;
5513 expect_uihandler_iface = &DocHostUIHandler;
5516 static void test_HTMLDocument(BOOL do_load)
5518 IHTMLDocument2 *doc;
5520 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
5522 init_test(do_load ? LD_DOLOAD : LD_NO);
5524 doc = create_document();
5525 doc_unk = (IUnknown*)doc;
5527 test_QueryInterface(doc);
5529 test_IsDirty(doc, S_FALSE);
5530 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5531 test_external(doc, FALSE);
5532 test_ViewAdviseSink(doc);
5533 test_ConnectionPointContainer(doc);
5534 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5535 test_Persist(doc, &Moniker);
5537 test_OnAmbientPropertyChange2(doc);
5539 test_Activate(doc, CLIENTSITE_EXPECTPATH);
5542 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5543 test_download(DWL_CSS|DWL_TRYCSS);
5544 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5545 test_elem_from_point(doc);
5548 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5549 test_OleCommandTarget_fail(doc);
5550 test_OleCommandTarget(doc);
5551 test_OnAmbientPropertyChange(doc);
5552 test_Window(doc, TRUE);
5553 test_external(doc, TRUE);
5555 test_UIDeactivate();
5556 test_OleCommandTarget(doc);
5557 test_Window(doc, TRUE);
5558 test_InPlaceDeactivate(doc, TRUE);
5560 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
5561 * MSHTML. It doesn't with Wine. */
5563 test_Window(doc, FALSE);
5565 test_InPlaceDeactivate(doc, FALSE);
5567 test_Close(doc, FALSE);
5569 /* Activate HTMLDocument again */
5570 test_Activate(doc, CLIENTSITE_SETNULL);
5571 test_Window(doc, TRUE);
5572 test_OleCommandTarget(doc);
5573 test_UIDeactivate();
5574 test_InPlaceDeactivate(doc, TRUE);
5575 test_Close(doc, FALSE);
5577 /* Activate HTMLDocument again, this time without UIActivate */
5578 call_UIActivate = CallUIActivate_None;
5579 test_Activate(doc, CLIENTSITE_SETNULL);
5580 test_Window(doc, TRUE);
5582 test_external(doc, TRUE);
5583 set_custom_uihandler(doc, NULL);
5584 test_external(doc, FALSE);
5586 test_UIDeactivate();
5587 test_InPlaceDeactivate(doc, TRUE);
5590 test_Close(doc, TRUE);
5591 test_OnAmbientPropertyChange2(doc);
5592 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
5595 /* Activate HTMLDocument again, calling UIActivate after showing the window */
5596 call_UIActivate = CallUIActivate_AfterShow;
5597 test_Activate(doc, 0);
5598 test_Window(doc, TRUE);
5599 test_OleCommandTarget(doc);
5600 test_UIDeactivate();
5601 test_InPlaceDeactivate(doc, TRUE);
5602 test_Close(doc, FALSE);
5603 call_UIActivate = CallUIActivate_None;
5607 IOleDocumentView_Release(view);
5610 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5611 release_document(doc);
5612 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
5615 static void test_HTMLDocument_hlink(DWORD status)
5617 IHTMLDocument2 *doc;
5619 trace("Testing HTMLDocument (hlink)...\n");
5621 init_test(LD_DOLOAD);
5624 doc = create_document();
5625 doc_unk = (IUnknown*)doc;
5627 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5628 test_ViewAdviseSink(doc);
5629 test_ConnectionPointContainer(doc);
5630 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5631 test_Persist(doc, &Moniker);
5634 status_code = status;
5635 test_download(DWL_CSS|DWL_TRYCSS);
5636 status_code = HTTP_STATUS_OK;
5638 test_IsDirty(doc, S_FALSE);
5639 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5641 test_exec_onunload(doc);
5642 test_Window(doc, TRUE);
5643 test_InPlaceDeactivate(doc, TRUE);
5644 test_Close(doc, FALSE);
5645 test_IsDirty(doc, S_FALSE);
5646 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5648 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5651 IOleDocumentView_Release(view);
5654 release_document(doc);
5657 static void test_cookies(IHTMLDocument2 *doc)
5665 hres = IHTMLDocument2_get_cookie(doc, &str);
5666 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5668 size = sizeof(buf)/sizeof(WCHAR);
5669 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5670 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5671 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
5675 str = a2bstr("test=testval");
5676 hres = IHTMLDocument2_put_cookie(doc, str);
5677 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5680 hres = IHTMLDocument2_get_cookie(doc, &str2);
5681 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5682 ok(str2 != NULL, "cookie = NULL\n");
5683 size = sizeof(buf)/sizeof(WCHAR);
5684 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5685 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5686 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5687 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5689 SysFreeString(str2);
5691 str = a2bstr("test=testval2");
5692 hres = IHTMLDocument2_put_cookie(doc, str);
5693 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5696 hres = IHTMLDocument2_get_cookie(doc, &str2);
5697 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5698 ok(str2 != NULL, "cookie = NULL\n");
5699 size = sizeof(buf)/sizeof(WCHAR);
5700 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5701 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5702 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5703 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5705 SysFreeString(str2);
5708 static void test_HTMLDocument_http(void)
5711 IHTMLDocument2 *doc;
5715 trace("Testing HTMLDocument (http)...\n");
5717 if(!winetest_interactive && is_ie_hardened()) {
5718 win_skip("IE running in Enhanced Security Configuration\n");
5722 init_test(LD_DOLOAD);
5725 doc = create_document();
5726 doc_unk = (IUnknown*)doc;
5728 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
5729 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
5731 test_ViewAdviseSink(doc);
5732 test_ConnectionPointContainer(doc);
5733 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5734 test_Persist(doc, http_mon);
5736 test_download(DWL_HTTP);
5738 test_IsDirty(doc, S_FALSE);
5739 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5740 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
5742 nav_url = "http://www.winehq.org/"; /* for valid prev nav_url */
5743 test_put_href(doc, FALSE, "javascript:external&&undefined", TRUE);
5745 test_put_href(doc, FALSE, "about:blank", FALSE);
5746 test_put_href(doc, TRUE, "about:replace", FALSE);
5748 test_open_window(doc);
5750 test_InPlaceDeactivate(doc, TRUE);
5751 test_Close(doc, FALSE);
5752 test_IsDirty(doc, S_FALSE);
5753 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
5756 IOleDocumentView_Release(view);
5759 release_document(doc);
5761 ref = IMoniker_Release(http_mon);
5762 ok(!ref, "ref=%d, expected 0\n", ref);
5765 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
5767 IHTMLWindow2 *window, *sp_window;
5768 IServiceProvider *sp;
5772 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
5773 ok(hres == S_OK, "QueryService returned %08x\n", hres);
5775 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5777 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
5778 IServiceProvider_Release(sp);
5782 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5783 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5784 IHlinkFrame_Release(hf);
5786 IServiceProvider_Release(sp);
5788 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5789 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5791 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
5792 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
5794 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
5795 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
5796 /* FIXME: test returned window */
5797 IHTMLWindow2_Release(sp_window);
5799 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5800 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5801 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5802 IHlinkFrame_Release(hf);
5804 IServiceProvider_Release(sp);
5805 IHTMLWindow2_Release(window);
5808 static void test_HTMLDocument_StreamLoad(void)
5810 IHTMLDocument2 *doc;
5815 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
5817 init_test(LD_DOLOAD);
5818 load_from_stream = TRUE;
5820 doc = create_document();
5821 doc_unk = (IUnknown*)doc;
5823 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5824 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5826 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5827 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5829 test_readyState((IUnknown*)doc);
5830 test_IsDirty(doc, S_FALSE);
5831 test_ViewAdviseSink(doc);
5832 test_ConnectionPointContainer(doc);
5833 test_QueryService(doc, FALSE);
5834 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5835 test_QueryService(doc, TRUE);
5836 test_DoVerb(oleobj);
5837 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5839 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5840 test_StreamLoad(doc);
5841 test_download(DWL_VERBDONE|DWL_TRYCSS);
5842 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5844 test_UIDeactivate();
5845 test_InPlaceDeactivate(doc, TRUE);
5846 SET_EXPECT(Advise_Close);
5847 test_Close(doc, TRUE);
5848 CHECK_CALLED(Advise_Close);
5849 test_external(doc, FALSE);
5850 test_IsDirty(doc, S_FALSE);
5852 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5853 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
5854 test_external(doc, TRUE);
5855 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5856 test_external(doc, TRUE);
5857 set_custom_uihandler(doc, NULL);
5858 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5860 IOleObject_Release(oleobj);
5862 IOleDocumentView_Release(view);
5866 release_document(doc);
5869 static void test_HTMLDocument_StreamInitNew(void)
5871 IHTMLDocument2 *doc;
5876 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
5878 init_test(LD_DOLOAD);
5879 load_from_stream = TRUE;
5881 doc = create_document();
5882 doc_unk = (IUnknown*)doc;
5884 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5885 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5887 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5888 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5890 test_readyState((IUnknown*)doc);
5891 test_IsDirty(doc, S_FALSE);
5892 test_ViewAdviseSink(doc);
5893 test_ConnectionPointContainer(doc);
5894 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5895 test_DoVerb(oleobj);
5896 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5898 IOleObject_Release(oleobj);
5900 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5901 test_StreamInitNew(doc);
5903 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
5904 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
5905 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
5907 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5909 test_UIDeactivate();
5910 test_InPlaceDeactivate(doc, TRUE);
5911 SET_EXPECT(Advise_Close);
5912 test_Close(doc, FALSE);
5913 CHECK_CALLED(Advise_Close);
5914 test_IsDirty(doc, S_FALSE);
5917 IOleDocumentView_Release(view);
5921 release_document(doc);
5924 static void test_edit_uiactivate(IOleObject *oleobj)
5926 IOleDocumentView *docview;
5929 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5930 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5932 SET_EXPECT(OnFocus_TRUE);
5933 SET_EXPECT(SetActiveObject);
5935 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5936 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5937 expect_status_text = NULL;
5939 hres = IOleDocumentView_UIActivate(docview, TRUE);
5940 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5942 CHECK_CALLED(OnFocus_TRUE);
5943 CHECK_CALLED(SetActiveObject);
5944 CHECK_CALLED(ShowUI);
5945 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5946 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5948 IOleDocumentView_Release(docview);
5951 static void test_editing_mode(BOOL do_load)
5953 IHTMLDocument2 *doc;
5959 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
5961 init_test(do_load ? LD_DOLOAD : LD_NO);
5962 call_UIActivate = CallUIActivate_AfterShow;
5964 doc = create_document();
5965 unk = doc_unk = (IUnknown*)doc;
5967 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5968 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5970 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5971 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5973 test_readyState((IUnknown*)doc);
5974 test_ViewAdviseSink(doc);
5975 test_ConnectionPointContainer(doc);
5976 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5977 test_DoVerb(oleobj);
5978 test_edit_uiactivate(oleobj);
5980 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5982 test_Persist(doc, &Moniker);
5983 stream_read = protocol_read = 0;
5984 test_exec_editmode(unk, do_load);
5985 test_UIDeactivate();
5986 call_UIActivate = CallUIActivate_None;
5987 IOleObject_Release(oleobj);
5989 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5990 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
5992 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
5993 test_timer(EXPECT_UPDATEUI);
5994 SET_CALLED(SetStatusText);
5996 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5999 test_exec_fontname(unk, NULL, wszTimesNewRoman);
6000 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
6001 test_timer(EXPECT_UPDATEUI);
6002 test_exec_fontname(unk, NULL, wszArial);
6004 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
6005 test_timer(EXPECT_UPDATEUI);
6006 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
6007 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
6009 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
6010 test_timer(EXPECT_UPDATEUI);
6011 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
6012 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
6013 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
6014 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
6016 test_exec_noargs(unk, IDM_HORIZONTALLINE);
6017 test_timer(EXPECT_UPDATEUI);
6018 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
6019 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
6022 test_UIDeactivate();
6023 test_InPlaceDeactivate(doc, TRUE);
6024 SET_EXPECT(Advise_Close);
6025 test_Close(doc, FALSE);
6026 CHECK_CALLED(Advise_Close);
6029 IOleDocumentView_Release(view);
6033 release_document(doc);
6036 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
6038 IHTMLDocument2 *doc;
6040 IOleInPlaceSite *inplacesite;
6043 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
6045 init_test(do_load ? LD_DOLOAD : LD_NO);
6047 doc = create_document();
6048 doc_unk = (IUnknown*)doc;
6053 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6054 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6056 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
6057 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
6059 SET_EXPECT(Invoke_AMBIENT_USERMODE);
6060 SET_EXPECT(GetHostInfo);
6061 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6062 SET_EXPECT(Invoke_AMBIENT_SILENT);
6063 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6064 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6065 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6066 SET_EXPECT(GetOptionKeyPath);
6067 SET_EXPECT(GetOverrideKeyPath);
6068 SET_EXPECT(GetWindow);
6069 SET_EXPECT(Exec_DOCCANNAVIGATE);
6070 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
6071 SET_EXPECT(Exec_SETPROGRESSMAX);
6072 SET_EXPECT(Exec_SETPROGRESSPOS);
6073 SET_EXPECT(GetTravelLog);
6075 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
6076 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6077 set_clientsite = TRUE;
6079 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
6080 CHECK_CALLED(GetHostInfo);
6081 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6082 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6083 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6084 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6085 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
6086 CHECK_CALLED(GetOptionKeyPath);
6087 CHECK_CALLED(GetOverrideKeyPath);
6088 CHECK_CALLED(GetWindow);
6089 CHECK_CALLED(Exec_DOCCANNAVIGATE);
6090 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
6091 CHECK_CALLED(Exec_SETPROGRESSMAX);
6092 CHECK_CALLED(Exec_SETPROGRESSPOS);
6093 todo_wine CHECK_CALLED(GetTravelLog);
6095 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6096 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6097 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
6099 SET_EXPECT(GetContainer);
6100 SET_EXPECT(LockContainer);
6101 SET_EXPECT(CanInPlaceActivate);
6102 SET_EXPECT(GetWindowContext);
6103 SET_EXPECT(GetWindow);
6105 SET_EXPECT(OnInPlaceActivateEx);
6106 SET_EXPECT(RequestUIActivate);
6109 SET_EXPECT(OnInPlaceActivate);
6110 SET_EXPECT(OnUIActivate);
6111 SET_EXPECT(SetStatusText);
6112 SET_EXPECT(Exec_SETPROGRESSMAX);
6113 SET_EXPECT(Exec_SETPROGRESSPOS);
6115 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6116 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6117 SET_EXPECT(OnFocus_TRUE);
6118 SET_EXPECT(SetActiveObject);
6119 expect_LockContainer_fLock = TRUE;
6121 hres = IOleDocumentView_UIActivate(view, TRUE);
6122 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6124 CHECK_CALLED(GetContainer);
6125 CHECK_CALLED(LockContainer);
6126 CHECK_CALLED(CanInPlaceActivate);
6127 CHECK_CALLED(GetWindowContext);
6128 CHECK_CALLED(GetWindow);
6130 CHECK_CALLED(OnInPlaceActivateEx);
6131 SET_EXPECT(RequestUIActivate);
6134 CHECK_CALLED(OnInPlaceActivate);
6135 CHECK_CALLED(OnUIActivate);
6136 CHECK_CALLED(SetStatusText);
6137 CHECK_CALLED(Exec_SETPROGRESSMAX);
6138 CHECK_CALLED(Exec_SETPROGRESSPOS);
6139 CHECK_CALLED(ShowUI);
6140 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6141 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6142 CHECK_CALLED(OnFocus_TRUE);
6143 CHECK_CALLED(SetActiveObject);
6144 container_locked = TRUE;
6146 SET_EXPECT(SetActiveObject_null);
6147 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6149 SET_EXPECT(OnUIDeactivate);
6151 hres = IOleDocumentView_UIActivate(view, FALSE);
6152 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6154 CHECK_CALLED(SetActiveObject_null);
6155 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6156 CHECK_CALLED(HideUI);
6157 CHECK_CALLED(OnUIDeactivate);
6159 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6160 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6161 ok(inplacesite != NULL, "inplacesite = NULL\n");
6162 IOleInPlaceSite_Release(inplacesite);
6164 SET_EXPECT(OnFocus_FALSE);
6166 SET_EXPECT(OnInPlaceDeactivateEx);
6168 SET_EXPECT(OnInPlaceDeactivate);
6172 CHECK_CALLED(OnFocus_FALSE);
6174 CHECK_CALLED(OnInPlaceDeactivateEx);
6176 CHECK_CALLED(OnInPlaceDeactivate);
6178 test_Close(doc, TRUE);
6180 IOleObject_Release(oleobj);
6181 IOleDocumentView_Release(view);
6184 release_document(doc);
6187 static void register_protocol(void)
6189 IInternetSession *session;
6192 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
6194 hres = CoInternetGetSession(0, &session, 0);
6195 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
6197 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
6198 wsz_winetest, 0, NULL, 0);
6199 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
6201 IInternetSession_Release(session);
6204 static void test_HTMLDoc_ISupportErrorInfo(void)
6206 IHTMLDocument2 *doc;
6208 ISupportErrorInfo *sinfo;
6210 doc = create_document();
6212 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
6213 ok(hres == S_OK, "got %x\n", hres);
6214 ok(sinfo != NULL, "got %p\n", sinfo);
6217 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
6218 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
6219 IUnknown_Release(sinfo);
6222 release_document(doc);
6225 static void test_IPersistHistory(void)
6227 IHTMLDocument2 *doc;
6229 IPersistHistory *phist;
6231 doc = create_document();
6233 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
6234 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
6236 IPersistHistory_Release(phist);
6238 release_document(doc);
6241 static BOOL check_ie(void)
6243 IHTMLDocument2 *doc;
6244 IHTMLDocument5 *doc5;
6247 doc = create_document();
6251 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
6253 IHTMLDocument5_Release(doc5);
6255 release_document(doc);
6256 return SUCCEEDED(hres);
6265 win_skip("Too old IE\n");
6269 container_hwnd = create_container_window();
6270 register_protocol();
6272 asynchronous_binding = TRUE;
6273 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
6275 asynchronous_binding = FALSE;
6276 test_HTMLDocument_hlink(HTTP_STATUS_OK);
6277 test_HTMLDocument(FALSE);
6278 test_HTMLDocument(TRUE);
6279 test_HTMLDocument_StreamLoad();
6280 test_HTMLDocument_StreamInitNew();
6281 test_editing_mode(FALSE);
6282 test_editing_mode(TRUE);
6283 test_HTMLDocument_http();
6284 test_UIActivate(FALSE, FALSE, FALSE);
6285 test_UIActivate(FALSE, TRUE, FALSE);
6286 test_UIActivate(FALSE, TRUE, TRUE);
6287 test_UIActivate(TRUE, FALSE, FALSE);
6288 test_UIActivate(TRUE, TRUE, FALSE);
6289 test_UIActivate(TRUE, TRUE, TRUE);
6290 test_HTMLDoc_ISupportErrorInfo();
6291 test_IPersistHistory();
6293 DestroyWindow(container_hwnd);