mshtml: Added noscript tag handling tests.
[wine] / dlls / mshtml / tests / protocol.c
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #define COBJMACROS
20
21 #include <wine/test.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ole2.h"
28 #include "urlmon.h"
29 #include "shlwapi.h"
30
31 #include "initguid.h"
32
33 #define DEFINE_EXPECT(func) \
34     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
35
36 #define SET_EXPECT(func) \
37     expect_ ## func = TRUE
38
39 #define CHECK_EXPECT(func) \
40     do { \
41         ok(expect_ ##func, "unexpected call " #func "\n"); \
42         expect_ ## func = FALSE; \
43         called_ ## func = TRUE; \
44     }while(0)
45
46 #define CHECK_EXPECT2(func) \
47     do { \
48         ok(expect_ ##func, "unexpected call " #func  "\n"); \
49         called_ ## func = TRUE; \
50     }while(0)
51
52 #define CHECK_CALLED(func) \
53     do { \
54         ok(called_ ## func, "expected " #func "\n"); \
55         expect_ ## func = called_ ## func = FALSE; \
56     }while(0)
57
58 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
59 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
60 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
61
62 DEFINE_EXPECT(GetBindInfo);
63 DEFINE_EXPECT(ReportProgress);
64 DEFINE_EXPECT(ReportData);
65 DEFINE_EXPECT(ReportResult);
66
67 static HRESULT expect_hrResult;
68 static BOOL expect_hr_win32err = FALSE;
69 static DWORD bindf;
70
71 static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
72 static const WCHAR about_test_url[] = {'a','b','o','u','t',':','t','e','s','t',0};
73 static const WCHAR about_res_url[] = {'r','e','s',':','b','l','a','n','k',0};
74 static const WCHAR javascript_test_url[] = {'j','a','v','a','s','c','r','i','p','t',':','t','e','s','t','(',')',0};
75
76 static const char *debugstr_guid(REFIID riid)
77 {
78     static char buf[50];
79
80     sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
81             riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
82             riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
83             riid->Data4[5], riid->Data4[6], riid->Data4[7]);
84
85     return buf;
86 }
87
88 static HRESULT WINAPI ProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
89 {
90     if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
91         *ppv = iface;
92         return S_OK;
93     }
94
95     *ppv = NULL;
96     ok(0, "unexpected riid %s\n", debugstr_guid(riid));
97     return E_NOINTERFACE;
98 }
99
100 static ULONG WINAPI ProtocolSink_AddRef(IInternetProtocolSink *iface)
101 {
102     return 2;
103 }
104
105 static ULONG WINAPI ProtocolSink_Release(IInternetProtocolSink *iface)
106 {
107     return 1;
108 }
109
110 static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
111 {
112     ok(0, "unexpected call\n");
113     return E_NOTIMPL;
114 }
115
116 static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode,
117         LPCWSTR szStatusText)
118 {
119     static const WCHAR text_html[] = {'t','e','x','t','/','h','t','m','l',0};
120
121     CHECK_EXPECT(ReportProgress);
122
123     ok(ulStatusCode == BINDSTATUS_MIMETYPEAVAILABLE
124             || ulStatusCode == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
125             "ulStatusCode=%d\n", ulStatusCode);
126     ok(!lstrcmpW(szStatusText, text_html), "szStatusText != text/html\n");
127
128     return S_OK;
129 }
130
131 static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress,
132         ULONG ulProgressMax)
133 {
134     CHECK_EXPECT(ReportData);
135
136     ok(ulProgress == ulProgressMax, "ulProgress != ulProgressMax\n");
137     ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE),
138             "grcf = %08x\n", grfBSCF);
139
140     return S_OK;
141 }
142
143 static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError,
144         LPCWSTR szResult)
145 {
146     CHECK_EXPECT(ReportResult);
147
148     if(expect_hr_win32err)
149         ok((hrResult&0xffff0000) == ((FACILITY_WIN32 << 16)|0x80000000) || expect_hrResult,
150                 "expected win32 err or %08x got: %08x\n", expect_hrResult, hrResult);
151     else
152         ok(hrResult == expect_hrResult || ((expect_hrResult == E_INVALIDARG ||
153            expect_hrResult == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND)) &&
154            hrResult == MK_E_SYNTAX), "expected: %08x got: %08x\n", expect_hrResult, hrResult);
155     ok(dwError == 0, "dwError = %d\n", dwError);
156     ok(!szResult, "szResult != NULL\n");
157
158     return S_OK;
159 }
160
161 static IInternetProtocolSinkVtbl protocol_sink_vtbl = {
162     ProtocolSink_QueryInterface,
163     ProtocolSink_AddRef,
164     ProtocolSink_Release,
165     ProtocolSink_Switch,
166     ProtocolSink_ReportProgress,
167     ProtocolSink_ReportData,
168     ProtocolSink_ReportResult
169 };
170
171 static IInternetProtocolSink protocol_sink = {
172     &protocol_sink_vtbl
173 };
174
175 static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv)
176 {
177     if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetBindInfo, riid)) {
178         *ppv = iface;
179         return S_OK;
180     }
181
182     *ppv = NULL;
183     ok(0, "unexpected riid %s\n", debugstr_guid(riid));
184     return E_NOINTERFACE;
185 }
186
187 static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface)
188 {
189     return 2;
190 }
191
192 static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface)
193 {
194     return 1;
195 }
196
197 static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
198 {
199     CHECK_EXPECT(GetBindInfo);
200
201     ok(grfBINDF != NULL, "grfBINDF == NULL\n");
202     ok(pbindinfo != NULL, "pbindinfo == NULL\n");
203     ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %d\n", pbindinfo->cbSize);
204
205     *grfBINDF = bindf;
206     return S_OK;
207 }
208
209 static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr,
210         ULONG cEl, ULONG *pcElFetched)
211 {
212     ok(0, "unexpected call\n");
213     return E_NOTIMPL;
214 }
215
216 static IInternetBindInfoVtbl bind_info_vtbl = {
217     BindInfo_QueryInterface,
218     BindInfo_AddRef,
219     BindInfo_Release,
220     BindInfo_GetBindInfo,
221     BindInfo_GetBindString
222 };
223
224 static IInternetBindInfo bind_info = {
225     &bind_info_vtbl
226 };
227
228 static void test_protocol_fail(IInternetProtocol *protocol, LPCWSTR url, HRESULT expected_hres,
229         BOOL expect_win32err)
230 {
231     HRESULT hres;
232
233     SET_EXPECT(GetBindInfo);
234     SET_EXPECT(ReportResult);
235
236     expect_hrResult = expected_hres;
237     expect_hr_win32err = expect_win32err;
238     hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
239     if(expect_win32err)
240         ok((hres&0xffff0000) == ((FACILITY_WIN32 << 16)|0x80000000) || hres == expect_hrResult,
241                 "expected win32 err or %08x got: %08x\n", expected_hres, hres);
242     else
243         ok(hres == expected_hres || ((expected_hres == E_INVALIDARG ||
244            expected_hres == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND)) && hres == MK_E_SYNTAX),
245            "expected: %08x got: %08x\n", expected_hres, hres);
246
247     CHECK_CALLED(GetBindInfo);
248     CHECK_CALLED(ReportResult);
249 }
250
251 static void protocol_start(IInternetProtocol *protocol, LPCWSTR url)
252 {
253     HRESULT hres;
254
255     SET_EXPECT(GetBindInfo);
256     SET_EXPECT(ReportResult);
257     SET_EXPECT(ReportProgress);
258     SET_EXPECT(ReportData);
259     expect_hrResult = S_OK;
260     expect_hr_win32err = FALSE;
261
262     hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
263     ok(hres == S_OK, "Start failed: %08x\n", hres);
264
265     CHECK_CALLED(GetBindInfo);
266     CHECK_CALLED(ReportProgress);
267     CHECK_CALLED(ReportData);
268     CHECK_CALLED(ReportResult);
269 }
270
271 static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
272 {
273     WCHAR buf[MAX_PATH];
274     DWORD len;
275
276     static const WCHAR fileW[] = {'f','i','l','e',':','/','/'};
277
278     if(size < sizeof(fileW)/sizeof(WCHAR) || memcmp(url, fileW, sizeof(fileW))) {
279         ok(0, "wrong URL protocol\n");
280         return;
281     }
282
283     SetLastError(0xdeadbeef);
284     len = SearchPathW(NULL, file, NULL, sizeof(buf)/sizeof(WCHAR), buf, NULL);
285     if(!len) {
286         if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
287             win_skip("SearchPathW is not implemented\n");
288         else
289             ok(0, "SearchPath failed: %u\n", GetLastError());
290         return;
291     }
292
293     len += sizeof(fileW)/sizeof(WCHAR)+1;
294     ok(len == size, "wrong size %u, expected %u\n", size, len);
295     ok(!lstrcmpW(url + sizeof(fileW)/sizeof(WCHAR), buf), "wrong file part %s\n", wine_dbgstr_w(url));
296 }
297
298 static void test_res_protocol(void)
299 {
300     IInternetProtocolInfo *protocol_info;
301     IUnknown *unk;
302     IClassFactory *factory;
303     HRESULT hres;
304
305     static const WCHAR blank_url[] =
306         {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
307     static const WCHAR test_part_url[] = {'r','e','s',':','/','/','C','S','S','/','t','e','s','t',0};
308     static const WCHAR wrong_url1[] =
309         {'m','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','m','t','h',0};
310     static const WCHAR wrong_url2[] =
311         {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',0};
312     static const WCHAR wrong_url3[] =
313         {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l','/','x','x','.','h','t','m',0};
314     static const WCHAR wrong_url4[] =
315         {'r','e','s',':','/','/','x','x','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
316     static const WCHAR wrong_url5[] =
317         {'r','e','s',':','/','/','s','h','t','m','l','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
318     static const WCHAR wrong_url6[] =
319         {'r','e','s',':','/','/','c',':','\\','d','i','r','\\','f','i','l','e','.','d','l','l','/','b','l','a','n','k','.','h','t','m',0};
320     static const WCHAR mshtml_dllW[] = {'m','s','h','t','m','l','.','d','l','l',0};
321
322     hres = CoGetClassObject(&CLSID_ResProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
323     ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
324     if(FAILED(hres))
325         return;
326
327     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
328     ok(hres == S_OK, "Could not get IInternetProtocolInfo interface: %08x\n", hres);
329     if(SUCCEEDED(hres)) {
330         WCHAR buf[128];
331         DWORD size, expected_size;
332         int i;
333
334         for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
335             if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
336                 hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, i, 0, buf,
337                         sizeof(buf)/sizeof(buf[0]), &size, 0);
338                 ok(hres == INET_E_DEFAULT_ACTION,
339                         "[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
340             }
341         }
342
343         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
344                 sizeof(buf)/sizeof(buf[0]), &size, 0);
345         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
346         res_sec_url_cmp(buf, size, mshtml_dllW);
347         ok(size == lstrlenW(buf)+1, "size = %d\n", size);
348         expected_size = size;
349
350         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
351                 expected_size, &size, 0);
352         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
353         res_sec_url_cmp(buf, size, mshtml_dllW);
354         ok(size == expected_size, "size = %d\n", size);
355
356         size = 0;
357         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
358                 3, &size, 0);
359         ok(hres == S_FALSE, "ParseUrl failed: %08x, expected S_FALSE\n", hres);
360         ok(size == expected_size, "size = %d\n", size);
361
362         hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_SECURITY_URL, 0, buf,
363                 sizeof(buf)/sizeof(buf[0]), &size, 0);
364         ok(hres == MK_E_SYNTAX || hres == E_INVALIDARG,
365            "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
366
367         hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url5, PARSE_SECURITY_URL, 0, buf,
368                 sizeof(buf)/sizeof(buf[0]), &size, 0);
369         ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
370
371         hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url6, PARSE_SECURITY_URL, 0, buf,
372                 sizeof(buf)/sizeof(buf[0]), &size, 0);
373         ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
374
375         size = 0xdeadbeef;
376         buf[0] = '?';
377         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
378                 sizeof(buf)/sizeof(buf[0]), &size, 0);
379         ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
380         ok(buf[0] == '?', "buf changed\n");
381         ok(size == sizeof(blank_url)/sizeof(WCHAR) ||
382            size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
383            "size=%d\n", size);
384
385         size = 0xdeadbeef;
386         hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_DOMAIN, 0, buf,
387                 sizeof(buf)/sizeof(buf[0]), &size, 0);
388         ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
389         ok(buf[0] == '?', "buf changed\n");
390         ok(size == sizeof(wrong_url1)/sizeof(WCHAR) ||
391            size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
392            "size=%d\n", size);
393
394         if (0)
395         {
396         /* Crashes on windows */
397         size = 0xdeadbeef;
398         buf[0] = '?';
399         hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
400                 sizeof(buf)/sizeof(buf[0]), &size, 0);
401         ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
402         ok(buf[0] == '?', "buf changed\n");
403         ok(size == 1, "size=%u, expected 1\n", size);
404
405         buf[0] = '?';
406         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
407                 sizeof(buf)/sizeof(buf[0]), NULL, 0);
408         ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
409         ok(buf[0] == '?', "buf changed\n");
410
411         buf[0] = '?';
412         hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
413                 sizeof(buf)/sizeof(buf[0]), NULL, 0);
414         ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
415         ok(buf[0] == '?', "buf changed\n");
416         }
417
418         buf[0] = '?';
419         hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf,
420                 sizeof(buf)/sizeof(buf[0]), &size, 0);
421         ok(hres == INET_E_DEFAULT_ACTION,
422                 "ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
423         ok(buf[0] == '?', "buf changed\n");
424
425         size = 0xdeadbeef;
426         hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
427                 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
428         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
429         ok(size == 0xdeadbeef, "size=%d\n", size);
430
431         size = 0xdeadbeef;
432         hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
433                 URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
434         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
435         ok(size == 0xdeadbeef, "size=%d\n", size);
436
437         size = 0xdeadbeef;
438         hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
439                 URL_FILE_USE_PATHURL, NULL, 0xdeadbeef, NULL, 0);
440         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
441         ok(size == 0xdeadbeef, "size=%d\n", size);
442
443         hres = IInternetProtocolInfo_CompareUrl(protocol_info, blank_url, blank_url, 0);
444         ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
445
446         hres = IInternetProtocolInfo_CompareUrl(protocol_info, NULL, NULL, 0xdeadbeef);
447         ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
448
449         for(i=0; i<30; i++) {
450             if(i == QUERY_USES_NETWORK || i == QUERY_IS_SECURE || i == QUERY_IS_SAFE)
451                 continue;
452
453             hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, i, 0,
454                                                    buf, sizeof(buf), &size, 0);
455             ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
456                "QueryInfo(%d) returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", i, hres);
457         }
458
459         size = 0xdeadbeef;
460         memset(buf, '?', sizeof(buf));
461         hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
462                                                buf, sizeof(buf), &size, 0);
463         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
464         ok(size == sizeof(DWORD), "size=%d\n", size);
465         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
466
467         memset(buf, '?', sizeof(buf));
468         hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
469                                                buf, sizeof(buf), NULL, 0);
470         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
471         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
472
473         hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
474                                                buf, 3, &size, 0);
475         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
476
477         size = 0xdeadbeef;
478         memset(buf, '?', sizeof(buf));
479         hres = IInternetProtocolInfo_QueryInfo(protocol_info, NULL, QUERY_USES_NETWORK, 0,
480                                                buf, sizeof(buf), &size, 0);
481         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
482         ok(size == sizeof(DWORD), "size=%d\n", size);
483         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
484
485         hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, QUERY_USES_NETWORK, 0,
486                                                NULL, sizeof(buf), &size, 0);
487         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
488
489         hres = IInternetProtocolInfo_QueryInfo(protocol_info, blank_url, 60, 0,
490                                                NULL, sizeof(buf), &size, 0);
491         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
492            "QueryInfo failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres);
493
494         IInternetProtocolInfo_Release(protocol_info);
495     }
496
497     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
498     ok(hres == S_OK, "Could not get IClassFactory interface\n");
499     if(SUCCEEDED(hres)) {
500         IInternetProtocol *protocol;
501         BYTE buf[512];
502         ULONG cb;
503         hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
504         ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
505
506         if(SUCCEEDED(hres)) {
507             IInternetPriority *priority;
508
509             hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
510             ok(hres == E_NOINTERFACE,
511                "QueryInterface(IInternetPriority) returned %08x, expected E_NOINTEFACE\n", hres);
512
513             test_protocol_fail(protocol, wrong_url1, E_INVALIDARG, FALSE);
514             test_protocol_fail(protocol, wrong_url2,
515                                HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), FALSE);
516             test_protocol_fail(protocol, wrong_url3, E_FAIL, TRUE);
517             test_protocol_fail(protocol, wrong_url4, E_FAIL, TRUE);
518
519             cb = 0xdeadbeef;
520             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
521             ok(hres == E_FAIL, "Read returned %08x expected E_FAIL\n", hres);
522             ok(cb == 0xdeadbeef, "cb=%u expected 0xdeadbeef\n", cb);
523     
524             protocol_start(protocol, blank_url);
525             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
526             ok(hres == S_OK, "Read failed: %08x\n", hres);
527             ok(cb == 2, "cb=%u expected 2\n", cb);
528             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
529             ok(hres == S_OK, "Read failed: %08x\n", hres);
530             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
531             ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
532             ok(cb == 0, "cb=%u expected 0\n", cb);
533             hres = IInternetProtocol_UnlockRequest(protocol);
534             ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
535
536             protocol_start(protocol, blank_url);
537             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
538             ok(hres == S_OK, "Read failed: %08x\n", hres);
539             hres = IInternetProtocol_LockRequest(protocol, 0);
540             ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
541             hres = IInternetProtocol_UnlockRequest(protocol);
542             ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
543             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
544             ok(hres == S_OK, "Read failed: %08x\n", hres);
545
546             protocol_start(protocol, blank_url);
547             hres = IInternetProtocol_LockRequest(protocol, 0);
548             ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
549             hres = IInternetProtocol_Terminate(protocol, 0);
550             ok(hres == S_OK, "Terminate failed: %08x\n", hres);
551             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
552             ok(hres == S_OK, "Read failed: %08x\n\n", hres);
553             hres = IInternetProtocol_UnlockRequest(protocol);
554             ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
555             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
556             ok(hres == S_OK, "Read failed: %08x\n", hres);
557             hres = IInternetProtocol_Terminate(protocol, 0);
558             ok(hres == S_OK, "Terminate failed: %08x\n", hres);
559             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
560             ok(hres == S_OK, "Read failed: %08x\n", hres);
561             ok(cb == 2, "cb=%u expected 2\n", cb);
562
563             protocol_start(protocol, blank_url);
564             hres = IInternetProtocol_LockRequest(protocol, 0);
565             ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
566             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
567             ok(hres == S_OK, "Read failed: %08x\n", hres);
568             protocol_start(protocol, blank_url);
569             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
570             ok(hres == S_OK, "Read failed: %08x\n", hres);
571             hres = IInternetProtocol_Terminate(protocol, 0);
572             ok(hres == S_OK, "Terminate failed: %08x\n", hres);
573
574             IInternetProtocol_Release(protocol);
575         }
576
577         IClassFactory_Release(factory);
578     }
579
580     IUnknown_Release(unk);
581 }
582
583 static void do_test_about_protocol(IClassFactory *factory, DWORD bf)
584 {
585     IInternetProtocol *protocol;
586     IInternetPriority *priority;
587     BYTE buf[512];
588     ULONG cb;
589     HRESULT hres;
590
591     static const WCHAR blank_html[] = {0xfeff,'<','H','T','M','L','>','<','/','H','T','M','L','>',0};
592     static const WCHAR test_html[] =
593         {0xfeff,'<','H','T','M','L','>','t','e','s','t','<','/','H','T','M','L','>',0};
594
595     bindf = bf;
596
597     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
598     ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
599     if(FAILED(hres))
600         return;
601
602     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
603     ok(hres == E_NOINTERFACE,
604        "QueryInterface(IInternetPriority) returned %08x, expected E_NOINTEFACE\n", hres);
605
606     protocol_start(protocol, about_blank_url);
607     hres = IInternetProtocol_LockRequest(protocol, 0);
608     ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
609     hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
610     ok(hres == S_OK, "Read failed: %08x\n", hres);
611     ok(cb == sizeof(blank_html), "cb=%d\n", cb);
612     ok(!memcmp(buf, blank_html, cb), "Readed wrong data\n");
613     hres = IInternetProtocol_UnlockRequest(protocol);
614     ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
615
616     protocol_start(protocol, about_test_url);
617     hres = IInternetProtocol_LockRequest(protocol, 0);
618     ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
619     hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
620     ok(hres == S_OK, "Read failed: %08x\n", hres);
621     ok(cb == sizeof(test_html), "cb=%d\n", cb);
622     ok(!memcmp(buf, test_html, cb), "Readed wrong data\n");
623     hres = IInternetProtocol_UnlockRequest(protocol);
624     ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
625
626     protocol_start(protocol, about_res_url);
627     hres = IInternetProtocol_LockRequest(protocol, 0);
628     ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
629     hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
630     ok(hres == S_OK, "Read failed: %08x\n", hres);
631     ok(cb == sizeof(blank_html), "cb=%d\n", cb);
632     ok(!memcmp(buf, blank_html, cb), "Readed wrong data\n");
633     hres = IInternetProtocol_UnlockRequest(protocol);
634     ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
635
636     IInternetProtocol_Release(protocol);
637 }
638
639 static void test_about_protocol(void)
640 {
641     IInternetProtocolInfo *protocol_info;
642     IUnknown *unk;
643     IClassFactory *factory;
644     HRESULT hres;
645
646     hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
647     ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
648     if(FAILED(hres))
649         return;
650
651     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
652     ok(hres == S_OK, "Could not get IInternetProtocolInfo interface: %08x\n", hres);
653     if(SUCCEEDED(hres)) {
654         WCHAR buf[128];
655         DWORD size;
656         int i;
657
658         for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
659             if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
660                 hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, i, 0, buf,
661                         sizeof(buf)/sizeof(buf[0]), &size, 0);
662                 ok(hres == INET_E_DEFAULT_ACTION,
663                         "[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
664             }
665         }
666
667         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
668                 sizeof(buf)/sizeof(buf[0]), &size, 0);
669         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
670         ok(!lstrcmpW(about_blank_url, buf), "buf != blank_url\n");
671
672         size = 0xdeadbeef;
673         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
674                 3, &size, 0);
675         ok(hres == S_FALSE, "ParseUrl failed: %08x, expected S_FALSE\n", hres);
676         ok(size == 12, "size = %d\n", size);
677
678         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_test_url, PARSE_SECURITY_URL, 0, buf,
679                 sizeof(buf)/sizeof(buf[0]), &size, 0);
680         ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
681         ok(!lstrcmpW(about_test_url, buf), "buf != test_url\n");
682         ok(size == 11, "size = %d\n", size);
683
684         size = 0xdeadbeef;
685         buf[0] = '?';
686         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
687                 sizeof(buf)/sizeof(buf[0]), &size, 0);
688         ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
689         ok(buf[0] == '?', "buf changed\n");
690         ok(size == sizeof(about_blank_url)/sizeof(WCHAR) ||
691            size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
692            "size=%d\n", size);
693
694         if (0)
695         {
696         /* Crashes on windows */
697         size = 0xdeadbeef;
698         buf[0] = '?';
699         hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
700                 sizeof(buf)/sizeof(buf[0]), &size, 0);
701         ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
702         ok(buf[0] == '?', "buf changed\n");
703         ok(size == 1, "size=%u, expected 1\n", size);
704
705         buf[0] = '?';
706         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
707                 sizeof(buf)/sizeof(buf[0]), NULL, 0);
708         ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
709         ok(buf[0] == '?', "buf changed\n");
710
711         buf[0] = '?';
712         hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
713                 sizeof(buf)/sizeof(buf[0]), NULL, 0);
714         ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
715         ok(buf[0] == '?', "buf changed\n");
716         }
717
718         hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_UNESCAPE+1, 0, buf,
719                 sizeof(buf)/sizeof(buf[0]), &size, 0);
720         ok(hres == INET_E_DEFAULT_ACTION,
721                 "ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
722
723         size = 0xdeadbeef;
724         hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
725                 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
726         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
727         ok(size == 0xdeadbeef, "size=%d\n", size);
728
729         size = 0xdeadbeef;
730         hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
731                 URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
732         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
733         ok(size == 0xdeadbeef, "size=%d\n", size);
734
735         size = 0xdeadbeef;
736         hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
737                 URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
738         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
739         ok(size == 0xdeadbeef, "size=%d\n", size);
740
741         hres = IInternetProtocolInfo_CompareUrl(protocol_info, about_blank_url, about_blank_url, 0);
742         ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
743
744         hres = IInternetProtocolInfo_CompareUrl(protocol_info, NULL, NULL, 0xdeadbeef);
745         ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
746
747         for(i=0; i<30; i++) {
748             switch(i) {
749             case QUERY_CAN_NAVIGATE:
750             case QUERY_USES_NETWORK:
751             case QUERY_IS_CACHED:
752             case QUERY_IS_INSTALLEDENTRY:
753             case QUERY_IS_CACHED_OR_MAPPED:
754             case QUERY_IS_SECURE:
755             case QUERY_IS_SAFE:
756             case QUERY_USES_HISTORYFOLDER:
757             case QUERY_IS_CACHED_AND_USABLE_OFFLINE:
758                 break;
759             default:
760                 hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, i, 0,
761                                                        buf, sizeof(buf), &size, 0);
762                 ok(hres == E_FAIL, "QueryInfo(%d) returned: %08x, expected E_FAIL\n", i, hres);
763             }
764         }
765
766         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_CAN_NAVIGATE, 0,
767                                                buf, sizeof(buf), &size, 0);
768         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER ||
769            hres == E_FAIL, /* win2k */
770            "QueryInfo returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER or E_FAIL\n", hres);
771
772         size = 0xdeadbeef;
773         memset(buf, '?', sizeof(buf));
774         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
775                                                buf, sizeof(buf), &size, 0);
776         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
777         ok(size == sizeof(DWORD), "size=%d\n", size);
778         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
779
780         memset(buf, '?', sizeof(buf));
781         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
782                                                buf, sizeof(buf), NULL, 0);
783         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
784         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
785
786         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
787                                                buf, 3, &size, 0);
788         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
789
790         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, QUERY_USES_NETWORK, 0,
791                                                NULL, sizeof(buf), &size, 0);
792         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
793
794         hres = IInternetProtocolInfo_QueryInfo(protocol_info, about_blank_url, 60, 0,
795                                                NULL, sizeof(buf), &size, 0);
796         ok(hres == E_FAIL, "QueryInfo failed: %08x, expected E_FAIL\n", hres);
797
798         IInternetProtocolInfo_Release(protocol_info);
799     }
800
801     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
802     ok(hres == S_OK, "Could not get IClassFactory interface\n");
803     if(SUCCEEDED(hres)) {
804         do_test_about_protocol(factory, 0);
805         do_test_about_protocol(factory,
806                 BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE);
807
808         IClassFactory_Release(factory);
809     }
810
811     IUnknown_Release(unk);
812 }
813
814 static void test_javascript_protocol(void)
815 {
816     IInternetProtocolInfo *protocol_info;
817     IUnknown *unk;
818     IClassFactory *factory;
819     HRESULT hres;
820
821     hres = CoGetClassObject(&CLSID_JSProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
822     ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
823     if(FAILED(hres))
824         return;
825
826     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
827     ok(hres == S_OK, "Could not get IInternetProtocolInfo interface: %08x\n", hres);
828     if(SUCCEEDED(hres)) {
829         WCHAR buf[128];
830         DWORD size;
831         int i;
832
833         for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
834             if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
835                 hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, i, 0, buf,
836                         sizeof(buf)/sizeof(buf[0]), &size, 0);
837                 ok(hres == INET_E_DEFAULT_ACTION,
838                         "[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
839             }
840         }
841
842         hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, PARSE_UNESCAPE+1, 0, buf,
843                 sizeof(buf)/sizeof(buf[0]), &size, 0);
844         ok(hres == INET_E_DEFAULT_ACTION,
845                 "ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
846
847         size = 0xdeadbeef;
848         hres = IInternetProtocolInfo_CombineUrl(protocol_info, javascript_test_url, javascript_test_url,
849                 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
850         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
851         ok(size == 0xdeadbeef, "size=%d\n", size);
852
853         hres = IInternetProtocolInfo_CompareUrl(protocol_info, javascript_test_url, javascript_test_url, 0);
854         ok(hres == E_NOTIMPL, "CompareUrl failed: %08x\n", hres);
855
856         for(i=0; i<30; i++) {
857             switch(i) {
858             case QUERY_USES_NETWORK:
859             case QUERY_IS_SECURE:
860                 break;
861             default:
862                 hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, i, 0,
863                                                        buf, sizeof(buf), &size, 0);
864                 ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
865                    "QueryInfo(%d) returned: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", i, hres);
866             }
867         }
868
869
870         memset(buf, '?', sizeof(buf));
871         hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, QUERY_USES_NETWORK, 0,
872                                                buf, sizeof(buf), &size, 0);
873         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
874         ok(size == sizeof(DWORD), "size=%d\n", size);
875         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
876
877         memset(buf, '?', sizeof(buf));
878         hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, QUERY_USES_NETWORK, 0,
879                                                buf, sizeof(buf), NULL, 0);
880         ok(hres == S_OK, "QueryInfo(QUERY_USES_NETWORK) failed: %08x\n", hres);
881         ok(!*(DWORD*)buf, "buf=%d\n", *(DWORD*)buf);
882
883         hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, QUERY_USES_NETWORK, 0,
884                                                buf, 3, &size, 0);
885         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
886
887         hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, QUERY_USES_NETWORK, 0,
888                                                NULL, sizeof(buf), &size, 0);
889         ok(hres == E_FAIL, "QueryInfo(QUERY_USES_NETWORK) failed: %08x, expected E_FAIL\n", hres);
890
891         hres = IInternetProtocolInfo_QueryInfo(protocol_info, javascript_test_url, 60, 0,
892                                                NULL, sizeof(buf), &size, 0);
893         ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER,
894            "QueryInfo failed: %08x, expected INET_E_USE_DEFAULT_PROTOCOLHANDLER\n", hres);
895
896         /* FIXME: test QUERY_IS_SECURE */
897
898         IInternetProtocolInfo_Release(protocol_info);
899     }
900
901     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
902     ok(hres == S_OK, "Could not get IClassFactory interface\n");
903     if(SUCCEEDED(hres))
904         IClassFactory_Release(factory);
905
906     IUnknown_Release(unk);
907 }
908
909 START_TEST(protocol)
910 {
911     OleInitialize(NULL);
912
913     test_res_protocol();
914     test_about_protocol();
915     test_javascript_protocol();
916
917     OleUninitialize();
918 }