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