[MSXML3_WINETEST]
[reactos.git] / rostests / winetests / msxml3 / httpreq.c
1 /*
2 * XML test
3 *
4 * Copyright 2010-2012 Nikolay Sivov for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #define WIN32_NO_STATUS
22 #define _INC_WINDOWS
23 #define COM_NO_WINDOWS_H
24
25 #define COBJMACROS
26 #define CONST_VTABLE
27
28 #include <stdio.h>
29 #include <assert.h>
30
31 //#include "windows.h"
32
33 #include <wine/test.h>
34
35 #include <winnls.h>
36 #include <wingdi.h>
37 #include <ole2.h>
38 //#include "msxml2.h"
39 //#include "msxml2did.h"
40 //#include "dispex.h"
41 #include <initguid.h>
42 #include <objsafe.h>
43 #include <mshtml.h>
44
45
46 #define EXPECT_HR(hr,hr_exp) \
47 ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
48
49 #define EXPECT_REF(node,ref) _expect_ref((IUnknown*)node, ref, __LINE__)
50 static void _expect_ref(IUnknown* obj, ULONG ref, int line)
51 {
52 ULONG rc = IUnknown_AddRef(obj);
53 IUnknown_Release(obj);
54 ok_(__FILE__,line)(rc-1 == ref, "expected refcount %d, got %d\n", ref, rc-1);
55 }
56
57 DEFINE_GUID(SID_SContainerDispatch, 0xb722be00, 0x4e68, 0x101b, 0xa2, 0xbc, 0x00, 0xaa, 0x00, 0x40, 0x47, 0x70);
58 DEFINE_GUID(SID_UnknownSID, 0x75dd09cb, 0x6c40, 0x11d5, 0x85, 0x43, 0x00, 0xc0, 0x4f, 0xa0, 0xfb, 0xa3);
59
60 static BOOL g_enablecallchecks;
61
62 #define DEFINE_EXPECT(func) \
63 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
64
65 #define SET_EXPECT(func) \
66 expect_ ## func = TRUE
67
68 #define CHECK_EXPECT2(func) \
69 do { \
70 if (g_enablecallchecks) \
71 ok(expect_ ##func, "unexpected call " #func "\n"); \
72 called_ ## func = TRUE; \
73 }while(0)
74
75 #define CHECK_CALLED(func) \
76 do { \
77 ok(called_ ## func, "expected " #func "\n"); \
78 expect_ ## func = called_ ## func = FALSE; \
79 }while(0)
80
81 /* object site */
82 DEFINE_EXPECT(site_qi_IServiceProvider);
83 DEFINE_EXPECT(site_qi_IXMLDOMDocument);
84 DEFINE_EXPECT(site_qi_IOleClientSite);
85
86 DEFINE_EXPECT(sp_queryservice_SID_SBindHost);
87 DEFINE_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
88 DEFINE_EXPECT(sp_queryservice_SID_secmgr_htmldoc2);
89 DEFINE_EXPECT(sp_queryservice_SID_secmgr_xmldomdoc);
90 DEFINE_EXPECT(sp_queryservice_SID_secmgr_secmgr);
91
92 DEFINE_EXPECT(htmldoc2_get_all);
93 DEFINE_EXPECT(htmldoc2_get_url);
94 DEFINE_EXPECT(collection_get_length);
95
96 static int g_unexpectedcall, g_expectedcall;
97
98 static BSTR alloc_str_from_narrow(const char *str)
99 {
100 int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
101 BSTR ret = SysAllocStringLen(NULL, len - 1); /* NUL character added automatically */
102 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len-1);
103 return ret;
104 }
105
106 static BSTR alloced_bstrs[256];
107 static int alloced_bstrs_count;
108
109 static BSTR _bstr_(const char *str)
110 {
111 if(!str)
112 return NULL;
113
114 assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
115 alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
116 return alloced_bstrs[alloced_bstrs_count++];
117 }
118
119 static void free_bstrs(void)
120 {
121 int i;
122 for (i = 0; i < alloced_bstrs_count; i++)
123 SysFreeString(alloced_bstrs[i]);
124 alloced_bstrs_count = 0;
125 }
126
127 static BSTR a2bstr(const char *str)
128 {
129 BSTR ret;
130 int len;
131
132 if(!str)
133 return NULL;
134
135 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
136 ret = SysAllocStringLen(NULL, len);
137 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
138
139 return ret;
140 }
141
142
143 /* test IHTMLElementCollection */
144 static HRESULT WINAPI htmlecoll_QueryInterface(IHTMLElementCollection *iface, REFIID riid, void **ppvObject)
145 {
146 ok(0, "unexpected call\n");
147 *ppvObject = NULL;
148 return E_NOINTERFACE;
149 }
150
151 static ULONG WINAPI htmlecoll_AddRef(IHTMLElementCollection *iface)
152 {
153 return 2;
154 }
155
156 static ULONG WINAPI htmlecoll_Release(IHTMLElementCollection *iface)
157 {
158 return 1;
159 }
160
161 static HRESULT WINAPI htmlecoll_GetTypeInfoCount(IHTMLElementCollection *iface, UINT *pctinfo)
162 {
163 ok(0, "unexpected call\n");
164 return E_NOTIMPL;
165 }
166
167 static HRESULT WINAPI htmlecoll_GetTypeInfo(IHTMLElementCollection *iface, UINT iTInfo,
168 LCID lcid, ITypeInfo **ppTInfo)
169 {
170 ok(0, "unexpected call\n");
171 return E_NOTIMPL;
172 }
173
174 static HRESULT WINAPI htmlecoll_GetIDsOfNames(IHTMLElementCollection *iface, REFIID riid,
175 LPOLESTR *rgszNames, UINT cNames,
176 LCID lcid, DISPID *rgDispId)
177 {
178 ok(0, "unexpected call\n");
179 return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI htmlecoll_Invoke(IHTMLElementCollection *iface, DISPID dispIdMember,
183 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
184 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
185 {
186 ok(0, "unexpected call\n");
187 return E_NOTIMPL;
188 }
189
190 static HRESULT WINAPI htmlecoll_toString(IHTMLElementCollection *iface, BSTR *String)
191 {
192 ok(0, "unexpected call\n");
193 return E_NOTIMPL;
194 }
195
196 static HRESULT WINAPI htmlecoll_put_length(IHTMLElementCollection *iface, LONG v)
197 {
198 ok(0, "unexpected call\n");
199 return E_NOTIMPL;
200 }
201
202 static HRESULT WINAPI htmlecoll_get_length(IHTMLElementCollection *iface, LONG *v)
203 {
204 CHECK_EXPECT2(collection_get_length);
205 return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI htmlecoll_get__newEnum(IHTMLElementCollection *iface, IUnknown **p)
209 {
210 ok(0, "unexpected call\n");
211 return E_NOTIMPL;
212 }
213
214 static HRESULT WINAPI htmlecoll_item(IHTMLElementCollection *iface, VARIANT name, VARIANT index, IDispatch **pdisp)
215 {
216 ok(0, "unexpected call\n");
217 return E_NOTIMPL;
218 }
219
220 static HRESULT WINAPI htmlecoll_tags(IHTMLElementCollection *iface, VARIANT tagName, IDispatch **pdisp)
221 {
222 ok(0, "unexpected call\n");
223 return E_NOTIMPL;
224 }
225
226 static const IHTMLElementCollectionVtbl TestHTMLECollectionVtbl = {
227 htmlecoll_QueryInterface,
228 htmlecoll_AddRef,
229 htmlecoll_Release,
230 htmlecoll_GetTypeInfoCount,
231 htmlecoll_GetTypeInfo,
232 htmlecoll_GetIDsOfNames,
233 htmlecoll_Invoke,
234 htmlecoll_toString,
235 htmlecoll_put_length,
236 htmlecoll_get_length,
237 htmlecoll_get__newEnum,
238 htmlecoll_item,
239 htmlecoll_tags
240 };
241
242 static IHTMLElementCollection htmlecoll = { &TestHTMLECollectionVtbl };
243
244 /* test IHTMLDocument2 */
245 static HRESULT WINAPI htmldoc2_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject)
246 {
247 trace("\n");
248 *ppvObject = NULL;
249 return E_NOINTERFACE;
250 }
251
252 static ULONG WINAPI htmldoc2_AddRef(IHTMLDocument2 *iface)
253 {
254 return 2;
255 }
256
257 static ULONG WINAPI htmldoc2_Release(IHTMLDocument2 *iface)
258 {
259 return 1;
260 }
261
262 static HRESULT WINAPI htmldoc2_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
263 {
264 ok(0, "unexpected call\n");
265 return E_NOTIMPL;
266 }
267
268 static HRESULT WINAPI htmldoc2_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
269 LCID lcid, ITypeInfo **ppTInfo)
270 {
271 ok(0, "unexpected call\n");
272 return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI htmldoc2_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
276 LPOLESTR *rgszNames, UINT cNames,
277 LCID lcid, DISPID *rgDispId)
278 {
279 ok(0, "unexpected call\n");
280 return E_NOTIMPL;
281 }
282
283 static HRESULT WINAPI htmldoc2_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
284 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
285 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
286 {
287 ok(0, "unexpected call\n");
288 return E_NOTIMPL;
289 }
290
291 static HRESULT WINAPI htmldoc2_get_Script(IHTMLDocument2 *iface, IDispatch **p)
292 {
293 ok(0, "unexpected call\n");
294 return E_NOTIMPL;
295 }
296
297 static HRESULT WINAPI htmldoc2_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
298 {
299 CHECK_EXPECT2(htmldoc2_get_all);
300 *p = &htmlecoll;
301 return S_OK;
302 }
303
304 static HRESULT WINAPI htmldoc2_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
305 {
306 ok(0, "unexpected call\n");
307 return E_NOTIMPL;
308 }
309
310 static HRESULT WINAPI htmldoc2_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
311 {
312 ok(0, "unexpected call\n");
313 return E_NOTIMPL;
314 }
315
316 static HRESULT WINAPI htmldoc2_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
317 {
318 ok(0, "unexpected call\n");
319 return E_NOTIMPL;
320 }
321
322 static HRESULT WINAPI htmldoc2_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
323 {
324 ok(0, "unexpected call\n");
325 return E_NOTIMPL;
326 }
327
328 static HRESULT WINAPI htmldoc2_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
329 {
330 ok(0, "unexpected call\n");
331 return E_NOTIMPL;
332 }
333
334 static HRESULT WINAPI htmldoc2_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
335 {
336 ok(0, "unexpected call\n");
337 return E_NOTIMPL;
338 }
339
340 static HRESULT WINAPI htmldoc2_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
341 {
342 ok(0, "unexpected call\n");
343 return E_NOTIMPL;
344 }
345
346 static HRESULT WINAPI htmldoc2_put_title(IHTMLDocument2 *iface, BSTR v)
347 {
348 ok(0, "unexpected call\n");
349 return E_NOTIMPL;
350 }
351
352 static HRESULT WINAPI htmldoc2_get_title(IHTMLDocument2 *iface, BSTR *p)
353 {
354 ok(0, "unexpected call\n");
355 return E_NOTIMPL;
356 }
357
358 static HRESULT WINAPI htmldoc2_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
359 {
360 ok(0, "unexpected call\n");
361 return E_NOTIMPL;
362 }
363
364 static HRESULT WINAPI htmldoc2_put_designMode(IHTMLDocument2 *iface, BSTR v)
365 {
366 ok(0, "unexpected call\n");
367 return E_NOTIMPL;
368 }
369
370 static HRESULT WINAPI htmldoc2_get_designMode(IHTMLDocument2 *iface, BSTR *p)
371 {
372 ok(0, "unexpected call\n");
373 return E_NOTIMPL;
374 }
375
376 static HRESULT WINAPI htmldoc2_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
377 {
378 ok(0, "unexpected call\n");
379 return E_NOTIMPL;
380 }
381
382 static HRESULT WINAPI htmldoc2_get_readyState(IHTMLDocument2 *iface, BSTR *p)
383 {
384 ok(0, "unexpected call\n");
385 return E_NOTIMPL;
386 }
387
388 static HRESULT WINAPI htmldoc2_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
389 {
390 ok(0, "unexpected call\n");
391 return E_NOTIMPL;
392 }
393
394 static HRESULT WINAPI htmldoc2_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
395 {
396 ok(0, "unexpected call\n");
397 return E_NOTIMPL;
398 }
399
400 static HRESULT WINAPI htmldoc2_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
401 {
402 ok(0, "unexpected call\n");
403 return E_NOTIMPL;
404 }
405
406 static HRESULT WINAPI htmldoc2_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
407 {
408 ok(0, "unexpected call\n");
409 return E_NOTIMPL;
410 }
411
412 static HRESULT WINAPI htmldoc2_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
413 {
414 ok(0, "unexpected call\n");
415 return E_NOTIMPL;
416 }
417
418 static HRESULT WINAPI htmldoc2_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
419 {
420 ok(0, "unexpected call\n");
421 return E_NOTIMPL;
422 }
423
424 static HRESULT WINAPI htmldoc2_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
425 {
426 ok(0, "unexpected call\n");
427 return E_NOTIMPL;
428 }
429
430 static HRESULT WINAPI htmldoc2_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
431 {
432 ok(0, "unexpected call\n");
433 return E_NOTIMPL;
434 }
435
436 static HRESULT WINAPI htmldoc2_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
437 {
438 ok(0, "unexpected call\n");
439 return E_NOTIMPL;
440 }
441
442 static HRESULT WINAPI htmldoc2_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
443 {
444 ok(0, "unexpected call\n");
445 return E_NOTIMPL;
446 }
447
448 static HRESULT WINAPI htmldoc2_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
449 {
450 ok(0, "unexpected call\n");
451 return E_NOTIMPL;
452 }
453
454 static HRESULT WINAPI htmldoc2_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
455 {
456 ok(0, "unexpected call\n");
457 return E_NOTIMPL;
458 }
459
460 static HRESULT WINAPI htmldoc2_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
461 {
462 ok(0, "unexpected call\n");
463 return E_NOTIMPL;
464 }
465
466 static HRESULT WINAPI htmldoc2_get_referrer(IHTMLDocument2 *iface, BSTR *p)
467 {
468 ok(0, "unexpected call\n");
469 return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI htmldoc2_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
473 {
474 ok(0, "unexpected call\n");
475 return E_NOTIMPL;
476 }
477
478 static HRESULT WINAPI htmldoc2_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
479 {
480 ok(0, "unexpected call\n");
481 return E_NOTIMPL;
482 }
483
484 static HRESULT WINAPI htmldoc2_put_URL(IHTMLDocument2 *iface, BSTR v)
485 {
486 ok(0, "unexpected call\n");
487 return E_NOTIMPL;
488 }
489
490 static HRESULT WINAPI htmldoc2_get_URL(IHTMLDocument2 *iface, BSTR *p)
491 {
492 CHECK_EXPECT2(htmldoc2_get_url);
493 *p = a2bstr("http://test.winehq.org/");
494 return S_OK;
495 }
496
497 static HRESULT WINAPI htmldoc2_put_domain(IHTMLDocument2 *iface, BSTR v)
498 {
499 ok(0, "unexpected call\n");
500 return E_NOTIMPL;
501 }
502
503 static HRESULT WINAPI htmldoc2_get_domain(IHTMLDocument2 *iface, BSTR *p)
504 {
505 ok(0, "unexpected call\n");
506 return E_NOTIMPL;
507 }
508
509 static HRESULT WINAPI htmldoc2_put_cookie(IHTMLDocument2 *iface, BSTR v)
510 {
511 ok(0, "unexpected call\n");
512 return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI htmldoc2_get_cookie(IHTMLDocument2 *iface, BSTR *p)
516 {
517 ok(0, "unexpected call\n");
518 return E_NOTIMPL;
519 }
520
521 static HRESULT WINAPI htmldoc2_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
522 {
523 ok(0, "unexpected call\n");
524 return E_NOTIMPL;
525 }
526
527 static HRESULT WINAPI htmldoc2_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
528 {
529 ok(0, "unexpected call\n");
530 return E_NOTIMPL;
531 }
532
533 static HRESULT WINAPI htmldoc2_put_charset(IHTMLDocument2 *iface, BSTR v)
534 {
535 ok(0, "unexpected call\n");
536 return E_NOTIMPL;
537 }
538
539 static HRESULT WINAPI htmldoc2_get_charset(IHTMLDocument2 *iface, BSTR *p)
540 {
541 ok(0, "unexpected call\n");
542 return E_NOTIMPL;
543 }
544
545 static HRESULT WINAPI htmldoc2_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
546 {
547 ok(0, "unexpected call\n");
548 return E_NOTIMPL;
549 }
550
551 static HRESULT WINAPI htmldoc2_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
552 {
553 ok(0, "unexpected call\n");
554 return E_NOTIMPL;
555 }
556
557 static HRESULT WINAPI htmldoc2_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
558 {
559 ok(0, "unexpected call\n");
560 return E_NOTIMPL;
561 }
562
563 static HRESULT WINAPI htmldoc2_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
564 {
565 ok(0, "unexpected call\n");
566 return E_NOTIMPL;
567 }
568
569 static HRESULT WINAPI htmldoc2_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
570 {
571 ok(0, "unexpected call\n");
572 return E_NOTIMPL;
573 }
574
575 static HRESULT WINAPI htmldoc2_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
576 {
577 ok(0, "unexpected call\n");
578 return E_NOTIMPL;
579 }
580
581 static HRESULT WINAPI htmldoc2_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
582 {
583 ok(0, "unexpected call\n");
584 return E_NOTIMPL;
585 }
586
587 static HRESULT WINAPI htmldoc2_get_security(IHTMLDocument2 *iface, BSTR *p)
588 {
589 ok(0, "unexpected call\n");
590 return E_NOTIMPL;
591 }
592
593 static HRESULT WINAPI htmldoc2_get_protocol(IHTMLDocument2 *iface, BSTR *p)
594 {
595 ok(0, "unexpected call\n");
596 return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI htmldoc2_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
600 {
601 ok(0, "unexpected call\n");
602 return E_NOTIMPL;
603 }
604
605 static HRESULT WINAPI htmldoc2_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
606 {
607 ok(0, "unexpected call\n");
608 return E_NOTIMPL;
609 }
610
611 static HRESULT WINAPI htmldoc2_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
612 {
613 ok(0, "unexpected call\n");
614 return E_NOTIMPL;
615 }
616
617 static HRESULT WINAPI htmldoc2_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
618 VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
619 {
620 ok(0, "unexpected call\n");
621 return E_NOTIMPL;
622 }
623
624 static HRESULT WINAPI htmldoc2_close(IHTMLDocument2 *iface)
625 {
626 ok(0, "unexpected call\n");
627 return E_NOTIMPL;
628 }
629
630 static HRESULT WINAPI htmldoc2_clear(IHTMLDocument2 *iface)
631 {
632 ok(0, "unexpected call\n");
633 return E_NOTIMPL;
634 }
635
636 static HRESULT WINAPI htmldoc2_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
637 VARIANT_BOOL *pfRet)
638 {
639 ok(0, "unexpected call\n");
640 return E_NOTIMPL;
641 }
642
643 static HRESULT WINAPI htmldoc2_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
644 VARIANT_BOOL *pfRet)
645 {
646 ok(0, "unexpected call\n");
647 return E_NOTIMPL;
648 }
649
650 static HRESULT WINAPI htmldoc2_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
651 VARIANT_BOOL *pfRet)
652 {
653 ok(0, "unexpected call\n");
654 return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI htmldoc2_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
658 VARIANT_BOOL *pfRet)
659 {
660 ok(0, "unexpected call\n");
661 return E_NOTIMPL;
662 }
663
664 static HRESULT WINAPI htmldoc2_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
665 BSTR *pfRet)
666 {
667 ok(0, "unexpected call\n");
668 return E_NOTIMPL;
669 }
670
671 static HRESULT WINAPI htmldoc2_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
672 VARIANT *pfRet)
673 {
674 ok(0, "unexpected call\n");
675 return E_NOTIMPL;
676 }
677
678 static HRESULT WINAPI htmldoc2_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
679 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
680 {
681 ok(0, "unexpected call\n");
682 return E_NOTIMPL;
683 }
684
685 static HRESULT WINAPI htmldoc2_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
686 VARIANT_BOOL *pfRet)
687 {
688 ok(0, "unexpected call\n");
689 return E_NOTIMPL;
690 }
691
692 static HRESULT WINAPI htmldoc2_createElement(IHTMLDocument2 *iface, BSTR eTag,
693 IHTMLElement **newElem)
694 {
695 ok(0, "unexpected call\n");
696 return E_NOTIMPL;
697 }
698
699 static HRESULT WINAPI htmldoc2_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
700 {
701 ok(0, "unexpected call\n");
702 return E_NOTIMPL;
703 }
704
705 static HRESULT WINAPI htmldoc2_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
706 {
707 ok(0, "unexpected call\n");
708 return E_NOTIMPL;
709 }
710
711 static HRESULT WINAPI htmldoc2_put_onclick(IHTMLDocument2 *iface, VARIANT v)
712 {
713 ok(0, "unexpected call\n");
714 return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI htmldoc2_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
718 {
719 ok(0, "unexpected call\n");
720 return E_NOTIMPL;
721 }
722
723 static HRESULT WINAPI htmldoc2_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
724 {
725 ok(0, "unexpected call\n");
726 return E_NOTIMPL;
727 }
728
729 static HRESULT WINAPI htmldoc2_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
730 {
731 ok(0, "unexpected call\n");
732 return E_NOTIMPL;
733 }
734
735 static HRESULT WINAPI htmldoc2_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
736 {
737 ok(0, "unexpected call\n");
738 return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI htmldoc2_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
742 {
743 ok(0, "unexpected call\n");
744 return E_NOTIMPL;
745 }
746
747 static HRESULT WINAPI htmldoc2_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
748 {
749 ok(0, "unexpected call\n");
750 return E_NOTIMPL;
751 }
752
753 static HRESULT WINAPI htmldoc2_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
754 {
755 ok(0, "unexpected call\n");
756 return E_NOTIMPL;
757 }
758
759 static HRESULT WINAPI htmldoc2_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
760 {
761 ok(0, "unexpected call\n");
762 return E_NOTIMPL;
763 }
764
765 static HRESULT WINAPI htmldoc2_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
766 {
767 ok(0, "unexpected call\n");
768 return E_NOTIMPL;
769 }
770
771 static HRESULT WINAPI htmldoc2_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
772 {
773 ok(0, "unexpected call\n");
774 return E_NOTIMPL;
775 }
776
777 static HRESULT WINAPI htmldoc2_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
778 {
779 ok(0, "unexpected call\n");
780 return E_NOTIMPL;
781 }
782
783 static HRESULT WINAPI htmldoc2_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
784 {
785 ok(0, "unexpected call\n");
786 return E_NOTIMPL;
787 }
788
789 static HRESULT WINAPI htmldoc2_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
790 {
791 ok(0, "unexpected call\n");
792 return E_NOTIMPL;
793 }
794
795 static HRESULT WINAPI htmldoc2_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
796 {
797 ok(0, "unexpected call\n");
798 return E_NOTIMPL;
799 }
800
801 static HRESULT WINAPI htmldoc2_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
802 {
803 ok(0, "unexpected call\n");
804 return E_NOTIMPL;
805 }
806
807 static HRESULT WINAPI htmldoc2_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
808 {
809 ok(0, "unexpected call\n");
810 return E_NOTIMPL;
811 }
812
813 static HRESULT WINAPI htmldoc2_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
814 {
815 ok(0, "unexpected call\n");
816 return E_NOTIMPL;
817 }
818
819 static HRESULT WINAPI htmldoc2_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
820 {
821 ok(0, "unexpected call\n");
822 return E_NOTIMPL;
823 }
824
825 static HRESULT WINAPI htmldoc2_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
826 {
827 ok(0, "unexpected call\n");
828 return E_NOTIMPL;
829 }
830
831 static HRESULT WINAPI htmldoc2_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
832 {
833 ok(0, "unexpected call\n");
834 return E_NOTIMPL;
835 }
836
837 static HRESULT WINAPI htmldoc2_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
838 {
839 ok(0, "unexpected call\n");
840 return E_NOTIMPL;
841 }
842
843 static HRESULT WINAPI htmldoc2_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
844 {
845 ok(0, "unexpected call\n");
846 return E_NOTIMPL;
847 }
848
849 static HRESULT WINAPI htmldoc2_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
850 {
851 ok(0, "unexpected call\n");
852 return E_NOTIMPL;
853 }
854
855 static HRESULT WINAPI htmldoc2_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
856 {
857 ok(0, "unexpected call\n");
858 return E_NOTIMPL;
859 }
860
861 static HRESULT WINAPI htmldoc2_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
862 {
863 ok(0, "unexpected call\n");
864 return E_NOTIMPL;
865 }
866
867 static HRESULT WINAPI htmldoc2_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
868 {
869 ok(0, "unexpected call\n");
870 return E_NOTIMPL;
871 }
872
873 static HRESULT WINAPI htmldoc2_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
874 {
875 ok(0, "unexpected call\n");
876 return E_NOTIMPL;
877 }
878
879 static HRESULT WINAPI htmldoc2_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
880 {
881 ok(0, "unexpected call\n");
882 return E_NOTIMPL;
883 }
884
885 static HRESULT WINAPI htmldoc2_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
886 {
887 ok(0, "unexpected call\n");
888 return E_NOTIMPL;
889 }
890
891 static HRESULT WINAPI htmldoc2_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
892 {
893 ok(0, "unexpected call\n");
894 return E_NOTIMPL;
895 }
896
897 static HRESULT WINAPI htmldoc2_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
898 {
899 ok(0, "unexpected call\n");
900 return E_NOTIMPL;
901 }
902
903 static HRESULT WINAPI htmldoc2_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
904 IHTMLElement **elementHit)
905 {
906 ok(0, "unexpected call\n");
907 return E_NOTIMPL;
908 }
909
910 static HRESULT WINAPI htmldoc2_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
911 {
912 ok(0, "unexpected call\n");
913 return E_NOTIMPL;
914 }
915
916 static HRESULT WINAPI htmldoc2_get_styleSheets(IHTMLDocument2 *iface,
917 IHTMLStyleSheetsCollection **p)
918 {
919 ok(0, "unexpected call\n");
920 return E_NOTIMPL;
921 }
922
923 static HRESULT WINAPI htmldoc2_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
924 {
925 ok(0, "unexpected call\n");
926 return E_NOTIMPL;
927 }
928
929 static HRESULT WINAPI htmldoc2_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
930 {
931 ok(0, "unexpected call\n");
932 return E_NOTIMPL;
933 }
934
935 static HRESULT WINAPI htmldoc2_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
936 {
937 ok(0, "unexpected call\n");
938 return E_NOTIMPL;
939 }
940
941 static HRESULT WINAPI htmldoc2_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
942 {
943 ok(0, "unexpected call\n");
944 return E_NOTIMPL;
945 }
946
947 static HRESULT WINAPI htmldoc2_toString(IHTMLDocument2 *iface, BSTR *String)
948 {
949 ok(0, "unexpected call\n");
950 return E_NOTIMPL;
951 }
952
953 static HRESULT WINAPI htmldoc2_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
954 LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet)
955 {
956 ok(0, "unexpected call\n");
957 return E_NOTIMPL;
958 }
959
960 static const IHTMLDocument2Vtbl TestHTMLDocumentVtbl = {
961 htmldoc2_QueryInterface,
962 htmldoc2_AddRef,
963 htmldoc2_Release,
964 htmldoc2_GetTypeInfoCount,
965 htmldoc2_GetTypeInfo,
966 htmldoc2_GetIDsOfNames,
967 htmldoc2_Invoke,
968 htmldoc2_get_Script,
969 htmldoc2_get_all,
970 htmldoc2_get_body,
971 htmldoc2_get_activeElement,
972 htmldoc2_get_images,
973 htmldoc2_get_applets,
974 htmldoc2_get_links,
975 htmldoc2_get_forms,
976 htmldoc2_get_anchors,
977 htmldoc2_put_title,
978 htmldoc2_get_title,
979 htmldoc2_get_scripts,
980 htmldoc2_put_designMode,
981 htmldoc2_get_designMode,
982 htmldoc2_get_selection,
983 htmldoc2_get_readyState,
984 htmldoc2_get_frames,
985 htmldoc2_get_embeds,
986 htmldoc2_get_plugins,
987 htmldoc2_put_alinkColor,
988 htmldoc2_get_alinkColor,
989 htmldoc2_put_bgColor,
990 htmldoc2_get_bgColor,
991 htmldoc2_put_fgColor,
992 htmldoc2_get_fgColor,
993 htmldoc2_put_linkColor,
994 htmldoc2_get_linkColor,
995 htmldoc2_put_vlinkColor,
996 htmldoc2_get_vlinkColor,
997 htmldoc2_get_referrer,
998 htmldoc2_get_location,
999 htmldoc2_get_lastModified,
1000 htmldoc2_put_URL,
1001 htmldoc2_get_URL,
1002 htmldoc2_put_domain,
1003 htmldoc2_get_domain,
1004 htmldoc2_put_cookie,
1005 htmldoc2_get_cookie,
1006 htmldoc2_put_expando,
1007 htmldoc2_get_expando,
1008 htmldoc2_put_charset,
1009 htmldoc2_get_charset,
1010 htmldoc2_put_defaultCharset,
1011 htmldoc2_get_defaultCharset,
1012 htmldoc2_get_mimeType,
1013 htmldoc2_get_fileSize,
1014 htmldoc2_get_fileCreatedDate,
1015 htmldoc2_get_fileModifiedDate,
1016 htmldoc2_get_fileUpdatedDate,
1017 htmldoc2_get_security,
1018 htmldoc2_get_protocol,
1019 htmldoc2_get_nameProp,
1020 htmldoc2_write,
1021 htmldoc2_writeln,
1022 htmldoc2_open,
1023 htmldoc2_close,
1024 htmldoc2_clear,
1025 htmldoc2_queryCommandSupported,
1026 htmldoc2_queryCommandEnabled,
1027 htmldoc2_queryCommandState,
1028 htmldoc2_queryCommandIndeterm,
1029 htmldoc2_queryCommandText,
1030 htmldoc2_queryCommandValue,
1031 htmldoc2_execCommand,
1032 htmldoc2_execCommandShowHelp,
1033 htmldoc2_createElement,
1034 htmldoc2_put_onhelp,
1035 htmldoc2_get_onhelp,
1036 htmldoc2_put_onclick,
1037 htmldoc2_get_onclick,
1038 htmldoc2_put_ondblclick,
1039 htmldoc2_get_ondblclick,
1040 htmldoc2_put_onkeyup,
1041 htmldoc2_get_onkeyup,
1042 htmldoc2_put_onkeydown,
1043 htmldoc2_get_onkeydown,
1044 htmldoc2_put_onkeypress,
1045 htmldoc2_get_onkeypress,
1046 htmldoc2_put_onmouseup,
1047 htmldoc2_get_onmouseup,
1048 htmldoc2_put_onmousedown,
1049 htmldoc2_get_onmousedown,
1050 htmldoc2_put_onmousemove,
1051 htmldoc2_get_onmousemove,
1052 htmldoc2_put_onmouseout,
1053 htmldoc2_get_onmouseout,
1054 htmldoc2_put_onmouseover,
1055 htmldoc2_get_onmouseover,
1056 htmldoc2_put_onreadystatechange,
1057 htmldoc2_get_onreadystatechange,
1058 htmldoc2_put_onafterupdate,
1059 htmldoc2_get_onafterupdate,
1060 htmldoc2_put_onrowexit,
1061 htmldoc2_get_onrowexit,
1062 htmldoc2_put_onrowenter,
1063 htmldoc2_get_onrowenter,
1064 htmldoc2_put_ondragstart,
1065 htmldoc2_get_ondragstart,
1066 htmldoc2_put_onselectstart,
1067 htmldoc2_get_onselectstart,
1068 htmldoc2_elementFromPoint,
1069 htmldoc2_get_parentWindow,
1070 htmldoc2_get_styleSheets,
1071 htmldoc2_put_onbeforeupdate,
1072 htmldoc2_get_onbeforeupdate,
1073 htmldoc2_put_onerrorupdate,
1074 htmldoc2_get_onerrorupdate,
1075 htmldoc2_toString,
1076 htmldoc2_createStyleSheet
1077 };
1078
1079 static IHTMLDocument2 htmldoc2 = { &TestHTMLDocumentVtbl };
1080
1081 static HRESULT WINAPI sp_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppvObject)
1082 {
1083 *ppvObject = NULL;
1084
1085 if (IsEqualGUID(riid, &IID_IUnknown) ||
1086 IsEqualGUID(riid, &IID_IServiceProvider))
1087 {
1088 *ppvObject = iface;
1089 IServiceProvider_AddRef(iface);
1090 return S_OK;
1091 }
1092
1093 ok(0, "unexpected query interface: %s\n", wine_dbgstr_guid(riid));
1094
1095 return E_NOINTERFACE;
1096 }
1097
1098 static ULONG WINAPI sp_AddRef(IServiceProvider *iface)
1099 {
1100 return 2;
1101 }
1102
1103 static ULONG WINAPI sp_Release(IServiceProvider *iface)
1104 {
1105 return 1;
1106 }
1107
1108 static HRESULT WINAPI sp_QueryService(IServiceProvider *iface, REFGUID service, REFIID riid, void **obj)
1109 {
1110 *obj = NULL;
1111
1112 if (IsEqualGUID(service, &SID_SBindHost) &&
1113 IsEqualGUID(riid, &IID_IBindHost))
1114 {
1115 CHECK_EXPECT2(sp_queryservice_SID_SBindHost);
1116 }
1117 else if (IsEqualGUID(service, &SID_SContainerDispatch) &&
1118 IsEqualGUID(riid, &IID_IHTMLDocument2))
1119 {
1120 CHECK_EXPECT2(sp_queryservice_SID_SContainerDispatch_htmldoc2);
1121 }
1122 else if (IsEqualGUID(service, &SID_SInternetHostSecurityManager) &&
1123 IsEqualGUID(riid, &IID_IHTMLDocument2))
1124 {
1125 CHECK_EXPECT2(sp_queryservice_SID_secmgr_htmldoc2);
1126 *obj = &htmldoc2;
1127 return S_OK;
1128 }
1129 else if (IsEqualGUID(service, &SID_SInternetHostSecurityManager) &&
1130 IsEqualGUID(riid, &IID_IXMLDOMDocument))
1131 {
1132 CHECK_EXPECT2(sp_queryservice_SID_secmgr_xmldomdoc);
1133 }
1134 else if (IsEqualGUID(service, &SID_SInternetHostSecurityManager) &&
1135 IsEqualGUID(riid, &IID_IInternetHostSecurityManager))
1136 {
1137 CHECK_EXPECT2(sp_queryservice_SID_secmgr_secmgr);
1138 }
1139 else if (IsEqualGUID(service, &SID_UnknownSID) &&
1140 IsEqualGUID(riid, &IID_IStream))
1141 {
1142 /* FIXME: unidentified service id */
1143 }
1144 else if ((IsEqualGUID(service, &IID_IInternetProtocol) && IsEqualGUID(riid, &IID_IInternetProtocol)) ||
1145 (IsEqualGUID(service, &IID_IHttpNegotiate2) && IsEqualGUID(riid, &IID_IHttpNegotiate2)) ||
1146 (IsEqualGUID(service, &IID_IGetBindHandle) && IsEqualGUID(riid, &IID_IGetBindHandle)) ||
1147 (IsEqualGUID(service, &IID_IBindStatusCallback) && IsEqualGUID(riid, &IID_IBindStatusCallback)) ||
1148 (IsEqualGUID(service, &IID_IWindowForBindingUI) && IsEqualGUID(riid, &IID_IWindowForBindingUI)))
1149 {
1150 }
1151 else
1152 ok(0, "unexpected request: sid %s, riid %s\n", wine_dbgstr_guid(service), wine_dbgstr_guid(riid));
1153
1154 return E_NOTIMPL;
1155 }
1156
1157 static const IServiceProviderVtbl testprovVtbl =
1158 {
1159 sp_QueryInterface,
1160 sp_AddRef,
1161 sp_Release,
1162 sp_QueryService
1163 };
1164
1165 static IServiceProvider testprov = { &testprovVtbl };
1166
1167 static HRESULT WINAPI site_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObject)
1168 {
1169 *ppvObject = NULL;
1170
1171 if (IsEqualGUID(riid, &IID_IServiceProvider))
1172 CHECK_EXPECT2(site_qi_IServiceProvider);
1173
1174 if (IsEqualGUID(riid, &IID_IXMLDOMDocument))
1175 CHECK_EXPECT2(site_qi_IXMLDOMDocument);
1176
1177 if (IsEqualGUID(riid, &IID_IOleClientSite))
1178 CHECK_EXPECT2(site_qi_IOleClientSite);
1179
1180 if (IsEqualGUID(riid, &IID_IUnknown))
1181 *ppvObject = iface;
1182 else if (IsEqualGUID(riid, &IID_IServiceProvider))
1183 *ppvObject = &testprov;
1184
1185 if (*ppvObject) IUnknown_AddRef(iface);
1186
1187 return *ppvObject ? S_OK : E_NOINTERFACE;
1188 }
1189
1190 static ULONG WINAPI site_AddRef(IUnknown *iface)
1191 {
1192 return 2;
1193 }
1194
1195 static ULONG WINAPI site_Release(IUnknown *iface)
1196 {
1197 return 1;
1198 }
1199
1200 static const IUnknownVtbl testsiteVtbl =
1201 {
1202 site_QueryInterface,
1203 site_AddRef,
1204 site_Release
1205 };
1206
1207 static IUnknown testsite = { &testsiteVtbl };
1208
1209 typedef struct
1210 {
1211 IDispatch IDispatch_iface;
1212 LONG ref;
1213 } dispevent;
1214
1215 static IXMLHttpRequest *httpreq;
1216
1217 static inline dispevent *impl_from_IDispatch( IDispatch *iface )
1218 {
1219 return CONTAINING_RECORD(iface, dispevent, IDispatch_iface);
1220 }
1221
1222 static HRESULT WINAPI dispevent_QueryInterface(IDispatch *iface, REFIID riid, void **ppvObject)
1223 {
1224 *ppvObject = NULL;
1225
1226 if ( IsEqualGUID( riid, &IID_IDispatch) ||
1227 IsEqualGUID( riid, &IID_IUnknown) )
1228 {
1229 *ppvObject = iface;
1230 }
1231 else
1232 return E_NOINTERFACE;
1233
1234 IDispatch_AddRef( iface );
1235
1236 return S_OK;
1237 }
1238
1239 static ULONG WINAPI dispevent_AddRef(IDispatch *iface)
1240 {
1241 dispevent *This = impl_from_IDispatch( iface );
1242 return InterlockedIncrement( &This->ref );
1243 }
1244
1245 static ULONG WINAPI dispevent_Release(IDispatch *iface)
1246 {
1247 dispevent *This = impl_from_IDispatch( iface );
1248 ULONG ref = InterlockedDecrement( &This->ref );
1249
1250 if (ref == 0)
1251 HeapFree(GetProcessHeap(), 0, This);
1252
1253 return ref;
1254 }
1255
1256 static HRESULT WINAPI dispevent_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
1257 {
1258 g_unexpectedcall++;
1259 *pctinfo = 0;
1260 return S_OK;
1261 }
1262
1263 static HRESULT WINAPI dispevent_GetTypeInfo(IDispatch *iface, UINT iTInfo,
1264 LCID lcid, ITypeInfo **ppTInfo)
1265 {
1266 g_unexpectedcall++;
1267 return S_OK;
1268 }
1269
1270 static HRESULT WINAPI dispevent_GetIDsOfNames(IDispatch *iface, REFIID riid,
1271 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1272 {
1273 g_unexpectedcall++;
1274 return S_OK;
1275 }
1276
1277 static HRESULT WINAPI dispevent_Invoke(IDispatch *iface, DISPID member, REFIID riid,
1278 LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result,
1279 EXCEPINFO *excepInfo, UINT *argErr)
1280 {
1281 LONG state;
1282 HRESULT hr;
1283
1284 ok(member == 0, "expected 0 member, got %d\n", member);
1285 ok(lcid == LOCALE_SYSTEM_DEFAULT, "expected LOCALE_SYSTEM_DEFAULT, got lcid %x\n", lcid);
1286 ok(flags == DISPATCH_METHOD, "expected DISPATCH_METHOD, got %d\n", flags);
1287
1288 ok(params->cArgs == 0, "got %d\n", params->cArgs);
1289 ok(params->cNamedArgs == 0, "got %d\n", params->cNamedArgs);
1290 ok(params->rgvarg == NULL, "got %p\n", params->rgvarg);
1291 ok(params->rgdispidNamedArgs == NULL, "got %p\n", params->rgdispidNamedArgs);
1292
1293 ok(result == NULL, "got %p\n", result);
1294 ok(excepInfo == NULL, "got %p\n", excepInfo);
1295 ok(argErr == NULL, "got %p\n", argErr);
1296
1297 g_expectedcall++;
1298
1299 state = READYSTATE_UNINITIALIZED;
1300 hr = IXMLHttpRequest_get_readyState(httpreq, &state);
1301 ok(hr == S_OK, "got 0x%08x\n", hr);
1302 if (state == READYSTATE_COMPLETE)
1303 {
1304 BSTR text = NULL;
1305
1306 hr = IXMLHttpRequest_get_responseText(httpreq, &text);
1307 ok(hr == S_OK, "got 0x%08x\n", hr);
1308 ok(*text != 0, "got %s\n", wine_dbgstr_w(text));
1309 SysFreeString(text);
1310 }
1311
1312 return E_FAIL;
1313 }
1314
1315 static const IDispatchVtbl dispeventVtbl =
1316 {
1317 dispevent_QueryInterface,
1318 dispevent_AddRef,
1319 dispevent_Release,
1320 dispevent_GetTypeInfoCount,
1321 dispevent_GetTypeInfo,
1322 dispevent_GetIDsOfNames,
1323 dispevent_Invoke
1324 };
1325
1326 static IDispatch* create_dispevent(void)
1327 {
1328 dispevent *event = HeapAlloc(GetProcessHeap(), 0, sizeof(*event));
1329
1330 event->IDispatch_iface.lpVtbl = &dispeventVtbl;
1331 event->ref = 1;
1332
1333 return &event->IDispatch_iface;
1334 }
1335
1336 static IXMLHttpRequest *create_xhr(void)
1337 {
1338 IXMLHttpRequest *ret;
1339 HRESULT hr;
1340
1341 hr = CoCreateInstance(&CLSID_XMLHTTPRequest, NULL, CLSCTX_INPROC_SERVER,
1342 &IID_IXMLHttpRequest, (void**)&ret);
1343
1344 return SUCCEEDED(hr) ? ret : NULL;
1345 }
1346
1347 static void set_safety_opt(IUnknown *unk, DWORD mask, DWORD opts)
1348 {
1349 IObjectSafety *obj_safety;
1350 HRESULT hr;
1351
1352 hr = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&obj_safety);
1353 ok(hr == S_OK, "Could not get IObjectSafety iface: %08x\n", hr);
1354
1355 hr = IObjectSafety_SetInterfaceSafetyOptions(obj_safety, &IID_IDispatch, mask, mask&opts);
1356 ok(hr == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hr);
1357
1358 IObjectSafety_Release(obj_safety);
1359 }
1360
1361 static void set_xhr_site(IXMLHttpRequest *xhr)
1362 {
1363 IObjectWithSite *obj_site;
1364 HRESULT hr;
1365
1366 hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site);
1367 ok(hr == S_OK, "Could not get IObjectWithSite iface: %08x\n", hr);
1368
1369 g_enablecallchecks = TRUE;
1370
1371 SET_EXPECT(site_qi_IServiceProvider);
1372 SET_EXPECT(sp_queryservice_SID_SBindHost);
1373 SET_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
1374 SET_EXPECT(sp_queryservice_SID_secmgr_htmldoc2);
1375 SET_EXPECT(sp_queryservice_SID_secmgr_xmldomdoc);
1376 SET_EXPECT(sp_queryservice_SID_secmgr_secmgr);
1377
1378 /* calls to IHTMLDocument2 */
1379 SET_EXPECT(htmldoc2_get_all);
1380 SET_EXPECT(collection_get_length);
1381 SET_EXPECT(htmldoc2_get_url);
1382
1383 SET_EXPECT(site_qi_IXMLDOMDocument);
1384 SET_EXPECT(site_qi_IOleClientSite);
1385
1386 hr = IObjectWithSite_SetSite(obj_site, &testsite);
1387 EXPECT_HR(hr, S_OK);
1388
1389 CHECK_CALLED(site_qi_IServiceProvider);
1390 todo_wine
1391 CHECK_CALLED(sp_queryservice_SID_SBindHost);
1392 CHECK_CALLED(sp_queryservice_SID_SContainerDispatch_htmldoc2);
1393 CHECK_CALLED(sp_queryservice_SID_secmgr_htmldoc2);
1394 todo_wine
1395 CHECK_CALLED(sp_queryservice_SID_secmgr_xmldomdoc);
1396 /* this one isn't very reliable
1397 CHECK_CALLED(sp_queryservice_SID_secmgr_secmgr); */
1398 todo_wine {
1399 CHECK_CALLED(htmldoc2_get_all);
1400 CHECK_CALLED(collection_get_length);
1401 }
1402 CHECK_CALLED(htmldoc2_get_url);
1403
1404 todo_wine {
1405 CHECK_CALLED(site_qi_IXMLDOMDocument);
1406 CHECK_CALLED(site_qi_IOleClientSite);
1407 }
1408
1409 g_enablecallchecks = FALSE;
1410
1411 IObjectWithSite_Release(obj_site);
1412 }
1413
1414 #define test_open(a,b,c,d) _test_open(__LINE__,a,b,c,d)
1415 static void _test_open(unsigned line, IXMLHttpRequest *xhr, const char *method, const char *url, HRESULT exhres)
1416 {
1417 VARIANT empty, vfalse;
1418 HRESULT hr;
1419
1420 V_VT(&empty) = VT_EMPTY;
1421 V_VT(&vfalse) = VT_BOOL;
1422 V_BOOL(&vfalse) = VARIANT_FALSE;
1423
1424 hr = IXMLHttpRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty, empty);
1425 ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected %08x\n", method, url, hr, exhres);
1426 }
1427
1428 static void test_XMLHTTP(void)
1429 {
1430 static const char bodyA[] = "mode=Test";
1431 static const char urlA[] = "http://test.winehq.org/tests/post.php";
1432 static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml";
1433 static const char referertesturl[] = "http://test.winehq.org/tests/referer.php";
1434 static const WCHAR wszExpectedResponse[] = {'F','A','I','L','E','D',0};
1435 static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<a>TEST</a>\n";
1436 static const WCHAR norefererW[] = {'n','o',' ','r','e','f','e','r','e','r',' ','s','e','t',0};
1437
1438 IXMLHttpRequest *xhr;
1439 IObjectWithSite *obj_site, *obj_site2;
1440 BSTR bstrResponse, str, str1;
1441 VARIANT varbody, varbody_ref;
1442 VARIANT dummy;
1443 LONG state, status, bound;
1444 IDispatch *event;
1445 void *ptr;
1446 HRESULT hr;
1447 HGLOBAL g;
1448
1449 xhr = create_xhr();
1450
1451 VariantInit(&dummy);
1452 V_VT(&dummy) = VT_ERROR;
1453 V_ERROR(&dummy) = DISP_E_MEMBERNOTFOUND;
1454
1455 hr = IXMLHttpRequest_put_onreadystatechange(xhr, NULL);
1456 EXPECT_HR(hr, S_OK);
1457
1458 hr = IXMLHttpRequest_abort(xhr);
1459 EXPECT_HR(hr, S_OK);
1460
1461 V_VT(&varbody) = VT_I2;
1462 V_I2(&varbody) = 1;
1463 hr = IXMLHttpRequest_get_responseBody(xhr, &varbody);
1464 EXPECT_HR(hr, E_PENDING);
1465 ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody));
1466
1467 V_VT(&varbody) = VT_I2;
1468 V_I2(&varbody) = 1;
1469 hr = IXMLHttpRequest_get_responseStream(xhr, &varbody);
1470 EXPECT_HR(hr, E_PENDING);
1471 ok(V_VT(&varbody) == VT_EMPTY, "got type %d\n", V_VT(&varbody));
1472
1473 /* send before open */
1474 hr = IXMLHttpRequest_send(xhr, dummy);
1475 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1476
1477 /* initial status code */
1478 hr = IXMLHttpRequest_get_status(xhr, NULL);
1479 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1480
1481 status = 0xdeadbeef;
1482 hr = IXMLHttpRequest_get_status(xhr, &status);
1483 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1484 ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status);
1485
1486 hr = IXMLHttpRequest_get_statusText(xhr, &str);
1487 ok(hr == E_FAIL, "got 0x%08x\n", hr);
1488
1489 /* invalid parameters */
1490 test_open(xhr, NULL, NULL, E_INVALIDARG);
1491 test_open(xhr, "POST", NULL, E_INVALIDARG);
1492 test_open(xhr, NULL, urlA, E_INVALIDARG);
1493
1494 hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, NULL);
1495 EXPECT_HR(hr, E_INVALIDARG);
1496
1497 hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), NULL);
1498 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1499
1500 hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1"));
1501 EXPECT_HR(hr, E_INVALIDARG);
1502
1503 hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1"));
1504 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1505
1506 hr = IXMLHttpRequest_get_readyState(xhr, NULL);
1507 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1508
1509 state = -1;
1510 hr = IXMLHttpRequest_get_readyState(xhr, &state);
1511 EXPECT_HR(hr, S_OK);
1512 ok(state == READYSTATE_UNINITIALIZED, "got %d, expected READYSTATE_UNINITIALIZED\n", state);
1513
1514 httpreq = xhr;
1515 event = create_dispevent();
1516
1517 EXPECT_REF(event, 1);
1518 hr = IXMLHttpRequest_put_onreadystatechange(xhr, event);
1519 EXPECT_HR(hr, S_OK);
1520 EXPECT_REF(event, 2);
1521
1522 g_unexpectedcall = g_expectedcall = 0;
1523
1524 test_open(xhr, "POST", urlA, S_OK);
1525
1526 ok(g_unexpectedcall == 0, "unexpected disp event call\n");
1527 ok(g_expectedcall == 1 || broken(g_expectedcall == 0) /* win2k */, "no expected disp event call\n");
1528
1529 /* status code after ::open() */
1530 status = 0xdeadbeef;
1531 hr = IXMLHttpRequest_get_status(xhr, &status);
1532 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1533 ok(status == READYSTATE_UNINITIALIZED || broken(status == 0xdeadbeef) /* <win8 */, "got %d\n", status);
1534
1535 state = -1;
1536 hr = IXMLHttpRequest_get_readyState(xhr, &state);
1537 EXPECT_HR(hr, S_OK);
1538 ok(state == READYSTATE_LOADING, "got %d, expected READYSTATE_LOADING\n", state);
1539
1540 hr = IXMLHttpRequest_abort(xhr);
1541 EXPECT_HR(hr, S_OK);
1542
1543 state = -1;
1544 hr = IXMLHttpRequest_get_readyState(xhr, &state);
1545 EXPECT_HR(hr, S_OK);
1546 ok(state == READYSTATE_UNINITIALIZED || broken(state == READYSTATE_LOADING) /* win2k */,
1547 "got %d, expected READYSTATE_UNINITIALIZED\n", state);
1548
1549 test_open(xhr, "POST", urlA, S_OK);
1550
1551 hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_("header1"), _bstr_("value1"));
1552 EXPECT_HR(hr, S_OK);
1553
1554 hr = IXMLHttpRequest_setRequestHeader(xhr, NULL, _bstr_("value1"));
1555 EXPECT_HR(hr, E_INVALIDARG);
1556
1557 hr = IXMLHttpRequest_setRequestHeader(xhr, _bstr_(""), _bstr_("value1"));
1558 EXPECT_HR(hr, E_INVALIDARG);
1559
1560 V_VT(&varbody) = VT_BSTR;
1561 V_BSTR(&varbody) = _bstr_(bodyA);
1562
1563 hr = IXMLHttpRequest_send(xhr, varbody);
1564 if (hr == INET_E_RESOURCE_NOT_FOUND)
1565 {
1566 skip("No connection could be made with test.winehq.org\n");
1567 IXMLHttpRequest_Release(xhr);
1568 return;
1569 }
1570 EXPECT_HR(hr, S_OK);
1571
1572 /* response headers */
1573 hr = IXMLHttpRequest_getAllResponseHeaders(xhr, NULL);
1574 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1575 hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str);
1576 EXPECT_HR(hr, S_OK);
1577 /* status line is stripped already */
1578 ok(memcmp(str, _bstr_("HTTP"), 4*sizeof(WCHAR)), "got response headers %s\n", wine_dbgstr_w(str));
1579 ok(*str, "got empty headers\n");
1580 hr = IXMLHttpRequest_getAllResponseHeaders(xhr, &str1);
1581 EXPECT_HR(hr, S_OK);
1582 ok(str1 != str, "got %p\n", str1);
1583 SysFreeString(str1);
1584 SysFreeString(str);
1585
1586 hr = IXMLHttpRequest_getResponseHeader(xhr, NULL, NULL);
1587 EXPECT_HR(hr, E_INVALIDARG);
1588 hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), NULL);
1589 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1590 hr = IXMLHttpRequest_getResponseHeader(xhr, _bstr_("Date"), &str);
1591 EXPECT_HR(hr, S_OK);
1592 ok(*str != ' ', "got leading space in header %s\n", wine_dbgstr_w(str));
1593 SysFreeString(str);
1594
1595 /* status code after ::send() */
1596 status = 0xdeadbeef;
1597 hr = IXMLHttpRequest_get_status(xhr, &status);
1598 EXPECT_HR(hr, S_OK);
1599 ok(status == 200, "got %d\n", status);
1600
1601 hr = IXMLHttpRequest_get_statusText(xhr, NULL);
1602 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1603
1604 hr = IXMLHttpRequest_get_statusText(xhr, &str);
1605 EXPECT_HR(hr, S_OK);
1606 ok(!lstrcmpW(str, _bstr_("OK")), "got status %s\n", wine_dbgstr_w(str));
1607 SysFreeString(str);
1608
1609 /* another ::send() after completed request */
1610 V_VT(&varbody) = VT_BSTR;
1611 V_BSTR(&varbody) = _bstr_(bodyA);
1612
1613 hr = IXMLHttpRequest_send(xhr, varbody);
1614 ok(hr == E_FAIL || broken(hr == E_UNEXPECTED) /* win2k */, "got 0x%08x\n", hr);
1615
1616 hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse);
1617 EXPECT_HR(hr, S_OK);
1618 /* the server currently returns "FAILED" because the Content-Type header is
1619 * not what the server expects */
1620 if(hr == S_OK)
1621 {
1622 ok(!memcmp(bstrResponse, wszExpectedResponse, sizeof(wszExpectedResponse)),
1623 "expected %s, got %s\n", wine_dbgstr_w(wszExpectedResponse), wine_dbgstr_w(bstrResponse));
1624 SysFreeString(bstrResponse);
1625 }
1626
1627 /* POST: VT_VARIANT|VT_BYREF body */
1628 test_open(xhr, "POST", urlA, S_OK);
1629
1630 V_VT(&varbody_ref) = VT_VARIANT|VT_BYREF;
1631 V_VARIANTREF(&varbody_ref) = &varbody;
1632 hr = IXMLHttpRequest_send(xhr, varbody_ref);
1633 EXPECT_HR(hr, S_OK);
1634
1635 /* GET request */
1636 test_open(xhr, "GET", xmltestA, S_OK);
1637
1638 V_VT(&varbody) = VT_EMPTY;
1639
1640 hr = IXMLHttpRequest_send(xhr, varbody);
1641 if (hr == INET_E_RESOURCE_NOT_FOUND)
1642 {
1643 skip("No connection could be made with test.winehq.org\n");
1644 IXMLHttpRequest_Release(xhr);
1645 return;
1646 }
1647 EXPECT_HR(hr, S_OK);
1648
1649 hr = IXMLHttpRequest_get_responseText(xhr, NULL);
1650 ok(hr == E_POINTER || broken(hr == E_INVALIDARG) /* <win8 */, "got 0x%08x\n", hr);
1651
1652 hr = IXMLHttpRequest_get_responseText(xhr, &bstrResponse);
1653 EXPECT_HR(hr, S_OK);
1654 ok(!memcmp(bstrResponse, _bstr_(xmltestbodyA), sizeof(xmltestbodyA)*sizeof(WCHAR)),
1655 "expected %s, got %s\n", xmltestbodyA, wine_dbgstr_w(bstrResponse));
1656 SysFreeString(bstrResponse);
1657
1658 hr = IXMLHttpRequest_get_responseBody(xhr, NULL);
1659 EXPECT_HR(hr, E_INVALIDARG);
1660
1661 V_VT(&varbody) = VT_EMPTY;
1662 hr = IXMLHttpRequest_get_responseBody(xhr, &varbody);
1663 EXPECT_HR(hr, S_OK);
1664 ok(V_VT(&varbody) == (VT_ARRAY|VT_UI1), "got type %d, expected %d\n", V_VT(&varbody), VT_ARRAY|VT_UI1);
1665 ok(SafeArrayGetDim(V_ARRAY(&varbody)) == 1, "got %d, expected one dimension\n", SafeArrayGetDim(V_ARRAY(&varbody)));
1666
1667 bound = -1;
1668 hr = SafeArrayGetLBound(V_ARRAY(&varbody), 1, &bound);
1669 EXPECT_HR(hr, S_OK);
1670 ok(bound == 0, "got %d, expected zero bound\n", bound);
1671
1672 hr = SafeArrayAccessData(V_ARRAY(&varbody), &ptr);
1673 EXPECT_HR(hr, S_OK);
1674 ok(memcmp(ptr, xmltestbodyA, sizeof(xmltestbodyA)-1) == 0, "got wrong body data\n");
1675 SafeArrayUnaccessData(V_ARRAY(&varbody));
1676
1677 VariantClear(&varbody);
1678
1679 /* get_responseStream */
1680 hr = IXMLHttpRequest_get_responseStream(xhr, NULL);
1681 EXPECT_HR(hr, E_INVALIDARG);
1682
1683 V_VT(&varbody) = VT_EMPTY;
1684 hr = IXMLHttpRequest_get_responseStream(xhr, &varbody);
1685 ok(V_VT(&varbody) == VT_UNKNOWN, "got type %d\n", V_VT(&varbody));
1686 EXPECT_HR(hr, S_OK);
1687 EXPECT_REF(V_UNKNOWN(&varbody), 1);
1688
1689 g = NULL;
1690 hr = GetHGlobalFromStream((IStream*)V_UNKNOWN(&varbody), &g);
1691 EXPECT_HR(hr, S_OK);
1692 ok(g != NULL, "got %p\n", g);
1693
1694 IDispatch_Release(event);
1695
1696 /* test if referrer header is sent */
1697 test_open(xhr, "GET", referertesturl, S_OK);
1698
1699 V_VT(&varbody) = VT_EMPTY;
1700 hr = IXMLHttpRequest_send(xhr, varbody);
1701 ok(hr == S_OK, "got 0x%08x\n", hr);
1702 hr = IXMLHttpRequest_get_responseText(xhr, &str);
1703 ok(hr == S_OK, "got 0x%08x\n", hr);
1704 ok(!lstrcmpW(str, norefererW), "got response text %s\n", wine_dbgstr_w(str));
1705 SysFreeString(str);
1706
1707 /* interaction with object site */
1708 hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site);
1709 EXPECT_HR(hr, S_OK);
1710
1711 hr = IObjectWithSite_SetSite(obj_site, NULL);
1712 ok(hr == S_OK, "got 0x%08x\n", hr);
1713
1714 hr = IXMLHttpRequest_QueryInterface(xhr, &IID_IObjectWithSite, (void**)&obj_site2);
1715 EXPECT_HR(hr, S_OK);
1716 ok(obj_site == obj_site2 || broken(obj_site != obj_site2), "got new instance\n");
1717 IObjectWithSite_Release(obj_site2);
1718
1719 set_xhr_site(xhr);
1720
1721 test_open(xhr, "GET", "tests/referer.php", S_OK);
1722 str1 = a2bstr("http://test.winehq.org/");
1723
1724 V_VT(&varbody) = VT_EMPTY;
1725 hr = IXMLHttpRequest_send(xhr, varbody);
1726 ok(hr == S_OK, "got 0x%08x\n", hr);
1727
1728 hr = IXMLHttpRequest_get_responseText(xhr, &str);
1729 ok(hr == S_OK, "got 0x%08x\n", hr);
1730 ok(!lstrcmpW(str, str1), "got response text %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str1));
1731 SysFreeString(str);
1732 SysFreeString(str1);
1733
1734 /* try to set site another time */
1735 hr = IObjectWithSite_SetSite(obj_site, &testsite);
1736 EXPECT_HR(hr, S_OK);
1737
1738 IObjectWithSite_Release(obj_site);
1739 IXMLHttpRequest_Release(xhr);
1740 free_bstrs();
1741 }
1742
1743 static void test_safe_httpreq(void)
1744 {
1745 IXMLHttpRequest *xhr;
1746
1747 xhr = create_xhr();
1748
1749 set_safety_opt((IUnknown*)xhr, INTERFACESAFE_FOR_UNTRUSTED_DATA, -1);
1750 set_xhr_site(xhr);
1751
1752 /* different scheme */
1753 test_open(xhr, "GET", "https://test.winehq.org/tests/hello.html", E_ACCESSDENIED);
1754
1755 /* different host */
1756 test_open(xhr, "GET", "http://tests.winehq.org/tests/hello.html", E_ACCESSDENIED);
1757 test_open(xhr, "GET", "http://www.test.winehq.org/tests/hello.html", E_ACCESSDENIED);
1758
1759 IXMLHttpRequest_Release(xhr);
1760 }
1761
1762 START_TEST(httpreq)
1763 {
1764 IXMLHttpRequest *xhr;
1765
1766 CoInitialize(NULL);
1767
1768 if((xhr = create_xhr())) {
1769 IXMLHttpRequest_Release(xhr);
1770
1771 test_XMLHTTP();
1772 test_safe_httpreq();
1773 }else {
1774 win_skip("IXMLHTTPRequest is not available\n");
1775 }
1776
1777 CoUninitialize();
1778 }