4 * Copyright 2010 Thomas Mullaly
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.
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.
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
21 #include <wine/test.h>
35 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
36 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
37 #define URI_BUILDER_STR_PROPERTY_COUNT 7
39 #define DEFINE_EXPECT(func) \
40 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
42 #define SET_EXPECT(func) \
43 expect_ ## func = TRUE
45 #define CHECK_EXPECT(func) \
47 ok(expect_ ##func, "unexpected call " #func "\n"); \
48 expect_ ## func = FALSE; \
49 called_ ## func = TRUE; \
52 #define CHECK_EXPECT2(func) \
54 ok(expect_ ##func, "unexpected call " #func "\n"); \
55 called_ ## func = TRUE; \
58 #define CHECK_CALLED(func) \
60 ok(called_ ## func, "expected " #func "\n"); \
61 expect_ ## func = called_ ## func = FALSE; \
64 DEFINE_EXPECT(CombineUrl);
66 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
67 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
68 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
69 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
70 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
71 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
72 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
74 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
75 '.','o','r','g','/',0};
76 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
77 '.','o','r','g','/','#','F','r','a','g',0};
79 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
80 'e','s','t','i','n','g',0};
81 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
82 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
84 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
86 typedef struct _uri_create_flag_test {
89 } uri_create_flag_test;
91 static const uri_create_flag_test invalid_flag_tests[] = {
92 /* Set of invalid flag combinations to test for. */
93 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
94 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
95 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
96 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
97 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
100 typedef struct _uri_str_property {
104 const char* broken_value;
107 typedef struct _uri_dword_property {
111 } uri_dword_property;
113 typedef struct _uri_properties {
116 HRESULT create_expected;
119 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
120 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
123 static const uri_properties uri_tests[] = {
124 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
126 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
127 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
128 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
129 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
130 {"",S_FALSE,FALSE}, /* EXTENSION */
131 {"",S_FALSE,FALSE}, /* FRAGMENT */
132 {"www.winehq.org",S_OK,FALSE}, /* HOST */
133 {"",S_FALSE,FALSE}, /* PASSWORD */
134 {"/",S_OK,FALSE}, /* PATH */
135 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
136 {"",S_FALSE,FALSE}, /* QUERY */
137 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
138 {"http",S_OK,FALSE}, /* SCHEME_NAME */
139 {"",S_FALSE,FALSE}, /* USER_INFO */
140 {"",S_FALSE,FALSE} /* USER_NAME */
143 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
144 {80,S_OK,FALSE}, /* PORT */
145 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
146 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
149 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
151 {"http://winehq.org/tests",S_OK,FALSE},
152 {"winehq.org",S_OK,FALSE},
153 {"http://winehq.org/tests",S_OK,FALSE},
154 {"winehq.org",S_OK,FALSE},
157 {"winehq.org",S_OK,FALSE},
159 {"/tests",S_OK,FALSE},
160 {"/tests",S_OK,FALSE},
162 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
168 {Uri_HOST_DNS,S_OK,FALSE},
170 {URL_SCHEME_HTTP,S_OK,FALSE},
171 {URLZONE_INVALID,E_NOTIMPL,FALSE}
174 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
176 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
177 {"www.winehq.org",S_OK,FALSE},
178 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
179 {"winehq.org",S_OK,FALSE},
182 {"www.winehq.org",S_OK,FALSE},
185 {"/?query=x&return=y",S_OK,FALSE},
186 {"?query=x&return=y",S_OK,FALSE},
187 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
193 {Uri_HOST_DNS,S_OK,FALSE},
195 {URL_SCHEME_HTTP,S_OK,FALSE},
196 {URLZONE_INVALID,E_NOTIMPL,FALSE},
199 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
201 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
202 {"usEr%3Ainfo@example.com",S_OK,FALSE},
203 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
204 {"example.com",S_OK,FALSE},
207 {"example.com",S_OK,FALSE},
209 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
210 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
212 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
214 {"usEr%3Ainfo",S_OK,FALSE},
215 {"usEr%3Ainfo",S_OK,FALSE}
218 {Uri_HOST_DNS,S_OK,FALSE},
220 {URL_SCHEME_HTTP,S_OK,FALSE},
221 {URLZONE_INVALID,E_NOTIMPL,FALSE},
224 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
226 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
227 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
228 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
229 {"winehq.org",S_OK,FALSE},
232 {"ftp.winehq.org",S_OK,FALSE},
234 {"/dir/foo%20bar.txt",S_OK,FALSE},
235 {"/dir/foo%20bar.txt",S_OK,FALSE},
237 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
239 {"winepass:wine",S_OK,FALSE},
240 {"winepass",S_OK,FALSE}
243 {Uri_HOST_DNS,S_OK,FALSE},
245 {URL_SCHEME_FTP,S_OK,FALSE},
246 {URLZONE_INVALID,E_NOTIMPL,FALSE}
249 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
251 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
253 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
259 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
260 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
262 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
268 {Uri_HOST_UNKNOWN,S_OK,FALSE},
270 {URL_SCHEME_FILE,S_OK,FALSE},
271 {URLZONE_INVALID,E_NOTIMPL,FALSE}
274 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
276 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
278 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
284 {"/tests/test%20file.README.txt",S_OK,FALSE},
285 {"/tests/test%20file.README.txt",S_OK,FALSE},
287 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
293 {Uri_HOST_UNKNOWN,S_OK,FALSE},
295 {URL_SCHEME_FILE,S_OK,FALSE},
296 {URLZONE_INVALID,E_NOTIMPL,FALSE}
299 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
301 {"urn:nothing:should:happen here",S_OK,FALSE},
303 {"urn:nothing:should:happen here",S_OK,FALSE},
309 {"nothing:should:happen here",S_OK,FALSE},
310 {"nothing:should:happen here",S_OK,FALSE},
312 {"urn:nothing:should:happen here",S_OK,FALSE},
318 {Uri_HOST_UNKNOWN,S_OK,FALSE},
320 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
321 {URLZONE_INVALID,E_NOTIMPL,FALSE}
324 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
326 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
327 {"127.0.0.1",S_OK,FALSE},
328 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
332 {"127.0.0.1",S_OK,FALSE},
334 {"/test%20dir/test.txt",S_OK,FALSE},
335 {"/test%20dir/test.txt",S_OK,FALSE},
337 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
343 {Uri_HOST_IPV4,S_OK,FALSE},
345 {URL_SCHEME_HTTP,S_OK,FALSE},
346 {URLZONE_INVALID,E_NOTIMPL,FALSE}
349 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
351 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
352 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
353 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
357 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
362 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
368 {Uri_HOST_IPV6,S_OK,FALSE},
370 {URL_SCHEME_HTTP,S_OK,FALSE},
371 {URLZONE_INVALID,E_NOTIMPL,FALSE}
374 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
376 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
377 {"[::13.1.68.3]",S_OK,FALSE},
378 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
382 {"::13.1.68.3",S_OK,FALSE},
387 {"ftp://[::13.1.68.3]",S_OK,FALSE},
393 {Uri_HOST_IPV6,S_OK,FALSE},
395 {URL_SCHEME_FTP,S_OK,FALSE},
396 {URLZONE_INVALID,E_NOTIMPL,FALSE}
399 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
401 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
402 {"[fedc:ba98::3210]",S_OK,FALSE},
403 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
407 {"fedc:ba98::3210",S_OK,FALSE},
412 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
418 {Uri_HOST_IPV6,S_OK,FALSE},
420 {URL_SCHEME_HTTP,S_OK,FALSE},
421 {URLZONE_INVALID,E_NOTIMPL,FALSE}
424 { "1234://www.winehq.org", 0, S_OK, FALSE,
426 {"1234://www.winehq.org/",S_OK,FALSE},
427 {"www.winehq.org",S_OK,FALSE},
428 {"1234://www.winehq.org/",S_OK,FALSE},
429 {"winehq.org",S_OK,FALSE},
432 {"www.winehq.org",S_OK,FALSE},
437 {"1234://www.winehq.org",S_OK,FALSE},
443 {Uri_HOST_DNS,S_OK,FALSE},
445 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
446 {URLZONE_INVALID,E_NOTIMPL,FALSE}
449 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
450 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
452 {"file:///C:/test/test.mp3",S_OK,FALSE},
454 {"file:///C:/test/test.mp3",S_OK,FALSE},
460 {"/C:/test/test.mp3",S_OK,FALSE},
461 {"/C:/test/test.mp3",S_OK,FALSE},
463 {"C:/test/test.mp3",S_OK,FALSE},
469 {Uri_HOST_UNKNOWN,S_OK,FALSE},
471 {URL_SCHEME_FILE,S_OK,FALSE},
472 {URLZONE_INVALID,E_NOTIMPL,FALSE}
475 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
476 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
478 {"file://server/test.mp3",S_OK,FALSE},
479 {"server",S_OK,FALSE},
480 {"file://server/test.mp3",S_OK,FALSE},
484 {"server",S_OK,FALSE},
486 {"/test.mp3",S_OK,FALSE},
487 {"/test.mp3",S_OK,FALSE},
489 {"\\\\Server/test.mp3",S_OK,FALSE},
495 {Uri_HOST_DNS,S_OK,FALSE},
497 {URL_SCHEME_FILE,S_OK,FALSE},
498 {URLZONE_INVALID,E_NOTIMPL,FALSE}
501 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
503 {"*:www.winehq.org/test",S_OK,FALSE},
504 {"www.winehq.org",S_OK,FALSE},
505 {"*:www.winehq.org/test",S_OK,FALSE},
506 {"winehq.org",S_OK,FALSE},
509 {"www.winehq.org",S_OK,FALSE},
511 {"/test",S_OK,FALSE},
512 {"/test",S_OK,FALSE},
514 {"www.winehq.org/test",S_OK,FALSE},
520 {Uri_HOST_DNS,S_OK,FALSE},
522 {URL_SCHEME_WILDCARD,S_OK,FALSE},
523 {URLZONE_INVALID,E_NOTIMPL,FALSE}
526 /* Valid since the '*' is the only character in the scheme name. */
527 { "*:www.winehq.org/test", 0, S_OK, FALSE,
529 {"*:www.winehq.org/test",S_OK,FALSE},
530 {"www.winehq.org",S_OK,FALSE},
531 {"*:www.winehq.org/test",S_OK,FALSE},
532 {"winehq.org",S_OK,FALSE},
535 {"www.winehq.org",S_OK,FALSE},
537 {"/test",S_OK,FALSE},
538 {"/test",S_OK,FALSE},
540 {"*:www.winehq.org/test",S_OK,FALSE},
546 {Uri_HOST_DNS,S_OK,FALSE},
548 {URL_SCHEME_WILDCARD,S_OK,FALSE},
549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
552 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
554 {"/../some dir/test.ext",S_OK,FALSE},
556 {"/../some dir/test.ext",S_OK,FALSE},
562 {"/../some dir/test.ext",S_OK,FALSE},
563 {"/../some dir/test.ext",S_OK,FALSE},
565 {"/../some dir/test.ext",S_OK,FALSE},
571 {Uri_HOST_UNKNOWN,S_OK,FALSE},
573 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
574 {URLZONE_INVALID,E_NOTIMPL,FALSE}
577 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
579 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
581 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
587 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
588 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
590 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
596 {Uri_HOST_UNKNOWN,S_OK,FALSE},
598 {URL_SCHEME_WILDCARD,S_OK,FALSE},
599 {URLZONE_INVALID,E_NOTIMPL,FALSE}
602 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
603 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
605 {"zip:/.//google.com",S_OK,FALSE},
607 {"zip:/.//google.com",S_OK,FALSE},
613 {"/.//google.com",S_OK,FALSE},
614 {"/.//google.com",S_OK,FALSE},
616 {"zip://google.com",S_OK,FALSE},
622 {Uri_HOST_UNKNOWN,S_OK,FALSE},
624 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
628 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
629 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
631 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
632 {"user:pass:word@winehq.org",S_OK,FALSE},
633 {"ftp://winehq.org/",S_OK,FALSE},
634 {"winehq.org",S_OK,FALSE},
637 {"winehq.org",S_OK,FALSE},
638 {"pass:word",S_OK,FALSE},
642 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
644 {"user:pass:word",S_OK,FALSE},
648 {Uri_HOST_DNS,S_OK,FALSE},
650 {URL_SCHEME_FTP,S_OK,FALSE},
651 {URLZONE_INVALID,E_NOTIMPL,FALSE}
654 /* Make sure % encoded unreserved characters are decoded. */
655 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
657 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
658 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
659 {"ftp://ftp.google.com/",S_OK,FALSE},
660 {"google.com",S_OK,FALSE},
663 {"ftp.google.com",S_OK,FALSE},
668 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
670 {"wINe:PASS",S_OK,FALSE},
674 {Uri_HOST_DNS,S_OK,FALSE},
676 {URL_SCHEME_FTP,S_OK,FALSE},
677 {URLZONE_INVALID,E_NOTIMPL,FALSE}
680 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
681 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
683 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
684 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
685 {"ftp://ftp.google.com/",S_OK,FALSE},
686 {"google.com",S_OK,FALSE},
689 {"ftp.google.com",S_OK,FALSE},
690 {"PA%7B%7D",S_OK,FALSE},
694 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
696 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
697 {"w%5D%5Be",S_OK,FALSE}
700 {Uri_HOST_DNS,S_OK,FALSE},
702 {URL_SCHEME_FTP,S_OK,FALSE},
703 {URLZONE_INVALID,E_NOTIMPL,FALSE}
706 /* You're allowed to have an empty password portion in the userinfo section. */
707 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
709 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
710 {"empty:@ftp.google.com",S_OK,FALSE},
711 {"ftp://ftp.google.com/",S_OK,FALSE},
712 {"google.com",S_OK,FALSE},
715 {"ftp.google.com",S_OK,FALSE},
720 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
722 {"empty:",S_OK,FALSE},
726 {Uri_HOST_DNS,S_OK,FALSE},
728 {URL_SCHEME_FTP,S_OK,FALSE},
729 {URLZONE_INVALID,E_NOTIMPL,FALSE}
732 /* Make sure forbidden characters in "userinfo" get encoded. */
733 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
735 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
736 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
737 {"ftp://ftp.google.com/",S_OK,FALSE},
738 {"google.com",S_OK,FALSE},
741 {"ftp.google.com",S_OK,FALSE},
746 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
748 {"%22%20%22weird",S_OK,FALSE},
749 {"%22%20%22weird",S_OK,FALSE}
752 {Uri_HOST_DNS,S_OK,FALSE},
754 {URL_SCHEME_FTP,S_OK,FALSE},
755 {URLZONE_INVALID,E_NOTIMPL,FALSE}
758 /* Make sure the forbidden characters don't get percent encoded. */
759 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
761 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
762 {"\" \"weird@ftp.google.com",S_OK,FALSE},
763 {"ftp://ftp.google.com/",S_OK,FALSE},
764 {"google.com",S_OK,FALSE},
767 {"ftp.google.com",S_OK,FALSE},
772 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
774 {"\" \"weird",S_OK,FALSE},
775 {"\" \"weird",S_OK,FALSE}
778 {Uri_HOST_DNS,S_OK,FALSE},
780 {URL_SCHEME_FTP,S_OK,FALSE},
781 {URLZONE_INVALID,E_NOTIMPL,FALSE}
784 /* Allowed to have invalid % encoded because its an unknown scheme type. */
785 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
787 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
788 {"%xy:word@winehq.org",S_OK,FALSE},
789 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
790 {"winehq.org",S_OK,FALSE},
793 {"winehq.org",S_OK,FALSE},
798 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
800 {"%xy:word",S_OK,FALSE},
804 {Uri_HOST_DNS,S_OK,FALSE},
806 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
807 {URLZONE_INVALID,E_NOTIMPL,FALSE}
810 /* Unreserved, percent encoded characters aren't decoded in the userinfo becuase the scheme
813 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
815 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
816 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
817 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
818 {"winehq.org",S_OK,FALSE},
821 {"winehq.org",S_OK,FALSE},
822 {"%52%53ord",S_OK,FALSE},
826 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
828 {"%2E:%52%53ord",S_OK,FALSE},
832 {Uri_HOST_DNS,S_OK,FALSE},
834 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
835 {URLZONE_INVALID,E_NOTIMPL,FALSE}
838 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
840 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
841 {"[](),'test':word@winehq.org",S_OK,FALSE},
842 {"ftp://winehq.org/",S_OK,FALSE},
843 {"winehq.org",S_OK,FALSE},
846 {"winehq.org",S_OK,FALSE},
851 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
853 {"[](),'test':word",S_OK,FALSE},
854 {"[](),'test'",S_OK,FALSE}
857 {Uri_HOST_DNS,S_OK,FALSE},
859 {URL_SCHEME_FTP,S_OK,FALSE},
860 {URLZONE_INVALID,E_NOTIMPL,FALSE}
863 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
865 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
867 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
874 {"/?:word@winehq.org/",S_OK,FALSE},
875 {"?:word@winehq.org/",S_OK,FALSE},
876 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
882 {Uri_HOST_DNS,S_OK,FALSE},
884 {URL_SCHEME_FTP,S_OK,FALSE},
885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
888 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
890 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
892 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
895 {"#:word@winehq.org/",S_OK,FALSE},
901 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
907 {Uri_HOST_DNS,S_OK,FALSE},
909 {URL_SCHEME_FTP,S_OK,FALSE},
910 {URLZONE_INVALID,E_NOTIMPL,FALSE}
913 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
914 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
916 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
917 {"test\\:word@winehq.org",S_OK,FALSE},
918 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
919 {"winehq.org",S_OK,FALSE},
922 {"winehq.org",S_OK,FALSE},
927 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
929 {"test\\:word",S_OK,FALSE},
930 {"test\\",S_OK,FALSE}
933 {Uri_HOST_DNS,S_OK,FALSE},
935 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
936 {URLZONE_INVALID,E_NOTIMPL,FALSE}
939 /* It normalizes IPv4 addresses correctly. */
940 { "http://127.000.000.100/", 0, S_OK, FALSE,
942 {"http://127.0.0.100/",S_OK,FALSE},
943 {"127.0.0.100",S_OK,FALSE},
944 {"http://127.0.0.100/",S_OK,FALSE},
948 {"127.0.0.100",S_OK,FALSE},
953 {"http://127.000.000.100/",S_OK,FALSE},
959 {Uri_HOST_IPV4,S_OK,FALSE},
961 {URL_SCHEME_HTTP,S_OK,FALSE},
962 {URLZONE_INVALID,E_NOTIMPL,FALSE}
965 /* Make sure it normalizes partial IPv4 addresses correctly. */
966 { "http://127.0/", 0, S_OK, FALSE,
968 {"http://127.0.0.0/",S_OK,FALSE},
969 {"127.0.0.0",S_OK,FALSE},
970 {"http://127.0.0.0/",S_OK,FALSE},
974 {"127.0.0.0",S_OK,FALSE},
979 {"http://127.0/",S_OK,FALSE},
985 {Uri_HOST_IPV4,S_OK,FALSE},
987 {URL_SCHEME_HTTP,S_OK,FALSE},
988 {URLZONE_INVALID,E_NOTIMPL,FALSE}
991 /* Make sure it converts implicit IPv4's correctly. */
992 { "http://123456/", 0, S_OK, FALSE,
994 {"http://0.1.226.64/",S_OK,FALSE},
995 {"0.1.226.64",S_OK,FALSE},
996 {"http://0.1.226.64/",S_OK,FALSE},
1000 {"0.1.226.64",S_OK,FALSE},
1005 {"http://123456/",S_OK,FALSE},
1006 {"http",S_OK,FALSE},
1011 {Uri_HOST_IPV4,S_OK,FALSE},
1013 {URL_SCHEME_HTTP,S_OK,FALSE},
1014 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1018 { "http://4294967295/", 0, S_OK, FALSE,
1020 {"http://255.255.255.255/",S_OK,FALSE},
1021 {"255.255.255.255",S_OK,FALSE},
1022 {"http://255.255.255.255/",S_OK,FALSE},
1026 {"255.255.255.255",S_OK,FALSE},
1031 {"http://4294967295/",S_OK,FALSE},
1032 {"http",S_OK,FALSE},
1037 {Uri_HOST_IPV4,S_OK,FALSE},
1039 {URL_SCHEME_HTTP,S_OK,FALSE},
1040 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1044 { "http://4294967296/", 0, S_OK, FALSE,
1046 {"http://4294967296/",S_OK,FALSE},
1047 {"4294967296",S_OK,FALSE},
1048 {"http://4294967296/",S_OK,FALSE},
1052 {"4294967296",S_OK,FALSE},
1057 {"http://4294967296/",S_OK,FALSE},
1058 {"http",S_OK,FALSE},
1063 {Uri_HOST_DNS,S_OK,FALSE},
1065 {URL_SCHEME_HTTP,S_OK,FALSE},
1066 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1069 /* Window's doesn't normalize IP address for unknown schemes. */
1070 { "1234://4294967295/", 0, S_OK, FALSE,
1072 {"1234://4294967295/",S_OK,FALSE},
1073 {"4294967295",S_OK,FALSE},
1074 {"1234://4294967295/",S_OK,FALSE},
1078 {"4294967295",S_OK,FALSE},
1083 {"1234://4294967295/",S_OK,FALSE},
1084 {"1234",S_OK,FALSE},
1089 {Uri_HOST_IPV4,S_OK,FALSE},
1091 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1092 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1095 /* Window's doesn't normalize IP address for unknown schemes. */
1096 { "1234://127.001/", 0, S_OK, FALSE,
1098 {"1234://127.001/",S_OK,FALSE},
1099 {"127.001",S_OK,FALSE},
1100 {"1234://127.001/",S_OK,FALSE},
1104 {"127.001",S_OK,FALSE},
1109 {"1234://127.001/",S_OK,FALSE},
1110 {"1234",S_OK,FALSE},
1115 {Uri_HOST_IPV4,S_OK,FALSE},
1117 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1118 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1121 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1123 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1124 {"[fedc:ba98::3210]",S_OK,FALSE},
1125 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1129 {"fedc:ba98::3210",S_OK,FALSE},
1134 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1135 {"http",S_OK,FALSE},
1140 {Uri_HOST_IPV6,S_OK,FALSE},
1142 {URL_SCHEME_HTTP,S_OK,FALSE},
1143 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1146 { "http://[::]", 0, S_OK, FALSE,
1148 {"http://[::]/",S_OK,FALSE},
1149 {"[::]",S_OK,FALSE},
1150 {"http://[::]/",S_OK,FALSE},
1159 {"http://[::]",S_OK,FALSE},
1160 {"http",S_OK,FALSE},
1165 {Uri_HOST_IPV6,S_OK,FALSE},
1167 {URL_SCHEME_HTTP,S_OK,FALSE},
1168 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1171 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1173 {"http://[fedc:ba98::]/",S_OK,FALSE},
1174 {"[fedc:ba98::]",S_OK,FALSE},
1175 {"http://[fedc:ba98::]/",S_OK,FALSE},
1179 {"fedc:ba98::",S_OK,FALSE},
1184 {"http://[FEDC:BA98::]",S_OK,FALSE},
1185 {"http",S_OK,FALSE},
1190 {Uri_HOST_IPV6,S_OK,FALSE},
1192 {URL_SCHEME_HTTP,S_OK,FALSE},
1193 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1196 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1197 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1199 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1200 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1201 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1205 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1210 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1211 {"http",S_OK,FALSE},
1216 {Uri_HOST_IPV6,S_OK,FALSE},
1218 {URL_SCHEME_HTTP,S_OK,FALSE},
1219 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1222 { "http://[v2.34]/", 0, S_OK, FALSE,
1224 {"http://[v2.34]/",S_OK,FALSE},
1225 {"[v2.34]",S_OK,FALSE},
1226 {"http://[v2.34]/",S_OK,FALSE},
1230 {"[v2.34]",S_OK,FALSE},
1235 {"http://[v2.34]/",S_OK,FALSE},
1236 {"http",S_OK,FALSE},
1241 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1243 {URL_SCHEME_HTTP,S_OK,FALSE},
1244 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1247 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1248 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1250 {"http://[xyz:12345.com/test",S_OK,FALSE},
1251 {"[xyz:12345.com",S_OK,FALSE},
1252 {"http://[xyz:12345.com/test",S_OK,FALSE},
1253 {"[xyz:12345.com",S_OK,FALSE},
1256 {"[xyz:12345.com",S_OK,FALSE},
1258 {"/test",S_OK,FALSE},
1259 {"/test",S_OK,FALSE},
1261 {"http://[xyz:12345.com/test",S_OK,FALSE},
1262 {"http",S_OK,FALSE},
1267 {Uri_HOST_DNS,S_OK,FALSE},
1269 {URL_SCHEME_HTTP,S_OK,FALSE},
1270 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1273 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1274 * of the host name (respectively).
1276 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1278 {"ftp://www.[works].com/",S_OK,FALSE},
1279 {"www.[works].com",S_OK,FALSE},
1280 {"ftp://www.[works].com/",S_OK,FALSE},
1281 {"[works].com",S_OK,FALSE},
1284 {"www.[works].com",S_OK,FALSE},
1289 {"ftp://www.[works].com/",S_OK,FALSE},
1295 {Uri_HOST_DNS,S_OK,FALSE},
1297 {URL_SCHEME_FTP,S_OK,FALSE},
1298 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1301 /* Considers ':' a delimiter since it appears after the ']'. */
1302 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1304 {"http://www.google.com]:12345/",S_OK,FALSE},
1305 {"www.google.com]:12345",S_OK,FALSE},
1306 {"http://www.google.com]:12345/",S_OK,FALSE},
1307 {"google.com]",S_OK,FALSE},
1310 {"www.google.com]",S_OK,FALSE},
1315 {"http://www.google.com]:12345/",S_OK,FALSE},
1316 {"http",S_OK,FALSE},
1321 {Uri_HOST_DNS,S_OK,FALSE},
1323 {URL_SCHEME_HTTP,S_OK,FALSE},
1324 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1327 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1328 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1330 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1331 {"w%XXw%GEw.google.com",S_OK,FALSE},
1332 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1333 {"google.com",S_OK,FALSE},
1336 {"w%XXw%GEw.google.com",S_OK,FALSE},
1341 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1347 {Uri_HOST_DNS,S_OK,FALSE},
1349 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1350 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1353 /* Unknown scheme types hostname doesn't get lower cased. */
1354 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1356 {"zip://GOOGLE.com/",S_OK,FALSE},
1357 {"GOOGLE.com",S_OK,FALSE},
1358 {"zip://GOOGLE.com/",S_OK,FALSE},
1359 {"GOOGLE.com",S_OK,FALSE},
1362 {"GOOGLE.com",S_OK,FALSE},
1367 {"zip://GOOGLE.com/",S_OK,FALSE},
1373 {Uri_HOST_DNS,S_OK,FALSE},
1375 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1376 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1379 /* Hostname get's lower cased for known scheme types. */
1380 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1382 {"http://www.google.com/",S_OK,FALSE},
1383 {"www.google.com",S_OK,FALSE},
1384 {"http://www.google.com/",S_OK,FALSE},
1385 {"google.com",S_OK,FALSE},
1388 {"www.google.com",S_OK,FALSE},
1393 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1394 {"http",S_OK,FALSE},
1399 {Uri_HOST_DNS,S_OK,FALSE},
1401 {URL_SCHEME_HTTP,S_OK,FALSE},
1402 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1405 /* Characters that get % encoded in the hostname also have their percent
1406 * encoded forms lower cased.
1408 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1410 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1411 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1412 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1413 {"%7cgoogle%7c.com",S_OK,FALSE},
1416 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1421 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1422 {"http",S_OK,FALSE},
1427 {Uri_HOST_DNS,S_OK,FALSE},
1429 {URL_SCHEME_HTTP,S_OK,FALSE},
1430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1433 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1434 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1436 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1437 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1438 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1442 {"1:2:3:4:5:6::",S_OK,FALSE},
1447 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1448 {"http",S_OK,FALSE},
1453 {Uri_HOST_IPV6,S_OK,FALSE},
1455 {URL_SCHEME_HTTP,S_OK,FALSE},
1456 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1459 /* IPv4 addresses get normalized. */
1460 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1462 {"http://[::1.2.3.0]/",S_OK,FALSE},
1463 {"[::1.2.3.0]",S_OK,FALSE},
1464 {"http://[::1.2.3.0]/",S_OK,FALSE},
1468 {"::1.2.3.0",S_OK,FALSE},
1473 {"http://[::001.002.003.000]",S_OK,FALSE},
1474 {"http",S_OK,FALSE},
1479 {Uri_HOST_IPV6,S_OK,FALSE},
1481 {URL_SCHEME_HTTP,S_OK,FALSE},
1482 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1485 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1486 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1488 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1489 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1490 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1494 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1499 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1505 {Uri_HOST_IPV6,S_OK,FALSE},
1507 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1508 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1511 /* IPv4 address is converted into 2 h16 components. */
1512 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1514 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1515 {"[ffff::c0de:6f20]",S_OK,FALSE},
1516 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1520 {"ffff::c0de:6f20",S_OK,FALSE},
1525 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1526 {"http",S_OK,FALSE},
1531 {Uri_HOST_IPV6,S_OK,FALSE},
1533 {URL_SCHEME_HTTP,S_OK,FALSE},
1534 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1537 /* Max value for a port. */
1538 { "http://google.com:65535", 0, S_OK, FALSE,
1540 {"http://google.com:65535/",S_OK,FALSE},
1541 {"google.com:65535",S_OK,FALSE},
1542 {"http://google.com:65535/",S_OK,FALSE},
1543 {"google.com",S_OK,FALSE},
1546 {"google.com",S_OK,FALSE},
1551 {"http://google.com:65535",S_OK,FALSE},
1552 {"http",S_OK,FALSE},
1557 {Uri_HOST_DNS,S_OK,FALSE},
1559 {URL_SCHEME_HTTP,S_OK,FALSE},
1560 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1563 { "zip://google.com:65536", 0, S_OK, FALSE,
1565 {"zip://google.com:65536/",S_OK,FALSE},
1566 {"google.com:65536",S_OK,FALSE},
1567 {"zip://google.com:65536/",S_OK,FALSE},
1568 {"google.com:65536",S_OK,FALSE},
1571 {"google.com:65536",S_OK,FALSE},
1576 {"zip://google.com:65536",S_OK,FALSE},
1582 {Uri_HOST_DNS,S_OK,FALSE},
1584 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1585 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1588 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1590 {"zip://google.com:65536:25/",S_OK,FALSE},
1591 {"google.com:65536:25",S_OK,FALSE},
1592 {"zip://google.com:65536:25/",S_OK,FALSE},
1593 {"google.com:65536:25",S_OK,FALSE},
1596 {"google.com:65536:25",S_OK,FALSE},
1601 {"zip://google.com:65536:25",S_OK,FALSE},
1607 {Uri_HOST_DNS,S_OK,FALSE},
1609 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1610 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1613 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1615 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1616 {"[::ffff]:abcd",S_OK,FALSE},
1617 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1621 {"[::ffff]:abcd",S_OK,FALSE},
1626 {"zip://[::ffff]:abcd",S_OK,FALSE},
1632 {Uri_HOST_DNS,S_OK,FALSE},
1634 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1635 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1638 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1640 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1641 {"127.0.0.1:abcd",S_OK,FALSE},
1642 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1643 {"0.1:abcd",S_OK,FALSE},
1646 {"127.0.0.1:abcd",S_OK,FALSE},
1651 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1657 {Uri_HOST_DNS,S_OK,FALSE},
1659 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1660 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1663 /* Port is just copied over. */
1664 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1666 {"http://google.com:00035",S_OK,FALSE},
1667 {"google.com:00035",S_OK,FALSE},
1668 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1669 {"google.com",S_OK,FALSE},
1672 {"google.com",S_OK,FALSE},
1677 {"http://google.com:00035",S_OK,FALSE},
1678 {"http",S_OK,FALSE},
1683 {Uri_HOST_DNS,S_OK,FALSE},
1685 {URL_SCHEME_HTTP,S_OK,FALSE},
1686 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1689 /* Default port is copied over. */
1690 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1692 {"http://google.com:80",S_OK,FALSE},
1693 {"google.com:80",S_OK,FALSE},
1694 {"http://google.com:80",S_OK,FALSE},
1695 {"google.com",S_OK,FALSE},
1698 {"google.com",S_OK,FALSE},
1703 {"http://google.com:80",S_OK,FALSE},
1704 {"http",S_OK,FALSE},
1709 {Uri_HOST_DNS,S_OK,FALSE},
1711 {URL_SCHEME_HTTP,S_OK,FALSE},
1712 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1715 { "http://google.com.uk", 0, S_OK, FALSE,
1717 {"http://google.com.uk/",S_OK,FALSE},
1718 {"google.com.uk",S_OK,FALSE},
1719 {"http://google.com.uk/",S_OK,FALSE},
1720 {"google.com.uk",S_OK,FALSE},
1723 {"google.com.uk",S_OK,FALSE},
1728 {"http://google.com.uk",S_OK,FALSE},
1729 {"http",S_OK,FALSE},
1734 {Uri_HOST_DNS,S_OK,FALSE},
1736 {URL_SCHEME_HTTP,S_OK,FALSE},
1737 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1740 { "http://google.com.com", 0, S_OK, FALSE,
1742 {"http://google.com.com/",S_OK,FALSE},
1743 {"google.com.com",S_OK,FALSE},
1744 {"http://google.com.com/",S_OK,FALSE},
1745 {"com.com",S_OK,FALSE},
1748 {"google.com.com",S_OK,FALSE},
1753 {"http://google.com.com",S_OK,FALSE},
1754 {"http",S_OK,FALSE},
1759 {Uri_HOST_DNS,S_OK,FALSE},
1761 {URL_SCHEME_HTTP,S_OK,FALSE},
1762 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1765 { "http://google.uk.1", 0, S_OK, FALSE,
1767 {"http://google.uk.1/",S_OK,FALSE},
1768 {"google.uk.1",S_OK,FALSE},
1769 {"http://google.uk.1/",S_OK,FALSE},
1770 {"google.uk.1",S_OK,FALSE},
1773 {"google.uk.1",S_OK,FALSE},
1778 {"http://google.uk.1",S_OK,FALSE},
1779 {"http",S_OK,FALSE},
1784 {Uri_HOST_DNS,S_OK,FALSE},
1786 {URL_SCHEME_HTTP,S_OK,FALSE},
1787 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1790 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1791 { "http://google.foo.uk", 0, S_OK, FALSE,
1793 {"http://google.foo.uk/",S_OK,FALSE},
1794 {"google.foo.uk",S_OK,FALSE},
1795 {"http://google.foo.uk/",S_OK,FALSE},
1796 {"foo.uk",S_OK,FALSE},
1799 {"google.foo.uk",S_OK,FALSE},
1804 {"http://google.foo.uk",S_OK,FALSE},
1805 {"http",S_OK,FALSE},
1810 {Uri_HOST_DNS,S_OK,FALSE},
1812 {URL_SCHEME_HTTP,S_OK,FALSE},
1813 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1816 { "http://.com", 0, S_OK, FALSE,
1818 {"http://.com/",S_OK,FALSE},
1819 {".com",S_OK,FALSE},
1820 {"http://.com/",S_OK,FALSE},
1821 {".com",S_OK,FALSE},
1824 {".com",S_OK,FALSE},
1829 {"http://.com",S_OK,FALSE},
1830 {"http",S_OK,FALSE},
1835 {Uri_HOST_DNS,S_OK,FALSE},
1837 {URL_SCHEME_HTTP,S_OK,FALSE},
1838 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1841 { "http://.uk", 0, S_OK, FALSE,
1843 {"http://.uk/",S_OK,FALSE},
1845 {"http://.uk/",S_OK,FALSE},
1854 {"http://.uk",S_OK,FALSE},
1855 {"http",S_OK,FALSE},
1860 {Uri_HOST_DNS,S_OK,FALSE},
1862 {URL_SCHEME_HTTP,S_OK,FALSE},
1863 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1866 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1868 {"http://www.co.google.com.[]/",S_OK,FALSE},
1869 {"www.co.google.com.[]",S_OK,FALSE},
1870 {"http://www.co.google.com.[]/",S_OK,FALSE},
1871 {"google.com.[]",S_OK,FALSE},
1874 {"www.co.google.com.[]",S_OK,FALSE},
1879 {"http://www.co.google.com.[]",S_OK,FALSE},
1880 {"http",S_OK,FALSE},
1885 {Uri_HOST_DNS,S_OK,FALSE},
1887 {URL_SCHEME_HTTP,S_OK,FALSE},
1888 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1891 { "http://co.uk", 0, S_OK, FALSE,
1893 {"http://co.uk/",S_OK,FALSE},
1894 {"co.uk",S_OK,FALSE},
1895 {"http://co.uk/",S_OK,FALSE},
1899 {"co.uk",S_OK,FALSE},
1904 {"http://co.uk",S_OK,FALSE},
1905 {"http",S_OK,FALSE},
1910 {Uri_HOST_DNS,S_OK,FALSE},
1912 {URL_SCHEME_HTTP,S_OK,FALSE},
1913 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1916 { "http://www.co.google.us.test", 0, S_OK, FALSE,
1918 {"http://www.co.google.us.test/",S_OK,FALSE},
1919 {"www.co.google.us.test",S_OK,FALSE},
1920 {"http://www.co.google.us.test/",S_OK,FALSE},
1921 {"us.test",S_OK,FALSE},
1924 {"www.co.google.us.test",S_OK,FALSE},
1929 {"http://www.co.google.us.test",S_OK,FALSE},
1930 {"http",S_OK,FALSE},
1935 {Uri_HOST_DNS,S_OK,FALSE},
1937 {URL_SCHEME_HTTP,S_OK,FALSE},
1938 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1941 { "http://gov.uk", 0, S_OK, FALSE,
1943 {"http://gov.uk/",S_OK,FALSE},
1944 {"gov.uk",S_OK,FALSE},
1945 {"http://gov.uk/",S_OK,FALSE},
1949 {"gov.uk",S_OK,FALSE},
1954 {"http://gov.uk",S_OK,FALSE},
1955 {"http",S_OK,FALSE},
1960 {Uri_HOST_DNS,S_OK,FALSE},
1962 {URL_SCHEME_HTTP,S_OK,FALSE},
1963 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1966 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1968 {"zip://www.google.com\\test",S_OK,FALSE},
1969 {"www.google.com\\test",S_OK,FALSE},
1970 {"zip://www.google.com\\test",S_OK,FALSE},
1971 {"google.com\\test",S_OK,FALSE},
1974 {"www.google.com\\test",S_OK,FALSE},
1979 {"zip://www.google.com\\test",S_OK,FALSE},
1985 {Uri_HOST_DNS,S_OK,FALSE},
1987 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1988 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1991 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
1993 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
1995 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2001 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2002 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2004 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2010 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2012 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2013 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2016 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2017 * are decoded and all '%' are encoded.
2019 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2021 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2023 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2025 {".mp3",S_OK,FALSE},
2029 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2030 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2032 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2033 {"file",S_OK,FALSE},
2038 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2040 {URL_SCHEME_FILE,S_OK,FALSE},
2041 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2044 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2045 * is decoded and only %'s in front of invalid hex digits are encoded.
2047 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2049 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2051 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2053 {".mp3",S_OK,FALSE},
2057 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2058 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2060 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2061 {"file",S_OK,FALSE},
2066 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2068 {URL_SCHEME_FILE,S_OK,FALSE},
2069 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2072 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2073 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2075 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2076 {"[::1.2.3.0]",S_OK,FALSE},
2077 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2081 {"::1.2.3.0",S_OK,FALSE},
2083 {"/%3F%23.T/test",S_OK,FALSE},
2084 {"/%3F%23.T/test",S_OK,FALSE},
2086 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2087 {"http",S_OK,FALSE},
2092 {Uri_HOST_IPV6,S_OK,FALSE},
2094 {URL_SCHEME_HTTP,S_OK,FALSE},
2095 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2098 /* Forbidden characters are always encoded for file URIs. */
2099 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2101 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2103 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2105 {".mp3",S_OK,FALSE},
2109 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2110 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2112 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2113 {"file",S_OK,FALSE},
2118 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2120 {URL_SCHEME_FILE,S_OK,FALSE},
2121 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2124 /* Forbidden characters are never encoded for unknown scheme types. */
2125 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2127 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2128 {"4294967295",S_OK,FALSE},
2129 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2133 {"4294967295",S_OK,FALSE},
2135 {"/<|>\" test<|>",S_OK,FALSE},
2136 {"/<|>\" test<|>",S_OK,FALSE},
2138 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2139 {"1234",S_OK,FALSE},
2144 {Uri_HOST_IPV4,S_OK,FALSE},
2146 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2147 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2150 /* Make sure forbidden characters are percent encoded. */
2151 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2153 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2154 {"gov.uk",S_OK,FALSE},
2155 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2159 {"gov.uk",S_OK,FALSE},
2161 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2162 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2164 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2165 {"http",S_OK,FALSE},
2170 {Uri_HOST_DNS,S_OK,FALSE},
2172 {URL_SCHEME_HTTP,S_OK,FALSE},
2173 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2176 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2178 {"http://gov.uk/",S_OK,FALSE},
2179 {"gov.uk",S_OK,FALSE},
2180 {"http://gov.uk/",S_OK,FALSE},
2184 {"gov.uk",S_OK,FALSE},
2189 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2190 {"http",S_OK,FALSE},
2195 {Uri_HOST_DNS,S_OK,FALSE},
2197 {URL_SCHEME_HTTP,S_OK,FALSE},
2198 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2201 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2203 {"http://gov.uk/",S_OK,FALSE},
2204 {"gov.uk",S_OK,FALSE},
2205 {"http://gov.uk/",S_OK,FALSE},
2209 {"gov.uk",S_OK,FALSE},
2214 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2215 {"http",S_OK,FALSE},
2220 {Uri_HOST_DNS,S_OK,FALSE},
2222 {URL_SCHEME_HTTP,S_OK,FALSE},
2223 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2226 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2228 {"http://gov.uk/",S_OK,FALSE},
2229 {"gov.uk",S_OK,FALSE},
2230 {"http://gov.uk/",S_OK,FALSE},
2234 {"gov.uk",S_OK,FALSE},
2239 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2240 {"http",S_OK,FALSE},
2245 {Uri_HOST_DNS,S_OK,FALSE},
2247 {URL_SCHEME_HTTP,S_OK,FALSE},
2248 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2251 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2253 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2255 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2257 {".mp3",S_OK,FALSE},
2261 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2262 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2264 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2265 {"file",S_OK,FALSE},
2270 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2272 {URL_SCHEME_FILE,S_OK,FALSE},
2273 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2276 /* Dot removal happens for unknown scheme types. */
2277 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2279 {"zip://gov.uk/",S_OK,FALSE},
2280 {"gov.uk",S_OK,FALSE},
2281 {"zip://gov.uk/",S_OK,FALSE},
2285 {"gov.uk",S_OK,FALSE},
2290 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2296 {Uri_HOST_DNS,S_OK,FALSE},
2298 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2299 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2302 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2303 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2305 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2306 {"gov.uk",S_OK,FALSE},
2307 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2311 {"gov.uk",S_OK,FALSE},
2313 {"/test/test2/../../.",S_OK,FALSE},
2314 {"/test/test2/../../.",S_OK,FALSE},
2316 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2317 {"http",S_OK,FALSE},
2322 {Uri_HOST_DNS,S_OK,FALSE},
2324 {URL_SCHEME_HTTP,S_OK,FALSE},
2325 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2328 /* Dot removal doesn't happen for wildcard scheme types. */
2329 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2331 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2332 {"gov.uk",S_OK,FALSE},
2333 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2337 {"gov.uk",S_OK,FALSE},
2339 {"/test/test2/../../.",S_OK,FALSE},
2340 {"/test/test2/../../.",S_OK,FALSE},
2342 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2348 {Uri_HOST_DNS,S_OK,FALSE},
2350 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2351 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2354 /* Forbidden characters are encoded for opaque known scheme types. */
2355 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2357 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2359 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2361 {".com%22",S_OK,FALSE},
2365 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2366 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2368 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2369 {"mailto",S_OK,FALSE},
2374 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2376 {URL_SCHEME_MAILTO,S_OK,FALSE},
2377 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2380 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2382 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2384 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2386 {".com",S_OK,FALSE},
2390 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2391 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2393 {"news:test.tes<|>t.com",S_OK,FALSE},
2394 {"news",S_OK,FALSE},
2399 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2401 {URL_SCHEME_NEWS,S_OK,FALSE},
2402 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2405 /* Don't encode forbidden characters. */
2406 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2408 {"news:test.tes<|>t.com",S_OK,FALSE},
2410 {"news:test.tes<|>t.com",S_OK,FALSE},
2412 {".com",S_OK,FALSE},
2416 {"test.tes<|>t.com",S_OK,FALSE},
2417 {"test.tes<|>t.com",S_OK,FALSE},
2419 {"news:test.tes<|>t.com",S_OK,FALSE},
2420 {"news",S_OK,FALSE},
2425 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2427 {URL_SCHEME_NEWS,S_OK,FALSE},
2428 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2431 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2432 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2434 {"urn:test.tes<|>t.com",S_OK,FALSE},
2436 {"urn:test.tes<|>t.com",S_OK,FALSE},
2438 {".com",S_OK,FALSE},
2442 {"test.tes<|>t.com",S_OK,FALSE},
2443 {"test.tes<|>t.com",S_OK,FALSE},
2445 {"urn:test.tes<|>t.com",S_OK,FALSE},
2451 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2453 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2454 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2457 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2458 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2460 {"news:test.test.com",S_OK,FALSE},
2462 {"news:test.test.com",S_OK,FALSE},
2464 {".com",S_OK,FALSE},
2468 {"test.test.com",S_OK,FALSE},
2469 {"test.test.com",S_OK,FALSE},
2471 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2472 {"news",S_OK,FALSE},
2477 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2479 {URL_SCHEME_NEWS,S_OK,FALSE},
2480 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2483 /* Percent encoded characters are still decoded for known scheme types. */
2484 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2486 {"news:test.test.com",S_OK,FALSE},
2488 {"news:test.test.com",S_OK,FALSE},
2490 {".com",S_OK,FALSE},
2494 {"test.test.com",S_OK,FALSE},
2495 {"test.test.com",S_OK,FALSE},
2497 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2498 {"news",S_OK,FALSE},
2503 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2505 {URL_SCHEME_NEWS,S_OK,FALSE},
2506 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2509 /* Percent encoded characters aren't decoded for unknown scheme types. */
2510 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2512 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2514 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2516 {".com",S_OK,FALSE},
2520 {"test.%74%65%73%74.com",S_OK,FALSE},
2521 {"test.%74%65%73%74.com",S_OK,FALSE},
2523 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2529 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2531 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2532 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2535 /* Unknown scheme types can have invalid % encoded data in query string. */
2536 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2538 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2539 {"www.winehq.org",S_OK,FALSE},
2540 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2541 {"winehq.org",S_OK,FALSE},
2544 {"www.winehq.org",S_OK,FALSE},
2547 {"/?query=%xx&return=y",S_OK,FALSE},
2548 {"?query=%xx&return=y",S_OK,FALSE},
2549 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2555 {Uri_HOST_DNS,S_OK,FALSE},
2557 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2558 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2561 /* Known scheme types can have invalid % encoded data with the right flags. */
2562 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2564 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2565 {"www.winehq.org",S_OK,FALSE},
2566 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2567 {"winehq.org",S_OK,FALSE},
2570 {"www.winehq.org",S_OK,FALSE},
2573 {"/?query=%xx&return=y",S_OK,FALSE},
2574 {"?query=%xx&return=y",S_OK,FALSE},
2575 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2576 {"http",S_OK,FALSE},
2581 {Uri_HOST_DNS,S_OK,FALSE},
2583 {URL_SCHEME_HTTP,S_OK,FALSE},
2584 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2587 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2588 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2590 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2591 {"www.winehq.org",S_OK,FALSE},
2592 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2593 {"winehq.org",S_OK,FALSE},
2596 {"www.winehq.org",S_OK,FALSE},
2599 {"/?query=<|>&return=y",S_OK,FALSE},
2600 {"?query=<|>&return=y",S_OK,FALSE},
2601 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2602 {"http",S_OK,FALSE},
2607 {Uri_HOST_DNS,S_OK,FALSE},
2609 {URL_SCHEME_HTTP,S_OK,FALSE},
2610 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2613 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2614 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2616 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2617 {"www.winehq.org",S_OK,FALSE},
2618 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2619 {"winehq.org",S_OK,FALSE},
2622 {"www.winehq.org",S_OK,FALSE},
2625 {"/?query=<|>&return=y",S_OK,FALSE},
2626 {"?query=<|>&return=y",S_OK,FALSE},
2627 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2628 {"http",S_OK,FALSE},
2633 {Uri_HOST_DNS,S_OK,FALSE},
2635 {URL_SCHEME_HTTP,S_OK,FALSE},
2636 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2639 /* Forbidden characters are encoded for known scheme types. */
2640 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2642 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2643 {"www.winehq.org",S_OK,FALSE},
2644 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2645 {"winehq.org",S_OK,FALSE},
2648 {"www.winehq.org",S_OK,FALSE},
2651 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2652 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2653 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2654 {"http",S_OK,FALSE},
2659 {Uri_HOST_DNS,S_OK,FALSE},
2661 {URL_SCHEME_HTTP,S_OK,FALSE},
2662 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2665 /* Forbidden characters are not encoded for unknown scheme types. */
2666 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2668 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2669 {"www.winehq.org",S_OK,FALSE},
2670 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2671 {"winehq.org",S_OK,FALSE},
2674 {"www.winehq.org",S_OK,FALSE},
2677 {"/?query=<|>&return=y",S_OK,FALSE},
2678 {"?query=<|>&return=y",S_OK,FALSE},
2679 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2685 {Uri_HOST_DNS,S_OK,FALSE},
2687 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2688 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2691 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2692 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2694 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2695 {"www.winehq.org",S_OK,FALSE},
2696 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2697 {"winehq.org",S_OK,FALSE},
2700 {"www.winehq.org",S_OK,FALSE},
2703 {"/?query=01&return=y",S_OK,FALSE},
2704 {"?query=01&return=y",S_OK,FALSE},
2705 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2706 {"http",S_OK,FALSE},
2711 {Uri_HOST_DNS,S_OK,FALSE},
2713 {URL_SCHEME_HTTP,S_OK,FALSE},
2714 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2717 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2718 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2720 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2721 {"www.winehq.org",S_OK,FALSE},
2722 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2723 {"winehq.org",S_OK,FALSE},
2726 {"www.winehq.org",S_OK,FALSE},
2729 {"/?query=%30%31&return=y",S_OK,FALSE},
2730 {"?query=%30%31&return=y",S_OK,FALSE},
2731 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2737 {Uri_HOST_DNS,S_OK,FALSE},
2739 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2740 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2743 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2744 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2746 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2747 {"www.winehq.org",S_OK,FALSE},
2748 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2749 {"winehq.org",S_OK,FALSE},
2752 {"www.winehq.org",S_OK,FALSE},
2755 {"/?query=%30%31&return=y",S_OK,FALSE},
2756 {"?query=%30%31&return=y",S_OK,FALSE},
2757 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2758 {"http",S_OK,FALSE},
2763 {Uri_HOST_DNS,S_OK,FALSE},
2765 {URL_SCHEME_HTTP,S_OK,FALSE},
2766 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2769 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2771 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2772 {"www.winehq.org",S_OK,FALSE},
2773 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2774 {"winehq.org",S_OK,FALSE},
2777 {"www.winehq.org",S_OK,FALSE},
2780 {"?query=12&return=y",S_OK,FALSE},
2781 {"?query=12&return=y",S_OK,FALSE},
2782 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2783 {"http",S_OK,FALSE},
2788 {Uri_HOST_DNS,S_OK,FALSE},
2790 {URL_SCHEME_HTTP,S_OK,FALSE},
2791 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2794 /* Unknown scheme types can have invalid % encoded data in fragments. */
2795 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2797 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2798 {"www.winehq.org",S_OK,FALSE},
2799 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2800 {"winehq.org",S_OK,FALSE},
2802 {"#Te%xx",S_OK,FALSE},
2803 {"www.winehq.org",S_OK,FALSE},
2805 {"/tests/",S_OK,FALSE},
2806 {"/tests/",S_OK,FALSE},
2808 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2814 {Uri_HOST_DNS,S_OK,FALSE},
2816 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2817 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2820 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2821 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2823 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2824 {"www.winehq.org",S_OK,FALSE},
2825 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2826 {"winehq.org",S_OK,FALSE},
2828 {"#Te<|>",S_OK,FALSE},
2829 {"www.winehq.org",S_OK,FALSE},
2831 {"/tests/",S_OK,FALSE},
2832 {"/tests/",S_OK,FALSE},
2834 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2840 {Uri_HOST_DNS,S_OK,FALSE},
2842 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2843 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2846 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2847 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2849 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2850 {"www.winehq.org",S_OK,FALSE},
2851 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2852 {"winehq.org",S_OK,FALSE},
2854 {"#Te%3C%7C%3E",S_OK,FALSE},
2855 {"www.winehq.org",S_OK,FALSE},
2857 {"/tests/",S_OK,FALSE},
2858 {"/tests/",S_OK,FALSE},
2860 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2861 {"http",S_OK,FALSE},
2866 {Uri_HOST_DNS,S_OK,FALSE},
2868 {URL_SCHEME_HTTP,S_OK,FALSE},
2869 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2872 /* Forbidden characters aren't encoded in the fragment with this flag. */
2873 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2875 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2876 {"www.winehq.org",S_OK,FALSE},
2877 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2878 {"winehq.org",S_OK,FALSE},
2880 {"#Te<|>",S_OK,FALSE},
2881 {"www.winehq.org",S_OK,FALSE},
2883 {"/tests/",S_OK,FALSE},
2884 {"/tests/",S_OK,FALSE},
2886 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2887 {"http",S_OK,FALSE},
2892 {Uri_HOST_DNS,S_OK,FALSE},
2894 {URL_SCHEME_HTTP,S_OK,FALSE},
2895 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2898 /* Forbidden characters aren't encoded in the fragment with this flag. */
2899 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2901 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2902 {"www.winehq.org",S_OK,FALSE},
2903 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2904 {"winehq.org",S_OK,FALSE},
2906 {"#Te<|>",S_OK,FALSE},
2907 {"www.winehq.org",S_OK,FALSE},
2909 {"/tests/",S_OK,FALSE},
2910 {"/tests/",S_OK,FALSE},
2912 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2913 {"http",S_OK,FALSE},
2918 {Uri_HOST_DNS,S_OK,FALSE},
2920 {URL_SCHEME_HTTP,S_OK,FALSE},
2921 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2924 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2925 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2927 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2928 {"www.winehq.org",S_OK,FALSE},
2929 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2930 {"winehq.org",S_OK,FALSE},
2932 {"#Te%30%31%32",S_OK,FALSE},
2933 {"www.winehq.org",S_OK,FALSE},
2935 {"/tests/",S_OK,FALSE},
2936 {"/tests/",S_OK,FALSE},
2938 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2944 {Uri_HOST_DNS,S_OK,FALSE},
2946 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2947 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2950 /* Percent encoded, unreserved characters are decoded for known schemes. */
2951 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2953 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2954 {"www.winehq.org",S_OK,FALSE},
2955 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2956 {"winehq.org",S_OK,FALSE},
2958 {"#Te012",S_OK,FALSE},
2959 {"www.winehq.org",S_OK,FALSE},
2961 {"/tests/",S_OK,FALSE},
2962 {"/tests/",S_OK,FALSE},
2964 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2965 {"http",S_OK,FALSE},
2970 {Uri_HOST_DNS,S_OK,FALSE},
2972 {URL_SCHEME_HTTP,S_OK,FALSE},
2973 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2976 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
2977 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2979 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2980 {"www.winehq.org",S_OK,FALSE},
2981 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2982 {"winehq.org",S_OK,FALSE},
2984 {"#Te012",S_OK,FALSE},
2985 {"www.winehq.org",S_OK,FALSE},
2987 {"/tests/",S_OK,FALSE},
2988 {"/tests/",S_OK,FALSE},
2990 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2991 {"http",S_OK,FALSE},
2996 {Uri_HOST_DNS,S_OK,FALSE},
2998 {URL_SCHEME_HTTP,S_OK,FALSE},
2999 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3002 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3003 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3005 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3006 {"www.winehq.org",S_OK,FALSE},
3007 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3008 {"winehq.org",S_OK,FALSE},
3010 {"#Te%30%31%32",S_OK,FALSE},
3011 {"www.winehq.org",S_OK,FALSE},
3013 {"/tests/",S_OK,FALSE},
3014 {"/tests/",S_OK,FALSE},
3016 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3017 {"http",S_OK,FALSE},
3022 {Uri_HOST_DNS,S_OK,FALSE},
3024 {URL_SCHEME_HTTP,S_OK,FALSE},
3025 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3028 /* Leading/Trailing whitespace is removed. */
3029 { " http://google.com/ ", 0, S_OK, FALSE,
3031 {"http://google.com/",S_OK,FALSE},
3032 {"google.com",S_OK,FALSE},
3033 {"http://google.com/",S_OK,FALSE},
3034 {"google.com",S_OK,FALSE},
3037 {"google.com",S_OK,FALSE},
3042 {"http://google.com/",S_OK,FALSE},
3043 {"http",S_OK,FALSE},
3048 {Uri_HOST_DNS,S_OK,FALSE},
3050 {URL_SCHEME_HTTP,S_OK,FALSE},
3051 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3054 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3056 {"http://google.com/",S_OK,FALSE},
3057 {"google.com",S_OK,FALSE},
3058 {"http://google.com/",S_OK,FALSE},
3059 {"google.com",S_OK,FALSE},
3062 {"google.com",S_OK,FALSE},
3067 {"http://google.com/",S_OK,FALSE},
3068 {"http",S_OK,FALSE},
3073 {Uri_HOST_DNS,S_OK,FALSE},
3075 {URL_SCHEME_HTTP,S_OK,FALSE},
3076 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3079 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3081 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3082 {"g%0aoogle.co%0dm",S_OK,FALSE},
3083 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3084 {"g%0aoogle.co%0dm",S_OK,FALSE},
3087 {"g%0aoogle.co%0dm",S_OK,FALSE},
3089 {"/%0A%0A%0A",S_OK,FALSE},
3090 {"/%0A%0A%0A",S_OK,FALSE},
3092 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3093 {"http",S_OK,FALSE},
3098 {Uri_HOST_DNS,S_OK,FALSE},
3100 {URL_SCHEME_HTTP,S_OK,FALSE},
3101 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3104 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3106 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3107 {"g\noogle.co\rm",S_OK,FALSE},
3108 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3109 {"g\noogle.co\rm",S_OK,FALSE},
3112 {"g\noogle.co\rm",S_OK,FALSE},
3114 {"/\n\n\n",S_OK,FALSE},
3115 {"/\n\n\n",S_OK,FALSE},
3117 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3123 {Uri_HOST_DNS,S_OK,FALSE},
3125 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3129 /* Since file URLs are usually hierarchical, it returns an empty string
3130 * for the absolute URI property since it was declared as an opaque URI.
3132 { "file:index.html", 0, S_OK, FALSE,
3136 {"file:index.html",S_OK,FALSE},
3138 {".html",S_OK,FALSE},
3142 {"index.html",S_OK,FALSE},
3143 {"index.html",S_OK,FALSE},
3145 {"file:index.html",S_OK,FALSE},
3146 {"file",S_OK,FALSE},
3151 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3153 {URL_SCHEME_FILE,S_OK,FALSE},
3154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3157 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3158 { "http:test.com/index.html", 0, S_OK, FALSE,
3162 {"http:test.com/index.html",S_OK,FALSE},
3164 {".html",S_OK,FALSE},
3168 {"test.com/index.html",S_OK,FALSE},
3169 {"test.com/index.html",S_OK,FALSE},
3171 {"http:test.com/index.html",S_OK,FALSE},
3172 {"http",S_OK,FALSE},
3177 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3179 {URL_SCHEME_HTTP,S_OK,FALSE},
3180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3183 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3187 {"ftp:test.com/index.html",S_OK,FALSE},
3189 {".html",S_OK,FALSE},
3193 {"test.com/index.html",S_OK,FALSE},
3194 {"test.com/index.html",S_OK,FALSE},
3196 {"ftp:test.com/index.html",S_OK,FALSE},
3202 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3204 {URL_SCHEME_FTP,S_OK,FALSE},
3205 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3208 { "file://C|/test.mp3", 0, S_OK, FALSE,
3210 {"file:///C:/test.mp3",S_OK,FALSE},
3212 {"file:///C:/test.mp3",S_OK,FALSE},
3214 {".mp3",S_OK,FALSE},
3218 {"/C:/test.mp3",S_OK,FALSE},
3219 {"/C:/test.mp3",S_OK,FALSE},
3221 {"file://C|/test.mp3",S_OK,FALSE},
3222 {"file",S_OK,FALSE},
3227 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3229 {URL_SCHEME_FILE,S_OK,FALSE},
3230 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3233 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3235 {"file:///C:/test.mp3",S_OK,FALSE},
3237 {"file:///C:/test.mp3",S_OK,FALSE},
3239 {".mp3",S_OK,FALSE},
3243 {"/C:/test.mp3",S_OK,FALSE},
3244 {"/C:/test.mp3",S_OK,FALSE},
3246 {"file:///C|/test.mp3",S_OK,FALSE},
3247 {"file",S_OK,FALSE},
3252 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3254 {URL_SCHEME_FILE,S_OK,FALSE},
3255 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3258 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3261 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3263 {"file://c:\\dir\\index.html",S_OK,FALSE},
3265 {"file://c:\\dir\\index.html",S_OK,FALSE},
3267 {".html",S_OK,FALSE},
3271 {"c:\\dir\\index.html",S_OK,FALSE},
3272 {"c:\\dir\\index.html",S_OK,FALSE},
3274 {"file://c:/dir/index.html",S_OK,FALSE},
3275 {"file",S_OK,FALSE},
3280 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3282 {URL_SCHEME_FILE,S_OK,FALSE},
3283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3286 /* Extra '/' after "file://" is removed. */
3287 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3289 {"file://c:\\dir\\index.html",S_OK,FALSE},
3291 {"file://c:\\dir\\index.html",S_OK,FALSE},
3293 {".html",S_OK,FALSE},
3297 {"c:\\dir\\index.html",S_OK,FALSE},
3298 {"c:\\dir\\index.html",S_OK,FALSE},
3300 {"file:///c:/dir/index.html",S_OK,FALSE},
3301 {"file",S_OK,FALSE},
3306 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3308 {URL_SCHEME_FILE,S_OK,FALSE},
3309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3312 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3313 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3315 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3317 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3319 {".html",S_OK,FALSE},
3323 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3324 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3326 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3327 {"file",S_OK,FALSE},
3332 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3334 {URL_SCHEME_FILE,S_OK,FALSE},
3335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3338 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3340 {"file://c:\\dir\\index.html",S_OK,FALSE},
3342 {"file://c:\\dir\\index.html",S_OK,FALSE},
3344 {".html",S_OK,FALSE},
3348 {"c:\\dir\\index.html",S_OK,FALSE},
3349 {"c:\\dir\\index.html",S_OK,FALSE},
3351 {"file://c|/dir\\index.html",S_OK,FALSE},
3352 {"file",S_OK,FALSE},
3357 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3359 {URL_SCHEME_FILE,S_OK,FALSE},
3360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3363 /* The backslashes after the scheme name are converted to forward slashes. */
3364 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3366 {"file://c:\\dir\\index.html",S_OK,FALSE},
3368 {"file://c:\\dir\\index.html",S_OK,FALSE},
3370 {".html",S_OK,FALSE},
3374 {"c:\\dir\\index.html",S_OK,FALSE},
3375 {"c:\\dir\\index.html",S_OK,FALSE},
3377 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3378 {"file",S_OK,FALSE},
3383 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3385 {URL_SCHEME_FILE,S_OK,FALSE},
3386 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3389 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3391 {"file:///c:/dir/index.html",S_OK,FALSE},
3393 {"file:///c:/dir/index.html",S_OK,FALSE},
3395 {".html",S_OK,FALSE},
3399 {"/c:/dir/index.html",S_OK,FALSE},
3400 {"/c:/dir/index.html",S_OK,FALSE},
3402 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3403 {"file",S_OK,FALSE},
3408 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3410 {URL_SCHEME_FILE,S_OK,FALSE},
3411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3414 { "http:\\\\google.com", 0, S_OK, FALSE,
3416 {"http://google.com/",S_OK,FALSE},
3417 {"google.com",S_OK,FALSE},
3418 {"http://google.com/",S_OK,FALSE},
3419 {"google.com",S_OK,FALSE},
3422 {"google.com",S_OK,FALSE},
3427 {"http:\\\\google.com",S_OK,FALSE},
3428 {"http",S_OK,FALSE},
3433 {Uri_HOST_DNS,S_OK,FALSE},
3435 {URL_SCHEME_HTTP,S_OK,FALSE},
3436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3439 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3440 { "zip:\\\\google.com", 0, S_OK, FALSE,
3442 {"zip:\\\\google.com",S_OK,FALSE},
3444 {"zip:\\\\google.com",S_OK,FALSE},
3446 {".com",S_OK,FALSE},
3450 {"\\\\google.com",S_OK,FALSE},
3451 {"\\\\google.com",S_OK,FALSE},
3453 {"zip:\\\\google.com",S_OK,FALSE},
3459 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3461 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3465 /* Dot segments aren't removed. */
3466 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3468 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3470 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3472 {".html",S_OK,FALSE},
3476 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3477 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3479 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3480 {"file",S_OK,FALSE},
3485 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3487 {URL_SCHEME_FILE,S_OK,FALSE},
3488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3491 /* Forbidden characters aren't percent encoded. */
3492 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3494 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3496 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3498 {".html",S_OK,FALSE},
3502 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3503 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3505 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3506 {"file",S_OK,FALSE},
3511 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3513 {URL_SCHEME_FILE,S_OK,FALSE},
3514 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3517 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3518 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3522 {"file:c:/dir/../../index.html",S_OK,FALSE},
3524 {".html",S_OK,FALSE},
3528 {"c:/dir/../../index.html",S_OK,FALSE},
3529 {"c:/dir/../../index.html",S_OK,FALSE},
3531 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3532 {"file",S_OK,FALSE},
3537 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3539 {URL_SCHEME_FILE,S_OK,FALSE},
3540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3543 /* '/' are still converted to '\' even though it's an opaque URI. */
3544 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3548 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3550 {".html",S_OK,FALSE},
3554 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3555 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3557 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3558 {"file",S_OK,FALSE},
3563 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3565 {URL_SCHEME_FILE,S_OK,FALSE},
3566 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3569 /* Forbidden characters aren't percent encoded. */
3570 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3574 {"file:c:\\in^|dex.html",S_OK,FALSE},
3576 {".html",S_OK,FALSE},
3580 {"c:\\in^|dex.html",S_OK,FALSE},
3581 {"c:\\in^|dex.html",S_OK,FALSE},
3583 {"file:c:\\in^|dex.html",S_OK,FALSE},
3584 {"file",S_OK,FALSE},
3589 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3591 {URL_SCHEME_FILE,S_OK,FALSE},
3592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3595 /* Doesn't have a UserName since the ':' appears at the beginning of the
3598 { "http://:password@gov.uk", 0, S_OK, FALSE,
3600 {"http://:password@gov.uk/",S_OK,FALSE},
3601 {":password@gov.uk",S_OK,FALSE},
3602 {"http://gov.uk/",S_OK,FALSE},
3606 {"gov.uk",S_OK,FALSE},
3607 {"password",S_OK,FALSE},
3611 {"http://:password@gov.uk",S_OK,FALSE},
3612 {"http",S_OK,FALSE},
3613 {":password",S_OK,FALSE},
3617 {Uri_HOST_DNS,S_OK,FALSE},
3619 {URL_SCHEME_HTTP,S_OK,FALSE},
3620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3623 /* Has a UserName since the userinfo section doesn't contain a password. */
3624 { "http://@gov.uk", 0, S_OK, FALSE,
3626 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3627 {"@gov.uk",S_OK,FALSE},
3628 {"http://gov.uk/",S_OK,FALSE},
3632 {"gov.uk",S_OK,FALSE},
3637 {"http://@gov.uk",S_OK,FALSE},
3638 {"http",S_OK,FALSE},
3643 {Uri_HOST_DNS,S_OK,FALSE},
3645 {URL_SCHEME_HTTP,S_OK,FALSE},
3646 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3649 /* ":@" not included in the absolute URI. */
3650 { "http://:@gov.uk", 0, S_OK, FALSE,
3652 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3653 {":@gov.uk",S_OK,FALSE},
3654 {"http://gov.uk/",S_OK,FALSE},
3658 {"gov.uk",S_OK,FALSE},
3663 {"http://:@gov.uk",S_OK,FALSE},
3664 {"http",S_OK,FALSE},
3669 {Uri_HOST_DNS,S_OK,FALSE},
3671 {URL_SCHEME_HTTP,S_OK,FALSE},
3672 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3675 /* '@' is included because it's an unknown scheme type. */
3676 { "zip://@gov.uk", 0, S_OK, FALSE,
3678 {"zip://@gov.uk/",S_OK,FALSE},
3679 {"@gov.uk",S_OK,FALSE},
3680 {"zip://@gov.uk/",S_OK,FALSE},
3684 {"gov.uk",S_OK,FALSE},
3689 {"zip://@gov.uk",S_OK,FALSE},
3695 {Uri_HOST_DNS,S_OK,FALSE},
3697 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3698 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3701 /* ":@" are included because it's an unknown scheme type. */
3702 { "zip://:@gov.uk", 0, S_OK, FALSE,
3704 {"zip://:@gov.uk/",S_OK,FALSE},
3705 {":@gov.uk",S_OK,FALSE},
3706 {"zip://:@gov.uk/",S_OK,FALSE},
3710 {"gov.uk",S_OK,FALSE},
3715 {"zip://:@gov.uk",S_OK,FALSE},
3721 {Uri_HOST_DNS,S_OK,FALSE},
3723 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3724 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3727 { "about:blank", 0, S_OK, FALSE,
3729 {"about:blank",S_OK,FALSE},
3731 {"about:blank",S_OK,FALSE},
3737 {"blank",S_OK,FALSE},
3738 {"blank",S_OK,FALSE},
3740 {"about:blank",S_OK,FALSE},
3741 {"about",S_OK,FALSE},
3746 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3748 {URL_SCHEME_ABOUT,S_OK,FALSE},
3749 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3752 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3754 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3756 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3758 {".htm",S_OK,FALSE},
3762 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3763 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3765 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3771 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3773 {URL_SCHEME_MK,S_OK,FALSE},
3774 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3777 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3779 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3781 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3783 {".htm",S_OK,FALSE},
3787 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3788 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3790 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3796 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3798 {URL_SCHEME_MK,S_OK,FALSE},
3799 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3802 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3803 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3805 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3806 {"server",S_OK,FALSE},
3807 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3809 {".html",S_OK,FALSE},
3811 {"server",S_OK,FALSE},
3813 {"\\dir\\index.html",S_OK,FALSE},
3814 {"\\dir\\index.html",S_OK,FALSE},
3816 {"file://server/dir/index.html",S_OK,FALSE},
3817 {"file",S_OK,FALSE},
3822 {Uri_HOST_DNS,S_OK,FALSE},
3824 {URL_SCHEME_FILE,S_OK,FALSE},
3825 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3828 /* When CreateUri generates an IUri, it still displays the default port in the
3831 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3833 {"http://google.com:80/",S_OK,FALSE},
3834 {"google.com:80",S_OK,FALSE},
3835 {"http://google.com:80/",S_OK,FALSE},
3836 {"google.com",S_OK,FALSE},
3839 {"google.com",S_OK,FALSE},
3844 {"http://google.com:80/",S_OK,FALSE},
3845 {"http",S_OK,FALSE},
3850 {Uri_HOST_DNS,S_OK,FALSE},
3852 {URL_SCHEME_HTTP,S_OK,FALSE},
3853 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3856 /* For res URIs the host is everything up until the first '/'. */
3857 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3859 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3860 {"C:\\dir\\file.exe",S_OK,FALSE},
3861 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3863 {".html",S_OK,FALSE},
3865 {"C:\\dir\\file.exe",S_OK,FALSE},
3867 {"/DATA/test.html",S_OK,FALSE},
3868 {"/DATA/test.html",S_OK,FALSE},
3870 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3876 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3878 {URL_SCHEME_RES,S_OK,FALSE},
3879 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3882 /* Res URI can contain a '|' in the host name. */
3883 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3885 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3886 {"c:\\di|r\\file.exe",S_OK,FALSE},
3887 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3891 {"c:\\di|r\\file.exe",S_OK,FALSE},
3893 {"/test",S_OK,FALSE},
3894 {"/test",S_OK,FALSE},
3896 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3902 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3904 {URL_SCHEME_RES,S_OK,FALSE},
3905 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3908 /* Res URIs can have invalid percent encoded values. */
3909 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3911 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3912 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3913 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3917 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3919 {"/test",S_OK,FALSE},
3920 {"/test",S_OK,FALSE},
3922 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3928 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3930 {URL_SCHEME_RES,S_OK,FALSE},
3931 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3934 /* Res doesn't get forbidden characters percent encoded in it's path. */
3935 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3937 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3938 {"c:\\test",S_OK,FALSE},
3939 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3943 {"c:\\test",S_OK,FALSE},
3945 {"/tes<|>t",S_OK,FALSE},
3946 {"/tes<|>t",S_OK,FALSE},
3948 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3954 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3956 {URL_SCHEME_RES,S_OK,FALSE},
3957 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3962 typedef struct _invalid_uri {
3968 static const invalid_uri invalid_uri_tests[] = {
3969 /* Has to have a scheme name. */
3970 {"://www.winehq.org",0,FALSE},
3971 /* Window's doesn't like URI's which are implicitly file paths without the
3972 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
3974 {"C:/test/test.mp3",0,FALSE},
3975 {"\\\\Server/test/test.mp3",0,FALSE},
3976 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
3977 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
3978 /* Invalid schemes. */
3979 {"*abcd://not.valid.com",0,FALSE},
3980 {"*a*b*c*d://not.valid.com",0,FALSE},
3981 /* Not allowed to have invalid % encoded data. */
3982 {"ftp://google.co%XX/",0,FALSE},
3983 /* To many h16 components. */
3984 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
3985 /* Not enough room for IPv4 address. */
3986 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
3987 /* Not enough h16 components. */
3988 {"http://[1:2:3:4]",0,FALSE},
3989 /* Not enough components including IPv4. */
3990 {"http://[1:192.0.1.0]",0,FALSE},
3991 /* Not allowed to have partial IPv4 in IPv6. */
3992 {"http://[::192.0]",0,FALSE},
3993 /* Can't have elision of 1 h16 at beginning of address. */
3994 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
3995 /* Can't have elision of 1 h16 at end of address. */
3996 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
3997 /* Expects a valid IP Literal. */
3998 {"ftp://[not.valid.uri]/",0,FALSE},
3999 /* Expects valid port for a known scheme type. */
4000 {"ftp://www.winehq.org:123fgh",0,FALSE},
4001 /* Port exceeds USHORT_MAX for known scheme type. */
4002 {"ftp://www.winehq.org:65536",0,FALSE},
4003 /* Invalid port with IPv4 address. */
4004 {"http://www.winehq.org:1abcd",0,FALSE},
4005 /* Invalid port with IPv6 address. */
4006 {"http://[::ffff]:32xy",0,FALSE},
4007 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4008 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4009 /* Not allowed to have invalid % encoded data in opaque URI path. */
4010 {"news:test%XX",0,FALSE},
4011 {"mailto:wine@winehq%G8.com",0,FALSE},
4012 /* Known scheme types can't have invalid % encoded data in query string. */
4013 {"http://google.com/?query=te%xx",0,FALSE},
4014 /* Invalid % encoded data in fragment of know scheme type. */
4015 {"ftp://google.com/#Test%xx",0,FALSE},
4016 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4017 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4018 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4019 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4020 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4021 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4022 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4023 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4024 /* res URIs aren't allowed to have forbidden dos path characters in the
4027 {"res://c:\\te<st\\test/test",0,FALSE},
4028 {"res://c:\\te>st\\test/test",0,FALSE},
4029 {"res://c:\\te\"st\\test/test",0,FALSE},
4030 {"res://c:\\test/te%xxst",0,FALSE}
4033 typedef struct _uri_equality {
4035 DWORD create_flags_a;
4038 DWORD create_flags_b;
4044 static const uri_equality equality_tests[] = {
4046 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4047 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4051 /* http://www.winehq.org/test%20dir */
4052 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,FALSE,
4053 "http://www.winehq.org/test dir",0,FALSE,
4057 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4058 "file:///c:/test.mp3",0,FALSE,
4062 "ftp://ftp.winehq.org/",0,FALSE,
4063 "ftp://ftp.winehq.org",0,FALSE,
4067 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4068 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4072 "http://google.com/TEST",0,FALSE,
4073 "http://google.com/test",0,FALSE,
4077 "http://GOOGLE.com/",0,FALSE,
4078 "http://google.com/",0,FALSE,
4081 /* Performs case insensitive compare of host names (for known scheme types). */
4083 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4084 "ftp://google.com/",0,FALSE,
4088 "zip://GOOGLE.com/",0,FALSE,
4089 "zip://google.com/",0,FALSE,
4093 "file:///c:/TEST/TeST/",0,FALSE,
4094 "file:///c:/test/test/",0,FALSE,
4098 "file:///server/TEST",0,FALSE,
4099 "file:///SERVER/TEST",0,FALSE,
4103 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4104 "http://google.com/",0,FALSE,
4108 "ftp://google.com:21/",0,FALSE,
4109 "ftp://google.com/",0,FALSE,
4113 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4114 "http://google.com/",0,FALSE,
4118 "http://google.com:70/",0,FALSE,
4119 "http://google.com:71/",0,FALSE,
4124 typedef struct _uri_with_fragment {
4126 const char* fragment;
4128 HRESULT create_expected;
4131 const char* expected_uri;
4133 } uri_with_fragment;
4135 static const uri_with_fragment uri_fragment_tests[] = {
4137 "http://google.com/","#fragment",0,S_OK,FALSE,
4138 "http://google.com/#fragment",FALSE
4141 "http://google.com/","fragment",0,S_OK,FALSE,
4142 "http://google.com/#fragment",FALSE
4145 "zip://test.com/","?test",0,S_OK,FALSE,
4146 "zip://test.com/#?test",FALSE
4148 /* The fragment can be empty. */
4150 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4151 "ftp://ftp.google.com/#",FALSE
4155 typedef struct _uri_builder_property {
4158 const char *expected_value;
4159 Uri_PROPERTY property;
4162 } uri_builder_property;
4164 typedef struct _uri_builder_port {
4172 typedef struct _uri_builder_str_property {
4173 const char* expected;
4176 } uri_builder_str_property;
4178 typedef struct _uri_builder_dword_property {
4182 } uri_builder_dword_property;
4184 typedef struct _uri_builder_test {
4187 HRESULT create_builder_expected;
4188 BOOL create_builder_todo;
4190 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4192 uri_builder_port port_prop;
4198 DWORD uri_simple_encode_flags;
4199 HRESULT uri_simple_hres;
4200 BOOL uri_simple_todo;
4202 DWORD uri_with_flags;
4203 DWORD uri_with_builder_flags;
4204 DWORD uri_with_encode_flags;
4205 HRESULT uri_with_hres;
4208 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4209 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4212 static const uri_builder_test uri_builder_tests[] = {
4213 { "http://google.com/",0,S_OK,FALSE,
4215 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4216 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4217 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4218 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4225 {"http://username:password@google.com/?query=x#fragment",S_OK},
4226 {"username:password@google.com",S_OK},
4227 {"http://google.com/?query=x#fragment",S_OK},
4228 {"google.com",S_OK},
4231 {"google.com",S_OK},
4236 {"http://username:password@google.com/?query=x#fragment",S_OK},
4238 {"username:password",S_OK},
4242 {Uri_HOST_DNS,S_OK},
4244 {URL_SCHEME_HTTP,S_OK},
4245 {URLZONE_INVALID,E_NOTIMPL}
4248 { "http://google.com/",0,S_OK,FALSE,
4250 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4252 {TRUE,TRUE,120,S_OK,FALSE},
4257 {"test://google.com:120/",S_OK},
4258 {"google.com:120",S_OK},
4259 {"test://google.com:120/",S_OK},
4260 {"google.com",S_OK},
4263 {"google.com",S_OK},
4268 {"test://google.com:120/",S_OK},
4274 {Uri_HOST_DNS,S_OK},
4276 {URL_SCHEME_UNKNOWN,S_OK},
4277 {URLZONE_INVALID,E_NOTIMPL}
4280 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4282 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4283 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4284 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4291 {"http://[::192.2.3.4]/",S_OK},
4292 {"[::192.2.3.4]",S_OK},
4293 {"http://[::192.2.3.4]/",S_OK},
4297 {"::192.2.3.4",S_OK},
4302 {"http://[::192.2.3.4]/",S_OK},
4308 {Uri_HOST_IPV6,S_OK},
4310 {URL_SCHEME_HTTP,S_OK},
4311 {URLZONE_INVALID,E_NOTIMPL}
4314 { "http://google.com/",0,S_OK,FALSE,
4316 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4323 {"http://google.com/#Frag",S_OK},
4324 {"google.com",S_OK},
4325 {"http://google.com/#Frag",S_OK},
4326 {"google.com",S_OK},
4329 {"google.com",S_OK},
4334 {"http://google.com/#Frag",S_OK},
4340 {Uri_HOST_DNS,S_OK},
4342 {URL_SCHEME_HTTP,S_OK},
4343 {URLZONE_INVALID,E_NOTIMPL}
4346 { "http://google.com/",0,S_OK,FALSE,
4348 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4355 {"http://google.com/#",S_OK},
4356 {"google.com",S_OK},
4357 {"http://google.com/#",S_OK},
4358 {"google.com",S_OK},
4361 {"google.com",S_OK},
4366 {"http://google.com/#",S_OK},
4372 {Uri_HOST_DNS,S_OK},
4374 {URL_SCHEME_HTTP,S_OK},
4375 {URLZONE_INVALID,E_NOTIMPL}
4378 { "http://google.com/",0,S_OK,FALSE,
4380 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4387 {"http://::password@google.com/",S_OK},
4388 {"::password@google.com",S_OK},
4389 {"http://google.com/",S_OK},
4390 {"google.com",S_OK},
4393 {"google.com",S_OK},
4398 {"http://::password@google.com/",S_OK},
4400 {"::password",S_OK},
4404 {Uri_HOST_DNS,S_OK},
4406 {URL_SCHEME_HTTP,S_OK},
4407 {URLZONE_INVALID,E_NOTIMPL}
4410 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4412 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4415 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4417 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4419 {":password@test/test",S_OK},
4420 {":password@",S_OK},
4421 {":password@test/test",S_OK},
4430 {":password@test/test",S_OK},
4436 {Uri_HOST_UNKNOWN,S_OK},
4438 {URL_SCHEME_UNKNOWN,S_OK},
4439 {URLZONE_INVALID,E_NOTIMPL}
4442 { "http://google.com/",0,S_OK,FALSE,
4444 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4451 {"http://google.com/test/test",S_OK},
4452 {"google.com",S_OK},
4453 {"http://google.com/test/test",S_OK},
4454 {"google.com",S_OK},
4457 {"google.com",S_OK},
4459 {"/test/test",S_OK},
4460 {"/test/test",S_OK},
4462 {"http://google.com/test/test",S_OK},
4468 {Uri_HOST_DNS,S_OK},
4470 {URL_SCHEME_HTTP,S_OK},
4471 {URLZONE_INVALID,E_NOTIMPL}
4474 { "zip:testing/test",0,S_OK,FALSE,
4476 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4500 {Uri_HOST_UNKNOWN,S_OK},
4502 {URL_SCHEME_UNKNOWN,S_OK},
4503 {URLZONE_INVALID,E_NOTIMPL}
4506 { "http://google.com/",0,S_OK,FALSE,
4510 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4511 {TRUE,FALSE,555,S_OK,FALSE},
4516 {"http://google.com/",S_OK},
4517 {"google.com",S_OK},
4518 {"http://google.com/",S_OK},
4519 {"google.com",S_OK},
4522 {"google.com",S_OK},
4527 {"http://google.com/",S_OK},
4533 {Uri_HOST_DNS,S_OK},
4534 /* Still returns 80, even though earlier the port was disabled. */
4536 {URL_SCHEME_HTTP,S_OK},
4537 {URLZONE_INVALID,E_NOTIMPL}
4540 { "http://google.com/",0,S_OK,FALSE,
4544 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4545 * you'll get 122345 instead.
4547 {TRUE,122345,222,S_OK,FALSE},
4552 {"http://google.com:222/",S_OK},
4553 {"google.com:222",S_OK},
4554 {"http://google.com:222/",S_OK},
4555 {"google.com",S_OK},
4558 {"google.com",S_OK},
4563 {"http://google.com:222/",S_OK},
4569 {Uri_HOST_DNS,S_OK},
4571 {URL_SCHEME_HTTP,S_OK},
4572 {URLZONE_INVALID,E_NOTIMPL}
4575 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4576 { "http://google.com/",0,S_OK,FALSE,
4580 {TRUE,TRUE,999999,S_OK,FALSE},
4585 {"http://google.com:999999/",S_OK},
4586 {"google.com:999999",S_OK},
4587 {"http://google.com:999999/",S_OK},
4588 {"google.com",S_OK},
4591 {"google.com",S_OK},
4596 {"http://google.com:999999/",S_OK},
4602 {Uri_HOST_DNS,S_OK},
4604 {URL_SCHEME_HTTP,S_OK},
4605 {URLZONE_INVALID,E_NOTIMPL}
4608 { "http://google.com/",0,S_OK,FALSE,
4610 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
4618 {"http://google.com/?test",S_OK},
4619 {"google.com",S_OK},
4620 {"http://google.com/?test",S_OK},
4621 {"google.com",S_OK},
4624 {"google.com",S_OK},
4629 {"http://google.com/?test",S_OK},
4635 {Uri_HOST_DNS,S_OK},
4637 {URL_SCHEME_HTTP,S_OK},
4638 {URLZONE_INVALID,E_NOTIMPL}
4641 { "http://:password@google.com/",0,S_OK,FALSE,
4650 {"http://:password@google.com/",S_OK},
4651 {":password@google.com",S_OK},
4652 {"http://google.com/",S_OK},
4653 {"google.com",S_OK},
4656 {"google.com",S_OK},
4661 {"http://:password@google.com/",S_OK},
4667 {Uri_HOST_DNS,S_OK},
4669 {URL_SCHEME_HTTP,S_OK},
4670 {URLZONE_INVALID,E_NOTIMPL}
4673 /* IUriBuilder doesn't need a base IUri to build a IUri. */
4674 { NULL,0,S_OK,FALSE,
4676 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4677 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4684 {"http://google.com/",S_OK},
4685 {"google.com",S_OK},
4686 {"http://google.com/",S_OK},
4687 {"google.com",S_OK},
4690 {"google.com",S_OK},
4695 {"http://google.com/",S_OK},
4701 {Uri_HOST_DNS,S_OK},
4703 {URL_SCHEME_HTTP,S_OK},
4704 {URLZONE_INVALID,E_NOTIMPL}
4707 /* Can't set the scheme name to NULL. */
4708 { "zip://google.com/",0,S_OK,FALSE,
4710 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4717 {"zip://google.com/",S_OK},
4718 {"google.com",S_OK},
4719 {"zip://google.com/",S_OK},
4720 {"google.com",S_OK},
4723 {"google.com",S_OK},
4728 {"zip://google.com/",S_OK},
4734 {Uri_HOST_DNS,S_OK},
4736 {URL_SCHEME_UNKNOWN,S_OK},
4737 {URLZONE_INVALID,E_NOTIMPL}
4740 /* Can't set the scheme name to an empty string. */
4741 { "zip://google.com/",0,S_OK,FALSE,
4743 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4750 {"zip://google.com/",S_OK},
4751 {"google.com",S_OK},
4752 {"zip://google.com/",S_OK},
4753 {"google.com",S_OK},
4756 {"google.com",S_OK},
4761 {"zip://google.com/",S_OK},
4767 {Uri_HOST_DNS,S_OK},
4769 {URL_SCHEME_UNKNOWN,S_OK},
4770 {URLZONE_INVALID,E_NOTIMPL}
4773 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
4774 * CreateUriSimple always uses the flags the base IUri was created with (if any).
4776 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
4781 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4783 {"http://google.com/../../",S_OK},
4784 {"google.com",S_OK},
4785 {"http://google.com/../../",S_OK},
4786 {"google.com",S_OK},
4789 {"google.com",S_OK},
4794 {"http://google.com/../../",S_OK},
4800 {Uri_HOST_DNS,S_OK},
4802 {URL_SCHEME_HTTP,S_OK},
4803 {URLZONE_INVALID,E_NOTIMPL}
4806 { "http://google.com/",0,S_OK,FALSE,
4808 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4813 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4815 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4816 {"google.com",S_OK},
4817 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4818 {"google.com",S_OK},
4820 {"#Fr%3C%7C%3Eg",S_OK},
4821 {"google.com",S_OK},
4826 {"http://google.com/#Fr<|>g",S_OK},
4832 {Uri_HOST_DNS,S_OK},
4834 {URL_SCHEME_HTTP,S_OK},
4835 {URLZONE_INVALID,E_NOTIMPL}
4838 { "http://google.com/",0,S_OK,FALSE,
4840 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4843 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
4845 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4847 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4848 {"google.com",S_OK},
4849 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4850 {"google.com",S_OK},
4852 {"#Fr%3C%7C%3Eg",S_OK},
4853 {"google.com",S_OK},
4858 {"http://google.com/#Fr<|>g",S_OK},
4864 {Uri_HOST_DNS,S_OK},
4866 {URL_SCHEME_HTTP,S_OK},
4867 {URLZONE_INVALID,E_NOTIMPL}
4870 { NULL,0,S_OK,FALSE,
4872 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4873 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4876 0,INET_E_INVALID_URL,FALSE,
4877 0,INET_E_INVALID_URL,FALSE,
4878 0,0,0,INET_E_INVALID_URL,FALSE
4880 { "http://google.com/",0,S_OK,FALSE,
4882 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4885 0,INET_E_INVALID_URL,FALSE,
4886 0,INET_E_INVALID_URL,FALSE,
4887 0,0,0,INET_E_INVALID_URL,FALSE
4889 /* File scheme's can't have a username set. */
4890 { "file://google.com/",0,S_OK,FALSE,
4892 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4895 0,INET_E_INVALID_URL,FALSE,
4896 0,INET_E_INVALID_URL,FALSE,
4897 0,0,0,INET_E_INVALID_URL,FALSE
4899 /* File schemes can't have a password set. */
4900 { "file://google.com/",0,S_OK,FALSE,
4902 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4905 0,INET_E_INVALID_URL,FALSE,
4906 0,INET_E_INVALID_URL,FALSE,
4907 0,0,0,INET_E_INVALID_URL,FALSE
4909 /* UserName can't contain any character that is a delimeter for another
4910 * component that appears after it in a normal URI.
4912 { "http://google.com/",0,S_OK,FALSE,
4914 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4917 0,INET_E_INVALID_URL,FALSE,
4918 0,INET_E_INVALID_URL,FALSE,
4919 0,0,0,INET_E_INVALID_URL,FALSE
4921 { "http://google.com/",0,S_OK,FALSE,
4923 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4926 0,INET_E_INVALID_URL,FALSE,
4927 0,INET_E_INVALID_URL,FALSE,
4928 0,0,0,INET_E_INVALID_URL,FALSE
4930 { "http://google.com/",0,S_OK,FALSE,
4932 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4935 0,INET_E_INVALID_URL,FALSE,
4936 0,INET_E_INVALID_URL,FALSE,
4937 0,0,0,INET_E_INVALID_URL,FALSE
4939 { "http://google.com/",0,S_OK,FALSE,
4941 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4944 0,INET_E_INVALID_URL,FALSE,
4945 0,INET_E_INVALID_URL,FALSE,
4946 0,0,0,INET_E_INVALID_URL,FALSE
4948 { "http://google.com/",0,S_OK,FALSE,
4950 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4953 0,INET_E_INVALID_URL,FALSE,
4954 0,INET_E_INVALID_URL,FALSE,
4955 0,0,0,INET_E_INVALID_URL,FALSE
4957 { "http://google.com/",0,S_OK,FALSE,
4959 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4962 0,INET_E_INVALID_URL,FALSE,
4963 0,INET_E_INVALID_URL,FALSE,
4964 0,0,0,INET_E_INVALID_URL,FALSE
4966 { "http://google.com/",0,S_OK,FALSE,
4968 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4971 0,INET_E_INVALID_URL,FALSE,
4972 0,INET_E_INVALID_URL,FALSE,
4973 0,0,0,INET_E_INVALID_URL,FALSE
4975 { "http://google.com/",0,S_OK,FALSE,
4977 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4980 0,INET_E_INVALID_URL,FALSE,
4981 0,INET_E_INVALID_URL,FALSE,
4982 0,0,0,INET_E_INVALID_URL,FALSE
4984 { "http://google.com/",0,S_OK,FALSE,
4986 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4989 0,INET_E_INVALID_URL,FALSE,
4990 0,INET_E_INVALID_URL,FALSE,
4991 0,0,0,INET_E_INVALID_URL,FALSE
4993 { "http://google.com/",0,S_OK,FALSE,
4995 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4998 0,INET_E_INVALID_URL,FALSE,
4999 0,INET_E_INVALID_URL,FALSE,
5000 0,0,0,INET_E_INVALID_URL,FALSE
5002 { "http://google.com/",0,S_OK,FALSE,
5004 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5007 0,INET_E_INVALID_URL,FALSE,
5008 0,INET_E_INVALID_URL,FALSE,
5009 0,0,0,INET_E_INVALID_URL,FALSE
5011 { "http://google.com/",0,S_OK,FALSE,
5013 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5016 0,INET_E_INVALID_URL,FALSE,
5017 0,INET_E_INVALID_URL,FALSE,
5018 0,0,0,INET_E_INVALID_URL,FALSE
5020 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5021 { "http://google.com/",0,S_OK,FALSE,
5023 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5030 {"http://winehq.org:test/",S_OK},
5031 {"winehq.org:test",S_OK},
5032 {"http://winehq.org:test/",S_OK},
5033 {"winehq.org:test",S_OK},
5036 {"winehq.org:test",S_OK},
5041 {"http://winehq.org:test/",S_OK},
5047 {Uri_HOST_DNS,S_OK},
5049 {URL_SCHEME_HTTP,S_OK},
5050 {URLZONE_INVALID,E_NOTIMPL}
5053 /* Can't set the host name to NULL. */
5054 { "http://google.com/",0,S_OK,FALSE,
5056 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5063 {"http://google.com/",S_OK},
5064 {"google.com",S_OK},
5065 {"http://google.com/",S_OK},
5066 {"google.com",S_OK},
5069 {"google.com",S_OK},
5074 {"http://google.com/",S_OK},
5080 {Uri_HOST_DNS,S_OK},
5082 {URL_SCHEME_HTTP,S_OK},
5083 {URLZONE_INVALID,E_NOTIMPL}
5086 /* Can set the host name to an empty string. */
5087 { "http://google.com/",0,S_OK,FALSE,
5089 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5113 {Uri_HOST_UNKNOWN,S_OK},
5115 {URL_SCHEME_HTTP,S_OK},
5116 {URLZONE_INVALID,E_NOTIMPL}
5119 { "http://google.com/",0,S_OK,FALSE,
5121 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5124 0,INET_E_INVALID_URL,FALSE,
5125 0,INET_E_INVALID_URL,FALSE,
5126 0,0,0,INET_E_INVALID_URL,FALSE
5128 { "http://google.com/",0,S_OK,FALSE,
5130 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5133 0,INET_E_INVALID_URL,FALSE,
5134 0,INET_E_INVALID_URL,FALSE,
5135 0,0,0,INET_E_INVALID_URL,FALSE
5137 { "http://google.com/",0,S_OK,FALSE,
5139 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5142 0,INET_E_INVALID_URL,FALSE,
5143 0,INET_E_INVALID_URL,FALSE,
5144 0,0,0,INET_E_INVALID_URL,FALSE
5148 typedef struct _uri_builder_remove_test {
5151 HRESULT create_builder_expected;
5152 BOOL create_builder_todo;
5154 DWORD remove_properties;
5155 HRESULT remove_expected;
5158 const char *expected_uri;
5159 DWORD expected_flags;
5160 HRESULT expected_hres;
5162 } uri_builder_remove_test;
5164 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5165 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5166 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5167 "http://google.com/",0,S_OK,FALSE
5169 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5170 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5171 "http://winehq.org/",0,S_OK,FALSE
5173 { "zip://google.com?Test=x",0,S_OK,FALSE,
5174 Uri_HAS_HOST,S_OK,FALSE,
5175 "zip:/?Test=x",0,S_OK,FALSE
5177 /* Doesn't remove the whole userinfo component. */
5178 { "http://username:pass@google.com/",0,S_OK,FALSE,
5179 Uri_HAS_USER_INFO,S_OK,FALSE,
5180 "http://username:pass@google.com/",0,S_OK,FALSE
5182 /* Doesn't remove the domain. */
5183 { "http://google.com/",0,S_OK,FALSE,
5184 Uri_HAS_DOMAIN,S_OK,FALSE,
5185 "http://google.com/",0,S_OK,FALSE
5187 { "http://google.com:120/",0,S_OK,FALSE,
5188 Uri_HAS_AUTHORITY,S_OK,FALSE,
5189 "http://google.com:120/",0,S_OK,FALSE
5191 { "http://google.com/test.com/",0,S_OK,FALSE,
5192 Uri_HAS_EXTENSION,S_OK,FALSE,
5193 "http://google.com/test.com/",0,S_OK,FALSE
5195 { "http://google.com/?test=x",0,S_OK,FALSE,
5196 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5197 "http://google.com/?test=x",0,S_OK,FALSE
5199 /* Can't remove the scheme name. */
5200 { "http://google.com/?test=x",0,S_OK,FALSE,
5201 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5202 "http://google.com/?test=x",0,S_OK,FALSE
5206 typedef struct _uri_combine_str_property {
5210 const char *broken_value;
5211 const char *value_ex;
5212 } uri_combine_str_property;
5214 typedef struct _uri_combine_test {
5215 const char *base_uri;
5216 DWORD base_create_flags;
5217 const char *relative_uri;
5218 DWORD relative_create_flags;
5219 DWORD combine_flags;
5223 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5224 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5227 static const uri_combine_test uri_combine_tests[] = {
5228 { "http://google.com/fun/stuff",0,
5229 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5232 {"http://google.com/not/fun/stuff",S_OK},
5233 {"google.com",S_OK},
5234 {"http://google.com/not/fun/stuff",S_OK},
5235 {"google.com",S_OK},
5238 {"google.com",S_OK},
5240 {"/not/fun/stuff",S_OK},
5241 {"/not/fun/stuff",S_OK},
5243 {"http://google.com/not/fun/stuff",S_OK},
5249 {Uri_HOST_DNS,S_OK},
5251 {URL_SCHEME_HTTP,S_OK},
5252 {URLZONE_INVALID,E_NOTIMPL}
5255 { "http://google.com/test",0,
5256 "zip://test.com/cool",0,
5259 {"zip://test.com/cool",S_OK},
5261 {"zip://test.com/cool",S_OK},
5270 {"zip://test.com/cool",S_OK},
5276 {Uri_HOST_DNS,S_OK},
5278 {URL_SCHEME_UNKNOWN,S_OK},
5279 {URLZONE_INVALID,E_NOTIMPL}
5282 { "http://google.com/use/base/path",0,
5283 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5286 {"http://google.com/use/base/path?relative",S_OK},
5287 {"google.com",S_OK},
5288 {"http://google.com/use/base/path?relative",S_OK},
5289 {"google.com",S_OK},
5292 {"google.com",S_OK},
5294 {"/use/base/path",S_OK},
5295 {"/use/base/path?relative",S_OK},
5297 {"http://google.com/use/base/path?relative",S_OK},
5303 {Uri_HOST_DNS,S_OK},
5305 {URL_SCHEME_HTTP,S_OK},
5306 {URLZONE_INVALID,E_NOTIMPL}
5309 { "http://google.com/path",0,
5310 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5313 {"http://google.com/testing",S_OK},
5314 {"google.com",S_OK},
5315 {"http://google.com/testing",S_OK},
5316 {"google.com",S_OK},
5319 {"google.com",S_OK},
5324 {"http://google.com/testing",S_OK},
5330 {Uri_HOST_DNS,S_OK},
5332 {URL_SCHEME_HTTP,S_OK},
5333 {URLZONE_INVALID,E_NOTIMPL}
5336 { "http://google.com/path",0,
5337 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5338 URL_DONT_SIMPLIFY,S_OK,FALSE,
5340 {"http://google.com:80/test/../test/.././testing",S_OK},
5341 {"google.com",S_OK},
5342 {"http://google.com:80/test/../test/.././testing",S_OK},
5343 {"google.com",S_OK},
5346 {"google.com",S_OK},
5348 {"/test/../test/.././testing",S_OK},
5349 {"/test/../test/.././testing",S_OK},
5351 {"http://google.com:80/test/../test/.././testing",S_OK},
5357 {Uri_HOST_DNS,S_OK},
5359 {URL_SCHEME_HTTP,S_OK},
5360 {URLZONE_INVALID,E_NOTIMPL}
5363 { "http://winehq.org/test/abc",0,
5364 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5367 {"http://winehq.org/test/testing/test",S_OK},
5368 {"winehq.org",S_OK},
5369 {"http://winehq.org/test/testing/test",S_OK},
5370 {"winehq.org",S_OK},
5373 {"winehq.org",S_OK},
5375 {"/test/testing/test",S_OK},
5376 {"/test/testing/test",S_OK},
5378 {"http://winehq.org/test/testing/test",S_OK},
5384 {Uri_HOST_DNS,S_OK},
5386 {URL_SCHEME_HTTP,S_OK},
5387 {URLZONE_INVALID,E_NOTIMPL}
5390 { "http://winehq.org/test/abc",0,
5391 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5392 URL_DONT_SIMPLIFY,S_OK,FALSE,
5394 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5395 /* Default port is hidden in the authority. */
5396 {"winehq.org",S_OK},
5397 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5398 {"winehq.org",S_OK},
5401 {"winehq.org",S_OK},
5403 {"/test/testing/abc/../test",S_OK},
5404 {"/test/testing/abc/../test",S_OK},
5406 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5412 {Uri_HOST_DNS,S_OK},
5414 {URL_SCHEME_HTTP,S_OK},
5415 {URLZONE_INVALID,E_NOTIMPL}
5418 { "http://winehq.org/test?query",0,
5419 "testing",Uri_CREATE_ALLOW_RELATIVE,
5422 {"http://winehq.org/testing",S_OK},
5423 {"winehq.org",S_OK},
5424 {"http://winehq.org/testing",S_OK},
5425 {"winehq.org",S_OK},
5428 {"winehq.org",S_OK},
5433 {"http://winehq.org/testing",S_OK},
5439 {Uri_HOST_DNS,S_OK},
5441 {URL_SCHEME_HTTP,S_OK},
5442 {URLZONE_INVALID,E_NOTIMPL}
5445 { "http://winehq.org/test#frag",0,
5446 "testing",Uri_CREATE_ALLOW_RELATIVE,
5449 {"http://winehq.org/testing",S_OK},
5450 {"winehq.org",S_OK},
5451 {"http://winehq.org/testing",S_OK},
5452 {"winehq.org",S_OK},
5455 {"winehq.org",S_OK},
5460 {"http://winehq.org/testing",S_OK},
5466 {Uri_HOST_DNS,S_OK},
5468 {URL_SCHEME_HTTP,S_OK},
5469 {URLZONE_INVALID,E_NOTIMPL}
5472 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5473 "test",Uri_CREATE_ALLOW_RELATIVE,
5493 {Uri_HOST_UNKNOWN,S_OK},
5495 {URL_SCHEME_UNKNOWN,S_OK},
5496 {URLZONE_INVALID,E_NOTIMPL}
5499 { "file:///c:/test/test",0,
5500 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5501 URL_FILE_USE_PATHURL,S_OK,FALSE,
5503 {"file://c:\\testing.mp3",S_OK},
5505 {"file://c:\\testing.mp3",S_OK},
5511 {"c:\\testing.mp3",S_OK},
5512 {"c:\\testing.mp3",S_OK},
5514 {"file://c:\\testing.mp3",S_OK},
5520 {Uri_HOST_UNKNOWN,S_OK},
5522 {URL_SCHEME_FILE,S_OK},
5523 {URLZONE_INVALID,E_NOTIMPL}
5526 { "file:///c:/test/test",0,
5527 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5530 {"file:///c:/testing.mp3",S_OK},
5532 {"file:///c:/testing.mp3",S_OK},
5538 {"/c:/testing.mp3",S_OK},
5539 {"/c:/testing.mp3",S_OK},
5541 {"file:///c:/testing.mp3",S_OK},
5547 {Uri_HOST_UNKNOWN,S_OK},
5549 {URL_SCHEME_FILE,S_OK},
5550 {URLZONE_INVALID,E_NOTIMPL}
5553 { "file://test.com/test/test",0,
5554 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5555 URL_FILE_USE_PATHURL,S_OK,FALSE,
5557 {"file://\\\\test.com\\testing.mp3",S_OK},
5559 {"file://\\\\test.com\\testing.mp3",S_OK},
5565 {"\\testing.mp3",S_OK},
5566 {"\\testing.mp3",S_OK},
5568 {"file://\\\\test.com\\testing.mp3",S_OK},
5574 {Uri_HOST_DNS,S_OK},
5576 {URL_SCHEME_FILE,S_OK},
5577 {URLZONE_INVALID,E_NOTIMPL}
5580 /* URL_DONT_SIMPLIFY has no effect. */
5581 { "http://google.com/test",0,
5582 "zip://test.com/cool/../cool/test",0,
5583 URL_DONT_SIMPLIFY,S_OK,FALSE,
5585 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5587 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5593 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5594 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5596 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5597 * On IE 7 it reduces the path in the Raw URI.
5599 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5605 {Uri_HOST_DNS,S_OK},
5607 {URL_SCHEME_UNKNOWN,S_OK},
5608 {URLZONE_INVALID,E_NOTIMPL}
5611 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5612 * resulting URI is converted into a dos path.
5614 { "http://google.com/test",0,
5615 "file:///c:/test/",0,
5616 URL_FILE_USE_PATHURL,S_OK,FALSE,
5618 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5620 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5626 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5627 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5629 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5635 {Uri_HOST_UNKNOWN,S_OK},
5637 {URL_SCHEME_FILE,S_OK},
5638 {URLZONE_INVALID,E_NOTIMPL}
5641 { "http://google.com/test",0,
5642 "http://test.com/test#%30test",0,
5643 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
5645 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5647 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5650 {"#0test",S_OK,FALSE,NULL,"#%30test"},
5656 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
5657 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
5663 {Uri_HOST_DNS,S_OK},
5665 {URL_SCHEME_HTTP,S_OK},
5666 {URLZONE_INVALID,E_NOTIMPL}
5669 /* Windows validates the path component from the relative Uri. */
5670 { "http://google.com/test",0,
5671 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
5672 0,E_INVALIDARG,FALSE
5674 /* Windows doesn't validate the query from the relative Uri. */
5675 { "http://google.com/test",0,
5676 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5679 {"http://google.com/test?Tes%XXt",S_OK},
5680 {"google.com",S_OK},
5681 {"http://google.com/test?Tes%XXt",S_OK},
5682 {"google.com",S_OK},
5685 {"google.com",S_OK},
5688 {"/test?Tes%XXt",S_OK},
5690 {"http://google.com/test?Tes%XXt",S_OK},
5696 {Uri_HOST_DNS,S_OK},
5698 {URL_SCHEME_HTTP,S_OK},
5699 {URLZONE_INVALID,E_NOTIMPL}
5702 /* Windows doesn't validate the fragment from the relative Uri. */
5703 { "http://google.com/test",0,
5704 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5707 {"http://google.com/test#Tes%XXt",S_OK},
5708 {"google.com",S_OK},
5709 {"http://google.com/test#Tes%XXt",S_OK},
5710 {"google.com",S_OK},
5713 {"google.com",S_OK},
5718 {"http://google.com/test#Tes%XXt",S_OK},
5724 {Uri_HOST_DNS,S_OK},
5726 {URL_SCHEME_HTTP,S_OK},
5727 {URLZONE_INVALID,E_NOTIMPL}
5730 /* Creates an IUri which contains an invalid dos path char. */
5731 { "file:///c:/test",0,
5732 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
5733 URL_FILE_USE_PATHURL,S_OK,FALSE,
5735 {"file://c:\\test<ing",S_OK},
5737 {"file://c:\\test<ing",S_OK},
5743 {"c:\\test<ing",S_OK},
5744 {"c:\\test<ing",S_OK},
5746 {"file://c:\\test<ing",S_OK},
5752 {Uri_HOST_UNKNOWN,S_OK},
5754 {URL_SCHEME_FILE,S_OK},
5755 {URLZONE_INVALID,E_NOTIMPL}
5758 /* Appends the path after the drive letter (if any). */
5759 { "file:///c:/test",0,
5760 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
5763 {"file:///c:/c:/testing",S_OK},
5765 {"file:///c:/c:/testing",S_OK},
5771 {"/c:/c:/testing",S_OK},
5772 {"/c:/c:/testing",S_OK},
5774 {"file:///c:/c:/testing",S_OK},
5780 {Uri_HOST_UNKNOWN,S_OK},
5782 {URL_SCHEME_FILE,S_OK},
5783 {URLZONE_INVALID,E_NOTIMPL}
5786 /* A '/' is added if the base URI doesn't have a path and the
5787 * relative URI doesn't contain a path (since the base URI is
5790 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
5791 "?test",Uri_CREATE_ALLOW_RELATIVE,
5794 {"http://google.com/?test",S_OK},
5795 {"google.com",S_OK},
5796 {"http://google.com/?test",S_OK},
5797 {"google.com",S_OK},
5800 {"google.com",S_OK},
5805 {"http://google.com/?test",S_OK},
5811 {Uri_HOST_DNS,S_OK},
5813 {URL_SCHEME_HTTP,S_OK},
5814 {URLZONE_INVALID,E_NOTIMPL}
5817 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
5818 "?test",Uri_CREATE_ALLOW_RELATIVE,
5821 {"zip://google.com/?test",S_OK},
5822 {"google.com",S_OK},
5823 {"zip://google.com/?test",S_OK},
5824 {"google.com",S_OK},
5827 {"google.com",S_OK},
5832 {"zip://google.com/?test",S_OK},
5838 {Uri_HOST_DNS,S_OK},
5840 {URL_SCHEME_UNKNOWN,S_OK},
5841 {URLZONE_INVALID,E_NOTIMPL}
5844 /* No path is appended since the base URI is opaque. */
5846 "?test",Uri_CREATE_ALLOW_RELATIVE,
5866 {Uri_HOST_UNKNOWN,S_OK},
5868 {URL_SCHEME_UNKNOWN,S_OK},
5869 {URLZONE_INVALID,E_NOTIMPL}
5873 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
5876 {"file:///c:/testing/test",S_OK},
5878 {"file:///c:/testing/test",S_OK},
5884 {"/c:/testing/test",S_OK},
5885 {"/c:/testing/test",S_OK},
5887 {"file:///c:/testing/test",S_OK},
5893 {Uri_HOST_UNKNOWN,S_OK},
5895 {URL_SCHEME_FILE,S_OK},
5896 {URLZONE_INVALID,E_NOTIMPL}
5901 typedef struct _uri_parse_test {
5906 const char *property;
5911 static const uri_parse_test uri_parse_tests[] = {
5912 /* PARSE_CANONICALIZE tests. */
5913 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
5914 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
5915 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
5916 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
5917 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
5918 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
5919 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
5920 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
5921 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
5922 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
5923 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
5924 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
5926 /* PARSE_FRIENDLY tests. */
5927 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
5928 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
5930 /* PARSE_ROOTDOCUMENT tests. */
5931 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
5932 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
5933 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
5934 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
5935 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
5936 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
5938 /* PARSE_DOCUMENT tests. */
5939 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
5940 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
5941 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
5942 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
5943 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
5944 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE}
5947 static inline LPWSTR a2w(LPCSTR str) {
5951 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
5952 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
5953 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
5959 static inline BOOL heap_free(void* mem) {
5960 return HeapFree(GetProcessHeap(), 0, mem);
5963 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
5964 LPWSTR strAW = a2w(strA);
5965 DWORD ret = lstrcmpW(strAW, strB);
5970 static inline ULONG get_refcnt(IUri *uri) {
5972 return IUri_Release(uri);
5975 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
5980 valueW = a2w(prop->value);
5981 switch(prop->property) {
5982 case Uri_PROPERTY_FRAGMENT:
5983 hr = IUriBuilder_SetFragment(builder, valueW);
5986 ok(hr == prop->expected,
5987 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5988 hr, prop->expected, test_index);
5991 ok(hr == prop->expected,
5992 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5993 hr, prop->expected, test_index);
5996 case Uri_PROPERTY_HOST:
5997 hr = IUriBuilder_SetHost(builder, valueW);
6000 ok(hr == prop->expected,
6001 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6002 hr, prop->expected, test_index);
6005 ok(hr == prop->expected,
6006 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6007 hr, prop->expected, test_index);
6010 case Uri_PROPERTY_PASSWORD:
6011 hr = IUriBuilder_SetPassword(builder, valueW);
6014 ok(hr == prop->expected,
6015 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6016 hr, prop->expected, test_index);
6019 ok(hr == prop->expected,
6020 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6021 hr, prop->expected, test_index);
6024 case Uri_PROPERTY_PATH:
6025 hr = IUriBuilder_SetPath(builder, valueW);
6028 ok(hr == prop->expected,
6029 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6030 hr, prop->expected, test_index);
6033 ok(hr == prop->expected,
6034 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6035 hr, prop->expected, test_index);
6038 case Uri_PROPERTY_QUERY:
6039 hr = IUriBuilder_SetQuery(builder, valueW);
6042 ok(hr == prop->expected,
6043 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6044 hr, prop->expected, test_index);
6047 ok(hr == prop->expected,
6048 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6049 hr, prop->expected, test_index);
6052 case Uri_PROPERTY_SCHEME_NAME:
6053 hr = IUriBuilder_SetSchemeName(builder, valueW);
6056 ok(hr == prop->expected,
6057 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6058 hr, prop->expected, test_index);
6061 ok(hr == prop->expected,
6062 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6063 hr, prop->expected, test_index);
6066 case Uri_PROPERTY_USER_NAME:
6067 hr = IUriBuilder_SetUserName(builder, valueW);
6070 ok(hr == prop->expected,
6071 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6072 hr, prop->expected, test_index);
6075 ok(hr == prop->expected,
6076 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6077 hr, prop->expected, test_index);
6081 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6088 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6091 static void test_CreateUri_InvalidFlags(void) {
6094 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6096 IUri *uri = (void*) 0xdeadbeef;
6098 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6099 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6100 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6101 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6105 static void test_CreateUri_InvalidArgs(void) {
6107 IUri *uri = (void*) 0xdeadbeef;
6109 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6110 static const WCHAR emptyW[] = {0};
6112 hr = pCreateUri(http_urlW, 0, 0, NULL);
6113 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6115 hr = pCreateUri(NULL, 0, 0, &uri);
6116 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6117 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6119 uri = (void*) 0xdeadbeef;
6120 hr = pCreateUri(invalidW, 0, 0, &uri);
6121 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6122 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6124 uri = (void*) 0xdeadbeef;
6125 hr = pCreateUri(emptyW, 0, 0, &uri);
6126 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6127 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6130 static void test_CreateUri_InvalidUri(void) {
6133 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6134 invalid_uri test = invalid_uri_tests[i];
6139 uriW = a2w(test.uri);
6140 hr = pCreateUri(uriW, test.flags, 0, &uri);
6143 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6144 hr, E_INVALIDARG, i);
6147 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6148 hr, E_INVALIDARG, i);
6150 if(uri) IUri_Release(uri);
6156 static void test_IUri_GetPropertyBSTR(void) {
6161 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6162 hr = pCreateUri(http_urlW, 0, 0, &uri);
6163 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6165 BSTR received = NULL;
6167 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6168 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6170 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6171 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6172 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6173 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6174 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6175 SysFreeString(received);
6177 /* Make sure it handles the ZONE property correctly. */
6179 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6180 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6181 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6182 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6183 SysFreeString(received);
6185 if(uri) IUri_Release(uri);
6187 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6188 uri_properties test = uri_tests[i];
6192 uriW = a2w(test.uri);
6193 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6194 if(test.create_todo) {
6196 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6197 hr, test.create_expected, i);
6200 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6201 hr, test.create_expected, i);
6207 /* Checks all the string properties of the uri. */
6208 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6209 BSTR received = NULL;
6210 uri_str_property prop = test.str_props[j];
6212 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6215 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6216 hr, prop.expected, i, j);
6219 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6220 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6221 prop.value, wine_dbgstr_w(received), i, j);
6224 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6225 hr, prop.expected, i, j);
6226 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6227 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6228 prop.value, wine_dbgstr_w(received), i, j);
6231 SysFreeString(received);
6235 if(uri) IUri_Release(uri);
6241 static void test_IUri_GetPropertyDWORD(void) {
6246 hr = pCreateUri(http_urlW, 0, 0, &uri);
6247 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6249 DWORD received = 0xdeadbeef;
6251 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6252 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6254 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6255 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6256 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6258 if(uri) IUri_Release(uri);
6260 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6261 uri_properties test = uri_tests[i];
6265 uriW = a2w(test.uri);
6266 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6267 if(test.create_todo) {
6269 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6270 hr, test.create_expected, i);
6273 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6274 hr, test.create_expected, i);
6280 /* Checks all the DWORD properties of the uri. */
6281 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6283 uri_dword_property prop = test.dword_props[j];
6285 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6288 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6289 hr, prop.expected, i, j);
6292 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6293 prop.value, received, i, j);
6296 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6297 hr, prop.expected, i, j);
6298 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6299 prop.value, received, i, j);
6304 if(uri) IUri_Release(uri);
6310 /* Tests all the 'Get*' property functions which deal with strings. */
6311 static void test_IUri_GetStrProperties(void) {
6316 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6317 hr = pCreateUri(http_urlW, 0, 0, &uri);
6318 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6320 hr = IUri_GetAbsoluteUri(uri, NULL);
6321 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6323 hr = IUri_GetAuthority(uri, NULL);
6324 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6326 hr = IUri_GetDisplayUri(uri, NULL);
6327 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6329 hr = IUri_GetDomain(uri, NULL);
6330 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6332 hr = IUri_GetExtension(uri, NULL);
6333 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6335 hr = IUri_GetFragment(uri, NULL);
6336 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6338 hr = IUri_GetHost(uri, NULL);
6339 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6341 hr = IUri_GetPassword(uri, NULL);
6342 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6344 hr = IUri_GetPath(uri, NULL);
6345 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6347 hr = IUri_GetPathAndQuery(uri, NULL);
6348 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6350 hr = IUri_GetQuery(uri, NULL);
6351 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6353 hr = IUri_GetRawUri(uri, NULL);
6354 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6356 hr = IUri_GetSchemeName(uri, NULL);
6357 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6359 hr = IUri_GetUserInfo(uri, NULL);
6360 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6362 hr = IUri_GetUserName(uri, NULL);
6363 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6365 if(uri) IUri_Release(uri);
6367 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6368 uri_properties test = uri_tests[i];
6372 uriW = a2w(test.uri);
6373 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6374 if(test.create_todo) {
6376 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6377 hr, test.create_expected, i);
6380 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6381 hr, test.create_expected, i);
6385 uri_str_property prop;
6386 BSTR received = NULL;
6388 /* GetAbsoluteUri() tests. */
6389 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6390 hr = IUri_GetAbsoluteUri(uri, &received);
6393 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6394 hr, prop.expected, i);
6397 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6398 "Error: Expected %s but got %s on uri_tests[%d].\n",
6399 prop.value, wine_dbgstr_w(received), i);
6402 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6403 hr, prop.expected, i);
6404 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6405 "Error: Expected %s but got %s on uri_tests[%d].\n",
6406 prop.value, wine_dbgstr_w(received), i);
6408 SysFreeString(received);
6411 /* GetAuthority() tests. */
6412 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6413 hr = IUri_GetAuthority(uri, &received);
6416 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6417 hr, prop.expected, i);
6420 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6421 prop.value, wine_dbgstr_w(received), i);
6424 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6425 hr, prop.expected, i);
6426 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6427 prop.value, wine_dbgstr_w(received), i);
6429 SysFreeString(received);
6432 /* GetDisplayUri() tests. */
6433 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6434 hr = IUri_GetDisplayUri(uri, &received);
6437 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6438 hr, prop.expected, i);
6441 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6442 "Error: Expected %s but got %s on uri_test[%d].\n",
6443 prop.value, wine_dbgstr_w(received), i);
6446 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6447 hr, prop.expected, i);
6448 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6449 "Error: Expected %s but got %s on uri_tests[%d].\n",
6450 prop.value, wine_dbgstr_w(received), i);
6452 SysFreeString(received);
6455 /* GetDomain() tests. */
6456 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6457 hr = IUri_GetDomain(uri, &received);
6460 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6461 hr, prop.expected, i);
6464 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6465 prop.value, wine_dbgstr_w(received), i);
6468 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6469 hr, prop.expected, i);
6470 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6471 prop.value, wine_dbgstr_w(received), i);
6473 SysFreeString(received);
6476 /* GetExtension() tests. */
6477 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6478 hr = IUri_GetExtension(uri, &received);
6481 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6482 hr, prop.expected, i);
6485 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6486 prop.value, wine_dbgstr_w(received), i);
6489 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6490 hr, prop.expected, i);
6491 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6492 prop.value, wine_dbgstr_w(received), i);
6494 SysFreeString(received);
6497 /* GetFragment() tests. */
6498 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6499 hr = IUri_GetFragment(uri, &received);
6502 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6503 hr, prop.expected, i);
6506 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6507 prop.value, wine_dbgstr_w(received), i);
6510 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6511 hr, prop.expected, i);
6512 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6513 prop.value, wine_dbgstr_w(received), i);
6515 SysFreeString(received);
6518 /* GetHost() tests. */
6519 prop = test.str_props[Uri_PROPERTY_HOST];
6520 hr = IUri_GetHost(uri, &received);
6523 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6524 hr, prop.expected, i);
6527 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6528 prop.value, wine_dbgstr_w(received), i);
6531 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6532 hr, prop.expected, i);
6533 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6534 prop.value, wine_dbgstr_w(received), i);
6536 SysFreeString(received);
6539 /* GetPassword() tests. */
6540 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6541 hr = IUri_GetPassword(uri, &received);
6544 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6545 hr, prop.expected, i);
6548 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6549 prop.value, wine_dbgstr_w(received), i);
6552 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6553 hr, prop.expected, i);
6554 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6555 prop.value, wine_dbgstr_w(received), i);
6557 SysFreeString(received);
6560 /* GetPath() tests. */
6561 prop = test.str_props[Uri_PROPERTY_PATH];
6562 hr = IUri_GetPath(uri, &received);
6565 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6566 hr, prop.expected, i);
6569 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6570 prop.value, wine_dbgstr_w(received), i);
6573 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6574 hr, prop.expected, i);
6575 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6576 prop.value, wine_dbgstr_w(received), i);
6578 SysFreeString(received);
6581 /* GetPathAndQuery() tests. */
6582 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6583 hr = IUri_GetPathAndQuery(uri, &received);
6586 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6587 hr, prop.expected, i);
6590 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6591 prop.value, wine_dbgstr_w(received), i);
6594 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6595 hr, prop.expected, i);
6596 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6597 prop.value, wine_dbgstr_w(received), i);
6599 SysFreeString(received);
6602 /* GetQuery() tests. */
6603 prop = test.str_props[Uri_PROPERTY_QUERY];
6604 hr = IUri_GetQuery(uri, &received);
6607 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6608 hr, prop.expected, i);
6611 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6612 prop.value, wine_dbgstr_w(received), i);
6615 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6616 hr, prop.expected, i);
6617 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6618 prop.value, wine_dbgstr_w(received), i);
6620 SysFreeString(received);
6623 /* GetRawUri() tests. */
6624 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6625 hr = IUri_GetRawUri(uri, &received);
6628 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6629 hr, prop.expected, i);
6632 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6633 prop.value, wine_dbgstr_w(received), i);
6636 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6637 hr, prop.expected, i);
6638 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6639 prop.value, wine_dbgstr_w(received), i);
6641 SysFreeString(received);
6644 /* GetSchemeName() tests. */
6645 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
6646 hr = IUri_GetSchemeName(uri, &received);
6649 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6650 hr, prop.expected, i);
6653 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6654 prop.value, wine_dbgstr_w(received), i);
6657 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6658 hr, prop.expected, i);
6659 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6660 prop.value, wine_dbgstr_w(received), i);
6662 SysFreeString(received);
6665 /* GetUserInfo() tests. */
6666 prop = test.str_props[Uri_PROPERTY_USER_INFO];
6667 hr = IUri_GetUserInfo(uri, &received);
6670 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6671 hr, prop.expected, i);
6674 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6675 prop.value, wine_dbgstr_w(received), i);
6678 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6679 hr, prop.expected, i);
6680 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6681 prop.value, wine_dbgstr_w(received), i);
6683 SysFreeString(received);
6686 /* GetUserName() tests. */
6687 prop = test.str_props[Uri_PROPERTY_USER_NAME];
6688 hr = IUri_GetUserName(uri, &received);
6691 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6692 hr, prop.expected, i);
6695 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6696 prop.value, wine_dbgstr_w(received), i);
6699 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6700 hr, prop.expected, i);
6701 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6702 prop.value, wine_dbgstr_w(received), i);
6704 SysFreeString(received);
6707 if(uri) IUri_Release(uri);
6713 static void test_IUri_GetDwordProperties(void) {
6718 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
6719 hr = pCreateUri(http_urlW, 0, 0, &uri);
6720 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6722 hr = IUri_GetHostType(uri, NULL);
6723 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6725 hr = IUri_GetPort(uri, NULL);
6726 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6728 hr = IUri_GetScheme(uri, NULL);
6729 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6731 hr = IUri_GetZone(uri, NULL);
6732 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6734 if(uri) IUri_Release(uri);
6736 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6737 uri_properties test = uri_tests[i];
6741 uriW = a2w(test.uri);
6742 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6743 if(test.create_todo) {
6745 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6746 hr, test.create_expected, i);
6749 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6750 hr, test.create_expected, i);
6754 uri_dword_property prop;
6757 /* Assign an insane value so tests don't accidentally pass when
6760 received = -9999999;
6762 /* GetHostType() tests. */
6763 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
6764 hr = IUri_GetHostType(uri, &received);
6767 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6768 hr, prop.expected, i);
6771 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6774 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6775 hr, prop.expected, i);
6776 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6778 received = -9999999;
6780 /* GetPort() tests. */
6781 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
6782 hr = IUri_GetPort(uri, &received);
6785 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6786 hr, prop.expected, i);
6789 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6792 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6793 hr, prop.expected, i);
6794 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6796 received = -9999999;
6798 /* GetScheme() tests. */
6799 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
6800 hr = IUri_GetScheme(uri, &received);
6803 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6804 hr, prop.expected, i);
6807 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6810 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6811 hr, prop.expected, i);
6812 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6814 received = -9999999;
6816 /* GetZone() tests. */
6817 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
6818 hr = IUri_GetZone(uri, &received);
6821 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6822 hr, prop.expected, i);
6825 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6828 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6829 hr, prop.expected, i);
6830 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6834 if(uri) IUri_Release(uri);
6840 static void test_IUri_GetPropertyLength(void) {
6845 /* Make sure it handles invalid args correctly. */
6846 hr = pCreateUri(http_urlW, 0, 0, &uri);
6847 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6849 DWORD received = 0xdeadbeef;
6851 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
6852 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6854 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
6855 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6856 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
6858 if(uri) IUri_Release(uri);
6860 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6861 uri_properties test = uri_tests[i];
6865 uriW = a2w(test.uri);
6866 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6867 if(test.create_todo) {
6869 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6870 hr, test.create_expected, i);
6873 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
6874 hr, test.create_expected, i);
6880 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6881 DWORD expectedLen, brokenLen, receivedLen;
6882 uri_str_property prop = test.str_props[j];
6884 expectedLen = lstrlen(prop.value);
6885 brokenLen = lstrlen(prop.broken_value);
6887 /* This won't be necessary once GetPropertyLength is implemented. */
6890 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
6893 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6894 hr, prop.expected, i, j);
6897 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6898 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6899 expectedLen, receivedLen, i, j);
6902 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6903 hr, prop.expected, i, j);
6904 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6905 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6906 expectedLen, receivedLen, i, j);
6911 if(uri) IUri_Release(uri);
6917 static DWORD compute_expected_props(uri_properties *test)
6921 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
6922 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
6926 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
6927 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
6934 static void test_IUri_GetProperties(void) {
6939 hr = pCreateUri(http_urlW, 0, 0, &uri);
6940 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6942 hr = IUri_GetProperties(uri, NULL);
6943 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6945 if(uri) IUri_Release(uri);
6947 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6948 uri_properties test = uri_tests[i];
6952 uriW = a2w(test.uri);
6953 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6954 if(test.create_todo) {
6956 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6959 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6963 DWORD received = 0, expected_props;
6966 hr = IUri_GetProperties(uri, &received);
6967 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6969 expected_props = compute_expected_props(&test);
6971 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
6972 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
6973 if(expected_props & (1 << j))
6974 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
6976 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
6980 if(uri) IUri_Release(uri);
6986 static void test_IUri_HasProperty(void) {
6991 hr = pCreateUri(http_urlW, 0, 0, &uri);
6992 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6994 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
6995 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6997 if(uri) IUri_Release(uri);
6999 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7000 uri_properties test = uri_tests[i];
7004 uriW = a2w(test.uri);
7006 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7007 if(test.create_todo) {
7009 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7012 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7016 DWORD expected_props, j;
7018 expected_props = compute_expected_props(&test);
7020 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7021 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7024 hr = IUri_HasProperty(uri, j, &received);
7025 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7028 if(expected_props & (1 << j)) {
7029 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7031 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7036 if(uri) IUri_Release(uri);
7042 static void test_IUri_IsEqual(void) {
7049 /* Make sure IsEqual handles invalid args correctly. */
7050 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7051 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7052 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7053 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7054 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7056 hrA = IUri_IsEqual(uriA, NULL, &equal);
7057 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7058 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7060 hrA = IUri_IsEqual(uriA, uriB, NULL);
7061 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7063 if(uriA) IUri_Release(uriA);
7064 if(uriB) IUri_Release(uriB);
7066 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7067 uri_equality test = equality_tests[i];
7068 LPWSTR uriA_W, uriB_W;
7072 uriA_W = a2w(test.a);
7073 uriB_W = a2w(test.b);
7075 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7076 if(test.create_todo_a) {
7078 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7082 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7086 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7087 if(test.create_todo_b) {
7089 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7093 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7097 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7100 hrA = IUri_IsEqual(uriA, uriB, &equal);
7103 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7107 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7110 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7111 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7114 if(uriA) IUri_Release(uriA);
7115 if(uriB) IUri_Release(uriB);
7122 static void test_CreateUriWithFragment_InvalidArgs(void) {
7124 IUri *uri = (void*) 0xdeadbeef;
7125 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7127 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7128 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7129 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7131 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7132 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7134 /* Original URI can't already contain a fragment component. */
7135 uri = (void*) 0xdeadbeef;
7136 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7137 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7138 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7141 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7142 static void test_CreateUriWithFragment_InvalidFlags(void) {
7145 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7147 IUri *uri = (void*) 0xdeadbeef;
7149 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7150 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7151 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7152 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7156 static void test_CreateUriWithFragment(void) {
7159 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7163 uri_with_fragment test = uri_fragment_tests[i];
7165 uriW = a2w(test.uri);
7166 fragW = a2w(test.fragment);
7168 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7169 if(test.expected_todo) {
7171 ok(hr == test.create_expected,
7172 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7173 hr, test.create_expected, i);
7176 ok(hr == test.create_expected,
7177 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7178 hr, test.create_expected, i);
7181 BSTR received = NULL;
7183 hr = IUri_GetAbsoluteUri(uri, &received);
7184 if(test.expected_todo) {
7187 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7191 ok(!strcmp_aw(test.expected_uri, received),
7192 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7193 test.expected_uri, wine_dbgstr_w(received), i);
7196 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7198 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7199 test.expected_uri, wine_dbgstr_w(received), i);
7202 SysFreeString(received);
7205 if(uri) IUri_Release(uri);
7210 static void test_CreateIUriBuilder(void) {
7212 IUriBuilder *builder = NULL;
7215 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7216 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7219 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7220 hr = pCreateUri(http_urlW, 0, 0, &uri);
7221 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7223 ULONG cur_count, orig_count;
7225 orig_count = get_refcnt(uri);
7226 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7227 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7228 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7230 cur_count = get_refcnt(uri);
7231 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7233 if(builder) IUriBuilder_Release(builder);
7234 cur_count = get_refcnt(uri);
7235 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7237 if(uri) IUri_Release(uri);
7240 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7245 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7246 if(test->uri_todo) {
7248 ok(hr == test->uri_hres,
7249 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7250 hr, test->uri_hres, test_index);
7253 ok(hr == test->uri_hres,
7254 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7255 hr, test->uri_hres, test_index);
7261 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7262 uri_builder_str_property prop = test->expected_str_props[i];
7263 BSTR received = NULL;
7265 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7268 ok(hr == prop.result,
7269 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7270 hr, prop.result, test_index, i);
7273 ok(hr == prop.result,
7274 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7275 hr, prop.result, test_index, i);
7280 ok(!strcmp_aw(prop.expected, received),
7281 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7282 prop.expected, wine_dbgstr_w(received), test_index, i);
7285 ok(!strcmp_aw(prop.expected, received),
7286 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7287 prop.expected, wine_dbgstr_w(received), test_index, i);
7290 SysFreeString(received);
7293 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7294 uri_builder_dword_property prop = test->expected_dword_props[i];
7295 DWORD received = -2;
7297 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7300 ok(hr == prop.result,
7301 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7302 hr, prop.result, test_index, i);
7305 ok(hr == prop.result,
7306 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7307 hr, prop.result, test_index, i);
7312 ok(received == prop.expected,
7313 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7314 prop.expected, received, test_index, i);
7317 ok(received == prop.expected,
7318 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7319 prop.expected, received, test_index, i);
7324 if(uri) IUri_Release(uri);
7327 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7332 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7333 if(test->uri_simple_todo) {
7335 ok(hr == test->uri_simple_hres,
7336 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7337 hr, test->uri_simple_hres, test_index);
7340 ok(hr == test->uri_simple_hres,
7341 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7342 hr, test->uri_simple_hres, test_index);
7348 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7349 uri_builder_str_property prop = test->expected_str_props[i];
7350 BSTR received = NULL;
7352 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7355 ok(hr == prop.result,
7356 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7357 hr, prop.result, test_index, i);
7360 ok(hr == prop.result,
7361 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7362 hr, prop.result, test_index, i);
7367 ok(!strcmp_aw(prop.expected, received),
7368 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7369 prop.expected, wine_dbgstr_w(received), test_index, i);
7372 ok(!strcmp_aw(prop.expected, received),
7373 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7374 prop.expected, wine_dbgstr_w(received), test_index, i);
7377 SysFreeString(received);
7380 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7381 uri_builder_dword_property prop = test->expected_dword_props[i];
7382 DWORD received = -2;
7384 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7387 ok(hr == prop.result,
7388 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7389 hr, prop.result, test_index, i);
7392 ok(hr == prop.result,
7393 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7394 hr, prop.result, test_index, i);
7399 ok(received == prop.expected,
7400 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7401 prop.expected, received, test_index, i);
7404 ok(received == prop.expected,
7405 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7406 prop.expected, received, test_index, i);
7411 if(uri) IUri_Release(uri);
7414 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7419 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7420 test->uri_with_encode_flags, 0, &uri);
7421 if(test->uri_with_todo) {
7423 ok(hr == test->uri_with_hres,
7424 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7425 hr, test->uri_with_hres, test_index);
7428 ok(hr == test->uri_with_hres,
7429 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7430 hr, test->uri_with_hres, test_index);
7436 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7437 uri_builder_str_property prop = test->expected_str_props[i];
7438 BSTR received = NULL;
7440 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7443 ok(hr == prop.result,
7444 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7445 hr, prop.result, test_index, i);
7448 ok(hr == prop.result,
7449 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7450 hr, prop.result, test_index, i);
7455 ok(!strcmp_aw(prop.expected, received),
7456 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7457 prop.expected, wine_dbgstr_w(received), test_index, i);
7460 ok(!strcmp_aw(prop.expected, received),
7461 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7462 prop.expected, wine_dbgstr_w(received), test_index, i);
7465 SysFreeString(received);
7468 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7469 uri_builder_dword_property prop = test->expected_dword_props[i];
7470 DWORD received = -2;
7472 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7475 ok(hr == prop.result,
7476 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7477 hr, prop.result, test_index, i);
7480 ok(hr == prop.result,
7481 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7482 hr, prop.result, test_index, i);
7487 ok(received == prop.expected,
7488 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7489 prop.expected, received, test_index, i);
7492 ok(received == prop.expected,
7493 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7494 prop.expected, received, test_index, i);
7499 if(uri) IUri_Release(uri);
7502 static void test_IUriBuilder_CreateInvalidArgs(void) {
7503 IUriBuilder *builder;
7506 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7507 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7509 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7511 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7512 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7513 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7515 uri = (void*) 0xdeadbeef;
7516 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7517 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7518 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7520 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7521 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7524 uri = (void*) 0xdeadbeef;
7525 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7526 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7528 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7530 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7531 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7534 uri = (void*) 0xdeadbeef;
7535 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7536 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7538 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7540 hr = pCreateUri(http_urlW, 0, 0, &test);
7541 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7543 hr = IUriBuilder_SetIUri(builder, test);
7544 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7546 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7548 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7549 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7550 ok(uri != NULL, "Error: The uri was NULL.\n");
7551 if(uri) IUri_Release(uri);
7554 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7555 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7557 ok(uri != NULL, "Error: uri was NULL.\n");
7558 if(uri) IUri_Release(uri);
7561 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7562 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7564 ok(uri != NULL, "Error: uri was NULL.\n");
7565 if(uri) IUri_Release(uri);
7567 hr = IUriBuilder_SetFragment(builder, NULL);
7568 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7570 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7571 uri = (void*) 0xdeadbeef;
7572 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7573 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7574 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7576 uri = (void*) 0xdeadbeef;
7577 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7578 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7580 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7582 uri = (void*) 0xdeadbeef;
7583 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7584 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7586 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7588 if(test) IUri_Release(test);
7590 if(builder) IUriBuilder_Release(builder);
7593 /* Tests invalid args to the "Get*" functions. */
7594 static void test_IUriBuilder_GetInvalidArgs(void) {
7595 IUriBuilder *builder = NULL;
7598 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7599 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7601 LPCWSTR received = (void*) 0xdeadbeef;
7602 DWORD len = -1, port = -1;
7605 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7606 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7608 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7609 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7611 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7612 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7613 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7615 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7617 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7618 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7620 received = (void*) 0xdeadbeef;
7621 hr = IUriBuilder_GetHost(builder, NULL, &received);
7622 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7624 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7626 hr = IUriBuilder_GetHost(builder, &len, NULL);
7627 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7629 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7631 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7632 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7634 received = (void*) 0xdeadbeef;
7635 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7636 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7638 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7640 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7641 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7643 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7645 hr = IUriBuilder_GetPath(builder, NULL, NULL);
7646 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7648 received = (void*) 0xdeadbeef;
7649 hr = IUriBuilder_GetPath(builder, NULL, &received);
7650 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7652 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7654 hr = IUriBuilder_GetPath(builder, &len, NULL);
7655 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7657 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7659 hr = IUriBuilder_GetPort(builder, NULL, NULL);
7660 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7662 hr = IUriBuilder_GetPort(builder, NULL, &port);
7663 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7665 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
7666 hr = IUriBuilder_GetPort(builder, &set, NULL);
7667 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7669 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
7671 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
7672 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7674 received = (void*) 0xdeadbeef;
7675 hr = IUriBuilder_GetQuery(builder, NULL, &received);
7676 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7678 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7680 hr = IUriBuilder_GetQuery(builder, &len, NULL);
7681 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7683 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7685 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
7686 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7688 received = (void*) 0xdeadbeef;
7689 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
7690 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7692 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7694 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
7695 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7697 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7699 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
7700 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7702 received = (void*) 0xdeadbeef;
7703 hr = IUriBuilder_GetUserName(builder, NULL, &received);
7704 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7706 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7708 hr = IUriBuilder_GetUserName(builder, &len, NULL);
7709 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7711 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7713 if(builder) IUriBuilder_Release(builder);
7716 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
7720 LPCWSTR received = NULL;
7722 const uri_builder_property *prop = NULL;
7724 /* Check if the property was set earlier. */
7725 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7726 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
7727 prop = &(test->properties[i]);
7731 /* Use expected_value unless it's NULL, then use value. */
7732 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7733 hr = IUriBuilder_GetFragment(builder, &len, &received);
7736 ok(hr == (expected ? S_OK : S_FALSE),
7737 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7738 hr, (expected ? S_OK : S_FALSE), test_index);
7742 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7743 expected, wine_dbgstr_w(received), test_index);
7746 ok(lstrlen(expected) == len,
7747 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7748 lstrlen(expected), len, test_index);
7752 ok(hr == (expected ? S_OK : S_FALSE),
7753 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7754 hr, (expected ? S_OK : S_FALSE), test_index);
7755 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7756 expected, wine_dbgstr_w(received), test_index);
7757 ok(lstrlen(expected) == len,
7758 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7759 lstrlen(expected), len, test_index);
7762 /* The property wasn't set earlier, so it should return whatever
7763 * the base IUri contains (if anything).
7766 hr = IUriBuilder_GetIUri(builder, &uri);
7768 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7769 hr, S_OK, test_index);
7772 received = (void*) 0xdeadbeef;
7775 hr = IUriBuilder_GetFragment(builder, &len, &received);
7777 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7778 hr, S_FALSE, test_index);
7780 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7782 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7783 received, test_index);
7786 BOOL has_prop = FALSE;
7787 BSTR expected = NULL;
7789 hr = IUri_GetFragment(uri, &expected);
7791 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7793 has_prop = hr == S_OK;
7795 hr = IUriBuilder_GetFragment(builder, &len, &received);
7798 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7799 hr, S_OK, test_index);
7801 ok(!lstrcmpW(expected, received),
7802 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7803 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7804 ok(lstrlenW(expected) == len,
7805 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7806 lstrlenW(expected), len, test_index);
7810 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7811 hr, S_FALSE, test_index);
7813 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7814 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7818 SysFreeString(expected);
7821 if(uri) IUri_Release(uri);
7825 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
7829 LPCWSTR received = NULL;
7831 const uri_builder_property *prop = NULL;
7833 /* Check if the property was set earlier. */
7834 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7835 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
7836 prop = &(test->properties[i]);
7840 /* Use expected_value unless it's NULL, then use value. */
7841 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7842 hr = IUriBuilder_GetHost(builder, &len, &received);
7845 ok(hr == (expected ? S_OK : S_FALSE),
7846 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7847 hr, (expected ? S_OK : S_FALSE), test_index);
7851 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7852 expected, wine_dbgstr_w(received), test_index);
7855 ok(lstrlen(expected) == len,
7856 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7857 lstrlen(expected), len, test_index);
7861 ok(hr == (expected ? S_OK : S_FALSE),
7862 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7863 hr, (expected ? S_OK : S_FALSE), test_index);
7864 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7865 expected, wine_dbgstr_w(received), test_index);
7866 ok(lstrlen(expected) == len,
7867 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7868 lstrlen(expected), len, test_index);
7871 /* The property wasn't set earlier, so it should return whatever
7872 * the base IUri contains (if anything).
7875 hr = IUriBuilder_GetIUri(builder, &uri);
7877 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7878 hr, S_OK, test_index);
7881 received = (void*) 0xdeadbeef;
7884 hr = IUriBuilder_GetHost(builder, &len, &received);
7886 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7887 hr, S_FALSE, test_index);
7889 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7891 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7892 received, test_index);
7895 BOOL has_prop = FALSE;
7896 BSTR expected = NULL;
7898 hr = IUri_GetHost(uri, &expected);
7900 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7902 has_prop = hr == S_OK;
7904 hr = IUriBuilder_GetHost(builder, &len, &received);
7907 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7908 hr, S_OK, test_index);
7910 ok(!lstrcmpW(expected, received),
7911 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7912 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7913 ok(lstrlenW(expected) == len,
7914 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7915 lstrlenW(expected), len, test_index);
7919 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7920 hr, S_FALSE, test_index);
7922 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7923 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7927 SysFreeString(expected);
7930 if(uri) IUri_Release(uri);
7934 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
7938 LPCWSTR received = NULL;
7940 const uri_builder_property *prop = NULL;
7942 /* Check if the property was set earlier. */
7943 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7944 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
7945 prop = &(test->properties[i]);
7949 /* Use expected_value unless it's NULL, then use value. */
7950 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7951 hr = IUriBuilder_GetPassword(builder, &len, &received);
7954 ok(hr == (expected ? S_OK : S_FALSE),
7955 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7956 hr, (expected ? S_OK : S_FALSE), test_index);
7960 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7961 expected, wine_dbgstr_w(received), test_index);
7964 ok(lstrlen(expected) == len,
7965 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7966 lstrlen(expected), len, test_index);
7970 ok(hr == (expected ? S_OK : S_FALSE),
7971 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7972 hr, (expected ? S_OK : S_FALSE), test_index);
7973 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7974 expected, wine_dbgstr_w(received), test_index);
7975 ok(lstrlen(expected) == len,
7976 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7977 lstrlen(expected), len, test_index);
7980 /* The property wasn't set earlier, so it should return whatever
7981 * the base IUri contains (if anything).
7984 hr = IUriBuilder_GetIUri(builder, &uri);
7986 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7987 hr, S_OK, test_index);
7990 received = (void*) 0xdeadbeef;
7993 hr = IUriBuilder_GetPassword(builder, &len, &received);
7995 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7996 hr, S_FALSE, test_index);
7998 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8000 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8001 received, test_index);
8004 BOOL has_prop = FALSE;
8005 BSTR expected = NULL;
8007 hr = IUri_GetPassword(uri, &expected);
8009 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8011 has_prop = hr == S_OK;
8013 hr = IUriBuilder_GetPassword(builder, &len, &received);
8016 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8017 hr, S_OK, test_index);
8019 ok(!lstrcmpW(expected, received),
8020 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8021 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8022 ok(lstrlenW(expected) == len,
8023 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8024 lstrlenW(expected), len, test_index);
8028 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8029 hr, S_FALSE, test_index);
8031 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8032 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8036 SysFreeString(expected);
8039 if(uri) IUri_Release(uri);
8043 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8047 LPCWSTR received = NULL;
8049 const uri_builder_property *prop = NULL;
8051 /* Check if the property was set earlier. */
8052 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8053 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8054 prop = &(test->properties[i]);
8058 /* Use expected_value unless it's NULL, then use value. */
8059 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8060 hr = IUriBuilder_GetPath(builder, &len, &received);
8063 ok(hr == (expected ? S_OK : S_FALSE),
8064 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8065 hr, (expected ? S_OK : S_FALSE), test_index);
8069 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8070 expected, wine_dbgstr_w(received), test_index);
8073 ok(lstrlen(expected) == len,
8074 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8075 lstrlen(expected), len, test_index);
8079 ok(hr == (expected ? S_OK : S_FALSE),
8080 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8081 hr, (expected ? S_OK : S_FALSE), test_index);
8082 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8083 expected, wine_dbgstr_w(received), test_index);
8084 ok(lstrlen(expected) == len,
8085 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8086 lstrlen(expected), len, test_index);
8089 /* The property wasn't set earlier, so it should return whatever
8090 * the base IUri contains (if anything).
8093 hr = IUriBuilder_GetIUri(builder, &uri);
8095 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8096 hr, S_OK, test_index);
8099 received = (void*) 0xdeadbeef;
8102 hr = IUriBuilder_GetPath(builder, &len, &received);
8104 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8105 hr, S_FALSE, test_index);
8107 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8109 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8110 received, test_index);
8113 BOOL has_prop = FALSE;
8114 BSTR expected = NULL;
8116 hr = IUri_GetPath(uri, &expected);
8118 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8120 has_prop = hr == S_OK;
8122 hr = IUriBuilder_GetPath(builder, &len, &received);
8125 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8126 hr, S_OK, test_index);
8128 ok(!lstrcmpW(expected, received),
8129 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8130 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8131 ok(lstrlenW(expected) == len,
8132 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8133 lstrlenW(expected), len, test_index);
8137 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8138 hr, S_FALSE, test_index);
8140 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8141 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8145 SysFreeString(expected);
8148 if(uri) IUri_Release(uri);
8152 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8155 BOOL has_port = FALSE;
8156 DWORD received = -1;
8158 if(test->port_prop.change) {
8159 DWORD expected = test->port_prop.value;
8161 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8162 if(test->port_prop.todo) {
8165 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8166 hr, S_OK, test_index);
8170 ok(has_port == test->port_prop.set,
8171 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8172 test->port_prop.set, has_port, test_index);
8175 ok(received == expected,
8176 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8177 expected, received, test_index);
8182 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8183 hr, S_OK, test_index);
8184 ok(has_port == test->port_prop.set,
8185 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8186 test->port_prop.set, has_port, test_index);
8187 ok(received == test->port_prop.value,
8188 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8189 test->port_prop.value, received, test_index);
8194 hr = IUriBuilder_GetIUri(builder, &uri);
8196 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8197 hr, S_OK, test_index);
8200 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8202 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8203 hr, S_OK, test_index);
8205 ok(has_port == FALSE,
8206 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8207 has_port, test_index);
8208 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8209 received, test_index);
8214 hr = IUri_GetPort(uri, &expected);
8216 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8219 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8221 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8222 hr, S_OK, test_index);
8225 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8227 ok(received == expected,
8228 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8229 expected, received, test_index);
8233 if(uri) IUri_Release(uri);
8237 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8241 LPCWSTR received = NULL;
8243 const uri_builder_property *prop = NULL;
8245 /* Check if the property was set earlier. */
8246 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8247 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8248 prop = &(test->properties[i]);
8252 /* Use expected_value unless it's NULL, then use value. */
8253 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8254 hr = IUriBuilder_GetQuery(builder, &len, &received);
8257 ok(hr == (expected ? S_OK : S_FALSE),
8258 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8259 hr, (expected ? S_OK : S_FALSE), test_index);
8263 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8264 expected, wine_dbgstr_w(received), test_index);
8267 ok(lstrlen(expected) == len,
8268 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8269 lstrlen(expected), len, test_index);
8273 ok(hr == (expected ? S_OK : S_FALSE),
8274 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8275 hr, (expected ? S_OK : S_FALSE), test_index);
8276 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8277 expected, wine_dbgstr_w(received), test_index);
8278 ok(lstrlen(expected) == len,
8279 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8280 lstrlen(expected), len, test_index);
8283 /* The property wasn't set earlier, so it should return whatever
8284 * the base IUri contains (if anything).
8287 hr = IUriBuilder_GetIUri(builder, &uri);
8289 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8290 hr, S_OK, test_index);
8293 received = (void*) 0xdeadbeef;
8296 hr = IUriBuilder_GetQuery(builder, &len, &received);
8298 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8299 hr, S_FALSE, test_index);
8301 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8303 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8304 received, test_index);
8307 BOOL has_prop = FALSE;
8308 BSTR expected = NULL;
8310 hr = IUri_GetQuery(uri, &expected);
8312 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8314 has_prop = hr == S_OK;
8316 hr = IUriBuilder_GetQuery(builder, &len, &received);
8319 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8320 hr, S_OK, test_index);
8322 ok(!lstrcmpW(expected, received),
8323 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8324 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8325 ok(lstrlenW(expected) == len,
8326 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8327 lstrlenW(expected), len, test_index);
8331 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8332 hr, S_FALSE, test_index);
8334 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8335 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8339 SysFreeString(expected);
8342 if(uri) IUri_Release(uri);
8346 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8350 LPCWSTR received = NULL;
8352 const uri_builder_property *prop = NULL;
8354 /* Check if the property was set earlier. */
8355 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8356 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8357 prop = &(test->properties[i]);
8361 /* Use expected_value unless it's NULL, then use value. */
8362 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8363 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8366 ok(hr == (expected ? S_OK : S_FALSE),
8367 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8368 hr, (expected ? S_OK : S_FALSE), test_index);
8372 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8373 expected, wine_dbgstr_w(received), test_index);
8376 ok(lstrlen(expected) == len,
8377 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8378 lstrlen(expected), len, test_index);
8382 ok(hr == (expected ? S_OK : S_FALSE),
8383 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8384 hr, (expected ? S_OK : S_FALSE), test_index);
8385 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8386 expected, wine_dbgstr_w(received), test_index);
8387 ok(lstrlen(expected) == len,
8388 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8389 lstrlen(expected), len, test_index);
8392 /* The property wasn't set earlier, so it should return whatever
8393 * the base IUri contains (if anything).
8396 hr = IUriBuilder_GetIUri(builder, &uri);
8398 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8399 hr, S_OK, test_index);
8402 received = (void*) 0xdeadbeef;
8405 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8407 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8408 hr, S_FALSE, test_index);
8410 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8412 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8413 received, test_index);
8416 BOOL has_prop = FALSE;
8417 BSTR expected = NULL;
8419 hr = IUri_GetSchemeName(uri, &expected);
8421 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8423 has_prop = hr == S_OK;
8425 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8428 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8429 hr, S_OK, test_index);
8431 ok(!lstrcmpW(expected, received),
8432 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8433 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8434 ok(lstrlenW(expected) == len,
8435 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8436 lstrlenW(expected), len, test_index);
8440 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8441 hr, S_FALSE, test_index);
8443 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8444 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8448 SysFreeString(expected);
8451 if(uri) IUri_Release(uri);
8455 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8459 LPCWSTR received = NULL;
8461 const uri_builder_property *prop = NULL;
8463 /* Check if the property was set earlier. */
8464 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8465 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8466 prop = &(test->properties[i]);
8469 if(prop && prop->value && *prop->value) {
8470 /* Use expected_value unless it's NULL, then use value. */
8471 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8472 hr = IUriBuilder_GetUserName(builder, &len, &received);
8475 ok(hr == (expected ? S_OK : S_FALSE),
8476 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8477 hr, (expected ? S_OK : S_FALSE), test_index);
8481 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8482 expected, wine_dbgstr_w(received), test_index);
8485 ok(lstrlen(expected) == len,
8486 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8487 lstrlen(expected), len, test_index);
8491 ok(hr == (expected ? S_OK : S_FALSE),
8492 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8493 hr, (expected ? S_OK : S_FALSE), test_index);
8494 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8495 expected, wine_dbgstr_w(received), test_index);
8496 ok(lstrlen(expected) == len,
8497 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8498 lstrlen(expected), len, test_index);
8501 /* The property wasn't set earlier, so it should return whatever
8502 * the base IUri contains (if anything).
8505 hr = IUriBuilder_GetIUri(builder, &uri);
8507 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8508 hr, S_OK, test_index);
8511 received = (void*) 0xdeadbeef;
8514 hr = IUriBuilder_GetUserName(builder, &len, &received);
8516 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8517 hr, S_FALSE, test_index);
8519 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8521 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8522 received, test_index);
8525 BSTR expected = NULL;
8526 BOOL has_prop = FALSE;
8528 hr = IUri_GetUserName(uri, &expected);
8530 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8532 has_prop = hr == S_OK;
8534 hr = IUriBuilder_GetUserName(builder, &len, &received);
8537 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8538 hr, S_OK, test_index);
8540 ok(!lstrcmpW(expected, received),
8541 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8542 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8543 ok(lstrlenW(expected) == len,
8544 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8545 lstrlenW(expected), len, test_index);
8549 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8550 hr, S_FALSE, test_index);
8552 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8553 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8557 SysFreeString(expected);
8560 if(uri) IUri_Release(uri);
8564 /* Tests IUriBuilder functions. */
8565 static void test_IUriBuilder(void) {
8567 IUriBuilder *builder;
8570 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8572 uri_builder_test test = uri_builder_tests[i];
8576 uriW = a2w(test.uri);
8577 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8578 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8580 if(FAILED(hr)) continue;
8582 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8583 if(test.create_builder_todo) {
8585 ok(hr == test.create_builder_expected,
8586 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8587 hr, test.create_builder_expected, i);
8590 ok(hr == test.create_builder_expected,
8591 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8592 hr, test.create_builder_expected, i);
8596 BOOL modified = FALSE, received = FALSE;
8598 /* Perform all the string property changes. */
8599 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8600 uri_builder_property prop = test.properties[j];
8602 change_property(builder, &prop, i);
8603 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8604 prop.property != Uri_PROPERTY_HOST)
8606 else if(prop.value && *prop.value)
8608 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8609 /* Host name property can't be NULL, but it can be empty. */
8614 if(test.port_prop.change) {
8615 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8617 if(test.port_prop.todo) {
8619 ok(hr == test.port_prop.expected,
8620 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8621 hr, test.port_prop.expected, i);
8624 ok(hr == test.port_prop.expected,
8625 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8626 hr, test.port_prop.expected, i);
8630 hr = IUriBuilder_HasBeenModified(builder, &received);
8632 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8635 ok(received == modified,
8636 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8637 modified, received, i);
8639 /* Test the "Get*" functions. */
8640 test_IUriBuilder_GetFragment(builder, &test, i);
8641 test_IUriBuilder_GetHost(builder, &test, i);
8642 test_IUriBuilder_GetPassword(builder, &test, i);
8643 test_IUriBuilder_GetPath(builder, &test, i);
8644 test_IUriBuilder_GetPort(builder, &test, i);
8645 test_IUriBuilder_GetQuery(builder, &test, i);
8646 test_IUriBuilder_GetSchemeName(builder, &test, i);
8647 test_IUriBuilder_GetUserName(builder, &test, i);
8649 test_IUriBuilder_CreateUri(builder, &test, i);
8650 test_IUriBuilder_CreateUriSimple(builder, &test, i);
8651 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
8653 if(builder) IUriBuilder_Release(builder);
8654 if(uri) IUri_Release(uri);
8659 static void test_IUriBuilder_HasBeenModified(void) {
8661 IUriBuilder *builder = NULL;
8663 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8664 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8666 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
8670 hr = IUriBuilder_HasBeenModified(builder, NULL);
8671 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8674 hr = IUriBuilder_SetHost(builder, hostW);
8675 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
8678 hr = IUriBuilder_HasBeenModified(builder, &received);
8679 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8682 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8684 hr = pCreateUri(http_urlW, 0, 0, &uri);
8685 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8690 hr = IUriBuilder_SetIUri(builder, uri);
8691 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
8694 hr = IUriBuilder_HasBeenModified(builder, &received);
8695 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8698 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
8700 /* Test what happens with you call SetIUri with the same IUri again. */
8701 hr = IUriBuilder_SetHost(builder, hostW);
8702 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8704 hr = IUriBuilder_HasBeenModified(builder, &received);
8705 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8708 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8710 hr = IUriBuilder_SetIUri(builder, uri);
8711 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8713 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
8714 * reset any of the changes that were made to the IUriBuilder.
8716 hr = IUriBuilder_HasBeenModified(builder, &received);
8717 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8719 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8721 hr = IUriBuilder_GetHost(builder, &len, &prop);
8722 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8724 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8725 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8726 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
8727 lstrlenW(hostW), len);
8730 hr = IUriBuilder_SetIUri(builder, NULL);
8731 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8733 hr = IUriBuilder_SetHost(builder, hostW);
8734 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8735 hr = IUriBuilder_HasBeenModified(builder, &received);
8736 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8739 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8741 hr = IUriBuilder_SetIUri(builder, NULL);
8742 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
8744 hr = IUriBuilder_HasBeenModified(builder, &received);
8745 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8748 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8750 hr = IUriBuilder_GetHost(builder, &len, &prop);
8751 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8753 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8754 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8755 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
8756 lstrlenW(hostW), len);
8759 if(uri) IUri_Release(uri);
8761 if(builder) IUriBuilder_Release(builder);
8764 /* Test IUriBuilder {Get,Set}IUri functions. */
8765 static void test_IUriBuilder_IUriProperty(void) {
8766 IUriBuilder *builder = NULL;
8769 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8770 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8774 hr = IUriBuilder_GetIUri(builder, NULL);
8775 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
8778 hr = pCreateUri(http_urlW, 0, 0, &uri);
8781 ULONG cur_count, orig_count;
8783 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
8784 orig_count = get_refcnt(uri);
8785 hr = IUriBuilder_SetIUri(builder, uri);
8786 cur_count = get_refcnt(uri);
8788 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8789 orig_count+1, cur_count);
8791 hr = IUriBuilder_SetIUri(builder, NULL);
8792 cur_count = get_refcnt(uri);
8794 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8795 orig_count, cur_count);
8797 /* CreateUri* functions will return back the same IUri if nothing has changed. */
8798 hr = IUriBuilder_SetIUri(builder, uri);
8799 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8800 orig_count = get_refcnt(uri);
8802 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
8803 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8805 cur_count = get_refcnt(uri);
8806 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8807 orig_count+1, cur_count);
8808 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
8811 if(test) IUri_Release(test);
8814 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
8815 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8817 cur_count = get_refcnt(uri);
8818 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8819 orig_count+1, cur_count);
8820 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8822 if(test) IUri_Release(test);
8824 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8828 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
8829 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8831 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8833 if(test) IUri_Release(test);
8835 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8836 * explicitly set (because it's a default flags).
8839 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
8840 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8842 cur_count = get_refcnt(uri);
8843 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8844 orig_count+1, cur_count);
8845 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8847 if(test) IUri_Release(test);
8850 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
8851 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8853 cur_count = get_refcnt(uri);
8854 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8855 orig_count+1, cur_count);
8856 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8858 if(test) IUri_Release(test);
8861 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
8862 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8865 cur_count = get_refcnt(uri);
8866 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8867 orig_count+1, cur_count);
8868 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8870 if(test) IUri_Release(test);
8872 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8876 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
8877 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8879 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8881 if(test) IUri_Release(test);
8883 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8884 * explicitly set (because it's a default flags).
8887 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
8888 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8890 cur_count = get_refcnt(uri);
8891 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8892 orig_count+1, cur_count);
8893 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8895 if(test) IUri_Release(test);
8897 if(uri) IUri_Release(uri);
8899 if(builder) IUriBuilder_Release(builder);
8902 static void test_IUriBuilder_RemoveProperties(void) {
8903 IUriBuilder *builder = NULL;
8907 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8908 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8910 /* Properties that can't be removed. */
8911 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
8912 Uri_HAS_SCHEME|Uri_HAS_ZONE;
8914 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
8915 hr = IUriBuilder_RemoveProperties(builder, i << 1);
8916 if((i << 1) & invalid) {
8917 ok(hr == E_INVALIDARG,
8918 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8919 hr, E_INVALIDARG, i);
8922 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8927 /* Also doesn't accept anything that's outside the range of the
8930 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
8931 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
8934 if(builder) IUriBuilder_Release(builder);
8936 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
8937 uri_builder_remove_test test = uri_builder_remove_tests[i];
8941 uriW = a2w(test.uri);
8942 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8946 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8947 if(test.create_builder_todo) {
8949 ok(hr == test.create_builder_expected,
8950 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8951 hr, test.create_builder_expected, i);
8954 ok(hr == test.create_builder_expected,
8955 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8956 hr, test.create_builder_expected, i);
8959 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
8960 if(test.remove_todo) {
8962 ok(hr == test.remove_expected,
8963 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
8964 hr, test.remove_expected, i);
8967 ok(hr == test.remove_expected,
8968 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8969 hr, test.remove_expected, i);
8972 IUri *result = NULL;
8974 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
8975 if(test.expected_todo) {
8977 ok(hr == test.expected_hres,
8978 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
8979 hr, test.expected_hres, i);
8982 ok(hr == test.expected_hres,
8983 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
8984 hr, test.expected_hres, i);
8987 BSTR received = NULL;
8989 hr = IUri_GetAbsoluteUri(result, &received);
8990 ok(!strcmp_aw(test.expected_uri, received),
8991 "Error: Expected %s but got %s instead on test %d.\n",
8992 test.expected_uri, wine_dbgstr_w(received), i);
8993 SysFreeString(received);
8995 if(result) IUri_Release(result);
8998 if(builder) IUriBuilder_Release(builder);
9000 if(uri) IUri_Release(uri);
9005 static void test_IUriBuilder_Misc(void) {
9009 hr = pCreateUri(http_urlW, 0, 0, &uri);
9011 IUriBuilder *builder;
9013 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9014 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9019 hr = IUriBuilder_GetPort(builder, &has, &port);
9020 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9022 /* 'has' will be set to FALSE, even though uri had a port. */
9023 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9024 /* Still sets 'port' to 80. */
9025 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9028 if(builder) IUriBuilder_Release(builder);
9030 if(uri) IUri_Release(uri);
9033 static void test_CoInternetCombineIUri(void) {
9035 IUri *base, *relative, *result;
9039 hr = pCreateUri(http_urlW, 0, 0, &base);
9040 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9042 result = (void*) 0xdeadbeef;
9043 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9044 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9045 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9049 hr = pCreateUri(http_urlW, 0, 0, &relative);
9050 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9052 result = (void*) 0xdeadbeef;
9053 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9054 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9055 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9058 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9059 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9061 if(base) IUri_Release(base);
9062 if(relative) IUri_Release(relative);
9064 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9065 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9067 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9068 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9070 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9072 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9073 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9077 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9078 if(uri_combine_tests[i].todo) {
9080 ok(hr == uri_combine_tests[i].expected,
9081 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9082 hr, uri_combine_tests[i].expected, i);
9085 ok(hr == uri_combine_tests[i].expected,
9086 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9087 hr, uri_combine_tests[i]. expected, i);
9092 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9093 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9096 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9099 ok(hr == prop.expected,
9100 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9101 hr, prop.expected, i, j);
9104 ok(!strcmp_aw(prop.value, received) ||
9105 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9106 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9107 prop.value, wine_dbgstr_w(received), i, j);
9110 ok(hr == prop.expected,
9111 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9112 hr, prop.expected, i, j);
9113 ok(!strcmp_aw(prop.value, received) ||
9114 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9115 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9116 prop.value, wine_dbgstr_w(received), i, j);
9118 SysFreeString(received);
9121 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9122 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9125 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9128 ok(hr == prop.expected,
9129 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9130 hr, prop.expected, i, j);
9133 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9134 prop.value, received, i, j);
9137 ok(hr == prop.expected,
9138 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9139 hr, prop.expected, i, j);
9140 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9141 prop.value, received, i, j);
9145 if(result) IUri_Release(result);
9147 if(relative) IUri_Release(relative);
9148 heap_free(relativeW);
9150 if(base) IUri_Release(base);
9155 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9156 REFIID riid, void **ppv)
9158 ok(0, "unexpected call\n");
9159 return E_NOINTERFACE;
9162 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9167 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9172 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9173 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9174 DWORD *pcchResult, DWORD dwReserved)
9176 ok(0, "unexpected call %d\n", ParseAction);
9180 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9181 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9182 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9184 CHECK_EXPECT(CombineUrl);
9185 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9186 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9187 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9188 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9189 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9190 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9191 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9193 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9194 *pcchResult = lstrlenW(combine_resultW);
9199 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9200 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9202 ok(0, "unexpected call\n");
9206 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9207 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9208 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9210 ok(0, "unexpected call\n");
9214 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9215 InternetProtocolInfo_QueryInterface,
9216 InternetProtocolInfo_AddRef,
9217 InternetProtocolInfo_Release,
9218 InternetProtocolInfo_ParseUrl,
9219 InternetProtocolInfo_CombineUrl,
9220 InternetProtocolInfo_CompareUrl,
9221 InternetProtocolInfo_QueryInfo
9224 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9226 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9228 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9229 *ppv = &protocol_info;
9233 ok(0, "unexpected call\n");
9234 return E_NOINTERFACE;
9237 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9242 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9247 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9248 REFIID riid, void **ppv)
9250 ok(0, "unexpected call\n");
9254 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9256 ok(0, "unexpected call\n");
9260 static const IClassFactoryVtbl ClassFactoryVtbl = {
9261 ClassFactory_QueryInterface,
9262 ClassFactory_AddRef,
9263 ClassFactory_Release,
9264 ClassFactory_CreateInstance,
9265 ClassFactory_LockServer
9268 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9270 static void register_protocols(void)
9272 IInternetSession *session;
9275 hres = pCoInternetGetSession(0, &session, 0);
9276 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9280 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9281 winetestW, 0, NULL, 0);
9282 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9284 IInternetSession_Release(session);
9287 static void unregister_protocols(void) {
9288 IInternetSession *session;
9291 hr = pCoInternetGetSession(0, &session, 0);
9292 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9296 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9297 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9299 IInternetSession_Release(session);
9302 static void test_CoInternetCombineIUri_Pluggable(void) {
9306 hr = pCreateUri(combine_baseW, 0, 0, &base);
9307 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9309 IUri *relative = NULL;
9311 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9312 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9314 IUri *result = NULL;
9316 SET_EXPECT(CombineUrl);
9318 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9320 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9322 CHECK_CALLED(CombineUrl);
9325 BSTR received = NULL;
9326 hr = IUri_GetAbsoluteUri(result, &received);
9327 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9329 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9330 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9332 SysFreeString(received);
9334 if(result) IUri_Release(result);
9336 if(relative) IUri_Release(relative);
9338 if(base) IUri_Release(base);
9341 static void test_CoInternetCombineUrlEx(void) {
9343 IUri *base, *result;
9347 hr = pCreateUri(http_urlW, 0, 0, &base);
9348 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9350 result = (void*) 0xdeadbeef;
9351 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9352 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9354 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9357 result = (void*) 0xdeadbeef;
9358 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9359 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9361 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9363 result = (void*) 0xdeadbeef;
9364 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9365 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9367 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9369 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9370 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9372 if(base) IUri_Release(base);
9374 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9375 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9377 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9378 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9380 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9382 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9384 if(uri_combine_tests[i].todo) {
9386 ok(hr == uri_combine_tests[i].expected,
9387 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9388 hr, uri_combine_tests[i].expected, i);
9391 ok(hr == uri_combine_tests[i].expected,
9392 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9393 hr, uri_combine_tests[i]. expected, i);
9398 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9399 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9401 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9403 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9406 ok(hr == prop.expected,
9407 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9408 hr, prop.expected, i, j);
9411 ok(!strcmp_aw(value, received) ||
9412 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9413 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9414 value, wine_dbgstr_w(received), i, j);
9417 ok(hr == prop.expected,
9418 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9419 hr, prop.expected, i, j);
9420 ok(!strcmp_aw(value, received) ||
9421 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9422 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9423 value, wine_dbgstr_w(received), i, j);
9425 SysFreeString(received);
9428 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9429 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9432 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9435 ok(hr == prop.expected,
9436 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9437 hr, prop.expected, i, j);
9440 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9441 prop.value, received, i, j);
9444 ok(hr == prop.expected,
9445 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9446 hr, prop.expected, i, j);
9447 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9448 prop.value, received, i, j);
9452 if(result) IUri_Release(result);
9453 heap_free(relativeW);
9455 if(base) IUri_Release(base);
9460 static void test_CoInternetCombineUrlEx_Pluggable(void) {
9464 hr = pCreateUri(combine_baseW, 0, 0, &base);
9465 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9467 IUri *result = NULL;
9469 SET_EXPECT(CombineUrl);
9471 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9473 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9475 CHECK_CALLED(CombineUrl);
9478 BSTR received = NULL;
9479 hr = IUri_GetAbsoluteUri(result, &received);
9480 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9482 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9483 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9485 SysFreeString(received);
9487 if(result) IUri_Release(result);
9489 if(base) IUri_Release(base);
9492 static void test_CoInternetParseIUri_InvalidArgs(void) {
9498 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9499 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9501 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9503 hr = pCreateUri(http_urlW, 0, 0, &uri);
9504 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9509 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
9510 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9512 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9514 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
9515 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9519 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
9520 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
9522 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9525 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
9526 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9528 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9531 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
9532 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9534 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9537 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
9538 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9540 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9542 expected_len = lstrlenW(http_urlW);
9544 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9545 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
9546 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9547 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
9548 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
9549 expected_len, result);
9551 if(uri) IUri_Release(uri);
9554 static void test_CoInternetParseIUri(void) {
9557 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
9561 uri_parse_test test = uri_parse_tests[i];
9563 uriW = a2w(test.uri);
9564 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
9565 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
9567 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
9568 DWORD result_len = -1;
9570 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
9573 ok(hr == test.expected,
9574 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9575 hr, test.expected, i);
9578 ok(hr == test.expected,
9579 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9580 hr, test.expected, i);
9583 DWORD len = lstrlenA(test.property);
9584 ok(!strcmp_aw(test.property, result),
9585 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
9586 test.property, wine_dbgstr_w(result), i);
9587 ok(len == result_len,
9588 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
9589 len, result_len, i);
9592 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
9596 if(uri) IUri_Release(uri);
9604 hurlmon = GetModuleHandle("urlmon.dll");
9605 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
9606 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
9607 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
9608 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
9609 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
9610 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
9611 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
9614 win_skip("CreateUri is not present, skipping tests.\n");
9618 trace("test CreateUri invalid flags...\n");
9619 test_CreateUri_InvalidFlags();
9621 trace("test CreateUri invalid args...\n");
9622 test_CreateUri_InvalidArgs();
9624 trace("test CreateUri invalid URIs...\n");
9625 test_CreateUri_InvalidUri();
9627 trace("test IUri_GetPropertyBSTR...\n");
9628 test_IUri_GetPropertyBSTR();
9630 trace("test IUri_GetPropertyDWORD...\n");
9631 test_IUri_GetPropertyDWORD();
9633 trace("test IUri_GetStrProperties...\n");
9634 test_IUri_GetStrProperties();
9636 trace("test IUri_GetDwordProperties...\n");
9637 test_IUri_GetDwordProperties();
9639 trace("test IUri_GetPropertyLength...\n");
9640 test_IUri_GetPropertyLength();
9642 trace("test IUri_GetProperties...\n");
9643 test_IUri_GetProperties();
9645 trace("test IUri_HasProperty...\n");
9646 test_IUri_HasProperty();
9648 trace("test IUri_IsEqual...\n");
9649 test_IUri_IsEqual();
9651 trace("test CreateUriWithFragment invalid args...\n");
9652 test_CreateUriWithFragment_InvalidArgs();
9654 trace("test CreateUriWithFragment invalid flags...\n");
9655 test_CreateUriWithFragment_InvalidFlags();
9657 trace("test CreateUriWithFragment...\n");
9658 test_CreateUriWithFragment();
9660 trace("test CreateIUriBuilder...\n");
9661 test_CreateIUriBuilder();
9663 trace("test IUriBuilder_CreateInvalidArgs...\n");
9664 test_IUriBuilder_CreateInvalidArgs();
9666 trace("test IUriBuilder...\n");
9669 trace("test IUriBuilder_GetInvalidArgs...\n");
9670 test_IUriBuilder_GetInvalidArgs();
9672 trace("test IUriBuilder_HasBeenModified...\n");
9673 test_IUriBuilder_HasBeenModified();
9675 trace("test IUriBuilder_IUriProperty...\n");
9676 test_IUriBuilder_IUriProperty();
9678 trace("test IUriBuilder_RemoveProperties...\n");
9679 test_IUriBuilder_RemoveProperties();
9681 trace("test IUriBuilder miscellaneous...\n");
9682 test_IUriBuilder_Misc();
9684 trace("test CoInternetCombineIUri...\n");
9685 test_CoInternetCombineIUri();
9687 trace("test CoInternetCombineUrlEx...\n");
9688 test_CoInternetCombineUrlEx();
9690 trace("test CoInternetParseIUri Invalid Args...\n");
9691 test_CoInternetParseIUri_InvalidArgs();
9693 trace("test CoInternetParseIUri...\n");
9694 test_CoInternetParseIUri();
9696 register_protocols();
9698 trace("test CoInternetCombineIUri pluggable...\n");
9699 test_CoInternetCombineIUri_Pluggable();
9701 trace("test CoInternetCombineUrlEx Pluggable...\n");
9702 test_CoInternetCombineUrlEx_Pluggable();
9704 unregister_protocols();