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>"
219 static const char css_data[] = "body {color: red}";
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 static BOOL is_english(void)
288 static HMODULE hkernel32 = NULL;
289 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
293 hkernel32 = GetModuleHandleA("kernel32.dll");
294 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
296 if (pGetUserDefaultUILanguage)
297 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
299 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
302 #define EXPECT_UPDATEUI 1
303 #define EXPECT_SETTITLE 2
305 static void test_timer(DWORD flags)
307 BOOL *b = &called_Exec_SETTITLE;
310 if(flags & EXPECT_UPDATEUI) {
311 SET_EXPECT(UpdateUI);
312 SET_EXPECT(Exec_UPDATECOMMANDS);
313 b = &called_UpdateUI;
315 if(flags & EXPECT_SETTITLE)
316 SET_EXPECT(Exec_SETTITLE);
318 while(!*b && GetMessage(&msg, hwnd, 0, 0)) {
319 TranslateMessage(&msg);
320 DispatchMessage(&msg);
323 if(flags & EXPECT_UPDATEUI) {
324 CHECK_CALLED(UpdateUI);
325 CHECK_CALLED(Exec_UPDATECOMMANDS);
327 if(flags & EXPECT_SETTITLE)
328 CHECK_CALLED(Exec_SETTITLE);
331 static IMoniker Moniker;
333 #define test_GetCurMoniker(u,m,v) _test_GetCurMoniker(__LINE__,u,m,v)
334 static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, const char *exurl)
337 IPersistMoniker *permon;
338 IMoniker *mon = (void*)0xdeadbeef;
339 BSTR doc_url = (void*)0xdeadbeef;
345 hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
346 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
350 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
351 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
353 hres = IHTMLDocument2_get_URL(doc, &doc_url);
354 ok(hres == S_OK, "get_URL failed: %08x\n", hres);
356 hres = IPersistMoniker_GetCurMoniker(permon, &mon);
357 IPersistMoniker_Release(permon);
361 BOOL exb = expect_GetDisplayName;
362 BOOL clb = called_GetDisplayName;
364 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
365 ok_(__FILE__,line)(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon);
368 SET_EXPECT(GetDisplayName);
369 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
370 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
372 CHECK_CALLED(GetDisplayName);
373 expect_GetDisplayName = exb;
374 called_GetDisplayName = clb;
376 ok(!lstrcmpW(url, doc_url), "url != doc_url\n");
381 ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
383 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
384 ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
386 ok_(__FILE__,line)(!strcmp_wa(url, exurl), "unexpected url %s\n", wine_dbgstr_w(url));
387 ok_(__FILE__,line)(!lstrcmpW(url, doc_url), "url != doc_url\n");
391 ok_(__FILE__,line)(hres == E_UNEXPECTED,
392 "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres);
393 ok_(__FILE__,line)(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon);
394 ok_(__FILE__,line)(!strcmp_wa(doc_url, "about:blank"), "doc_url is not about:blank\n");
397 SysFreeString(doc_url);
398 IHTMLDocument_Release(doc);
399 if(mon && mon != (void*)0xdeadbeef)
400 IMoniker_Release(mon);
403 DEFINE_GUID(IID_External_unk,0x30510406,0x98B5,0x11CF,0xBB,0x82,0x00,0xAA,0x00,0xBD,0xCE,0x0B);
405 static HRESULT WINAPI External_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
409 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
414 if(IsEqualGUID(&IID_IProxyManager, riid))
415 return E_NOINTERFACE; /* TODO */
416 if(IsEqualGUID(&IID_IDispatchEx, riid))
417 return E_NOINTERFACE; /* TODO */
418 if(IsEqualGUID(&IID_External_unk, riid))
419 return E_NOINTERFACE; /* TODO */
421 if(!ignore_external_qi)
422 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
423 return E_NOINTERFACE;
426 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
431 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
436 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
438 ok(0, "unexpected call\n");
442 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
445 ok(0, "unexpected call\n");
449 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
450 UINT cNames, LCID lcid, DISPID *rgDispId)
452 ok(0, "unexpected call\n");
456 static HRESULT WINAPI External_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
457 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
458 EXCEPINFO *pExcepInfo, UINT *puArgErr)
460 ok(0, "unexpected call\n");
464 static const IDispatchVtbl ExternalVtbl = {
465 External_QueryInterface,
468 Dispatch_GetTypeInfoCount,
469 Dispatch_GetTypeInfo,
470 Dispatch_GetIDsOfNames,
474 static IDispatch External = { &ExternalVtbl };
476 static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
478 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
484 return E_NOINTERFACE;
487 static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
492 static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
497 static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
498 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
499 DWORD grfPI, HANDLE_PTR dwReserved)
505 static const WCHAR wszTextCss[] = {'t','e','x','t','/','c','s','s',0};
506 static const WCHAR empty_str = {0};
510 ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
511 ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
512 ok(!grfPI, "grfPI = %x\n", grfPI);
513 ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
515 memset(&bindinfo, 0, sizeof(bindinfo));
516 bindinfo.cbSize = sizeof(bindinfo);
517 hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
518 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
519 ok(bindf == (BINDF_FROMURLMON|BINDF_PULLDATA|BINDF_NEEDFILE|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS),
520 "bindf = %x\n", bindf);
522 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
523 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
524 /* TODO: test stgmedData */
525 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
526 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
527 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
528 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
529 ok(bindinfo.dwOptions == 0x80000 ||
530 bindinfo.dwOptions == 0x4080000, /* win2k3 */
531 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
532 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
533 /* TODO: test dwCodePage */
534 /* TODO: test securityAttributes */
535 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
536 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
537 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
539 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
540 BINDSTATUS_CACHEFILENAMEAVAILABLE, &empty_str);
541 ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
543 hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
544 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextCss);
546 "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
548 hres = IInternetProtocolSink_ReportData(pOIProtSink,
549 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
550 ok(hres == S_OK, "ReportData failed: %08x\n", hres);
552 hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
553 ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
558 static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
559 PROTOCOLDATA *pProtocolData)
561 ok(0, "unexpected call\n");
565 static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
568 ok(0, "unexpected call\n");
572 static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
574 CHECK_EXPECT(Terminate);
578 static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
580 ok(0, "unexpected call\n");
584 static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
586 ok(0, "unexpected call\n");
590 static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
591 ULONG cb, ULONG *pcbRead)
593 CHECK_EXPECT2(Protocol_Read);
595 ok(pv != NULL, "pv == NULL\n");
596 ok(cb > sizeof(css_data), "cb < sizeof(css_data)\n");
597 ok(pcbRead != NULL, "pcbRead == NULL\n");
598 ok(!*pcbRead, "*pcbRead=%d\n", *pcbRead);
603 protocol_read += *pcbRead = sizeof(css_data)-1;
604 memcpy(pv, css_data, sizeof(css_data)-1);
608 static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
609 LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
611 ok(0, "unexpected call\n");
615 static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
617 CHECK_EXPECT(LockRequest);
621 static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
623 CHECK_EXPECT(UnlockRequest);
627 static const IInternetProtocolVtbl ProtocolVtbl = {
628 Protocol_QueryInterface,
639 Protocol_LockRequest,
640 Protocol_UnlockRequest
643 static IInternetProtocol Protocol = { &ProtocolVtbl };
645 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
647 if(!IsEqualGUID(&IID_IInternetProtocolInfo, riid))
648 ok(0, "unexpected call\n");
649 return E_NOINTERFACE;
652 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
657 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
662 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
663 REFIID riid, void **ppv)
665 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid))
666 return E_NOINTERFACE;
668 CHECK_EXPECT(CreateInstance);
669 ok(ppv != NULL, "ppv == NULL\n");
675 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
677 ok(0, "unexpected call\n");
681 static const IClassFactoryVtbl ClassFactoryVtbl = {
682 ClassFactory_QueryInterface,
684 ClassFactory_Release,
685 ClassFactory_CreateInstance,
686 ClassFactory_LockServer
689 static IClassFactory ClassFactory = { &ClassFactoryVtbl };
691 static HRESULT WINAPI HlinkFrame_QueryInterface(IHlinkFrame *iface, REFIID riid, void **ppv)
693 ok(0, "unexpected call\n");
697 static ULONG WINAPI HlinkFrame_AddRef(IHlinkFrame *iface)
702 static ULONG WINAPI HlinkFrame_Release(IHlinkFrame *iface)
707 static HRESULT WINAPI HlinkFrame_SetBrowseContext(IHlinkFrame *iface,
708 IHlinkBrowseContext *pihlbc)
710 ok(0, "unexpected call\n");
714 static HRESULT WINAPI HlinkFrame_GetBrowseContext(IHlinkFrame *iface,
715 IHlinkBrowseContext **ppihlbc)
717 ok(0, "unexpected call\n");
721 static HRESULT WINAPI HlinkFrame_Navigate(IHlinkFrame *iface, DWORD grfHLNF, LPBC pbc,
722 IBindStatusCallback *pibsc, IHlink *pihlNavigate)
726 CHECK_EXPECT(Navigate);
728 ok(grfHLNF == 0, "grfHLNF=%d, expected 0\n", grfHLNF);
729 ok(pbc != NULL, "pbc == NULL\n");
730 ok(pibsc != NULL, "pubsc == NULL\n");
731 ok(pihlNavigate != NULL, "puhlNavigate == NULL\n");
734 LPWSTR frame_name = (LPWSTR)0xdeadbeef;
735 LPWSTR location = (LPWSTR)0xdeadbeef;
737 IMoniker *mon = NULL;
738 DWORD site_data = 0xdeadbeef;
740 hres = IHlink_GetTargetFrameName(pihlNavigate, &frame_name);
742 ok(hres == S_FALSE, "GetTargetFrameName failed: %08x\n", hres);
743 ok(frame_name == NULL, "frame_name = %p\n", frame_name);
745 hres = IHlink_GetMonikerReference(pihlNavigate, 1, &mon, &location);
746 ok(hres == S_OK, "GetMonikerReference failed: %08x\n", hres);
747 ok(location == NULL, "location = %p\n", location);
748 ok(mon != NULL, "mon == NULL\n");
750 hres = IHlink_GetHlinkSite(pihlNavigate, &site, &site_data);
751 ok(hres == S_OK, "GetHlinkSite failed: %08x\n", hres);
752 ok(site == NULL, "site = %p\n, expected NULL\n", site);
753 ok(site_data == 0xdeadbeef, "site_data = %x\n", site_data);
759 static HRESULT WINAPI HlinkFrame_OnNavigate(IHlinkFrame *iface, DWORD grfHLNF,
760 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName, DWORD dwreserved)
762 ok(0, "unexpected call\n");
766 static HRESULT WINAPI HlinkFrame_UpdateHlink(IHlinkFrame *iface, ULONG uHLID,
767 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
769 ok(0, "unexpected call\n");
773 static const IHlinkFrameVtbl HlinkFrameVtbl = {
774 HlinkFrame_QueryInterface,
777 HlinkFrame_SetBrowseContext,
778 HlinkFrame_GetBrowseContext,
780 HlinkFrame_OnNavigate,
781 HlinkFrame_UpdateHlink
784 static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
786 static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
788 ok(0, "unexpected call\n");
789 return E_NOINTERFACE;
792 static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
797 static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
802 static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
803 LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
804 DWORD dwUserActionTime)
806 CHECK_EXPECT(EvaluateNewWindow);
808 ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
809 ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
810 ok(!strcmp_wa(pszUrlContext, "about:replace"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
811 ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
812 ok(!fReplace, "fReplace = %x\n", fReplace);
813 ok(dwFlags == NWMF_FIRST, "dwFlags = %x\n", dwFlags);
814 ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
819 static const INewWindowManagerVtbl NewWindowManagerVtbl = {
820 NewWindowManager_QueryInterface,
821 NewWindowManager_AddRef,
822 NewWindowManager_Release,
823 NewWindowManager_EvaluateNewWindow
826 static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
828 static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
829 REFIID riid, void**ppv)
831 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
836 ok(0, "unexpected call\n");
837 return E_NOINTERFACE;
840 static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
845 static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
850 static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
853 case DISPID_READYSTATE:
854 CHECK_EXPECT2(OnChanged_READYSTATE);
856 if(!readystate_set_interactive)
857 test_MSHTML_QueryStatus(NULL, OLECMDF_SUPPORTED
858 | (editmode && (load_state == LD_INTERACTIVE || load_state == LD_COMPLETE)
859 ? OLECMDF_ENABLED : 0));
861 if(readystate_set_loading) {
862 readystate_set_loading = FALSE;
863 load_state = LD_LOADING;
865 if(!editmode || load_state != LD_LOADING || !called_Exec_Explorer_69)
866 test_readyState(NULL);
869 CHECK_EXPECT(OnChanged_1005);
871 test_readyState(NULL);
872 readystate_set_interactive = (load_state != LD_INTERACTIVE);
875 CHECK_EXPECT(OnChanged_1012);
890 ok(0, "unexpected id %d\n", dispID);
894 static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
896 ok(0, "unexpected call\n");
900 static IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
901 PropertyNotifySink_QueryInterface,
902 PropertyNotifySink_AddRef,
903 PropertyNotifySink_Release,
904 PropertyNotifySink_OnChanged,
905 PropertyNotifySink_OnRequestEdit
908 static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
910 static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
912 ok(0, "unexpected call\n");
913 return E_NOINTERFACE;
916 static ULONG WINAPI Stream_AddRef(IStream *iface)
921 static ULONG WINAPI Stream_Release(IStream *iface)
926 static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
927 ULONG cb, ULONG *pcbRead)
930 ok(pv != NULL, "pv == NULL\n");
931 ok(cb > sizeof(html_page), "cb = %d\n", cb);
932 ok(pcbRead != NULL, "pcbRead == NULL\n");
933 ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
938 memcpy(pv, html_page, sizeof(html_page)-1);
939 stream_read += *pcbRead = sizeof(html_page)-1;
943 static HRESULT WINAPI Stream_Write(IStream *iface, const void *pv,
944 ULONG cb, ULONG *pcbWritten)
946 ok(0, "unexpected call\n");
950 static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
951 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
953 ok(0, "unexpected call\n");
957 static HRESULT WINAPI Stream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
959 ok(0, "unexpected call\n");
963 static HRESULT WINAPI Stream_CopyTo(IStream *iface, IStream *pstm,
964 ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
966 ok(0, "unexpected call\n");
970 static HRESULT WINAPI Stream_Commit(IStream *iface, DWORD grfCommitFlags)
972 ok(0, "unexpected call\n");
976 static HRESULT WINAPI Stream_Revert(IStream *iface)
978 ok(0, "unexpected call\n");
982 static HRESULT WINAPI Stream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset,
983 ULARGE_INTEGER cb, DWORD dwLockType)
985 ok(0, "unexpected call\n");
989 static HRESULT WINAPI Stream_UnlockRegion(IStream *iface,
990 ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
992 ok(0, "unexpected call\n");
996 static HRESULT WINAPI Stream_Stat(IStream *iface, STATSTG *pstatstg,
999 ok(0, "unexpected call\n");
1003 static HRESULT WINAPI Stream_Clone(IStream *iface, IStream **ppstm)
1005 ok(0, "unexpected call\n");
1009 static const IStreamVtbl StreamVtbl = {
1010 Stream_QueryInterface,
1021 Stream_UnlockRegion,
1026 static IStream Stream = { &StreamVtbl };
1028 static HRESULT WINAPI WinInetHttpInfo_QueryInterface(
1029 IWinInetHttpInfo* This,
1033 ok(0, "unexpected call\n");
1034 return E_NOINTERFACE;
1037 static ULONG WINAPI WinInetHttpInfo_AddRef(
1038 IWinInetHttpInfo* This)
1043 static ULONG WINAPI WinInetHttpInfo_Release(
1044 IWinInetHttpInfo* This)
1049 static HRESULT WINAPI WinInetHttpInfo_QueryOption(
1050 IWinInetHttpInfo* This,
1055 return E_NOTIMPL; /* TODO */
1058 static HRESULT WINAPI WinInetHttpInfo_QueryInfo(
1059 IWinInetHttpInfo* This,
1066 ok(pdwReserved == NULL, "pdwReserved != NULL\n");
1068 if(dwOption == (HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER)) {
1069 ok(pBuffer != NULL, "pBuffer == NULL\n");
1070 ok(*pcbBuf == sizeof(DWORD), "*pcbBuf = %d\n", *pcbBuf);
1071 ok(pdwFlags == NULL, "*pdwFlags != NULL\n");
1072 *((DWORD*)pBuffer) = status_code;
1076 return E_NOTIMPL; /* TODO */
1079 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = {
1080 WinInetHttpInfo_QueryInterface,
1081 WinInetHttpInfo_AddRef,
1082 WinInetHttpInfo_Release,
1083 WinInetHttpInfo_QueryOption,
1084 WinInetHttpInfo_QueryInfo
1087 static IWinInetHttpInfo WinInetHttpInfo = { &WinInetHttpInfoVtbl };
1089 static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv)
1091 if(IsEqualGUID(&IID_IUnknown, riid)) {
1096 if(IsEqualGUID(&IID_IWinInetInfo, riid) || IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
1097 *ppv = &WinInetHttpInfo;
1101 ok(0, "unexpected call\n");
1102 return E_NOINTERFACE;
1105 static ULONG WINAPI Binding_AddRef(IBinding *iface)
1110 static ULONG WINAPI Binding_Release(IBinding *iface)
1115 static HRESULT WINAPI Binding_Abort(IBinding *iface)
1117 CHECK_EXPECT(Abort);
1118 if(asynchronous_binding)
1119 PeekMessage(NULL, container_hwnd, WM_CONTINUE_BINDING, WM_CONTINUE_BINDING, PM_REMOVE);
1123 static HRESULT WINAPI Binding_Suspend(IBinding *iface)
1125 ok(0, "unexpected call\n");
1129 static HRESULT WINAPI Binding_Resume(IBinding *iface)
1131 ok(0, "unexpected call\n");
1135 static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority)
1137 ok(0, "unexpected call\n");
1141 static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority)
1143 ok(0, "unexpected call\n");
1147 static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol,
1148 DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved)
1150 CHECK_EXPECT(GetBindResult);
1154 static const IBindingVtbl BindingVtbl = {
1155 Binding_QueryInterface,
1161 Binding_SetPriority,
1162 Binding_GetPriority,
1163 Binding_GetBindResult
1166 static IBinding Binding = { &BindingVtbl };
1168 DEFINE_GUID(IID_IMoniker_unk,0xA158A630,0xED6F,0x45FB,0xB9,0x87,0xF6,0x86,0x76,0xF5,0x77,0x52);
1169 DEFINE_GUID(IID_IMoniker_unk2, 0x79EAC9D3,0xBAF9,0x11CE,0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B);
1171 static HRESULT WINAPI Moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv)
1175 if(IsEqualGUID(&IID_IMoniker_unk, riid))
1176 return E_NOINTERFACE; /* TODO */
1177 if(IsEqualGUID(&IID_IMoniker_unk2, riid))
1178 return E_NOINTERFACE; /* TODO */
1180 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
1181 return E_NOINTERFACE;
1184 static ULONG WINAPI Moniker_AddRef(IMoniker *iface)
1189 static ULONG WINAPI Moniker_Release(IMoniker *iface)
1194 static HRESULT WINAPI Moniker_GetClassID(IMoniker *iface, CLSID *pClassID)
1196 CHECK_EXPECT(GetClassID);
1197 ok(IsEqualGUID(pClassID, &IID_NULL), "pClassID = %s\n", debugstr_guid(pClassID));
1201 static HRESULT WINAPI Moniker_IsDirty(IMoniker *iface)
1203 ok(0, "unexpected call\n");
1207 static HRESULT WINAPI Moniker_Load(IMoniker *iface, IStream *pStm)
1209 ok(0, "unexpected call\n");
1213 static HRESULT WINAPI Moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty)
1215 ok(0, "unexpected call\n");
1219 static HRESULT WINAPI Moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
1221 ok(0, "unexpected call\n");
1225 static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoniker *pmkToLeft,
1226 REFIID riidResult, void **ppvResult)
1228 ok(0, "unexpected call\n");
1232 static void continue_binding(IBindStatusCallback *callback)
1234 FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
1235 STGMEDIUM stgmedium;
1238 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
1240 hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
1242 ok(hres == S_OK, "OnProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
1244 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1245 BINDSTATUS_BEGINDOWNLOADDATA, doc_url);
1246 ok(hres == S_OK, "OnProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
1247 if(status_code != HTTP_STATUS_OK) {
1248 CHECK_CALLED_BROKEN(IsErrorUrl);
1249 SET_EXPECT(IsErrorUrl);
1253 stgmedium.tymed = TYMED_ISTREAM;
1254 U(stgmedium).pstm = &Stream;
1255 stgmedium.pUnkForRelease = (IUnknown*)&Moniker;
1256 hres = IBindStatusCallback_OnDataAvailable(callback,
1257 BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
1258 sizeof(html_page)-1, &formatetc, &stgmedium);
1259 ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
1262 hres = IBindStatusCallback_OnProgress(callback, sizeof(html_page)-1, sizeof(html_page)-1,
1263 BINDSTATUS_ENDDOWNLOADDATA, NULL);
1264 ok(hres == S_OK, "OnProgress(BINDSTATUS_ENDDOWNLOADDATA) failed: %08x\n", hres);
1266 SET_EXPECT(GetBindResult);
1267 hres = IBindStatusCallback_OnStopBinding(callback, S_OK, NULL);
1268 ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
1269 SET_CALLED(GetBindResult); /* IE7 */
1271 IBindStatusCallback_Release(callback);
1274 static HRESULT WINAPI Moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1275 REFIID riid, void **ppv)
1277 IBindStatusCallback *callback = NULL;
1282 static OLECHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
1284 CHECK_EXPECT(BindToStorage);
1286 load_state = LD_LOADING;
1288 ok(pbc != NULL, "pbc == NULL\n");
1289 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1290 ok(IsEqualGUID(&IID_IStream, riid), "unexpected riid\n");
1291 ok(ppv != NULL, "ppv == NULL\n");
1292 ok(*ppv == NULL, "*ppv=%p\n", *ppv);
1294 hres = IBindCtx_GetObjectParam(pbc, BSCBHolder, (IUnknown**)&callback);
1295 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
1296 ok(callback != NULL, "callback == NULL\n");
1298 memset(&bindinfo, 0xf0, sizeof(bindinfo));
1299 bindinfo.cbSize = sizeof(bindinfo);
1301 hres = IBindStatusCallback_GetBindInfo(callback, &bindf, &bindinfo);
1302 ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
1303 ok(bindf == (BINDF_PULLDATA|BINDF_ASYNCSTORAGE|BINDF_ASYNCHRONOUS), "bindf = %08x\n", bindf);
1304 ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize=%d\n", bindinfo.cbSize);
1305 ok(bindinfo.szExtraInfo == NULL, "bindinfo.szExtraInfo=%p\n", bindinfo.szExtraInfo);
1306 /* TODO: test stgmedData */
1307 ok(bindinfo.grfBindInfoF == 0, "bindinfo.grfBinfInfoF=%08x\n", bindinfo.grfBindInfoF);
1308 ok(bindinfo.dwBindVerb == 0, "bindinfo.dwBindVerb=%d\n", bindinfo.dwBindVerb);
1309 ok(bindinfo.szCustomVerb == 0, "bindinfo.szCustomVerb=%p\n", bindinfo.szCustomVerb);
1310 ok(bindinfo.cbstgmedData == 0, "bindinfo.cbstgmedData=%d\n", bindinfo.cbstgmedData);
1311 ok(bindinfo.dwOptions == 0x80000 || bindinfo.dwOptions == 0x4080000,
1312 "bindinfo.dwOptions=%x\n", bindinfo.dwOptions);
1313 ok(bindinfo.dwOptionsFlags == 0, "bindinfo.dwOptionsFlags=%d\n", bindinfo.dwOptionsFlags);
1314 /* TODO: test dwCodePage */
1315 /* TODO: test securityAttributes */
1316 ok(IsEqualGUID(&IID_NULL, &bindinfo.iid), "unexpected bindinfo.iid\n");
1317 ok(bindinfo.pUnk == NULL, "bindinfo.pUnk=%p\n", bindinfo.pUnk);
1318 ok(bindinfo.dwReserved == 0, "bindinfo.dwReserved=%d\n", bindinfo.dwReserved);
1320 hres = IBindStatusCallback_OnStartBinding(callback, 0, &Binding);
1321 ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
1323 if(asynchronous_binding) {
1324 PostMessageW(container_hwnd, WM_CONTINUE_BINDING, (WPARAM)callback, 0);
1325 return MK_S_ASYNCHRONOUS;
1328 continue_binding(callback);
1332 static HRESULT WINAPI Moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar,
1333 IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
1335 ok(0, "unexpected call\n");
1339 static HRESULT WINAPI Moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight,
1340 BOOL fOnlyIfNotGeneric, IMoniker **ppnkComposite)
1342 ok(0, "unexpected call\n");
1346 static HRESULT WINAPI Moniker_Enum(IMoniker *iface, BOOL fForwrd, IEnumMoniker **ppenumMoniker)
1348 ok(0, "unexpected call\n");
1352 static HRESULT WINAPI Moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker)
1354 ok(0, "unexpected call\n");
1358 static HRESULT WINAPI Moniker_Hash(IMoniker *iface, DWORD *pdwHash)
1360 ok(0, "unexpected call\n");
1364 static HRESULT WINAPI Moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft,
1365 IMoniker *pmkNewlyRunning)
1367 ok(0, "unexpected call\n");
1371 static HRESULT WINAPI Moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
1372 IMoniker *pmkToLeft, FILETIME *pFileTime)
1374 ok(0, "unexpected call\n");
1378 static HRESULT WINAPI Moniker_Inverse(IMoniker *iface, IMoniker **ppmk)
1380 ok(0, "unexpected call\n");
1384 static HRESULT WINAPI Moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther,
1385 IMoniker **ppmkPrefix)
1387 ok(0, "unexpected call\n");
1391 static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther,
1392 IMoniker **pmkRelPath)
1394 ok(0, "unexpected call\n");
1398 static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
1399 IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
1401 CHECK_EXPECT2(GetDisplayName);
1403 /* ok(pbc != NULL, "pbc == NULL\n"); */
1404 ok(pmkToLeft == NULL, "pmkToLeft=%p\n", pmkToLeft);
1405 ok(ppszDisplayName != NULL, "ppszDisplayName == NULL\n");
1407 *ppszDisplayName = CoTaskMemAlloc(sizeof(doc_url));
1408 memcpy(*ppszDisplayName, doc_url, sizeof(doc_url));
1413 static HRESULT WINAPI Moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc,
1414 IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1416 ok(0, "unexpected call\n");
1420 static HRESULT WINAPI Moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys)
1422 CHECK_EXPECT(IsSystemMoniker);
1426 static const IMonikerVtbl MonikerVtbl = {
1427 Moniker_QueryInterface,
1435 Moniker_BindToObject,
1436 Moniker_BindToStorage,
1438 Moniker_ComposeWith,
1443 Moniker_GetTimeOfLastChange,
1445 Moniker_CommonPrefixWith,
1446 Moniker_RelativePathTo,
1447 Moniker_GetDisplayName,
1448 Moniker_ParseDisplayName,
1449 Moniker_IsSystemMoniker
1452 static IMoniker Moniker = { &MonikerVtbl };
1454 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1456 return QueryInterface(riid, ppv);
1459 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1464 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1469 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc,
1470 LPOLESTR pszDiaplayName, ULONG *pchEaten, IMoniker **ppmkOut)
1472 ok(0, "unexpected call\n");
1476 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags,
1477 IEnumUnknown **ppenum)
1479 ok(0, "unexpected call\n");
1483 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1485 CHECK_EXPECT(LockContainer);
1486 ok(expect_LockContainer_fLock == fLock, "fLock=%x, expected %x\n", fLock, expect_LockContainer_fLock);
1490 static const IOleContainerVtbl OleContainerVtbl = {
1491 OleContainer_QueryInterface,
1492 OleContainer_AddRef,
1493 OleContainer_Release,
1494 OleContainer_ParseDisplayName,
1495 OleContainer_EnumObjects,
1496 OleContainer_LockContainer
1499 static IOleContainer OleContainer = { &OleContainerVtbl };
1501 static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
1503 return QueryInterface(riid, ppv);
1506 static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
1511 static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
1516 static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
1518 ok(0, "unexpected call\n");
1522 static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
1525 ok(0, "unexpected call\n");
1529 static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
1531 CHECK_EXPECT(GetContainer);
1532 ok(ppContainer != NULL, "ppContainer = NULL\n");
1533 *ppContainer = &OleContainer;
1537 static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
1539 ok(0, "unexpected call\n");
1543 static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
1545 ok(0, "unexpected call\n");
1549 static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
1551 ok(0, "unexpected call\n");
1555 static const IOleClientSiteVtbl ClientSiteVtbl = {
1556 ClientSite_QueryInterface,
1559 ClientSite_SaveObject,
1560 ClientSite_GetMoniker,
1561 ClientSite_GetContainer,
1562 ClientSite_ShowObject,
1563 ClientSite_OnShowWindow,
1564 ClientSite_RequestNewObjectLayout
1567 static IOleClientSite ClientSite = { &ClientSiteVtbl };
1569 static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
1571 static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
1573 if(!IsEqualGUID(&undocumented_frame_iid, riid))
1574 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
1577 return E_NOINTERFACE;
1580 static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
1585 static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
1590 static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
1592 CHECK_EXPECT(Frame_GetWindow);
1596 static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
1598 ok(0, "unexpected call\n");
1602 static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
1604 ok(0, "unexpected call\n");
1608 static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
1609 LPCBORDERWIDTHS pborderwidths)
1611 ok(0, "unexpected call\n");
1615 static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
1616 LPCBORDERWIDTHS pborderwidths)
1618 CHECK_EXPECT(InPlaceFrame_SetBorderSpace);
1622 static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
1623 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1625 static const WCHAR wszHTML_Document[] =
1626 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1628 CHECK_EXPECT2(InPlaceUIWindow_SetActiveObject);
1630 if(expect_InPlaceUIWindow_SetActiveObject_active) {
1631 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
1632 if(pActiveObject && is_english())
1633 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1636 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1637 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1639 expect_InPlaceUIWindow_SetActiveObject_active = !expect_InPlaceUIWindow_SetActiveObject_active;
1643 static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
1644 IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
1646 static const WCHAR wszHTML_Document[] =
1647 {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0};
1650 CHECK_EXPECT2(SetActiveObject);
1652 if(pActiveObject && is_english())
1653 ok(!lstrcmpW(wszHTML_Document, pszObjName), "%s != \"HTML Document\"\n", wine_dbgstr_w(pszObjName));
1655 CHECK_EXPECT(SetActiveObject_null);
1657 ok(pActiveObject == NULL, "pActiveObject=%p, expected NULL\n", pActiveObject);
1658 ok(pszObjName == NULL, "pszObjName=%p, expected NULL\n", pszObjName);
1664 static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
1665 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1667 ok(0, "unexpected call\n");
1671 static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
1672 HOLEMENU holemenu, HWND hwndActiveObject)
1674 ok(0, "unexpected call\n");
1678 static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
1680 ok(0, "unexpected call\n");
1684 static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
1686 CHECK_EXPECT2(SetStatusText);
1687 if(!expect_status_text)
1688 ok(pszStatusText == NULL, "pszStatusText=%p, expected NULL\n", pszStatusText);
1692 static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
1695 CHECK_EXPECT2(Frame_EnableModeless_TRUE);
1697 CHECK_EXPECT2(Frame_EnableModeless_FALSE);
1701 static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
1703 ok(0, "unexpected call\n");
1707 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
1708 InPlaceFrame_QueryInterface,
1709 InPlaceFrame_AddRef,
1710 InPlaceFrame_Release,
1711 InPlaceFrame_GetWindow,
1712 InPlaceFrame_ContextSensitiveHelp,
1713 InPlaceFrame_GetBorder,
1714 InPlaceFrame_RequestBorderSpace,
1715 InPlaceFrame_SetBorderSpace,
1716 InPlaceFrame_SetActiveObject,
1717 InPlaceFrame_InsertMenus,
1718 InPlaceFrame_SetMenu,
1719 InPlaceFrame_RemoveMenus,
1720 InPlaceFrame_SetStatusText,
1721 InPlaceFrame_EnableModeless,
1722 InPlaceFrame_TranslateAccelerator
1725 static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
1727 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
1728 InPlaceFrame_QueryInterface,
1729 InPlaceFrame_AddRef,
1730 InPlaceFrame_Release,
1731 InPlaceFrame_GetWindow,
1732 InPlaceFrame_ContextSensitiveHelp,
1733 InPlaceFrame_GetBorder,
1734 InPlaceFrame_RequestBorderSpace,
1735 InPlaceFrame_SetBorderSpace,
1736 InPlaceUIWindow_SetActiveObject,
1739 static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
1741 static HRESULT WINAPI InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
1743 return QueryInterface(riid, ppv);
1746 static ULONG WINAPI InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
1751 static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
1756 static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
1757 IOleInPlaceSiteWindowless *iface, HWND *phwnd)
1759 IOleClientSite *client_site;
1760 IOleObject *ole_obj;
1763 CHECK_EXPECT2(GetWindow);
1764 ok(phwnd != NULL, "phwnd = NULL\n");
1765 *phwnd = container_hwnd;
1767 hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
1768 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
1770 hres = IOleObject_GetClientSite(ole_obj, &client_site);
1771 IOleObject_Release(ole_obj);
1772 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
1773 ok(client_site == &ClientSite, "client_site != ClientSite\n");
1774 IOleClientSite_Release(client_site);
1779 static HRESULT WINAPI InPlaceSiteWindowless_ContextSensitiveHelp(
1780 IOleInPlaceSiteWindowless *iface, BOOL fEnterMode)
1782 ok(0, "unexpected call\n");
1786 static HRESULT WINAPI InPlaceSiteWindowless_CanInPlaceActivate(
1787 IOleInPlaceSiteWindowless *iface)
1789 CHECK_EXPECT(CanInPlaceActivate);
1793 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivate(
1794 IOleInPlaceSiteWindowless *iface)
1796 CHECK_EXPECT(OnInPlaceActivate);
1797 inplace_deactivated = FALSE;
1801 static HRESULT WINAPI InPlaceSiteWindowless_OnUIActivate(
1802 IOleInPlaceSiteWindowless *iface)
1804 CHECK_EXPECT(OnUIActivate);
1808 static HRESULT WINAPI InPlaceSiteWindowless_GetWindowContext(
1809 IOleInPlaceSiteWindowless *iface, IOleInPlaceFrame **ppFrame,
1810 IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
1811 LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
1813 static const RECT rect = {0,0,500,500};
1815 CHECK_EXPECT(GetWindowContext);
1817 ok(ppFrame != NULL, "ppFrame = NULL\n");
1819 *ppFrame = &InPlaceFrame;
1820 ok(ppDoc != NULL, "ppDoc = NULL\n");
1822 *ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
1823 ok(lprcPosRect != NULL, "lprcPosRect = NULL\n");
1825 memcpy(lprcPosRect, &rect, sizeof(RECT));
1826 ok(lprcClipRect != NULL, "lprcClipRect = NULL\n");
1828 memcpy(lprcClipRect, &rect, sizeof(RECT));
1829 ok(lpFrameInfo != NULL, "lpFrameInfo = NULL\n");
1831 ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
1832 lpFrameInfo->fMDIApp = FALSE;
1833 lpFrameInfo->hwndFrame = container_hwnd;
1834 lpFrameInfo->haccel = NULL;
1835 lpFrameInfo->cAccelEntries = 0;
1841 static HRESULT WINAPI InPlaceSiteWindowless_Scroll(
1842 IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
1844 ok(0, "unexpected call\n");
1848 static HRESULT WINAPI InPlaceSiteWindowless_OnUIDeactivate(
1849 IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
1851 CHECK_EXPECT(OnUIDeactivate);
1852 ok(!fUndoable, "fUndoable = TRUE\n");
1856 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivate(
1857 IOleInPlaceSiteWindowless *iface)
1859 CHECK_EXPECT(OnInPlaceDeactivate);
1860 inplace_deactivated = TRUE;
1864 static HRESULT WINAPI InPlaceSiteWindowless_DiscardUndoState(
1865 IOleInPlaceSiteWindowless *iface)
1867 ok(0, "unexpected call\n");
1871 static HRESULT WINAPI InPlaceSiteWindowless_DeactivateAndUndo(
1872 IOleInPlaceSiteWindowless *iface)
1874 ok(0, "unexpected call\n");
1878 static HRESULT WINAPI InPlaceSiteWindowless_OnPosRectChange(
1879 IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
1881 ok(0, "unexpected call\n");
1885 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceActivateEx(
1886 IOleInPlaceSiteWindowless *iface, BOOL *pfNoRedraw, DWORD dwFlags)
1888 CHECK_EXPECT(OnInPlaceActivateEx);
1890 ok(pfNoRedraw != NULL, "pfNoRedraw == NULL\n");
1891 ok(!*pfNoRedraw, "*pfNoRedraw == TRUE\n");
1892 ok(dwFlags == 0, "dwFlags = %08x\n", dwFlags);
1897 static HRESULT WINAPI InPlaceSiteWindowless_OnInPlaceDeactivateEx(
1898 IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
1900 CHECK_EXPECT(OnInPlaceDeactivateEx);
1902 ok(fNoRedraw, "fNoRedraw == FALSE\n");
1907 static HRESULT WINAPI InPlaceSiteWindowless_RequestUIActivate(
1908 IOleInPlaceSiteWindowless *iface)
1910 CHECK_EXPECT2(RequestUIActivate);
1914 static HRESULT WINAPI InPlaceSiteWindowless_CanWindowlessActivate(
1915 IOleInPlaceSiteWindowless *iface)
1917 ok(0, "unexpected call\n");
1921 static HRESULT WINAPI InPlaceSiteWindowless_GetCapture(
1922 IOleInPlaceSiteWindowless *iface)
1924 ok(0, "unexpected call\n");
1928 static HRESULT WINAPI InPlaceSiteWindowless_SetCapture(
1929 IOleInPlaceSiteWindowless *iface, BOOL fCapture)
1931 ok(0, "unexpected call\n");
1935 static HRESULT WINAPI InPlaceSiteWindowless_GetFocus(
1936 IOleInPlaceSiteWindowless *iface)
1938 ok(0, "unexpected call\n");
1942 static HRESULT WINAPI InPlaceSiteWindowless_SetFocus(
1943 IOleInPlaceSiteWindowless *iface, BOOL fFocus)
1945 ok(0, "unexpected call\n");
1949 static HRESULT WINAPI InPlaceSiteWindowless_GetDC(
1950 IOleInPlaceSiteWindowless *iface, LPCRECT pRect,
1951 DWORD grfFlags, HDC *phDC)
1953 ok(0, "unexpected call\n");
1957 static HRESULT WINAPI InPlaceSiteWindowless_ReleaseDC(
1958 IOleInPlaceSiteWindowless *iface, HDC hDC)
1960 ok(0, "unexpected call\n");
1964 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRect(
1965 IOleInPlaceSiteWindowless *iface, LPCRECT pRect, BOOL fErase)
1967 ok(0, "unexpected call\n");
1971 static HRESULT WINAPI InPlaceSiteWindowless_InvalidateRgn(
1972 IOleInPlaceSiteWindowless *iface, HRGN hRGN, BOOL fErase)
1974 ok(0, "unexpected call\n");
1978 static HRESULT WINAPI InPlaceSiteWindowless_ScrollRect(
1979 IOleInPlaceSiteWindowless *iface, INT dx, INT dy,
1980 LPCRECT pRectScroll, LPCRECT pRectClip)
1982 ok(0, "unexpected call\n");
1986 static HRESULT WINAPI InPlaceSiteWindowless_AdjustRect(
1987 IOleInPlaceSiteWindowless *iface, LPRECT prc)
1989 ok(0, "unexpected call\n");
1993 static HRESULT WINAPI InPlaceSiteWindowless_OnDefWindowMessage(
1994 IOleInPlaceSiteWindowless *iface, UINT msg,
1995 WPARAM wParam, LPARAM lParam, LRESULT *plResult)
1997 ok(0, "unexpected call\n");
2001 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
2002 InPlaceSiteWindowless_QueryInterface,
2003 InPlaceSiteWindowless_AddRef,
2004 InPlaceSiteWindowless_Release,
2005 InPlaceSiteWindowless_GetWindow,
2006 InPlaceSiteWindowless_ContextSensitiveHelp,
2007 InPlaceSiteWindowless_CanInPlaceActivate,
2008 InPlaceSiteWindowless_OnInPlaceActivate,
2009 InPlaceSiteWindowless_OnUIActivate,
2010 InPlaceSiteWindowless_GetWindowContext,
2011 InPlaceSiteWindowless_Scroll,
2012 InPlaceSiteWindowless_OnUIDeactivate,
2013 InPlaceSiteWindowless_OnInPlaceDeactivate,
2014 InPlaceSiteWindowless_DiscardUndoState,
2015 InPlaceSiteWindowless_DeactivateAndUndo,
2016 InPlaceSiteWindowless_OnPosRectChange,
2017 InPlaceSiteWindowless_OnInPlaceActivateEx,
2018 InPlaceSiteWindowless_OnInPlaceDeactivateEx,
2019 InPlaceSiteWindowless_RequestUIActivate,
2020 InPlaceSiteWindowless_CanWindowlessActivate,
2021 InPlaceSiteWindowless_GetCapture,
2022 InPlaceSiteWindowless_SetCapture,
2023 InPlaceSiteWindowless_GetFocus,
2024 InPlaceSiteWindowless_SetFocus,
2025 InPlaceSiteWindowless_GetDC,
2026 InPlaceSiteWindowless_ReleaseDC,
2027 InPlaceSiteWindowless_InvalidateRect,
2028 InPlaceSiteWindowless_InvalidateRgn,
2029 InPlaceSiteWindowless_ScrollRect,
2030 InPlaceSiteWindowless_AdjustRect,
2031 InPlaceSiteWindowless_OnDefWindowMessage
2034 static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
2036 static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
2038 return QueryInterface(riid, ppv);
2041 static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
2046 static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
2053 CallUIActivate_None,
2054 CallUIActivate_ActivateMe,
2055 CallUIActivate_AfterShow,
2058 static BOOL call_UIActivate = CallUIActivate_ActivateMe;
2059 static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
2061 IOleDocument *document;
2064 CHECK_EXPECT(ActivateMe);
2065 ok(pViewToActivate != NULL, "pViewToActivate = NULL\n");
2067 hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
2068 ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
2070 if(SUCCEEDED(hres)) {
2071 hres = IOleDocument_CreateView(document, (IOleInPlaceSite*)&InPlaceSiteWindowless, NULL, 0, &view);
2072 ok(hres == S_OK, "CreateView failed: %08x\n", hres);
2074 if(SUCCEEDED(hres)) {
2075 IOleInPlaceActiveObject *activeobj = NULL;
2076 IOleInPlaceSite *inplacesite = NULL;
2077 HWND tmp_hwnd = NULL;
2078 static RECT rect = {0,0,400,500};
2080 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2081 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2082 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2083 inplacesite, &InPlaceSiteWindowless);
2085 hres = IOleDocumentView_SetInPlaceSite(view, (IOleInPlaceSite*)&InPlaceSiteWindowless);
2086 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
2088 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
2089 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
2090 ok(inplacesite == (IOleInPlaceSite*)&InPlaceSiteWindowless, "inplacesite=%p, expected %p\n",
2091 inplacesite, &InPlaceSiteWindowless);
2093 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobj);
2094 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
2097 IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2098 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2099 ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
2102 if(call_UIActivate == CallUIActivate_ActivateMe) {
2103 SET_EXPECT(CanInPlaceActivate);
2104 SET_EXPECT(GetWindowContext);
2105 SET_EXPECT(GetWindow);
2107 SET_EXPECT(OnInPlaceActivateEx);
2109 SET_EXPECT(OnInPlaceActivate);
2110 SET_EXPECT(SetStatusText);
2111 SET_EXPECT(Exec_SETPROGRESSMAX);
2112 SET_EXPECT(Exec_SETPROGRESSPOS);
2113 SET_EXPECT(OnUIActivate);
2114 SET_EXPECT(SetActiveObject);
2116 expect_status_text = NULL;
2118 hres = IOleDocumentView_UIActivate(view, TRUE);
2119 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2121 CHECK_CALLED(CanInPlaceActivate);
2122 CHECK_CALLED(GetWindowContext);
2123 CHECK_CALLED(GetWindow);
2125 CHECK_CALLED(OnInPlaceActivateEx);
2127 CHECK_CALLED(OnInPlaceActivate);
2128 CHECK_CALLED(SetStatusText);
2129 CHECK_CALLED(Exec_SETPROGRESSMAX);
2130 CHECK_CALLED(Exec_SETPROGRESSPOS);
2131 CHECK_CALLED(OnUIActivate);
2132 CHECK_CALLED(SetActiveObject);
2133 CHECK_CALLED(ShowUI);
2136 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2137 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2138 ok(hwnd != NULL, "hwnd == NULL\n");
2140 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2143 hres = IOleDocumentView_UIActivate(view, TRUE);
2144 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
2147 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
2148 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2149 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
2153 hres = IOleDocumentView_SetRect(view, &rect);
2154 ok(hres == S_OK, "SetRect failed: %08x\n", hres);
2156 if(call_UIActivate == CallUIActivate_ActivateMe) {
2157 hres = IOleDocumentView_Show(view, TRUE);
2158 ok(hres == S_OK, "Show failed: %08x\n", hres);
2160 SET_EXPECT(CanInPlaceActivate);
2161 SET_EXPECT(GetWindowContext);
2162 SET_EXPECT(GetWindow);
2164 SET_EXPECT(OnInPlaceActivateEx);
2166 SET_EXPECT(OnInPlaceActivate);
2167 SET_EXPECT(SetStatusText);
2168 SET_EXPECT(Exec_SETPROGRESSMAX);
2169 SET_EXPECT(Exec_SETPROGRESSPOS);
2170 SET_EXPECT(OnUIActivate);
2171 expect_status_text = (load_state == LD_COMPLETE ? (LPCOLESTR)0xdeadbeef : NULL);
2173 hres = IOleDocumentView_Show(view, TRUE);
2174 ok(hres == S_OK, "Show failed: %08x\n", hres);
2176 CHECK_CALLED(CanInPlaceActivate);
2177 CHECK_CALLED(GetWindowContext);
2178 CHECK_CALLED(GetWindow);
2180 CHECK_CALLED(OnInPlaceActivateEx);
2182 CHECK_CALLED(OnInPlaceActivate);
2183 CHECK_CALLED(SetStatusText);
2184 CHECK_CALLED(Exec_SETPROGRESSMAX);
2185 CHECK_CALLED(Exec_SETPROGRESSPOS);
2188 hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
2189 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
2190 ok(hwnd != NULL, "hwnd == NULL\n");
2192 ok(hwnd == last_hwnd, "hwnd != last_hwnd\n");
2196 test_timer(EXPECT_UPDATEUI | ((load_state == LD_LOADING) ? EXPECT_SETTITLE : 0));
2199 IOleInPlaceActiveObject_Release(activeobj);
2202 IOleDocument_Release(document);
2208 static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
2209 DocumentSite_QueryInterface,
2210 DocumentSite_AddRef,
2211 DocumentSite_Release,
2212 DocumentSite_ActivateMe
2215 static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
2217 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
2219 return QueryInterface(riid, ppv);
2222 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
2227 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
2232 static HRESULT WINAPI OleControlSite_OnControlInfoChanged(IOleControlSite *iface)
2234 ok(0, "unexpected call\n");
2238 static HRESULT WINAPI OleControlSite_LockInPlaceActive(IOleControlSite *iface, BOOL fLock)
2240 ok(0, "unexpected call\n");
2244 static HRESULT WINAPI OleControlSite_GetExtendedControl(IOleControlSite *iface, IDispatch **ppDisp)
2246 ok(0, "unexpected call\n");
2250 static HRESULT WINAPI OleControlSite_TransformCoords(IOleControlSite *iface, POINTL *pPtHimetric,
2251 POINTF *pPtfContainer, DWORD dwFlags)
2253 ok(0, "unexpected call\n");
2257 static HRESULT WINAPI OleControlSite_TranslateAccelerator(IOleControlSite *iface,
2258 MSG *pMsg, DWORD grfModifiers)
2260 ok(0, "unexpected call\n");
2264 static HRESULT WINAPI OleControlSite_OnFocus(IOleControlSite *iface, BOOL fGotFocus)
2267 CHECK_EXPECT(OnFocus_TRUE);
2269 CHECK_EXPECT2(OnFocus_FALSE);
2273 static HRESULT WINAPI OleControlSite_ShowPropertyFrame(IOleControlSite *iface)
2275 ok(0, "unexpected call\n");
2279 static const IOleControlSiteVtbl OleControlSiteVtbl = {
2280 OleControlSite_QueryInterface,
2281 OleControlSite_AddRef,
2282 OleControlSite_Release,
2283 OleControlSite_OnControlInfoChanged,
2284 OleControlSite_LockInPlaceActive,
2285 OleControlSite_GetExtendedControl,
2286 OleControlSite_TransformCoords,
2287 OleControlSite_TranslateAccelerator,
2288 OleControlSite_OnFocus,
2289 OleControlSite_ShowPropertyFrame
2292 static IOleControlSite OleControlSite = { &OleControlSiteVtbl };
2294 static IDocHostUIHandler2 *expect_uihandler_iface;
2296 static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2298 return QueryInterface(riid, ppv);
2301 static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
2306 static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
2311 static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
2312 IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
2314 ok(0, "unexpected call\n");
2315 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2319 static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
2321 CHECK_EXPECT(GetHostInfo);
2322 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2323 ok(pInfo != NULL, "pInfo=NULL\n");
2325 ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%u\n", pInfo->cbSize);
2326 ok(!pInfo->dwFlags, "pInfo->dwFlags=%08x, expected 0\n", pInfo->dwFlags);
2327 pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
2328 | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
2329 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
2330 ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08x, expected 0\n", pInfo->dwDoubleClick);
2331 ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
2332 ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
2337 static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
2338 IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
2339 IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
2341 CHECK_EXPECT(ShowUI);
2342 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2345 ok(dwID == DOCHOSTUITYPE_AUTHOR, "dwID=%d, expected DOCHOSTUITYPE_AUTHOR\n", dwID);
2347 ok(dwID == DOCHOSTUITYPE_BROWSE, "dwID=%d, expected DOCHOSTUITYPE_BROWSE\n", dwID);
2348 ok(pActiveObject != NULL, "pActiveObject = NULL\n");
2349 ok(pCommandTarget != NULL, "pCommandTarget = NULL\n");
2350 ok(pFrame == &InPlaceFrame, "pFrame=%p, expected %p\n", pFrame, &InPlaceFrame);
2351 if (expect_InPlaceUIWindow_SetActiveObject_active)
2352 ok(pDoc == (IOleInPlaceUIWindow *)&InPlaceUIWindow, "pDoc=%p, expected %p\n", pDoc, &InPlaceUIWindow);
2354 ok(pDoc == NULL, "pDoc=%p, expected NULL\n", pDoc);
2359 static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
2361 CHECK_EXPECT(HideUI);
2362 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2366 static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
2368 CHECK_EXPECT(UpdateUI);
2369 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2373 static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
2375 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2377 CHECK_EXPECT2(EnableModeless_TRUE);
2379 CHECK_EXPECT2(EnableModeless_FALSE);
2383 static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2385 ok(0, "unexpected call\n");
2386 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2390 static BOOL expect_OnFrameWindowActivate_fActivate;
2391 static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
2393 CHECK_EXPECT2(OnFrameWindowActivate);
2394 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2395 ok(fActivate == expect_OnFrameWindowActivate_fActivate, "fActivate=%x\n", fActivate);
2399 static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
2400 IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
2402 ok(0, "unexpected call\n");
2406 static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
2407 const GUID *pguidCmdGroup, DWORD nCmdID)
2409 ok(0, "unexpected call\n");
2410 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2414 static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
2415 LPOLESTR *pchKey, DWORD dw)
2417 CHECK_EXPECT(GetOptionKeyPath);
2418 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2419 ok(pchKey != NULL, "pchKey = NULL\n");
2420 ok(!dw, "dw=%d, expected 0\n", dw);
2422 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2426 static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
2427 IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
2429 CHECK_EXPECT(GetDropTarget);
2430 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2435 static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
2437 CHECK_EXPECT(GetExternal);
2438 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2439 *ppDispatch = &External;
2443 static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
2444 OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
2446 CHECK_EXPECT(TranslateUrl);
2447 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2448 ok(!dwTranslate, "dwTranslate = %x\n", dwTranslate);
2449 ok(!strcmp_wa(pchURLIn, nav_url), "pchURLIn = %s, expected %s\n", wine_dbgstr_w(pchURLIn), nav_url);
2450 ok(ppchURLOut != NULL, "ppchURLOut == NULL\n");
2451 ok(!*ppchURLOut, "*ppchURLOut = %p\n", *ppchURLOut);
2456 static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
2457 IDataObject **ppPORet)
2459 ok(0, "unexpected call\n");
2460 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2464 static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
2465 LPOLESTR *pchKey, DWORD dw)
2467 CHECK_EXPECT(GetOverrideKeyPath);
2468 ok(iface == expect_uihandler_iface, "called on unexpected iface\n");
2469 ok(pchKey != NULL, "pchKey = NULL\n");
2471 ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
2472 ok(!dw, "dw=%d, xepected 0\n", dw);
2476 static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
2477 DocHostUIHandler_QueryInterface,
2478 DocHostUIHandler_AddRef,
2479 DocHostUIHandler_Release,
2480 DocHostUIHandler_ShowContextMenu,
2481 DocHostUIHandler_GetHostInfo,
2482 DocHostUIHandler_ShowUI,
2483 DocHostUIHandler_HideUI,
2484 DocHostUIHandler_UpdateUI,
2485 DocHostUIHandler_EnableModeless,
2486 DocHostUIHandler_OnDocWindowActivate,
2487 DocHostUIHandler_OnFrameWindowActivate,
2488 DocHostUIHandler_ResizeBorder,
2489 DocHostUIHandler_TranslateAccelerator,
2490 DocHostUIHandler_GetOptionKeyPath,
2491 DocHostUIHandler_GetDropTarget,
2492 DocHostUIHandler_GetExternal,
2493 DocHostUIHandler_TranslateUrl,
2494 DocHostUIHandler_FilterDataObject,
2495 DocHostUIHandler_GetOverrideKeyPath
2498 static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
2500 static HRESULT WINAPI CustomDocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
2502 if(IsEqualGUID(&IID_IDocHostUIHandler2, riid)) {
2507 if(IsEqualGUID(&IID_IOleCommandTarget, riid))
2508 return E_NOINTERFACE;
2510 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
2511 return E_NOINTERFACE; /* TODO */
2513 ok(0, "unexpected call %s\n", debugstr_guid(riid));
2514 return E_NOINTERFACE;
2517 static const IDocHostUIHandler2Vtbl CustomDocHostUIHandlerVtbl = {
2518 CustomDocHostUIHandler_QueryInterface,
2519 DocHostUIHandler_AddRef,
2520 DocHostUIHandler_Release,
2521 DocHostUIHandler_ShowContextMenu,
2522 DocHostUIHandler_GetHostInfo,
2523 DocHostUIHandler_ShowUI,
2524 DocHostUIHandler_HideUI,
2525 DocHostUIHandler_UpdateUI,
2526 DocHostUIHandler_EnableModeless,
2527 DocHostUIHandler_OnDocWindowActivate,
2528 DocHostUIHandler_OnFrameWindowActivate,
2529 DocHostUIHandler_ResizeBorder,
2530 DocHostUIHandler_TranslateAccelerator,
2531 DocHostUIHandler_GetOptionKeyPath,
2532 DocHostUIHandler_GetDropTarget,
2533 DocHostUIHandler_GetExternal,
2534 DocHostUIHandler_TranslateUrl,
2535 DocHostUIHandler_FilterDataObject,
2536 DocHostUIHandler_GetOverrideKeyPath
2539 static IDocHostUIHandler2 CustomDocHostUIHandler = { &CustomDocHostUIHandlerVtbl };
2541 static HRESULT WINAPI OleCommandTarget_QueryInterface(IOleCommandTarget *iface,
2542 REFIID riid, void **ppv)
2544 return QueryInterface(riid, ppv);
2547 static ULONG WINAPI OleCommandTarget_AddRef(IOleCommandTarget *iface)
2552 static ULONG WINAPI OleCommandTarget_Release(IOleCommandTarget *iface)
2557 static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2558 ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
2560 ok(!pguidCmdGroup, "pguidCmdGroup != MULL\n");
2561 ok(cCmds == 1, "cCmds=%d, expected 1\n", cCmds);
2562 ok(!pCmdText, "pCmdText != NULL\n");
2564 switch(prgCmds[0].cmdID) {
2565 case OLECMDID_SETPROGRESSTEXT:
2566 CHECK_EXPECT(QueryStatus_SETPROGRESSTEXT);
2567 prgCmds[0].cmdf = OLECMDF_ENABLED;
2570 CHECK_EXPECT(QueryStatus_OPEN);
2571 prgCmds[0].cmdf = 0;
2574 CHECK_EXPECT(QueryStatus_NEW);
2575 prgCmds[0].cmdf = 0;
2578 ok(0, "unexpected command %d\n", prgCmds[0].cmdID);
2584 static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup,
2585 DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
2587 if((!pguidCmdGroup || !IsEqualGUID(pguidCmdGroup, &CGID_Explorer))
2588 && (!pguidCmdGroup || !IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup) || nCmdID != 63))
2589 test_readyState(NULL);
2591 if(!pguidCmdGroup) {
2593 case OLECMDID_SETPROGRESSMAX:
2594 CHECK_EXPECT2(Exec_SETPROGRESSMAX);
2595 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2596 ok(pvaIn != NULL, "pvaIn == NULL\n");
2598 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2599 if(load_state == LD_NO)
2600 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2602 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2604 case OLECMDID_SETPROGRESSPOS:
2605 CHECK_EXPECT2(Exec_SETPROGRESSPOS);
2606 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2607 ok(pvaIn != NULL, "pvaIn == NULL\n");
2609 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2610 if(load_state == LD_NO)
2611 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2613 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2615 case OLECMDID_HTTPEQUIV_DONE:
2616 CHECK_EXPECT(Exec_HTTPEQUIV_DONE);
2617 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2618 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2619 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2620 readystate_set_loading = FALSE;
2621 readystate_set_interactive = FALSE;
2622 load_state = LD_COMPLETE;
2624 case OLECMDID_SETDOWNLOADSTATE:
2625 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2626 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2627 ok(pvaIn != NULL, "pvaIn == NULL\n");
2628 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2630 switch(V_I4(pvaIn)) {
2632 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_0);
2634 load_state = LD_INTERACTIVE;
2637 CHECK_EXPECT(Exec_SETDOWNLOADSTATE_1);
2638 readystate_set_interactive = (load_state != LD_INTERACTIVE);
2641 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
2645 case OLECMDID_UPDATECOMMANDS:
2646 CHECK_EXPECT(Exec_UPDATECOMMANDS);
2647 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2648 ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
2649 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2651 case OLECMDID_SETTITLE:
2652 CHECK_EXPECT2(Exec_SETTITLE);
2653 ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
2654 ok(pvaIn != NULL, "pvaIn == NULL\n");
2655 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2656 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2657 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) == NULL\n"); /* TODO */
2659 case OLECMDID_HTTPEQUIV:
2660 CHECK_EXPECT2(Exec_HTTPEQUIV);
2661 ok(!nCmdexecopt, "nCmdexecopts=%08x\n", nCmdexecopt);
2662 ok(pvaIn != NULL, "pvaIn == NULL\n");
2663 ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
2664 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn)=%d\n", V_VT(pvaIn));
2665 ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
2666 test_readyState(NULL);
2668 case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
2669 return E_FAIL; /* FIXME */
2671 ok(0, "unexpected command %d\n", nCmdID);
2676 if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) {
2677 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2681 CHECK_EXPECT2(Exec_ShellDocView_37);
2684 test_GetCurMoniker(doc_unk, NULL, nav_url);
2685 else if(load_from_stream)
2686 test_GetCurMoniker(doc_unk, NULL, "about:blank");
2688 test_GetCurMoniker(doc_unk, doc_mon, NULL);
2690 ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut);
2691 ok(pvaIn != NULL, "pvaIn == NULL\n");
2693 ok(V_VT(pvaIn) == VT_I4, "V_VT(pvaIn)=%d, expected VT_I4\n", V_VT(pvaIn));
2694 ok(V_I4(pvaIn) == 0, "V_I4(pvaIn)=%d, expected 0\n", V_I4(pvaIn));
2699 IHTMLPrivateWindow *priv_window;
2702 CHECK_EXPECT(Exec_ShellDocView_63);
2703 ok(pvaIn != NULL, "pvaIn == NULL\n");
2704 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2705 ok(V_UNKNOWN(pvaIn) != NULL, "VPUNKNOWN(pvaIn) = NULL\n");
2706 ok(pvaOut != NULL, "pvaOut == NULL\n");
2707 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2709 hres = IUnknown_QueryInterface(V_UNKNOWN(pvaIn), &IID_IHTMLPrivateWindow, (void**)&priv_window);
2710 ok(hres == S_OK, "Could not get IHTMLPrivateWindow: %08x\n", hres);
2712 IHTMLPrivateWindow_Release(priv_window);
2714 load_state = loading_js ? LD_COMPLETE : LD_LOADING;
2715 return S_OK; /* TODO */
2719 CHECK_EXPECT(Exec_ShellDocView_67);
2720 ok(pvaIn != NULL, "pvaIn == NULL\n");
2721 ok(V_VT(pvaIn) == VT_BSTR, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2722 ok(!strcmp_wa(V_BSTR(pvaIn), nav_url), "V_BSTR(pvaIn) = %s, expected %s\n", wine_dbgstr_w(V_BSTR(pvaIn)), nav_url);
2723 ok(pvaOut != NULL, "pvaOut == NULL\n");
2724 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2725 ok(V_BOOL(pvaOut) == VARIANT_TRUE, "V_BOOL(pvaOut) = %x\n", V_BOOL(pvaOut));
2726 load_state = LD_DOLOAD;
2730 CHECK_EXPECT2(Exec_ShellDocView_84);
2732 ok(pvaIn == NULL, "pvaIn != NULL\n");
2733 ok(pvaOut != NULL, "pvaOut == NULL\n");
2735 ok(V_VT(pvaOut) == VT_EMPTY, "V_VT(pvaOut)=%d\n", V_VT(pvaOut));
2740 CHECK_EXPECT2(Exec_ShellDocView_103);
2742 ok(pvaIn == NULL, "pvaIn != NULL\n");
2743 ok(pvaOut == NULL, "pvaOut != NULL\n");
2748 CHECK_EXPECT2(Exec_ShellDocView_105);
2750 ok(pvaIn != NULL, "pvaIn == NULL\n");
2751 ok(pvaOut == NULL, "pvaOut != NULL\n");
2756 CHECK_EXPECT2(Exec_ShellDocView_140);
2758 ok(pvaIn == NULL, "pvaIn != NULL\n");
2759 ok(pvaOut == NULL, "pvaOut != NULL\n");
2764 ok(0, "unexpected command %d\n", nCmdID);
2769 if(IsEqualGUID(&CGID_MSHTML, pguidCmdGroup)) {
2770 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2773 case IDM_PARSECOMPLETE:
2774 CHECK_EXPECT(Exec_MSHTML_PARSECOMPLETE);
2775 ok(pvaIn == NULL, "pvaIn != NULL\n");
2776 ok(pvaOut == NULL, "pvaOut != NULL\n");
2779 ok(0, "unexpected command %d\n", nCmdID);
2783 if(IsEqualGUID(&CGID_DocHostCmdPriv, pguidCmdGroup)) {
2785 case DOCHOST_DOCCANNAVIGATE:
2786 CHECK_EXPECT(Exec_DOCCANNAVIGATE);
2787 ok(pvaIn != NULL, "pvaIn == NULL\n");
2788 ok(pvaOut == NULL, "pvaOut != NULL\n");
2789 ok(V_VT(pvaIn) == VT_UNKNOWN, "V_VT(pvaIn) != VT_UNKNOWN\n");
2790 /* FIXME: test V_UNKNOWN(pvaIn) == window */
2799 ok(pvaIn != NULL, "pvaIn == NULL\n");
2800 ok(pvaOut != NULL, "pvaOut != NULL\n");
2801 ok(V_VT(pvaIn) == VT_ARRAY, "V_VT(pvaIn) = %d\n", V_VT(pvaIn));
2802 ok(V_VT(pvaOut) == VT_BOOL, "V_VT(pvaOut) = %d\n", V_VT(pvaOut));
2803 sa = V_ARRAY(pvaIn);
2805 dim = SafeArrayGetDim(sa);
2806 ok(dim == 1, "dim = %d\n", dim);
2807 hres = SafeArrayGetLBound(sa, 1, &ind);
2808 ok(hres == S_OK, "SafeArrayGetLBound failed: %x\n", hres);
2809 ok(ind == 0, "Lower bound = %d\n", ind);
2810 hres = SafeArrayGetUBound(sa, 1, &ind);
2811 ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres);
2812 ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind);
2815 SafeArrayGetElement(sa, &ind, &var);
2816 ok(V_VT(&var) == VT_I4, "Incorrect data type: %d\n", V_VT(&var));
2817 ok(V_I4(&var) == status_code, "Incorrect error code: %d\n", V_I4(&var));
2820 SafeArrayGetElement(sa, &ind, &var);
2821 ok(V_VT(&var) == VT_BSTR, "Incorrect data type: %d\n", V_VT(&var));
2822 ok(!strcmp_wa(V_BSTR(&var), "winetest:doc"), "Page address: %s\n", wine_dbgstr_w(V_BSTR(&var)));
2825 SafeArrayGetElement(sa, &ind, &var);
2826 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2829 SafeArrayGetElement(sa, &ind, &var);
2830 ok(V_VT(&var) == VT_UNKNOWN, "Incorrect data type: %d\n", V_VT(&var));
2833 SafeArrayGetElement(sa, &ind, &var);
2834 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2835 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2838 SafeArrayGetElement(sa, &ind, &var);
2839 ok(V_VT(&var) == VT_BOOL, "Incorrect data type: %d\n", V_VT(&var));
2840 ok(!V_BOOL(&var), "Unknown value is incorrect\n");
2844 return E_FAIL; /* TODO */
2848 if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) {
2849 ok(nCmdexecopt == 0, "nCmdexecopts=%08x\n", nCmdexecopt);
2853 CHECK_EXPECT2(Exec_Explorer_69);
2854 ok(pvaIn == NULL, "pvaIn != NULL\n");
2855 ok(pvaOut != NULL, "pvaOut == NULL\n");
2858 ok(0, "unexpected cmd %d of CGID_Explorer\n", nCmdID);
2863 if(IsEqualGUID(&CGID_DocHostCommandHandler, pguidCmdGroup)) {
2865 case OLECMDID_PAGEACTIONBLOCKED: /* win2k3 */
2866 SET_EXPECT(SetStatusText);
2867 ok(pvaIn == NULL, "pvaIn != NULL\n");
2868 ok(pvaOut == NULL, "pvaOut != NULL\n");
2870 case OLECMDID_SHOWSCRIPTERROR:
2874 ok(0, "unexpected command %d\n", nCmdID);
2879 ok(0, "unexpected pguidCmdGroup: %s\n", debugstr_guid(pguidCmdGroup));
2883 static IOleCommandTargetVtbl OleCommandTargetVtbl = {
2884 OleCommandTarget_QueryInterface,
2885 OleCommandTarget_AddRef,
2886 OleCommandTarget_Release,
2887 OleCommandTarget_QueryStatus,
2888 OleCommandTarget_Exec
2891 static IOleCommandTarget OleCommandTarget = { &OleCommandTargetVtbl };
2893 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2895 return QueryInterface(riid, ppv);
2898 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2899 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2900 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2902 ok(IsEqualGUID(&IID_NULL, riid), "riid != IID_NULL\n");
2903 ok(pDispParams != NULL, "pDispParams == NULL\n");
2904 ok(pExcepInfo == NULL, "pExcepInfo=%p, expected NULL\n", pExcepInfo);
2905 ok(puArgErr != NULL, "puArgErr == NULL\n");
2906 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult)=%d, expected 0\n", V_VT(pVarResult));
2907 ok(wFlags == DISPATCH_PROPERTYGET, "wFlags=%08x, expected DISPATCH_PROPERTYGET\n", wFlags);
2908 test_readyState(NULL);
2910 switch(dispIdMember) {
2911 case DISPID_AMBIENT_USERMODE:
2912 CHECK_EXPECT2(Invoke_AMBIENT_USERMODE);
2913 V_VT(pVarResult) = VT_BOOL;
2914 V_BOOL(pVarResult) = VARIANT_TRUE;
2916 case DISPID_AMBIENT_DLCONTROL:
2917 CHECK_EXPECT2(Invoke_AMBIENT_DLCONTROL);
2919 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
2920 CHECK_EXPECT2(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
2922 case DISPID_AMBIENT_SILENT:
2923 CHECK_EXPECT2(Invoke_AMBIENT_SILENT);
2924 V_VT(pVarResult) = VT_BOOL;
2925 V_BOOL(pVarResult) = VARIANT_FALSE;
2927 case DISPID_AMBIENT_USERAGENT:
2928 CHECK_EXPECT(Invoke_AMBIENT_USERAGENT);
2930 case DISPID_AMBIENT_PALETTE:
2931 CHECK_EXPECT(Invoke_AMBIENT_PALETTE);
2935 ok(0, "unexpected dispid %d\n", dispIdMember);
2939 static const IDispatchVtbl DispatchVtbl = {
2940 Dispatch_QueryInterface,
2943 Dispatch_GetTypeInfoCount,
2944 Dispatch_GetTypeInfo,
2945 Dispatch_GetIDsOfNames,
2949 static IDispatch Dispatch = { &DispatchVtbl };
2951 static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
2953 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
2958 ok(0, "Unexpected call\n");
2959 return E_NOINTERFACE;
2962 static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
2963 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
2964 EXCEPINFO *pExcepInfo, UINT *puArgErr)
2967 IHTMLDocument2 *doc;
2970 ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", debugstr_guid(riid));
2971 ok(pDispParams != NULL, "pDispParams == NULL\n");
2972 ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
2973 ok(puArgErr != NULL, "puArgErr == NULL\n");
2974 ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
2975 ok(wFlags == DISPATCH_METHOD, "wFlags = %d, expected DISPATCH_METHOD\n", wFlags);
2977 hres = IUnknown_QueryInterface(doc_unk, &IID_IHTMLDocument2, (void**)&doc);
2978 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
2980 switch(dispIdMember) {
2981 case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
2982 hres = IHTMLDocument2_get_readyState(doc, &state);
2983 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
2985 if(!strcmp_wa(state, "interactive"))
2986 CHECK_EXPECT(Invoke_OnReadyStateChange_Interactive);
2987 else if(!strcmp_wa(state, "loading"))
2988 CHECK_EXPECT(Invoke_OnReadyStateChange_Loading);
2989 else if(!strcmp_wa(state, "complete")) {
2990 CHECK_EXPECT(Invoke_OnReadyStateChange_Complete);
2993 ok(0, "Unexpected readyState: %s\n", wine_dbgstr_w(state));
2995 SysFreeString(state);
2997 case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
3008 break; /* FIXME: Handle these events. */
3010 ok(0, "Unexpected DISPID: %d\n", dispIdMember);
3013 IHTMLDocument2_Release(doc);
3017 static const IDispatchVtbl EventDispatchVtbl = {
3018 EventDispatch_QueryInterface,
3021 Dispatch_GetTypeInfoCount,
3022 Dispatch_GetTypeInfo,
3023 Dispatch_GetIDsOfNames,
3024 EventDispatch_Invoke
3027 static IDispatch EventDispatch = { &EventDispatchVtbl };
3029 static HRESULT WINAPI DocObjectService_QueryInterface(
3030 IDocObjectService* This,
3034 /* F62D9369-75EF-4578-8856-232802C76468 (ITridentService2) */
3038 static ULONG WINAPI DocObjectService_AddRef(
3039 IDocObjectService* This)
3044 static ULONG WINAPI DocObjectService_Release(
3045 IDocObjectService* This)
3050 static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
3051 IDocObjectService* This,
3052 IDispatch *pDispatch,
3055 LPCWSTR lpszFrameName,
3058 LPCWSTR lpszHeaders,
3062 ok(0, "unexpected call\n");
3066 static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
3067 IDocObjectService* This,
3068 IHTMLWindow2 *pHTMLWindow2,
3071 CHECK_EXPECT(FireNavigateComplete2);
3075 static HRESULT WINAPI DocObjectService_FireDownloadBegin(
3076 IDocObjectService* This)
3078 ok(0, "unexpected call\n");
3082 static HRESULT WINAPI DocObjectService_FireDownloadComplete(
3083 IDocObjectService* This)
3085 ok(0, "unexpected call\n");
3089 static HRESULT WINAPI DocObjectService_FireDocumentComplete(
3090 IDocObjectService* This,
3091 IHTMLWindow2 *pHTMLWindow,
3094 CHECK_EXPECT(FireDocumentComplete);
3098 static HRESULT WINAPI DocObjectService_UpdateDesktopComponent(
3099 IDocObjectService* This,
3100 IHTMLWindow2 *pHTMLWindow)
3102 ok(0, "unexpected call\n");
3106 static HRESULT WINAPI DocObjectService_GetPendingUrl(
3107 IDocObjectService* This,
3108 BSTR *pbstrPendingUrl)
3110 CHECK_EXPECT(GetPendingUrl);
3114 static HRESULT WINAPI DocObjectService_ActiveElementChanged(
3115 IDocObjectService* This,
3116 IHTMLElement *pHTMLElement)
3118 CHECK_EXPECT(ActiveElementChanged);
3122 static HRESULT WINAPI DocObjectService_GetUrlSearchComponent(
3123 IDocObjectService* This,
3126 ok(0, "unexpected call\n");
3130 static HRESULT WINAPI DocObjectService_IsErrorUrl(
3131 IDocObjectService* This,
3135 CHECK_EXPECT(IsErrorUrl);
3140 static IDocObjectServiceVtbl DocObjectServiceVtbl = {
3141 DocObjectService_QueryInterface,
3142 DocObjectService_AddRef,
3143 DocObjectService_Release,
3144 DocObjectService_FireBeforeNavigate2,
3145 DocObjectService_FireNavigateComplete2,
3146 DocObjectService_FireDownloadBegin,
3147 DocObjectService_FireDownloadComplete,
3148 DocObjectService_FireDocumentComplete,
3149 DocObjectService_UpdateDesktopComponent,
3150 DocObjectService_GetPendingUrl,
3151 DocObjectService_ActiveElementChanged,
3152 DocObjectService_GetUrlSearchComponent,
3153 DocObjectService_IsErrorUrl
3156 static IDocObjectService DocObjectService = { &DocObjectServiceVtbl };
3158 DEFINE_GUID(IID_ITabBrowserService, 0x5E8FA523,0x83D4,0x4DBE,0x81,0x99,0x4C,0x18,0xE4,0x85,0x87,0x25);
3160 static HRESULT WINAPI BrowserService_QueryInterface(
3161 IBrowserService* This,
3167 if(IsEqualGUID(&IID_IShellBrowser, riid))
3168 return E_NOINTERFACE; /* TODO */
3170 if(IsEqualGUID(&IID_IDocObjectService, riid)) {
3171 *ppvObject = &DocObjectService;
3175 if(IsEqualGUID(&IID_ITabBrowserService, riid))
3176 return E_NOINTERFACE; /* TODO */
3178 ok(0, "unexpected call\n");
3179 return E_NOINTERFACE;
3182 static ULONG WINAPI BrowserService_AddRef(
3183 IBrowserService* This)
3188 static ULONG WINAPI BrowserService_Release(
3189 IBrowserService* This)
3194 static HRESULT WINAPI BrowserService_GetParentSite(
3195 IBrowserService* This,
3196 IOleInPlaceSite **ppipsite)
3198 ok(0, "unexpected call\n");
3202 static HRESULT WINAPI BrowserService_SetTitle(
3203 IBrowserService* This,
3207 ok(0, "unexpected call\n");
3211 static HRESULT WINAPI BrowserService_GetTitle(
3212 IBrowserService* This,
3217 ok(0, "unexpected call\n");
3221 static HRESULT WINAPI BrowserService_GetOleObject(
3222 IBrowserService* This,
3223 IOleObject **ppobjv)
3225 ok(0, "unexpected call\n");
3229 static HRESULT WINAPI BrowserService_GetTravelLog(
3230 IBrowserService* This,
3233 CHECK_EXPECT(GetTravelLog);
3237 static HRESULT WINAPI BrowserService_ShowControlWindow(
3238 IBrowserService* This,
3242 ok(0, "unexpected call\n");
3246 static HRESULT WINAPI BrowserService_IsControlWindowShown(
3247 IBrowserService* This,
3251 ok(0, "unexpected call\n");
3255 static HRESULT WINAPI BrowserService_IEGetDisplayName(
3256 IBrowserService* This,
3257 PCIDLIST_ABSOLUTE pidl,
3261 ok(0, "unexpected call\n");
3265 static HRESULT WINAPI BrowserService_IEParseDisplayName(
3266 IBrowserService* This,
3269 PIDLIST_ABSOLUTE *ppidlOut)
3271 ok(0, "unexpected call\n");
3275 static HRESULT WINAPI BrowserService_DisplayParseError(
3276 IBrowserService* This,
3280 ok(0, "unexpected call\n");
3284 static HRESULT WINAPI BrowserService_NavigateToPidl(
3285 IBrowserService* This,
3286 PCIDLIST_ABSOLUTE pidl,
3289 ok(0, "unexpected call\n");
3293 static HRESULT WINAPI BrowserService_SetNavigateState(
3294 IBrowserService* This,
3297 ok(0, "unexpected call\n");
3301 static HRESULT WINAPI BrowserService_GetNavigateState(
3302 IBrowserService* This,
3305 ok(0, "unexpected call\n");
3309 static HRESULT WINAPI BrowserService_NotifyRedirect(
3310 IBrowserService* This,
3312 PCIDLIST_ABSOLUTE pidl,
3315 ok(0, "unexpected call\n");
3319 static HRESULT WINAPI BrowserService_UpdateWindowList(
3320 IBrowserService* This)
3322 ok(0, "unexpected call\n");
3326 static HRESULT WINAPI BrowserService_UpdateBackForwardState(
3327 IBrowserService* This)
3329 CHECK_EXPECT(UpdateBackForwardState);
3333 static HRESULT WINAPI BrowserService_SetFlags(
3334 IBrowserService* This,
3338 ok(0, "unexpected call\n");
3342 static HRESULT WINAPI BrowserService_GetFlags(
3343 IBrowserService* This,
3346 ok(0, "unexpected call\n");
3350 static HRESULT WINAPI BrowserService_CanNavigateNow(
3351 IBrowserService* This)
3353 ok(0, "unexpected call\n");
3357 static HRESULT WINAPI BrowserService_GetPidl(
3358 IBrowserService* This,
3359 PIDLIST_ABSOLUTE *ppidl)
3361 ok(0, "unexpected call\n");
3365 static HRESULT WINAPI BrowserService_SetReferrer(
3366 IBrowserService* This,
3367 PCIDLIST_ABSOLUTE pidl)
3369 ok(0, "unexpected call\n");
3373 static DWORD WINAPI BrowserService_GetBrowserIndex(
3374 IBrowserService* This)
3376 ok(0, "unexpected call\n");
3380 static HRESULT WINAPI BrowserService_GetBrowserByIndex(
3381 IBrowserService* This,
3385 ok(0, "unexpected call\n");
3389 static HRESULT WINAPI BrowserService_GetHistoryObject(
3390 IBrowserService* This,
3395 ok(0, "unexpected call\n");
3399 static HRESULT WINAPI BrowserService_SetHistoryObject(
3400 IBrowserService* This,
3402 BOOL fIsLocalAnchor)
3404 ok(0, "unexpected call\n");
3408 static HRESULT WINAPI BrowserService_CacheOLEServer(
3409 IBrowserService* This,
3412 ok(0, "unexpected call\n");
3416 static HRESULT WINAPI BrowserService_GetSetCodePage(
3417 IBrowserService* This,
3421 ok(0, "unexpected call\n");
3425 static HRESULT WINAPI BrowserService_OnHttpEquiv(
3426 IBrowserService* This,
3430 VARIANT *pvarargOut)
3432 ok(0, "unexpected call\n");
3436 static HRESULT WINAPI BrowserService_GetPalette(
3437 IBrowserService* This,
3440 ok(0, "unexpected call\n");
3444 static HRESULT WINAPI BrowserService_RegisterWindow(
3445 IBrowserService* This,
3446 BOOL fForceRegister,
3449 ok(0, "unexpected call\n");
3453 static IBrowserServiceVtbl BrowserServiceVtbl = {
3454 BrowserService_QueryInterface,
3455 BrowserService_AddRef,
3456 BrowserService_Release,
3457 BrowserService_GetParentSite,
3458 BrowserService_SetTitle,
3459 BrowserService_GetTitle,
3460 BrowserService_GetOleObject,
3461 BrowserService_GetTravelLog,
3462 BrowserService_ShowControlWindow,
3463 BrowserService_IsControlWindowShown,
3464 BrowserService_IEGetDisplayName,
3465 BrowserService_IEParseDisplayName,
3466 BrowserService_DisplayParseError,
3467 BrowserService_NavigateToPidl,
3468 BrowserService_SetNavigateState,
3469 BrowserService_GetNavigateState,
3470 BrowserService_NotifyRedirect,
3471 BrowserService_UpdateWindowList,
3472 BrowserService_UpdateBackForwardState,
3473 BrowserService_SetFlags,
3474 BrowserService_GetFlags,
3475 BrowserService_CanNavigateNow,
3476 BrowserService_GetPidl,
3477 BrowserService_SetReferrer,
3478 BrowserService_GetBrowserIndex,
3479 BrowserService_GetBrowserByIndex,
3480 BrowserService_GetHistoryObject,
3481 BrowserService_SetHistoryObject,
3482 BrowserService_CacheOLEServer,
3483 BrowserService_GetSetCodePage,
3484 BrowserService_OnHttpEquiv,
3485 BrowserService_GetPalette,
3486 BrowserService_RegisterWindow
3489 static IBrowserService BrowserService = { &BrowserServiceVtbl };
3491 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface,
3492 REFIID riid, void **ppv)
3494 return QueryInterface(riid, ppv);
3497 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
3502 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
3507 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
3508 REFIID riid, void **ppv)
3511 * Services used by HTMLDocument:
3514 * IInternetSecurityManager
3516 * {D5F78C80-5252-11CF-90FA-00AA0042106E}
3519 * {3050F312-98B5-11CF-BB82-00AA00BDCE0B}
3520 * {53A2D5B1-D2FC-11D0-84E0-006097C9987D}
3521 * {AD7F6C62-F6BD-11D2-959B-006097C553C8}
3523 * {6D12FE80-7911-11CF-9534-0000C05BAE0B}
3524 * IElementBehaviorFactory
3525 * {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
3535 if(IsEqualGUID(&IID_IHlinkFrame, guidService)) {
3536 ok(IsEqualGUID(&IID_IHlinkFrame, riid), "unexpected riid\n");
3541 if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
3542 ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
3543 *ppv = &NewWindowManager;
3547 if(IsEqualGUID(&IID_IShellBrowser, guidService)) {
3548 ok(IsEqualGUID(&IID_IBrowserService, riid), "unexpected riid\n");
3549 *ppv = &BrowserService;
3553 return E_NOINTERFACE;
3556 static const IServiceProviderVtbl ServiceProviderVtbl = {
3557 ServiceProvider_QueryInterface,
3558 ServiceProvider_AddRef,
3559 ServiceProvider_Release,
3560 ServiceProvider_QueryService
3563 static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
3565 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSinkEx *iface,
3566 REFIID riid, void **ppv)
3568 return QueryInterface(riid, ppv);
3571 static ULONG WINAPI AdviseSink_AddRef(IAdviseSinkEx *iface)
3576 static ULONG WINAPI AdviseSink_Release(IAdviseSinkEx *iface)
3581 static void WINAPI AdviseSink_OnDataChange(IAdviseSinkEx *iface,
3582 FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
3584 ok(0, "unexpected call\n");
3587 static void WINAPI AdviseSink_OnViewChange(IAdviseSinkEx *iface,
3588 DWORD dwAspect, LONG lindex)
3590 ok(0, "unexpected call\n");
3593 static void WINAPI AdviseSink_OnRename(IAdviseSinkEx *iface, IMoniker *pmk)
3595 ok(0, "unexpected call\n");
3598 static void WINAPI AdviseSink_OnSave(IAdviseSinkEx *iface)
3600 ok(0, "unexpected call\n");
3603 static void WINAPI AdviseSink_OnClose(IAdviseSinkEx *iface)
3605 ok(0, "unexpected call\n");
3608 static void WINAPI AdviseSinkEx_OnViewStatusChange(IAdviseSinkEx *iface, DWORD dwViewStatus)
3610 ok(0, "unexpected call\n");
3613 static void WINAPI ObjectAdviseSink_OnClose(IAdviseSinkEx *iface)
3615 CHECK_EXPECT(Advise_Close);
3618 static const IAdviseSinkExVtbl AdviseSinkVtbl = {
3619 AdviseSink_QueryInterface,
3622 AdviseSink_OnDataChange,
3623 AdviseSink_OnViewChange,
3624 AdviseSink_OnRename,
3626 ObjectAdviseSink_OnClose,
3627 AdviseSinkEx_OnViewStatusChange
3630 static IAdviseSinkEx AdviseSink = { &AdviseSinkVtbl };
3632 static HRESULT WINAPI ViewAdviseSink_QueryInterface(IAdviseSinkEx *iface,
3633 REFIID riid, void **ppv)
3635 if(IsEqualGUID(&IID_IAdviseSinkEx, riid)) {
3640 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3642 return E_NOINTERFACE;
3645 static void WINAPI ViewAdviseSink_OnViewChange(IAdviseSinkEx *iface,
3646 DWORD dwAspect, LONG lindex)
3648 CHECK_EXPECT2(OnViewChange);
3650 ok(dwAspect == DVASPECT_CONTENT, "dwAspect = %d\n", dwAspect);
3651 ok(lindex == -1, "lindex = %d\n", lindex);
3654 static const IAdviseSinkExVtbl ViewAdviseSinkVtbl = {
3655 ViewAdviseSink_QueryInterface,
3658 AdviseSink_OnDataChange,
3659 ViewAdviseSink_OnViewChange,
3660 AdviseSink_OnRename,
3663 AdviseSinkEx_OnViewStatusChange
3666 static IAdviseSinkEx ViewAdviseSink = { &ViewAdviseSinkVtbl };
3668 DEFINE_GUID(IID_unk1, 0xD48A6EC6,0x6A4A,0x11CF,0x94,0xA7,0x44,0x45,0x53,0x54,0x00,0x00); /* HTMLWindow2 ? */
3669 DEFINE_GUID(IID_IThumbnailView, 0x7BB0B520,0xB1A7,0x11D2,0xBB,0x23,0x00,0xC0,0x4F,0x79,0xAB,0xCD);
3670 DEFINE_GUID(IID_IRenMailEditor, 0x000670BA,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
3671 DEFINE_GUID(IID_unk4, 0x305104a6,0x98b5,0x11cf,0xbb,0x82,0x00,0xaa,0x00,0xbd,0xce,0x0b);
3672 DEFINE_GUID(IID_IDocHostUIHandlerPriv, 0xf0d241d1,0x5d0e,0x4e85,0xbc,0xb4,0xfa,0xd7,0xf7,0xc5,0x52,0x8c);
3674 static HRESULT QueryInterface(REFIID riid, void **ppv)
3678 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
3680 else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
3681 *ppv = &DocumentSite;
3682 else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
3683 *ppv = &DocHostUIHandler;
3684 else if(IsEqualGUID(&IID_IOleContainer, riid))
3685 *ppv = &OleContainer;
3686 else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
3687 *ppv = &InPlaceSiteWindowless;
3688 else if(IsEqualGUID(&IID_IOleCommandTarget , riid))
3689 *ppv = &OleCommandTarget;
3690 else if(IsEqualGUID(&IID_IDispatch, riid))
3692 else if(IsEqualGUID(&IID_IServiceProvider, riid))
3693 *ppv = &ServiceProvider;
3694 else if(IsEqualGUID(&IID_IOleInPlaceSiteEx, riid))
3695 *ppv = ipsex ? &InPlaceSiteWindowless : NULL;
3696 else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless, riid))
3697 *ppv = ipsw ? &InPlaceSiteWindowless : NULL;
3698 else if(IsEqualGUID(&IID_IOleControlSite, riid))
3699 *ppv = &OleControlSite;
3700 else if(IsEqualGUID(&IID_IDocHostShowUI, riid))
3701 return E_NOINTERFACE; /* TODO */
3702 else if(IsEqualGUID(&IID_IProxyManager, riid))
3703 return E_NOINTERFACE; /* ? */
3704 else if(IsEqualGUID(&IID_unk1, riid))
3705 return E_NOINTERFACE; /* HTMLWindow2 ? */
3706 else if(IsEqualGUID(&IID_IThumbnailView, riid))
3707 return E_NOINTERFACE; /* ? */
3708 else if(IsEqualGUID(&IID_IRenMailEditor, riid))
3709 return E_NOINTERFACE; /* ? */
3710 else if(IsEqualGUID(&IID_unk4, riid))
3711 return E_NOINTERFACE; /* ? */
3712 else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid))
3713 return E_NOINTERFACE; /* ? */
3715 ok(0, "unexpected riid %s\n", debugstr_guid(riid));
3719 return E_NOINTERFACE;
3722 static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3724 if(msg == WM_CONTINUE_BINDING) {
3725 IBindStatusCallback *callback = (IBindStatusCallback*)wParam;
3726 continue_binding(callback);
3729 return DefWindowProc(hwnd, msg, wParam, lParam);
3732 static void test_doscroll(IUnknown *unk)
3734 IHTMLDocument3 *doc;
3735 IHTMLElement2 *elem2;
3740 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc);
3741 ok(hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
3745 hres = IHTMLDocument3_get_documentElement(doc, &elem);
3746 IHTMLDocument3_Release(doc);
3747 ok(hres == S_OK, "get_documentElement failed: %08x\n", hres);
3748 switch(load_state) {
3752 ok(!elem, "elem != NULL\n");
3755 case LD_INTERACTIVE:
3757 ok(elem != NULL, "elem == NULL\n");
3762 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3763 IHTMLElement_Release(elem);
3764 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3767 V_BSTR(&v) = a2bstr("left");
3768 hres = IHTMLElement2_doScroll(elem2, v);
3769 SysFreeString(V_BSTR(&v));
3770 IHTMLElement2_Release(elem2);
3772 if(inplace_deactivated)
3773 ok(hres == E_PENDING, "doScroll failed: %08x\n", hres);
3774 else if(load_state == LD_COMPLETE)
3775 ok(hres == S_OK, "doScroll failed: %08x\n", hres);
3777 ok(hres == E_PENDING || hres == S_OK, "doScroll failed: %08x\n", hres);
3780 static void _test_readyState(unsigned line, IUnknown *unk)
3782 IHTMLDocument2 *htmldoc;
3783 DISPPARAMS dispparams;
3789 static const LPCSTR expected_state[] = {
3804 hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
3805 ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
3809 hres = IHTMLDocument2_get_readyState(htmldoc, NULL);
3810 ok(hres == E_POINTER, "get_readyState failed: %08x, expected\n", hres);
3812 hres = IHTMLDocument2_get_readyState(htmldoc, &state);
3813 ok(hres == S_OK, "get_ReadyState failed: %08x\n", hres);
3815 if(!strcmp_wa(state, "interactive") && load_state == LD_LOADING)
3816 load_state = LD_INTERACTIVE;
3819 (!strcmp_wa(state, expected_state[load_state]), "unexpected state %s, expected %d\n",
3820 wine_dbgstr_w(state), load_state);
3821 SysFreeString(state);
3823 hres = IHTMLDocument2_get_body(htmldoc, &elem);
3824 ok_(__FILE__,line)(hres == S_OK, "get_body failed: %08x\n", hres);
3826 IHTMLElement2 *elem2;
3829 hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLElement2, (void**)&elem2);
3830 IHTMLElement_Release(elem);
3831 ok(hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
3833 hres = IHTMLElement2_get_readyState(elem2, &var);
3834 IHTMLElement2_Release(elem2);
3835 ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
3836 ok(V_VT(&var) == VT_BSTR, "V_VT(state) = %d\n", V_VT(&var));
3837 ok(!strcmp_wa(V_BSTR(&var), "complete"), "unexpected body state %s\n", wine_dbgstr_w(V_BSTR(&var)));
3840 ok_(__FILE__,line)(load_state != LD_COMPLETE, "body is NULL in complete state\n");
3843 dispparams.cArgs = 0;
3844 dispparams.cNamedArgs = 0;
3845 dispparams.rgdispidNamedArgs = NULL;
3846 dispparams.rgvarg = NULL;
3850 hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
3851 &dispparams, &out, NULL, NULL);
3852 ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
3854 ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
3855 ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
3857 test_doscroll((IUnknown*)htmldoc);
3859 IHTMLDocument2_Release(htmldoc);
3862 static void test_ViewAdviseSink(IHTMLDocument2 *doc)
3867 hres = IHTMLDocument2_QueryInterface(doc, &IID_IViewObject, (void**)&view);
3868 ok(hres == S_OK, "QueryInterface(IID_IViewObject) failed: %08x\n", hres);
3870 hres = IViewObject_SetAdvise(view, DVASPECT_CONTENT, ADVF_PRIMEFIRST, (IAdviseSink*)&ViewAdviseSink);
3871 ok(hres == S_OK, "SetAdvise failed: %08x\n", hres);
3873 IViewObject_Release(view);
3876 static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)
3878 IConnectionPointContainer *tmp_container = NULL;
3879 IConnectionPoint *cp;
3884 hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
3885 ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
3889 hres = IConnectionPoint_GetConnectionInterface(cp, &iid);
3890 ok(hres == S_OK, "GetConnectionInterface failed: %08x\n", hres);
3891 ok(IsEqualGUID(riid, &iid), "wrong iid\n");
3893 hres = IConnectionPoint_GetConnectionInterface(cp, NULL);
3894 ok(hres == E_POINTER, "GetConnectionInterface failed: %08x, expected E_POINTER\n", hres);
3896 hres = IConnectionPoint_GetConnectionPointContainer(cp, &tmp_container);
3897 ok(hres == S_OK, "GetConnectionPointContainer failed: %08x\n", hres);
3898 ok(tmp_container == container, "container != tmp_container\n");
3900 IConnectionPointContainer_Release(tmp_container);
3902 hres = IConnectionPoint_GetConnectionPointContainer(cp, NULL);
3903 ok(hres == E_POINTER, "GetConnectionPointContainer failed: %08x, expected E_POINTER\n", hres);
3905 if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
3906 hres = IConnectionPoint_Advise(cp, (IUnknown*)&PropertyNotifySink, &cookie);
3907 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3908 } else if(IsEqualGUID(&IID_IDispatch, riid)) {
3909 hres = IConnectionPoint_Advise(cp, (IUnknown*)&EventDispatch, &cookie);
3910 ok(hres == S_OK, "Advise failed: %08x\n", hres);
3913 IConnectionPoint_Release(cp);
3916 static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
3918 IConnectionPointContainer *container;
3921 hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
3922 ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
3926 test_ConnectionPoint(container, &IID_IDispatch);
3927 test_ConnectionPoint(container, &IID_IPropertyNotifySink);
3928 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents);
3929 test_ConnectionPoint(container, &DIID_HTMLDocumentEvents2);
3931 IConnectionPointContainer_Release(container);
3934 static void set_custom_uihandler(IHTMLDocument2 *doc, IDocHostUIHandler2 *uihandler)
3936 ICustomDoc *custom_doc;
3939 hres = IHTMLDocument2_QueryInterface(doc, &IID_ICustomDoc, (void**)&custom_doc);
3940 ok(hres == S_OK, "Could not get ICustomDoc iface: %08x\n", hres);
3942 expect_uihandler_iface = uihandler;
3944 hres = ICustomDoc_SetUIHandler(custom_doc, (IDocHostUIHandler*)uihandler);
3945 ICustomDoc_Release(custom_doc);
3946 ok(hres == S_OK, "SetUIHandler failed: %08x\n", hres);
3949 static void test_Load(IPersistMoniker *persist, IMoniker *mon)
3953 WCHAR sz_html_clientsite_objectparam[MAX_PATH];
3955 lstrcpyW(sz_html_clientsite_objectparam, SZ_HTML_CLIENTSITE_OBJECTPARAM);
3957 test_readyState((IUnknown*)persist);
3961 CreateBindCtx(0, &bind);
3962 IBindCtx_RegisterObjectParam(bind, sz_html_clientsite_objectparam,
3963 (IUnknown*)&ClientSite);
3966 SET_EXPECT(GetDisplayName);
3967 if(!set_clientsite) {
3968 SET_EXPECT(Invoke_AMBIENT_USERMODE);
3969 SET_EXPECT(GetHostInfo);
3970 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
3971 SET_EXPECT(Invoke_AMBIENT_SILENT);
3972 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3973 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
3974 SET_EXPECT(Invoke_AMBIENT_PALETTE);
3975 SET_EXPECT(GetOptionKeyPath);
3976 SET_EXPECT(GetOverrideKeyPath);
3977 SET_EXPECT(GetWindow);
3978 SET_EXPECT(Exec_DOCCANNAVIGATE);
3979 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
3980 SET_EXPECT(Exec_SETPROGRESSMAX);
3981 SET_EXPECT(Exec_SETPROGRESSPOS);
3982 SET_EXPECT(Exec_ShellDocView_37);
3984 if(!container_locked) {
3985 SET_EXPECT(GetContainer);
3986 SET_EXPECT(LockContainer);
3988 SET_EXPECT(OnChanged_READYSTATE);
3989 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
3990 SET_EXPECT(Exec_ShellDocView_84);
3991 SET_EXPECT(IsSystemMoniker);
3993 SET_EXPECT(BindToStorage);
3994 SET_EXPECT(SetActiveObject);
3995 if(set_clientsite) {
3996 SET_EXPECT(Invoke_AMBIENT_SILENT);
3997 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
3998 SET_EXPECT(Exec_ShellDocView_37);
3999 SET_EXPECT(IsErrorUrl);
4002 SET_EXPECT(GetTravelLog);
4003 SET_EXPECT(GetPendingUrl);
4004 load_state = LD_DOLOAD;
4005 expect_LockContainer_fLock = TRUE;
4006 readystate_set_loading = TRUE;
4008 hres = IPersistMoniker_Load(persist, FALSE, mon, bind, 0x12);
4009 ok(hres == S_OK, "Load failed: %08x\n", hres);
4012 CHECK_CALLED(GetDisplayName);
4013 if(!set_clientsite) {
4014 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4015 CHECK_CALLED(GetHostInfo);
4016 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4017 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4018 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4019 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4020 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4021 CHECK_CALLED(GetOptionKeyPath);
4022 CHECK_CALLED(GetOverrideKeyPath);
4023 CHECK_CALLED(GetWindow);
4024 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4025 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4026 CHECK_CALLED(Exec_SETPROGRESSMAX);
4027 CHECK_CALLED(Exec_SETPROGRESSPOS);
4028 CHECK_CALLED(Exec_ShellDocView_37);
4030 if(!container_locked) {
4031 CHECK_CALLED(GetContainer);
4032 CHECK_CALLED(LockContainer);
4033 container_locked = TRUE;
4035 CHECK_CALLED(OnChanged_READYSTATE);
4036 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4037 SET_CALLED(IsSystemMoniker); /* IE7 */
4038 SET_CALLED(Exec_ShellDocView_84);
4040 CHECK_CALLED(BindToStorage);
4041 SET_CALLED(SetActiveObject); /* FIXME */
4042 if(set_clientsite) {
4043 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4044 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4045 CHECK_CALLED(Exec_ShellDocView_37);
4046 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4049 todo_wine CHECK_CALLED(GetTravelLog);
4050 todo_wine CHECK_CALLED(GetPendingUrl);
4052 set_clientsite = container_locked = TRUE;
4054 test_GetCurMoniker((IUnknown*)persist, mon, NULL);
4056 IBindCtx_Release(bind);
4058 test_readyState((IUnknown*)persist);
4061 #define DWL_VERBDONE 0x0001
4062 #define DWL_CSS 0x0002
4063 #define DWL_TRYCSS 0x0004
4064 #define DWL_HTTP 0x0008
4065 #define DWL_EMPTY 0x0010
4066 #define DWL_JAVASCRIPT 0x0020
4068 static void test_download(DWORD flags)
4070 const BOOL is_js = (flags & DWL_JAVASCRIPT) != 0;
4075 b = is_js ? &called_Exec_SETDOWNLOADSTATE_0 : &called_Exec_HTTPEQUIV_DONE;
4077 hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
4078 ok(hwnd != NULL, "Could not find hidden window\n");
4080 test_readyState(NULL);
4082 if(flags & (DWL_VERBDONE|DWL_HTTP))
4083 SET_EXPECT(Exec_SETPROGRESSMAX);
4084 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js)
4085 SET_EXPECT(GetHostInfo);
4086 SET_EXPECT(SetStatusText);
4087 if(!(flags & DWL_EMPTY))
4088 SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
4090 SET_EXPECT(GetExternal);
4091 SET_EXPECT(OnViewChange);
4092 SET_EXPECT(GetDropTarget);
4093 if(flags & DWL_TRYCSS)
4094 SET_EXPECT(Exec_ShellDocView_84);
4095 if(flags & DWL_CSS) {
4096 SET_EXPECT(CreateInstance);
4098 SET_EXPECT(LockRequest);
4099 SET_EXPECT(Terminate);
4100 SET_EXPECT(Protocol_Read);
4101 SET_EXPECT(UnlockRequest);
4103 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4104 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
4106 SET_EXPECT(Invoke_OnReadyStateChange_Complete);
4107 SET_EXPECT(Exec_Explorer_69);
4108 SET_EXPECT(EnableModeless_TRUE); /* IE7 */
4109 SET_EXPECT(Frame_EnableModeless_TRUE); /* IE7 */
4110 SET_EXPECT(EnableModeless_FALSE); /* IE7 */
4111 SET_EXPECT(Frame_EnableModeless_FALSE); /* IE7 */
4112 if(nav_url && !is_js)
4113 SET_EXPECT(Exec_ShellDocView_37);
4114 if(flags & DWL_HTTP) {
4115 SET_EXPECT(OnChanged_1012);
4116 SET_EXPECT(Exec_HTTPEQUIV);
4117 SET_EXPECT(Exec_SETTITLE);
4120 SET_EXPECT(OnChanged_1005);
4121 SET_EXPECT(OnChanged_READYSTATE);
4122 SET_EXPECT(Exec_SETPROGRESSPOS);
4123 if(!(flags & DWL_EMPTY))
4124 SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
4125 SET_EXPECT(Exec_ShellDocView_103);
4126 SET_EXPECT(Exec_ShellDocView_105);
4127 SET_EXPECT(Exec_ShellDocView_140);
4129 SET_EXPECT(Exec_MSHTML_PARSECOMPLETE);
4130 SET_EXPECT(Exec_HTTPEQUIV_DONE);
4132 SET_EXPECT(SetStatusText);
4134 SET_EXPECT(UpdateUI);
4135 SET_EXPECT(Exec_UPDATECOMMANDS);
4136 SET_EXPECT(Exec_SETTITLE);
4137 SET_EXPECT(UpdateBackForwardState);
4141 if(!(flags & DWL_EMPTY))
4142 SET_EXPECT(FireNavigateComplete2);
4143 SET_EXPECT(FireDocumentComplete);
4145 SET_EXPECT(ActiveElementChanged);
4147 SET_EXPECT(IsErrorUrl);
4148 expect_status_text = (LPWSTR)0xdeadbeef; /* TODO */
4150 while(!*b && GetMessage(&msg, NULL, 0, 0)) {
4151 TranslateMessage(&msg);
4152 DispatchMessage(&msg);
4155 if(flags & DWL_VERBDONE)
4156 CHECK_CALLED(Exec_SETPROGRESSMAX);
4157 if(flags & DWL_HTTP)
4158 SET_CALLED(Exec_SETPROGRESSMAX);
4159 if((flags & DWL_VERBDONE) && !load_from_stream && !is_js) {
4161 todo_wine CHECK_CALLED(GetHostInfo);
4163 CHECK_CALLED(GetHostInfo);
4165 CHECK_CALLED(SetStatusText);
4166 if(!(flags & DWL_EMPTY))
4167 CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
4169 CHECK_CALLED(GetExternal);
4170 CHECK_CALLED(OnViewChange);
4171 SET_CALLED(GetDropTarget);
4172 if(flags & DWL_TRYCSS)
4173 SET_CALLED(Exec_ShellDocView_84);
4174 if(flags & DWL_CSS) {
4175 CHECK_CALLED(CreateInstance);
4176 CHECK_CALLED(Start);
4177 CHECK_CALLED(LockRequest);
4178 CHECK_CALLED(Terminate);
4179 CHECK_CALLED(Protocol_Read);
4180 CHECK_CALLED(UnlockRequest);
4182 if(!(flags & (DWL_EMPTY|DWL_JAVASCRIPT)))
4183 CHECK_CALLED(Invoke_OnReadyStateChange_Interactive);
4185 CHECK_CALLED(Invoke_OnReadyStateChange_Complete);
4186 SET_CALLED(Exec_Explorer_69);
4187 SET_CALLED(EnableModeless_TRUE); /* IE7 */
4188 SET_CALLED(Frame_EnableModeless_TRUE); /* IE7 */
4189 SET_CALLED(EnableModeless_FALSE); /* IE7 */
4190 SET_CALLED(Frame_EnableModeless_FALSE); /* IE7 */
4191 if(nav_url && !is_js)
4192 todo_wine CHECK_CALLED(Exec_ShellDocView_37);
4193 if(flags & DWL_HTTP) todo_wine {
4194 CHECK_CALLED(OnChanged_1012);
4195 CHECK_CALLED(Exec_HTTPEQUIV);
4196 CHECK_CALLED(Exec_SETTITLE);
4199 CHECK_CALLED(OnChanged_1005);
4200 CHECK_CALLED(OnChanged_READYSTATE);
4201 CHECK_CALLED(Exec_SETPROGRESSPOS);
4203 SET_CALLED(OnChanged_READYSTATE); /* sometimes called */
4204 todo_wine CHECK_CALLED(Exec_SETPROGRESSPOS);
4206 if(!(flags & DWL_EMPTY))
4207 CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
4208 SET_CALLED(Exec_ShellDocView_103);
4209 SET_CALLED(Exec_ShellDocView_105);
4210 SET_CALLED(Exec_ShellDocView_140);
4212 CHECK_CALLED(Exec_MSHTML_PARSECOMPLETE);
4213 CHECK_CALLED(Exec_HTTPEQUIV_DONE);
4215 SET_CALLED(SetStatusText);
4216 if(nav_url) { /* avoiding race, FIXME: find better way */
4217 SET_CALLED(UpdateUI);
4218 SET_CALLED(Exec_UPDATECOMMANDS);
4219 SET_CALLED(Exec_SETTITLE);
4220 todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState);
4224 if(!(flags & DWL_EMPTY))
4225 todo_wine CHECK_CALLED(FireNavigateComplete2);
4226 CHECK_CALLED(FireDocumentComplete);
4228 todo_wine CHECK_CALLED(ActiveElementChanged);
4230 todo_wine CHECK_CALLED_BROKEN(IsErrorUrl);
4232 load_state = LD_COMPLETE;
4234 test_readyState(NULL);
4237 static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
4239 IPersistMoniker *persist_mon;
4240 IPersistFile *persist_file;
4244 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
4245 ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
4246 if(SUCCEEDED(hres)) {
4247 hres = IPersist_GetClassID(persist_file, NULL);
4248 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4250 hres = IPersist_GetClassID(persist_file, &guid);
4251 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4252 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4254 IPersist_Release(persist_file);
4257 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
4258 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
4259 if(SUCCEEDED(hres)) {
4260 hres = IPersistMoniker_GetClassID(persist_mon, NULL);
4261 ok(hres == E_INVALIDARG, "GetClassID returned: %08x, expected E_INVALIDARG\n", hres);
4263 hres = IPersistMoniker_GetClassID(persist_mon, &guid);
4264 ok(hres == S_OK, "GetClassID failed: %08x\n", hres);
4265 ok(IsEqualGUID(&CLSID_HTMLDocument, &guid), "guid != CLSID_HTMLDocument\n");
4267 if(load_state == LD_DOLOAD)
4268 test_Load(persist_mon, mon);
4270 test_readyState((IUnknown*)doc);
4272 IPersistMoniker_Release(persist_mon);
4276 static void test_put_href(IHTMLDocument2 *doc, BOOL use_replace, const char *new_nav_url, BOOL is_js)
4278 IHTMLPrivateWindow *priv_window;
4279 const char *prev_nav_url;
4280 IHTMLWindow2 *window;
4281 IHTMLLocation *location;
4286 trace("put_href %s...\n", new_nav_url);
4291 hres = IHTMLDocument2_get_location(doc, &location);
4292 ok(hres == S_OK, "get_location failed: %08x\n", hres);
4293 ok(location != NULL, "location == NULL\n");
4295 prev_nav_url = nav_url;
4296 str = a2bstr(nav_url = new_nav_url);
4297 SET_EXPECT(TranslateUrl);
4298 SET_EXPECT(Navigate);
4300 hres = IHTMLLocation_replace(location, str);
4301 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4303 hres = IHTMLLocation_put_href(location, str);
4304 if(is_js && hres == E_ACCESSDENIED)
4305 win_skip("put_href: got E_ACCESSDENIED\n");
4307 ok(hres == S_OK, "put_href failed: %08x\n", hres);
4310 CHECK_CALLED(TranslateUrl);
4311 CHECK_CALLED(Navigate);
4313 SET_CALLED(TranslateUrl);
4314 SET_CALLED(Navigate);
4317 IHTMLLocation_Release(location);
4319 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4320 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4322 hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
4323 IHTMLWindow2_Release(window);
4324 ok(hres == S_OK, "QueryInterface(IID_IHTMLPrivateWindow) failed: %08x\n", hres);
4326 readystate_set_loading = TRUE;
4327 SET_EXPECT(TranslateUrl);
4328 SET_EXPECT(Exec_ShellDocView_67);
4329 SET_EXPECT(Invoke_AMBIENT_SILENT);
4330 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4331 SET_EXPECT(Exec_ShellDocView_63);
4334 V_VT(&vempty) = VT_EMPTY;
4335 hres = IHTMLPrivateWindow_SuperNavigate(priv_window, str, str2, NULL, NULL, &vempty, &vempty, 0);
4336 SysFreeString(str2);
4337 ok(hres == S_OK, "SuperNavigate failed: %08x\n", hres);
4339 CHECK_CALLED(TranslateUrl);
4340 CHECK_CALLED(Exec_ShellDocView_67);
4341 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4342 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4343 CHECK_CALLED(Exec_ShellDocView_63);
4346 test_GetCurMoniker(doc_unk, doc_mon, NULL);
4349 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4350 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4351 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4352 SysFreeString(str2);
4355 ignore_external_qi = TRUE;
4357 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4358 test_download(DWL_VERBDONE | (is_js ? DWL_JAVASCRIPT : 0));
4360 ignore_external_qi = FALSE;
4362 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4364 hres = IHTMLPrivateWindow_GetAddressBarUrl(priv_window, &str2);
4365 ok(hres == S_OK, "GetAddressBarUrl failed: %08x\n", hres);
4367 ok(!strcmp_wa(str2, prev_nav_url), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4369 ok(!lstrcmpW(str2, str), "unexpected address bar url: %s\n", wine_dbgstr_w(str2));
4370 SysFreeString(str2);
4372 IHTMLPrivateWindow_Release(priv_window);
4376 nav_url = prev_nav_url;
4379 static void test_open_window(IHTMLDocument2 *doc)
4381 IHTMLWindow2 *window, *new_window;
4385 hres = IHTMLDocument2_get_parentWindow(doc, &window);
4386 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
4388 url = a2bstr(nav_url = "about:blank");
4389 name = a2bstr("test");
4390 new_window = (void*)0xdeadbeef;
4394 SET_EXPECT(TranslateUrl);
4395 SET_EXPECT(EvaluateNewWindow);
4397 hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
4400 SysFreeString(name);
4403 CHECK_CALLED(TranslateUrl);
4405 if(!called_EvaluateNewWindow) {
4407 win_skip("INewWindowManager not supported\n");
4408 if(SUCCEEDED(hres) && new_window)
4409 IHTMLWindow2_Release(new_window);
4410 IHTMLWindow2_Release(window);
4415 CHECK_CALLED(EvaluateNewWindow);
4418 ok(hres == S_OK, "open failed: %08x\n", hres);
4420 ok(new_window == NULL, "new_window != NULL\n");
4422 IHTMLWindow2_Release(window);
4425 static void test_clear(IHTMLDocument2 *doc)
4429 hres = IHTMLDocument2_clear(doc);
4430 ok(hres == S_OK, "clear failed: %08x\n", hres);
4433 static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
4435 OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
4436 OLECMDF_SUPPORTED, /* OLECMDID_NEW */
4437 OLECMDF_SUPPORTED, /* OLECMDID_SAVE */
4438 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SAVEAS */
4439 OLECMDF_SUPPORTED, /* OLECMDID_SAVECOPYAS */
4440 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINT */
4441 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PRINTPREVIEW */
4442 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PAGESETUP */
4443 OLECMDF_SUPPORTED, /* OLECMDID_SPELL */
4444 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_PROPERTIES */
4445 OLECMDF_SUPPORTED, /* OLECMDID_CUT */
4446 OLECMDF_SUPPORTED, /* OLECMDID_COPY */
4447 OLECMDF_SUPPORTED, /* OLECMDID_PASTE */
4448 OLECMDF_SUPPORTED, /* OLECMDID_PASTESPECIAL */
4449 OLECMDF_SUPPORTED, /* OLECMDID_UNDO */
4450 OLECMDF_SUPPORTED, /* OLECMDID_REDO */
4451 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_SELECTALL */
4452 OLECMDF_SUPPORTED, /* OLECMDID_CLEARSELECTION */
4453 OLECMDF_SUPPORTED, /* OLECMDID_ZOOM */
4454 OLECMDF_SUPPORTED, /* OLECMDID_GETZOOMRANGE */
4456 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_REFRESH */
4457 OLECMDF_SUPPORTED|OLECMDF_ENABLED, /* OLECMDID_STOP */
4459 OLECMDF_SUPPORTED, /* OLECMDID_STOPDOWNLOAD */
4461 OLECMDF_SUPPORTED, /* OLECMDID_DELETE */
4463 OLECMDF_SUPPORTED, /* OLECMDID_ENABLE_INTERACTION */
4464 OLECMDF_SUPPORTED, /* OLECMDID_ONUNLOAD */
4466 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPAGESETUP */
4467 OLECMDF_SUPPORTED, /* OLECMDID_SHOWPRINT */
4469 OLECMDF_SUPPORTED, /* OLECMDID_CLOSE */
4471 OLECMDF_SUPPORTED, /* OLECMDID_SETPRINTTEMPLATE */
4472 OLECMDF_SUPPORTED /* OLECMDID_GETPRINTTEMPLATE */
4475 #define test_QueryStatus(u,cgid,cmdid,cmdf) _test_QueryStatus(__LINE__,u,cgid,cmdid,cmdf)
4476 static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf)
4478 IOleCommandTarget *cmdtrg;
4479 OLECMD olecmd = {cmdid, 0};
4482 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4483 ok_(__FILE__,line) (hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4487 hres = IOleCommandTarget_QueryStatus(cmdtrg, cgid, 1, &olecmd, NULL);
4488 ok(hres == S_OK, "QueryStatus(%u) failed: %08x\n", cmdid, hres);
4490 IOleCommandTarget_Release(cmdtrg);
4492 ok_(__FILE__,line) (olecmd.cmdID == cmdid, "cmdID changed\n");
4493 ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
4496 static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
4498 IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
4500 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
4501 test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
4502 test_QueryStatus(unk, &CGID_MSHTML, IDM_SELECTALL, cmdf|OLECMDF_ENABLED);
4503 test_QueryStatus(unk, &CGID_MSHTML, IDM_BOLD, cmdf);
4504 test_QueryStatus(unk, &CGID_MSHTML, IDM_FORECOLOR, cmdf);
4505 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER, cmdf);
4506 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYLEFT, cmdf);
4507 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT, cmdf);
4508 test_QueryStatus(unk, &CGID_MSHTML, IDM_ITALIC, cmdf);
4509 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNDERLINE, cmdf);
4510 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE, cmdf);
4511 test_QueryStatus(unk, &CGID_MSHTML, IDM_ORDERLIST, cmdf);
4512 test_QueryStatus(unk, &CGID_MSHTML, IDM_UNORDERLIST, cmdf);
4513 test_QueryStatus(unk, &CGID_MSHTML, IDM_INDENT, cmdf);
4514 test_QueryStatus(unk, &CGID_MSHTML, IDM_OUTDENT, cmdf);
4515 test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
4518 static void test_OleCommandTarget(IHTMLDocument2 *doc)
4520 IOleCommandTarget *cmdtrg;
4521 OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
4525 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4526 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
4530 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4531 cmds[i].cmdID = i+1;
4532 cmds[i].cmdf = 0xf0f0;
4535 SET_EXPECT(QueryStatus_OPEN);
4536 SET_EXPECT(QueryStatus_NEW);
4537 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
4538 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4539 CHECK_CALLED(QueryStatus_OPEN);
4540 CHECK_CALLED(QueryStatus_NEW);
4542 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4543 ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
4544 if(i+1 == OLECMDID_FIND)
4546 ok(cmds[i].cmdf == expect_cmds[i+1], "cmds[%d].cmdf=%x, expected %x\n",
4547 i+1, cmds[i].cmdf, expect_cmds[i+1]);
4550 ok(!cmds[OLECMDID_FIND-1].cmdf || cmds[OLECMDID_FIND-1].cmdf == (OLECMDF_SUPPORTED|OLECMDF_ENABLED),
4551 "cmds[OLECMDID_FIND].cmdf=%x\n", cmds[OLECMDID_FIND-1].cmdf);
4553 IOleCommandTarget_Release(cmdtrg);
4556 static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
4558 IOleCommandTarget *cmdtrg;
4563 {OLECMDID_OPEN, 0xf0f0},
4564 {OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
4567 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4568 ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
4572 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 0, NULL, NULL);
4573 ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
4575 SET_EXPECT(QueryStatus_OPEN);
4576 hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, 2, cmd, NULL);
4577 CHECK_CALLED(QueryStatus_OPEN);
4579 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4580 "QueryStatus failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4581 ok(cmd[1].cmdID == OLECMDID_GETPRINTTEMPLATE+1,
4582 "cmd[0].cmdID=%d, expected OLECMDID_GETPRINTTEMPLATE+1\n", cmd[0].cmdID);
4583 ok(cmd[1].cmdf == 0, "cmd[0].cmdf=%x, expected 0\n", cmd[0].cmdf);
4584 ok(cmd[0].cmdf == OLECMDF_SUPPORTED,
4585 "cmd[1].cmdf=%x, expected OLECMDF_SUPPORTED\n", cmd[1].cmdf);
4587 hres = IOleCommandTarget_QueryStatus(cmdtrg, &IID_IHTMLDocument2, 2, cmd, NULL);
4588 ok(hres == OLECMDERR_E_UNKNOWNGROUP,
4589 "QueryStatus failed: %08x, expected OLECMDERR_E_UNKNOWNGROUP\n", hres);
4591 for(i=0; i<OLECMDID_GETPRINTTEMPLATE; i++) {
4592 if(!expect_cmds[i]) {
4593 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
4594 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4595 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4596 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4600 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_GETPRINTTEMPLATE+1,
4601 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4602 ok(hres == OLECMDERR_E_NOTSUPPORTED,
4603 "Exec failed: %08x, expected OLECMDERR_E_NOTSUPPORTED\n", hres);
4605 IOleCommandTarget_Release(cmdtrg);
4608 static void test_exec_onunload(IHTMLDocument2 *doc)
4610 IOleCommandTarget *cmdtrg;
4614 hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
4615 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4619 memset(&var, 0x0a, sizeof(var));
4620 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4621 OLECMDEXECOPT_DODEFAULT, NULL, &var);
4622 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4623 ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var));
4624 ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var));
4626 hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD,
4627 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4628 ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08x\n", hres);
4630 IOleCommandTarget_Release(cmdtrg);
4633 static void test_exec_editmode(IUnknown *unk, BOOL loaded)
4635 IOleCommandTarget *cmdtrg;
4638 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4639 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4646 load_state = LD_DOLOAD;
4649 SET_EXPECT(GetClassID);
4650 SET_EXPECT(SetStatusText);
4651 SET_EXPECT(Exec_ShellDocView_37);
4652 SET_EXPECT(GetHostInfo);
4654 SET_EXPECT(GetDisplayName);
4655 SET_EXPECT(Invoke_AMBIENT_SILENT);
4656 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4657 SET_EXPECT(OnChanged_READYSTATE);
4658 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
4659 SET_EXPECT(IsSystemMoniker);
4660 SET_EXPECT(Exec_ShellDocView_84);
4662 SET_EXPECT(BindToStorage);
4663 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
4666 SET_EXPECT(InPlaceFrame_SetBorderSpace);
4668 expect_status_text = NULL;
4669 readystate_set_loading = TRUE;
4671 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4672 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4673 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4676 CHECK_CALLED(GetClassID);
4677 CHECK_CALLED(SetStatusText);
4678 CHECK_CALLED(Exec_ShellDocView_37);
4679 CHECK_CALLED(GetHostInfo);
4681 CHECK_CALLED(GetDisplayName);
4682 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4683 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4684 CHECK_CALLED(OnChanged_READYSTATE);
4685 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
4686 SET_CALLED(IsSystemMoniker); /* IE7 */
4687 SET_CALLED(Exec_ShellDocView_84);
4689 CHECK_CALLED(BindToStorage);
4690 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
4691 CHECK_CALLED(HideUI);
4692 CHECK_CALLED(ShowUI);
4693 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
4695 test_timer(EXPECT_UPDATEUI|EXPECT_SETTITLE);
4697 IOleCommandTarget_Release(cmdtrg);
4699 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE,
4700 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4701 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4704 static void test_exec_fontname(IUnknown *unk, LPCWSTR name, LPCWSTR exname)
4706 IOleCommandTarget *cmdtrg;
4707 VARIANT *in = NULL, _in, *out = NULL, _out;
4710 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4711 ok(hres == S_OK, "QueryInterface(IIDIOleM=CommandTarget failed: %08x\n", hres);
4718 V_BSTR(in) = SysAllocString(name);
4724 V_I4(out) = 0xdeadbeef;
4727 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_FONTNAME, 0, in, out);
4728 ok(hres == S_OK, "Exec(IDM_FONTNAME) failed: %08x\n", hres);
4734 ok(V_VT(out) == VT_BSTR, "V_VT(out) = %x\n", V_VT(out));
4735 if(V_VT(out) == VT_BSTR) {
4737 ok(!lstrcmpW(V_BSTR(out), name ? name : exname),
4738 "unexpected fontname %s\n", wine_dbgstr_w(name));
4740 ok(V_BSTR(out) == NULL, "V_BSTR(out) != NULL\n");
4745 IOleCommandTarget_Release(cmdtrg);
4748 static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
4750 IOleCommandTarget *cmdtrg;
4753 hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
4754 ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
4758 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, cmdid,
4759 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
4760 ok(hres == S_OK, "Exec failed: %08x\n", hres);
4762 IOleCommandTarget_Release(cmdtrg);
4765 static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
4767 IPersistStreamInit *perinit;
4768 IPersistMoniker *permon;
4769 IPersistFile *perfile;
4772 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
4773 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
4774 if(SUCCEEDED(hres)) {
4775 hres = IPersistStreamInit_IsDirty(perinit);
4776 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4777 IPersistStreamInit_Release(perinit);
4780 hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
4781 ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
4782 if(SUCCEEDED(hres)) {
4783 hres = IPersistMoniker_IsDirty(permon);
4784 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4785 IPersistMoniker_Release(permon);
4788 hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
4789 ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
4790 if(SUCCEEDED(hres)) {
4791 hres = IPersistFile_IsDirty(perfile);
4792 ok(hres == exhres, "IsDirty() = %08x, expected %08x\n", hres, exhres);
4793 IPersistFile_Release(perfile);
4797 static HWND create_container_window(void)
4799 static const WCHAR wszHTMLDocumentTest[] =
4800 {'H','T','M','L','D','o','c','u','m','e','n','t','T','e','s','t',0};
4801 static WNDCLASSEXW wndclass = {
4802 sizeof(WNDCLASSEXW),
4805 0, 0, NULL, NULL, NULL, NULL, NULL,
4806 wszHTMLDocumentTest,
4810 RegisterClassExW(&wndclass);
4811 return CreateWindowW(wszHTMLDocumentTest, wszHTMLDocumentTest,
4812 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
4813 515, 530, NULL, NULL, NULL, NULL);
4816 static void test_DoVerb(IOleObject *oleobj)
4818 RECT rect = {0,0,500,500};
4821 if(!container_locked) {
4822 SET_EXPECT(GetContainer);
4823 SET_EXPECT(LockContainer);
4825 SET_EXPECT(ActivateMe);
4826 expect_LockContainer_fLock = TRUE;
4828 hres = IOleObject_DoVerb(oleobj, OLEIVERB_SHOW, NULL, &ClientSite, -1, container_hwnd, &rect);
4829 ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
4831 if(!container_locked) {
4832 CHECK_CALLED(GetContainer);
4833 CHECK_CALLED(LockContainer);
4834 container_locked = TRUE;
4836 CHECK_CALLED(ActivateMe);
4839 #define CLIENTSITE_EXPECTPATH 0x00000001
4840 #define CLIENTSITE_SETNULL 0x00000002
4841 #define CLIENTSITE_DONTSET 0x00000004
4843 static void test_ClientSite(IOleObject *oleobj, DWORD flags)
4845 IOleClientSite *clientsite;
4848 if(flags & CLIENTSITE_SETNULL) {
4849 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4850 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4852 ok(clientsite == &ClientSite, "clientsite=%p, expected %p\n", clientsite, &ClientSite);
4854 ok(!clientsite, "clientsite != NULL\n");
4856 hres = IOleObject_SetClientSite(oleobj, NULL);
4857 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4859 set_clientsite = FALSE;
4862 if(flags & CLIENTSITE_DONTSET)
4865 if(!expect_uihandler_iface)
4866 expect_uihandler_iface = &DocHostUIHandler;
4868 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4869 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4870 ok(clientsite == (set_clientsite ? &ClientSite : NULL), "GetClientSite() = %p, expected %p\n",
4871 clientsite, set_clientsite ? &ClientSite : NULL);
4873 if(!set_clientsite) {
4874 if(expect_uihandler_iface)
4875 SET_EXPECT(GetHostInfo);
4876 if(flags & CLIENTSITE_EXPECTPATH) {
4877 SET_EXPECT(GetOptionKeyPath);
4878 SET_EXPECT(GetOverrideKeyPath);
4880 SET_EXPECT(GetWindow);
4881 if(flags & CLIENTSITE_EXPECTPATH)
4882 SET_EXPECT(Exec_DOCCANNAVIGATE);
4883 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
4884 SET_EXPECT(Exec_SETPROGRESSMAX);
4885 SET_EXPECT(Exec_SETPROGRESSPOS);
4886 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4887 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4888 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4889 SET_EXPECT(Invoke_AMBIENT_SILENT);
4890 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4891 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4892 SET_EXPECT(GetTravelLog);
4894 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4895 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4897 if(expect_uihandler_iface)
4898 CHECK_CALLED(GetHostInfo);
4899 if(flags & CLIENTSITE_EXPECTPATH) {
4900 CHECK_CALLED(GetOptionKeyPath);
4901 CHECK_CALLED(GetOverrideKeyPath);
4903 CHECK_CALLED(GetWindow);
4904 if(flags & CLIENTSITE_EXPECTPATH)
4905 CHECK_CALLED(Exec_DOCCANNAVIGATE);
4906 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
4907 CHECK_CALLED(Exec_SETPROGRESSMAX);
4908 CHECK_CALLED(Exec_SETPROGRESSPOS);
4909 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4910 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4911 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4912 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4913 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4914 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4915 todo_wine CHECK_CALLED(GetTravelLog);
4917 set_clientsite = TRUE;
4920 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
4921 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
4923 hres = IOleObject_GetClientSite(oleobj, &clientsite);
4924 ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
4925 ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
4928 static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
4930 IOleControl *control = NULL;
4933 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
4934 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
4938 SET_EXPECT(Invoke_AMBIENT_USERMODE);
4939 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERMODE);
4940 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4941 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
4943 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4944 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_DLCONTROL);
4945 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4946 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4948 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4949 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4950 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
4951 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4952 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4953 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
4955 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
4956 SET_EXPECT(Invoke_AMBIENT_SILENT);
4957 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_SILENT);
4958 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4959 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
4960 CHECK_CALLED(Invoke_AMBIENT_SILENT);
4962 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
4963 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_USERAGENT);
4964 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4965 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
4967 SET_EXPECT(Invoke_AMBIENT_PALETTE);
4968 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
4969 ok(hres == S_OK, "OnAmbientChange failed: %08x\n", hres);
4970 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
4972 IOleControl_Release(control);
4977 static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
4979 IOleControl *control = NULL;
4982 hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
4983 ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
4987 hres = IOleControl_OnAmbientPropertyChange(control, DISPID_AMBIENT_PALETTE);
4988 ok(hres == S_OK, "OnAmbientPropertyChange failed: %08x\n", hres);
4990 IOleControl_Release(control);
4993 static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
4995 IOleObject *oleobj = NULL;
4998 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
4999 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5003 SET_EXPECT(GetContainer);
5004 SET_EXPECT(LockContainer);
5005 expect_LockContainer_fLock = FALSE;
5006 hres = IOleObject_Close(oleobj, OLECLOSE_NOSAVE);
5007 ok(hres == S_OK, "Close failed: %08x\n", hres);
5008 CHECK_CALLED(GetContainer);
5009 CHECK_CALLED(LockContainer);
5010 container_locked = FALSE;
5013 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5015 IOleObject_Release(oleobj);
5018 static void test_Advise(IHTMLDocument2 *doc)
5020 IOleObject *oleobj = NULL;
5021 IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
5025 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5026 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5030 hres = IOleObject_Unadvise(oleobj, 0);
5031 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5033 hres = IOleObject_EnumAdvise(oleobj, &enum_advise);
5034 ok(hres == S_OK, "EnumAdvise returned: %08x\n", hres);
5035 ok(enum_advise == NULL, "enum_advise != NULL\n");
5038 hres = IOleObject_Advise(oleobj, NULL, &conn);
5039 /* Old IE returns S_OK and sets conn to 1 */
5040 ok(hres == E_INVALIDARG || hres == S_OK, "Advise returned: %08x\n", hres);
5041 ok(conn == 0 || conn == 1, "conn = %d\n", conn);
5043 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, NULL);
5044 ok(hres == E_INVALIDARG, "Advise returned: %08x\n", hres);
5046 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5047 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5048 ok(conn == 1, "conn = %d\n", conn);
5050 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5051 ok(hres == S_OK, "Advise returned: %08x\n", hres);
5052 ok(conn == 2, "conn = %d\n", conn);
5054 hres = IOleObject_Unadvise(oleobj, 1);
5055 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5057 hres = IOleObject_Unadvise(oleobj, 1);
5058 ok(hres == OLE_E_NOCONNECTION, "Unadvise returned: %08x\n", hres);
5060 hres = IOleObject_Unadvise(oleobj, 2);
5061 ok(hres == S_OK, "Unadvise returned: %08x\n", hres);
5063 IOleObject_Release(oleobj);
5066 static void test_OnFrameWindowActivate(IUnknown *unk)
5068 IOleInPlaceActiveObject *inplaceact;
5071 hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceActiveObject, (void**)&inplaceact);
5072 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceActiveObject) failed: %08x\n", hres);
5076 if(set_clientsite) {
5077 expect_OnFrameWindowActivate_fActivate = TRUE;
5078 SET_EXPECT(OnFrameWindowActivate);
5079 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5080 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5081 CHECK_CALLED(OnFrameWindowActivate);
5083 SET_EXPECT(OnFrameWindowActivate);
5084 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5085 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5086 CHECK_CALLED(OnFrameWindowActivate);
5088 expect_OnFrameWindowActivate_fActivate = FALSE;
5089 SET_EXPECT(OnFrameWindowActivate);
5090 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5091 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5092 CHECK_CALLED(OnFrameWindowActivate);
5094 expect_OnFrameWindowActivate_fActivate = TRUE;
5095 SET_EXPECT(OnFrameWindowActivate);
5096 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5097 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5098 CHECK_CALLED(OnFrameWindowActivate);
5100 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, FALSE);
5101 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5103 hres = IOleInPlaceActiveObject_OnFrameWindowActivate(inplaceact, TRUE);
5104 ok(hres == S_OK, "OnFrameWindowActivate failed: %08x\n", hres);
5107 IOleInPlaceActiveObject_Release(inplaceact);
5110 static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
5112 IOleInPlaceObjectWindowless *windowlessobj = NULL;
5115 hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
5116 (void**)&windowlessobj);
5117 ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
5122 SET_EXPECT(OnFocus_FALSE);
5124 SET_EXPECT(OnInPlaceDeactivateEx);
5126 SET_EXPECT(OnInPlaceDeactivate);
5128 hres = IOleInPlaceObjectWindowless_InPlaceDeactivate(windowlessobj);
5129 ok(hres == S_OK, "InPlaceDeactivate failed: %08x\n", hres);
5131 CHECK_CALLED(OnFocus_FALSE);
5133 CHECK_CALLED(OnInPlaceDeactivateEx);
5135 CHECK_CALLED(OnInPlaceDeactivate);
5138 IOleInPlaceObjectWindowless_Release(windowlessobj);
5141 static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
5143 IOleObject *oleobj = NULL;
5144 IOleDocumentView *docview;
5151 IOleDocumentView_Release(view);
5154 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5155 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
5157 hres = IOleObject_GetUserClassID(oleobj, NULL);
5158 ok(hres == E_INVALIDARG, "GetUserClassID returned: %08x, expected E_INVALIDARG\n", hres);
5160 hres = IOleObject_GetUserClassID(oleobj, &guid);
5161 ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
5162 ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
5164 test_OnFrameWindowActivate((IUnknown*)doc);
5166 test_ClientSite(oleobj, flags);
5167 test_InPlaceDeactivate(doc, FALSE);
5168 test_DoVerb(oleobj);
5170 if(call_UIActivate == CallUIActivate_AfterShow) {
5171 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5172 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5174 SET_EXPECT(OnFocus_TRUE);
5175 SET_EXPECT(SetActiveObject);
5177 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5178 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5179 expect_status_text = NULL;
5181 hres = IOleDocumentView_UIActivate(docview, TRUE);
5182 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5184 CHECK_CALLED(OnFocus_TRUE);
5185 CHECK_CALLED(SetActiveObject);
5186 CHECK_CALLED(ShowUI);
5187 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5188 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5190 IOleDocumentView_Release(docview);
5193 IOleObject_Release(oleobj);
5195 test_OnFrameWindowActivate((IUnknown*)doc);
5198 static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
5200 IOleInPlaceActiveObject *activeobject = NULL;
5204 hres = IOleDocumentView_QueryInterface(view, &IID_IOleInPlaceActiveObject, (void**)&activeobject);
5205 ok(hres == S_OK, "Could not get IOleInPlaceActiveObject interface: %08x\n", hres);
5209 hres = IOleInPlaceActiveObject_GetWindow(activeobject, &tmp_hwnd);
5211 if(expect_success) {
5212 ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
5213 ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd);
5215 ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
5216 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5219 IOleInPlaceActiveObject_Release(activeobject);
5222 static void test_CloseView(void)
5224 IOleInPlaceSite *inplacesite = (IOleInPlaceSite*)0xff00ff00;
5230 hres = IOleDocumentView_Show(view, FALSE);
5231 ok(hres == S_OK, "Show failed: %08x\n", hres);
5233 hres = IOleDocumentView_CloseView(view, 0);
5234 ok(hres == S_OK, "CloseView failed: %08x\n", hres);
5236 hres = IOleDocumentView_SetInPlaceSite(view, NULL);
5237 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5239 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
5240 ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
5241 ok(inplacesite == NULL, "inplacesite=%p, expected NULL\n", inplacesite);
5244 static void test_UIDeactivate(void)
5248 if(call_UIActivate == CallUIActivate_AfterShow) {
5249 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5251 if(call_UIActivate != CallUIActivate_None) {
5252 SET_EXPECT(SetActiveObject_null);
5254 SET_EXPECT(OnUIDeactivate);
5257 hres = IOleDocumentView_UIActivate(view, FALSE);
5258 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
5260 if(call_UIActivate != CallUIActivate_None) {
5261 CHECK_CALLED(SetActiveObject_null);
5262 CHECK_CALLED(HideUI);
5263 CHECK_CALLED(OnUIDeactivate);
5265 if(call_UIActivate == CallUIActivate_AfterShow) {
5266 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5270 static void test_Hide(void)
5277 hres = IOleDocumentView_Show(view, FALSE);
5278 ok(hres == S_OK, "Show failed: %08x\n", hres);
5281 static IHTMLDocument2 *create_document(void)
5283 IHTMLDocument2 *doc;
5286 hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
5287 &IID_IHTMLDocument2, (void**)&doc);
5288 ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
5295 static void release_document(IHTMLDocument2 *doc)
5301 /* Some broken IEs don't like if the last released reference is IHTMLDocument2 iface.
5302 * To workaround it, we release it via IUnknown iface */
5303 hres = IHTMLDocument2_QueryInterface(doc, &IID_IUnknown, (void**)&unk);
5304 ok(hres == S_OK, "Could not get IUnknown iface: %08x\n", hres);
5306 IHTMLDocument2_Release(doc);
5307 ref = IUnknown_Release(unk);
5308 ok(!ref, "ref = %d\n", ref);
5311 static void test_Navigate(IHTMLDocument2 *doc)
5313 IHlinkTarget *hlink;
5316 hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
5317 ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
5319 SET_EXPECT(ActivateMe);
5320 hres = IHlinkTarget_Navigate(hlink, 0, NULL);
5321 ok(hres == S_OK, "Navigate failed: %08x\n", hres);
5322 CHECK_CALLED(ActivateMe);
5324 IHlinkTarget_Release(hlink);
5327 static void test_external(IHTMLDocument2 *doc, BOOL initialized)
5329 IDispatch *external;
5330 IHTMLWindow2 *htmlwin;
5333 hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
5334 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5337 SET_EXPECT(GetExternal);
5338 external = (void*)0xdeadbeef;
5339 hres = IHTMLWindow2_get_external(htmlwin, &external);
5341 ok(hres == S_FALSE || hres == S_OK, "get_external failed: %08x\n", hres);
5342 CHECK_CALLED(GetExternal);
5343 ok(external != NULL, "external == NULL\n");
5345 ok(hres == S_OK, "get_external failed: %08x\n", hres);
5346 ok(external == NULL, "external != NULL\n");
5349 IHTMLWindow2_Release(htmlwin);
5352 static void test_StreamLoad(IHTMLDocument2 *doc)
5354 IPersistStreamInit *init;
5357 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5358 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5362 SET_EXPECT(Invoke_AMBIENT_SILENT);
5363 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5364 SET_EXPECT(Exec_ShellDocView_37);
5365 SET_EXPECT(OnChanged_READYSTATE);
5366 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5368 SET_EXPECT(GetPendingUrl);
5369 readystate_set_loading = TRUE;
5371 hres = IPersistStreamInit_Load(init, &Stream);
5372 ok(hres == S_OK, "Load failed: %08x\n", hres);
5374 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5375 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5376 CHECK_CALLED(Exec_ShellDocView_37);
5377 CHECK_CALLED(OnChanged_READYSTATE);
5378 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5380 todo_wine CHECK_CALLED(GetPendingUrl);
5382 test_timer(EXPECT_SETTITLE);
5383 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5385 IPersistStreamInit_Release(init);
5388 static void test_StreamInitNew(IHTMLDocument2 *doc)
5390 IPersistStreamInit *init;
5393 hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
5394 ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
5398 SET_EXPECT(Invoke_AMBIENT_SILENT);
5399 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5400 SET_EXPECT(Exec_ShellDocView_37);
5401 SET_EXPECT(OnChanged_READYSTATE);
5402 SET_EXPECT(Invoke_OnReadyStateChange_Loading);
5403 SET_EXPECT(GetPendingUrl);
5404 readystate_set_loading = TRUE;
5406 hres = IPersistStreamInit_InitNew(init);
5407 ok(hres == S_OK, "Load failed: %08x\n", hres);
5409 CHECK_CALLED(Invoke_AMBIENT_SILENT);
5410 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
5411 CHECK_CALLED(Exec_ShellDocView_37);
5412 CHECK_CALLED(OnChanged_READYSTATE);
5413 CHECK_CALLED(Invoke_OnReadyStateChange_Loading);
5414 todo_wine CHECK_CALLED(GetPendingUrl);
5416 test_timer(EXPECT_SETTITLE);
5417 test_GetCurMoniker((IUnknown*)doc, NULL, "about:blank");
5419 IPersistStreamInit_Release(init);
5422 static void test_QueryInterface(IHTMLDocument2 *doc)
5427 static const IID IID_UndocumentedScriptIface =
5428 {0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
5430 qi = (void*)0xdeadbeef;
5431 hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
5432 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5433 ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
5435 qi = (void*)0xdeadbeef;
5436 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
5437 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5438 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5440 qi = (void*)0xdeadbeef;
5441 hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
5442 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5443 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5445 qi = (void*)0xdeadbeef;
5446 hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
5447 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5448 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5450 qi = (void*)0xdeadbeef;
5451 hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
5452 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5453 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5455 qi = (void*)0xdeadbeef;
5456 hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
5457 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5458 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5460 qi = (void*)0xdeadbeef;
5461 hres = IUnknown_QueryInterface(doc, &IID_IExternalConnection, (void**)&qi);
5462 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5463 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5465 qi = (void*)0xdeadbeef;
5466 hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
5467 ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
5468 ok(qi == NULL, "qi=%p, expected NULL\n", qi);
5470 hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
5471 ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
5472 ok(qi != (IUnknown*)doc, "disp == doc\n");
5473 IUnknown_Release(qi);
5476 static void init_test(enum load_state_t ls) {
5478 hwnd = last_hwnd = NULL;
5479 set_clientsite = FALSE;
5480 load_from_stream = FALSE;
5481 call_UIActivate = CallUIActivate_None;
5488 inplace_deactivated = FALSE;
5490 expect_uihandler_iface = &DocHostUIHandler;
5493 static void test_HTMLDocument(BOOL do_load)
5495 IHTMLDocument2 *doc;
5497 trace("Testing HTMLDocument (%s)...\n", (do_load ? "load" : "no load"));
5499 init_test(do_load ? LD_DOLOAD : LD_NO);
5501 doc = create_document();
5502 doc_unk = (IUnknown*)doc;
5504 test_QueryInterface(doc);
5506 test_IsDirty(doc, S_FALSE);
5507 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5508 test_external(doc, FALSE);
5509 test_ViewAdviseSink(doc);
5510 test_ConnectionPointContainer(doc);
5511 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5512 test_Persist(doc, &Moniker);
5514 test_OnAmbientPropertyChange2(doc);
5516 test_Activate(doc, CLIENTSITE_EXPECTPATH);
5519 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5520 test_download(DWL_CSS|DWL_TRYCSS);
5521 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5524 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5525 test_OleCommandTarget_fail(doc);
5526 test_OleCommandTarget(doc);
5527 test_OnAmbientPropertyChange(doc);
5528 test_Window(doc, TRUE);
5529 test_external(doc, TRUE);
5531 test_UIDeactivate();
5532 test_OleCommandTarget(doc);
5533 test_Window(doc, TRUE);
5534 test_InPlaceDeactivate(doc, TRUE);
5536 /* Calling test_OleCommandTarget here causes Segmentation Fault with native
5537 * MSHTML. It doesn't with Wine. */
5539 test_Window(doc, FALSE);
5541 test_InPlaceDeactivate(doc, FALSE);
5543 test_Close(doc, FALSE);
5545 /* Activate HTMLDocument again */
5546 test_Activate(doc, CLIENTSITE_SETNULL);
5547 test_Window(doc, TRUE);
5548 test_OleCommandTarget(doc);
5549 test_UIDeactivate();
5550 test_InPlaceDeactivate(doc, TRUE);
5551 test_Close(doc, FALSE);
5553 /* Activate HTMLDocument again, this time without UIActivate */
5554 call_UIActivate = CallUIActivate_None;
5555 test_Activate(doc, CLIENTSITE_SETNULL);
5556 test_Window(doc, TRUE);
5558 test_external(doc, TRUE);
5559 set_custom_uihandler(doc, NULL);
5560 test_external(doc, FALSE);
5562 test_UIDeactivate();
5563 test_InPlaceDeactivate(doc, TRUE);
5566 test_Close(doc, TRUE);
5567 test_OnAmbientPropertyChange2(doc);
5568 test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
5571 /* Activate HTMLDocument again, calling UIActivate after showing the window */
5572 call_UIActivate = CallUIActivate_AfterShow;
5573 test_Activate(doc, 0);
5574 test_Window(doc, TRUE);
5575 test_OleCommandTarget(doc);
5576 test_UIDeactivate();
5577 test_InPlaceDeactivate(doc, TRUE);
5578 test_Close(doc, FALSE);
5579 call_UIActivate = CallUIActivate_None;
5583 IOleDocumentView_Release(view);
5586 ok(IsWindow(hwnd), "hwnd is destroyed\n");
5587 release_document(doc);
5588 ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
5591 static void test_HTMLDocument_hlink(DWORD status)
5593 IHTMLDocument2 *doc;
5595 trace("Testing HTMLDocument (hlink)...\n");
5597 init_test(LD_DOLOAD);
5600 doc = create_document();
5601 doc_unk = (IUnknown*)doc;
5603 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5604 test_ViewAdviseSink(doc);
5605 test_ConnectionPointContainer(doc);
5606 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5607 test_Persist(doc, &Moniker);
5610 status_code = status;
5611 test_download(DWL_CSS|DWL_TRYCSS);
5612 status_code = HTTP_STATUS_OK;
5614 test_IsDirty(doc, S_FALSE);
5615 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5617 test_exec_onunload(doc);
5618 test_Window(doc, TRUE);
5619 test_InPlaceDeactivate(doc, TRUE);
5620 test_Close(doc, FALSE);
5621 test_IsDirty(doc, S_FALSE);
5622 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5624 test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
5627 IOleDocumentView_Release(view);
5630 release_document(doc);
5633 static void test_cookies(IHTMLDocument2 *doc)
5641 hres = IHTMLDocument2_get_cookie(doc, &str);
5642 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5644 size = sizeof(buf)/sizeof(WCHAR);
5645 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5646 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5647 ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
5651 str = a2bstr("test=testval");
5652 hres = IHTMLDocument2_put_cookie(doc, str);
5653 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5656 hres = IHTMLDocument2_get_cookie(doc, &str2);
5657 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5658 ok(str2 != NULL, "cookie = NULL\n");
5659 size = sizeof(buf)/sizeof(WCHAR);
5660 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5661 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5662 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5663 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5665 SysFreeString(str2);
5667 str = a2bstr("test=testval2");
5668 hres = IHTMLDocument2_put_cookie(doc, str);
5669 ok(hres == S_OK, "put_cookie failed: %08x\n", hres);
5672 hres = IHTMLDocument2_get_cookie(doc, &str2);
5673 ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
5674 ok(str2 != NULL, "cookie = NULL\n");
5675 size = sizeof(buf)/sizeof(WCHAR);
5676 b = InternetGetCookieW(http_urlW, NULL, buf, &size);
5677 ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
5678 ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
5679 ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
5681 SysFreeString(str2);
5684 static void test_HTMLDocument_http(void)
5687 IHTMLDocument2 *doc;
5691 trace("Testing HTMLDocument (http)...\n");
5693 if(!winetest_interactive && is_ie_hardened()) {
5694 win_skip("IE running in Enhanced Security Configuration\n");
5698 init_test(LD_DOLOAD);
5701 doc = create_document();
5702 doc_unk = (IUnknown*)doc;
5704 hres = CreateURLMoniker(NULL, http_urlW, &http_mon);
5705 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
5707 test_ViewAdviseSink(doc);
5708 test_ConnectionPointContainer(doc);
5709 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5710 test_Persist(doc, http_mon);
5712 test_download(DWL_HTTP);
5714 test_IsDirty(doc, S_FALSE);
5715 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5716 test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
5718 nav_url = "http://www.winehq.org/"; /* for valid prev nav_url */
5719 test_put_href(doc, FALSE, "javascript:external&&undefined", TRUE);
5721 test_put_href(doc, FALSE, "about:blank", FALSE);
5722 test_put_href(doc, TRUE, "about:replace", FALSE);
5724 test_open_window(doc);
5726 test_InPlaceDeactivate(doc, TRUE);
5727 test_Close(doc, FALSE);
5728 test_IsDirty(doc, S_FALSE);
5729 test_GetCurMoniker((IUnknown*)doc, NULL, "about:replace");
5732 IOleDocumentView_Release(view);
5735 release_document(doc);
5737 ref = IMoniker_Release(http_mon);
5738 ok(!ref, "ref=%d, expected 0\n", ref);
5741 static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
5743 IHTMLWindow2 *window, *sp_window;
5744 IServiceProvider *sp;
5748 hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
5749 ok(hres == S_OK, "QueryService returned %08x\n", hres);
5751 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5753 ok(hres == E_NOINTERFACE, "QueryService returned %08x, expected E_NOINTERFACE\n", hres);
5754 IServiceProvider_Release(sp);
5758 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5759 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5760 IHlinkFrame_Release(hf);
5762 IServiceProvider_Release(sp);
5764 hres = IHTMLDocument2_get_parentWindow(doc, &window);
5765 ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
5767 hres = IHTMLWindow2_QueryInterface(window, &IID_IServiceProvider, (void**)&sp);
5768 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
5770 hres = IServiceProvider_QueryService(sp, &IID_IHTMLWindow2, &IID_IHTMLWindow2, (void**)&sp_window);
5771 ok(hres == S_OK, "QueryService(IID_IHTMLWindow2) failed: %08x\n", hres);
5772 /* FIXME: test returned window */
5773 IHTMLWindow2_Release(sp_window);
5775 hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
5776 ok(hres == S_OK, "QueryService(IID_IHlinkFrame) failed: %08x\n", hres);
5777 ok(hf == &HlinkFrame, "hf != HlinkFrame\n");
5778 IHlinkFrame_Release(hf);
5780 IServiceProvider_Release(sp);
5781 IHTMLWindow2_Release(window);
5784 static void test_HTMLDocument_StreamLoad(void)
5786 IHTMLDocument2 *doc;
5791 trace("Testing HTMLDocument (IPersistStreamInit)...\n");
5793 init_test(LD_DOLOAD);
5794 load_from_stream = TRUE;
5796 doc = create_document();
5797 doc_unk = (IUnknown*)doc;
5799 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5800 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5802 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5803 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5805 test_readyState((IUnknown*)doc);
5806 test_IsDirty(doc, S_FALSE);
5807 test_ViewAdviseSink(doc);
5808 test_ConnectionPointContainer(doc);
5809 test_QueryService(doc, FALSE);
5810 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5811 test_QueryService(doc, TRUE);
5812 test_DoVerb(oleobj);
5813 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5815 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5816 test_StreamLoad(doc);
5817 test_download(DWL_VERBDONE|DWL_TRYCSS);
5818 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5820 test_UIDeactivate();
5821 test_InPlaceDeactivate(doc, TRUE);
5822 SET_EXPECT(Advise_Close);
5823 test_Close(doc, TRUE);
5824 CHECK_CALLED(Advise_Close);
5825 test_external(doc, FALSE);
5826 test_IsDirty(doc, S_FALSE);
5828 set_custom_uihandler(doc, &CustomDocHostUIHandler);
5829 test_ClientSite(oleobj, CLIENTSITE_SETNULL);
5830 test_external(doc, TRUE);
5831 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5832 test_external(doc, TRUE);
5833 set_custom_uihandler(doc, NULL);
5834 test_ClientSite(oleobj, CLIENTSITE_SETNULL|CLIENTSITE_DONTSET);
5836 IOleObject_Release(oleobj);
5838 IOleDocumentView_Release(view);
5842 release_document(doc);
5845 static void test_HTMLDocument_StreamInitNew(void)
5847 IHTMLDocument2 *doc;
5852 trace("Testing HTMLDocument (IPersistStreamInit::InitNew)...\n");
5854 init_test(LD_DOLOAD);
5855 load_from_stream = TRUE;
5857 doc = create_document();
5858 doc_unk = (IUnknown*)doc;
5860 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5861 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5863 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5864 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5866 test_readyState((IUnknown*)doc);
5867 test_IsDirty(doc, S_FALSE);
5868 test_ViewAdviseSink(doc);
5869 test_ConnectionPointContainer(doc);
5870 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5871 test_DoVerb(oleobj);
5872 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5874 IOleObject_Release(oleobj);
5876 test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
5877 test_StreamInitNew(doc);
5879 SET_EXPECT(Invoke_OnReadyStateChange_Interactive);
5880 test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
5881 todo_wine CHECK_NOT_CALLED(Invoke_OnReadyStateChange_Interactive);
5883 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5885 test_UIDeactivate();
5886 test_InPlaceDeactivate(doc, TRUE);
5887 SET_EXPECT(Advise_Close);
5888 test_Close(doc, FALSE);
5889 CHECK_CALLED(Advise_Close);
5890 test_IsDirty(doc, S_FALSE);
5893 IOleDocumentView_Release(view);
5897 release_document(doc);
5900 static void test_edit_uiactivate(IOleObject *oleobj)
5902 IOleDocumentView *docview;
5905 hres = IOleObject_QueryInterface(oleobj, &IID_IOleDocumentView, (void **)&docview);
5906 ok(hres == S_OK, "IOleObject_QueryInterface failed with error 0x%08x\n", hres);
5908 SET_EXPECT(OnFocus_TRUE);
5909 SET_EXPECT(SetActiveObject);
5911 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
5912 SET_EXPECT(InPlaceFrame_SetBorderSpace);
5913 expect_status_text = NULL;
5915 hres = IOleDocumentView_UIActivate(docview, TRUE);
5916 ok(hres == S_OK, "IOleDocumentView_UIActivate failed with error 0x%08x\n", hres);
5918 CHECK_CALLED(OnFocus_TRUE);
5919 CHECK_CALLED(SetActiveObject);
5920 CHECK_CALLED(ShowUI);
5921 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
5922 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
5924 IOleDocumentView_Release(docview);
5927 static void test_editing_mode(BOOL do_load)
5929 IHTMLDocument2 *doc;
5935 trace("Testing HTMLDocument (edit%s)...\n", do_load ? " load" : "");
5937 init_test(do_load ? LD_DOLOAD : LD_NO);
5938 call_UIActivate = CallUIActivate_AfterShow;
5940 doc = create_document();
5941 unk = doc_unk = (IUnknown*)doc;
5943 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
5944 ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
5946 hres = IOleObject_Advise(oleobj, (IAdviseSink*)&AdviseSink, &conn);
5947 ok(hres == S_OK, "Advise failed: %08x\n", hres);
5949 test_readyState((IUnknown*)doc);
5950 test_ViewAdviseSink(doc);
5951 test_ConnectionPointContainer(doc);
5952 test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
5953 test_DoVerb(oleobj);
5954 test_edit_uiactivate(oleobj);
5956 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5958 test_Persist(doc, &Moniker);
5959 stream_read = protocol_read = 0;
5960 test_exec_editmode(unk, do_load);
5961 test_UIDeactivate();
5962 call_UIActivate = CallUIActivate_None;
5963 IOleObject_Release(oleobj);
5965 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
5966 test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
5968 SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
5969 test_timer(EXPECT_UPDATEUI);
5970 SET_CALLED(SetStatusText);
5972 test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5975 test_exec_fontname(unk, NULL, wszTimesNewRoman);
5976 test_exec_fontname(unk, wszArial, wszTimesNewRoman);
5977 test_timer(EXPECT_UPDATEUI);
5978 test_exec_fontname(unk, NULL, wszArial);
5980 test_exec_noargs(unk, IDM_JUSTIFYRIGHT);
5981 test_timer(EXPECT_UPDATEUI);
5982 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
5983 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
5985 test_exec_noargs(unk, IDM_JUSTIFYCENTER);
5986 test_timer(EXPECT_UPDATEUI);
5987 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYRIGHT,
5988 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5989 test_QueryStatus(unk, &CGID_MSHTML, IDM_JUSTIFYCENTER,
5990 OLECMDF_SUPPORTED|OLECMDF_ENABLED|OLECMDF_LATCHED);
5992 test_exec_noargs(unk, IDM_HORIZONTALLINE);
5993 test_timer(EXPECT_UPDATEUI);
5994 test_QueryStatus(unk, &CGID_MSHTML, IDM_HORIZONTALLINE,
5995 OLECMDF_SUPPORTED|OLECMDF_ENABLED);
5998 test_UIDeactivate();
5999 test_InPlaceDeactivate(doc, TRUE);
6000 SET_EXPECT(Advise_Close);
6001 test_Close(doc, FALSE);
6002 CHECK_CALLED(Advise_Close);
6005 IOleDocumentView_Release(view);
6009 release_document(doc);
6012 static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
6014 IHTMLDocument2 *doc;
6016 IOleInPlaceSite *inplacesite;
6019 trace("Running OleDocumentView_UIActivate tests (%d %d %d)\n", do_load, use_ipsex, use_ipsw);
6021 init_test(do_load ? LD_DOLOAD : LD_NO);
6023 doc = create_document();
6024 doc_unk = (IUnknown*)doc;
6029 hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
6030 ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
6032 hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
6033 ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
6035 SET_EXPECT(Invoke_AMBIENT_USERMODE);
6036 SET_EXPECT(GetHostInfo);
6037 SET_EXPECT(Invoke_AMBIENT_DLCONTROL);
6038 SET_EXPECT(Invoke_AMBIENT_SILENT);
6039 SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6040 SET_EXPECT(Invoke_AMBIENT_USERAGENT);
6041 SET_EXPECT(Invoke_AMBIENT_PALETTE);
6042 SET_EXPECT(GetOptionKeyPath);
6043 SET_EXPECT(GetOverrideKeyPath);
6044 SET_EXPECT(GetWindow);
6045 SET_EXPECT(Exec_DOCCANNAVIGATE);
6046 SET_EXPECT(QueryStatus_SETPROGRESSTEXT);
6047 SET_EXPECT(Exec_SETPROGRESSMAX);
6048 SET_EXPECT(Exec_SETPROGRESSPOS);
6049 SET_EXPECT(GetTravelLog);
6051 hres = IOleObject_SetClientSite(oleobj, &ClientSite);
6052 ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
6053 set_clientsite = TRUE;
6055 CHECK_CALLED(Invoke_AMBIENT_USERMODE);
6056 CHECK_CALLED(GetHostInfo);
6057 CHECK_CALLED(Invoke_AMBIENT_DLCONTROL);
6058 CHECK_CALLED(Invoke_AMBIENT_SILENT);
6059 CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
6060 CHECK_CALLED(Invoke_AMBIENT_USERAGENT);
6061 CHECK_CALLED(Invoke_AMBIENT_PALETTE);
6062 CHECK_CALLED(GetOptionKeyPath);
6063 CHECK_CALLED(GetOverrideKeyPath);
6064 CHECK_CALLED(GetWindow);
6065 CHECK_CALLED(Exec_DOCCANNAVIGATE);
6066 CHECK_CALLED(QueryStatus_SETPROGRESSTEXT);
6067 CHECK_CALLED(Exec_SETPROGRESSMAX);
6068 CHECK_CALLED(Exec_SETPROGRESSPOS);
6069 todo_wine CHECK_CALLED(GetTravelLog);
6071 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6072 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6073 ok(inplacesite == NULL, "inplacesite = %p, expected NULL\n", inplacesite);
6075 SET_EXPECT(GetContainer);
6076 SET_EXPECT(LockContainer);
6077 SET_EXPECT(CanInPlaceActivate);
6078 SET_EXPECT(GetWindowContext);
6079 SET_EXPECT(GetWindow);
6081 SET_EXPECT(OnInPlaceActivateEx);
6082 SET_EXPECT(RequestUIActivate);
6085 SET_EXPECT(OnInPlaceActivate);
6086 SET_EXPECT(OnUIActivate);
6087 SET_EXPECT(SetStatusText);
6088 SET_EXPECT(Exec_SETPROGRESSMAX);
6089 SET_EXPECT(Exec_SETPROGRESSPOS);
6091 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6092 SET_EXPECT(InPlaceFrame_SetBorderSpace);
6093 SET_EXPECT(OnFocus_TRUE);
6094 SET_EXPECT(SetActiveObject);
6095 expect_LockContainer_fLock = TRUE;
6097 hres = IOleDocumentView_UIActivate(view, TRUE);
6098 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6100 CHECK_CALLED(GetContainer);
6101 CHECK_CALLED(LockContainer);
6102 CHECK_CALLED(CanInPlaceActivate);
6103 CHECK_CALLED(GetWindowContext);
6104 CHECK_CALLED(GetWindow);
6106 CHECK_CALLED(OnInPlaceActivateEx);
6107 SET_EXPECT(RequestUIActivate);
6110 CHECK_CALLED(OnInPlaceActivate);
6111 CHECK_CALLED(OnUIActivate);
6112 CHECK_CALLED(SetStatusText);
6113 CHECK_CALLED(Exec_SETPROGRESSMAX);
6114 CHECK_CALLED(Exec_SETPROGRESSPOS);
6115 CHECK_CALLED(ShowUI);
6116 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6117 CHECK_CALLED(InPlaceFrame_SetBorderSpace);
6118 CHECK_CALLED(OnFocus_TRUE);
6119 CHECK_CALLED(SetActiveObject);
6120 container_locked = TRUE;
6122 SET_EXPECT(SetActiveObject_null);
6123 SET_EXPECT(InPlaceUIWindow_SetActiveObject);
6125 SET_EXPECT(OnUIDeactivate);
6127 hres = IOleDocumentView_UIActivate(view, FALSE);
6128 ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
6130 CHECK_CALLED(SetActiveObject_null);
6131 CHECK_CALLED(InPlaceUIWindow_SetActiveObject);
6132 CHECK_CALLED(HideUI);
6133 CHECK_CALLED(OnUIDeactivate);
6135 hres = IOleDocumentView_GetInPlaceSite(view, &inplacesite);
6136 ok(hres == S_OK, "GetInPlaceSite failed: %08x\n", hres);
6137 ok(inplacesite != NULL, "inplacesite = NULL\n");
6138 IOleInPlaceSite_Release(inplacesite);
6140 SET_EXPECT(OnFocus_FALSE);
6142 SET_EXPECT(OnInPlaceDeactivateEx);
6144 SET_EXPECT(OnInPlaceDeactivate);
6148 CHECK_CALLED(OnFocus_FALSE);
6150 CHECK_CALLED(OnInPlaceDeactivateEx);
6152 CHECK_CALLED(OnInPlaceDeactivate);
6154 test_Close(doc, TRUE);
6156 IOleObject_Release(oleobj);
6157 IOleDocumentView_Release(view);
6160 release_document(doc);
6163 static void register_protocol(void)
6165 IInternetSession *session;
6168 static const WCHAR wsz_winetest[] = {'w','i','n','e','t','e','s','t',0};
6170 hres = CoInternetGetSession(0, &session, 0);
6171 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
6173 hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL,
6174 wsz_winetest, 0, NULL, 0);
6175 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
6177 IInternetSession_Release(session);
6180 static void test_HTMLDoc_ISupportErrorInfo(void)
6182 IHTMLDocument2 *doc;
6184 ISupportErrorInfo *sinfo;
6186 doc = create_document();
6188 hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
6189 ok(hres == S_OK, "got %x\n", hres);
6190 ok(sinfo != NULL, "got %p\n", sinfo);
6193 hres = ISupportErrorInfo_InterfaceSupportsErrorInfo(sinfo, &IID_IErrorInfo);
6194 ok(hres == S_FALSE, "Expected S_OK, got %x\n", hres);
6195 IUnknown_Release(sinfo);
6198 release_document(doc);
6201 static void test_IPersistHistory(void)
6203 IHTMLDocument2 *doc;
6205 IPersistHistory *phist;
6207 doc = create_document();
6209 hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
6210 ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
6212 IPersistHistory_Release(phist);
6214 release_document(doc);
6217 static BOOL check_ie(void)
6219 IHTMLDocument2 *doc;
6220 IHTMLDocument5 *doc5;
6223 doc = create_document();
6227 hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
6229 IHTMLDocument5_Release(doc5);
6231 release_document(doc);
6232 return SUCCEEDED(hres);
6241 win_skip("Too old IE\n");
6245 container_hwnd = create_container_window();
6246 register_protocol();
6248 asynchronous_binding = TRUE;
6249 test_HTMLDocument_hlink(HTTP_STATUS_NOT_FOUND);
6251 asynchronous_binding = FALSE;
6252 test_HTMLDocument_hlink(HTTP_STATUS_OK);
6253 test_HTMLDocument(FALSE);
6254 test_HTMLDocument(TRUE);
6255 test_HTMLDocument_StreamLoad();
6256 test_HTMLDocument_StreamInitNew();
6257 test_editing_mode(FALSE);
6258 test_editing_mode(TRUE);
6259 test_HTMLDocument_http();
6260 test_UIActivate(FALSE, FALSE, FALSE);
6261 test_UIActivate(FALSE, TRUE, FALSE);
6262 test_UIActivate(FALSE, TRUE, TRUE);
6263 test_UIActivate(TRUE, FALSE, FALSE);
6264 test_UIActivate(TRUE, TRUE, FALSE);
6265 test_UIActivate(TRUE, TRUE, TRUE);
6266 test_HTMLDoc_ISupportErrorInfo();
6267 test_IPersistHistory();
6269 DestroyWindow(container_hwnd);