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},
5946 /* PARSE_PATH_FROM_URL tests. */
5947 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
5948 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
5949 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
5950 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
5951 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
5953 /* PARSE_URL_FROM_PATH tests. */
5954 /* This function almost seems to useless (just returns the absolute uri). */
5955 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
5956 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
5957 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
5958 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
5959 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
5961 /* PARSE_SCHEMA tests. */
5962 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
5963 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
5965 /* PARSE_SITE tests. */
5966 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
5967 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
5968 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
5969 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
5971 /* PARSE_DOMAIN tests. */
5972 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
5973 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
5974 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
5975 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
5977 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
5978 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
5979 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
5980 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
5981 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
5984 static inline LPWSTR a2w(LPCSTR str) {
5988 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
5989 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
5990 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
5996 static inline BOOL heap_free(void* mem) {
5997 return HeapFree(GetProcessHeap(), 0, mem);
6000 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6001 LPWSTR strAW = a2w(strA);
6002 DWORD ret = lstrcmpW(strAW, strB);
6007 static inline ULONG get_refcnt(IUri *uri) {
6009 return IUri_Release(uri);
6012 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6017 valueW = a2w(prop->value);
6018 switch(prop->property) {
6019 case Uri_PROPERTY_FRAGMENT:
6020 hr = IUriBuilder_SetFragment(builder, valueW);
6023 ok(hr == prop->expected,
6024 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6025 hr, prop->expected, test_index);
6028 ok(hr == prop->expected,
6029 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6030 hr, prop->expected, test_index);
6033 case Uri_PROPERTY_HOST:
6034 hr = IUriBuilder_SetHost(builder, valueW);
6037 ok(hr == prop->expected,
6038 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6039 hr, prop->expected, test_index);
6042 ok(hr == prop->expected,
6043 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6044 hr, prop->expected, test_index);
6047 case Uri_PROPERTY_PASSWORD:
6048 hr = IUriBuilder_SetPassword(builder, valueW);
6051 ok(hr == prop->expected,
6052 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6053 hr, prop->expected, test_index);
6056 ok(hr == prop->expected,
6057 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6058 hr, prop->expected, test_index);
6061 case Uri_PROPERTY_PATH:
6062 hr = IUriBuilder_SetPath(builder, valueW);
6065 ok(hr == prop->expected,
6066 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6067 hr, prop->expected, test_index);
6070 ok(hr == prop->expected,
6071 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6072 hr, prop->expected, test_index);
6075 case Uri_PROPERTY_QUERY:
6076 hr = IUriBuilder_SetQuery(builder, valueW);
6079 ok(hr == prop->expected,
6080 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6081 hr, prop->expected, test_index);
6084 ok(hr == prop->expected,
6085 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6086 hr, prop->expected, test_index);
6089 case Uri_PROPERTY_SCHEME_NAME:
6090 hr = IUriBuilder_SetSchemeName(builder, valueW);
6093 ok(hr == prop->expected,
6094 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6095 hr, prop->expected, test_index);
6098 ok(hr == prop->expected,
6099 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6100 hr, prop->expected, test_index);
6103 case Uri_PROPERTY_USER_NAME:
6104 hr = IUriBuilder_SetUserName(builder, valueW);
6107 ok(hr == prop->expected,
6108 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6109 hr, prop->expected, test_index);
6112 ok(hr == prop->expected,
6113 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6114 hr, prop->expected, test_index);
6118 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6125 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6128 static void test_CreateUri_InvalidFlags(void) {
6131 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6133 IUri *uri = (void*) 0xdeadbeef;
6135 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6136 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6137 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6138 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6142 static void test_CreateUri_InvalidArgs(void) {
6144 IUri *uri = (void*) 0xdeadbeef;
6146 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6147 static const WCHAR emptyW[] = {0};
6149 hr = pCreateUri(http_urlW, 0, 0, NULL);
6150 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6152 hr = pCreateUri(NULL, 0, 0, &uri);
6153 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6154 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6156 uri = (void*) 0xdeadbeef;
6157 hr = pCreateUri(invalidW, 0, 0, &uri);
6158 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6159 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6161 uri = (void*) 0xdeadbeef;
6162 hr = pCreateUri(emptyW, 0, 0, &uri);
6163 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6164 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6167 static void test_CreateUri_InvalidUri(void) {
6170 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6171 invalid_uri test = invalid_uri_tests[i];
6176 uriW = a2w(test.uri);
6177 hr = pCreateUri(uriW, test.flags, 0, &uri);
6180 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6181 hr, E_INVALIDARG, i);
6184 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6185 hr, E_INVALIDARG, i);
6187 if(uri) IUri_Release(uri);
6193 static void test_IUri_GetPropertyBSTR(void) {
6198 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6199 hr = pCreateUri(http_urlW, 0, 0, &uri);
6200 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6202 BSTR received = NULL;
6204 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6205 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6207 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6208 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6209 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6210 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6211 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6212 SysFreeString(received);
6214 /* Make sure it handles the ZONE property correctly. */
6216 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6217 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6218 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6219 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6220 SysFreeString(received);
6222 if(uri) IUri_Release(uri);
6224 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6225 uri_properties test = uri_tests[i];
6229 uriW = a2w(test.uri);
6230 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6231 if(test.create_todo) {
6233 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6234 hr, test.create_expected, i);
6237 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6238 hr, test.create_expected, i);
6244 /* Checks all the string properties of the uri. */
6245 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6246 BSTR received = NULL;
6247 uri_str_property prop = test.str_props[j];
6249 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6252 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6253 hr, prop.expected, i, j);
6256 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6257 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6258 prop.value, wine_dbgstr_w(received), i, j);
6261 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6262 hr, prop.expected, i, j);
6263 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6264 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6265 prop.value, wine_dbgstr_w(received), i, j);
6268 SysFreeString(received);
6272 if(uri) IUri_Release(uri);
6278 static void test_IUri_GetPropertyDWORD(void) {
6283 hr = pCreateUri(http_urlW, 0, 0, &uri);
6284 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6286 DWORD received = 0xdeadbeef;
6288 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6289 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6291 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6292 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6293 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6295 if(uri) IUri_Release(uri);
6297 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6298 uri_properties test = uri_tests[i];
6302 uriW = a2w(test.uri);
6303 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6304 if(test.create_todo) {
6306 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6307 hr, test.create_expected, i);
6310 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6311 hr, test.create_expected, i);
6317 /* Checks all the DWORD properties of the uri. */
6318 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6320 uri_dword_property prop = test.dword_props[j];
6322 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6325 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6326 hr, prop.expected, i, j);
6329 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6330 prop.value, received, i, j);
6333 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6334 hr, prop.expected, i, j);
6335 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6336 prop.value, received, i, j);
6341 if(uri) IUri_Release(uri);
6347 /* Tests all the 'Get*' property functions which deal with strings. */
6348 static void test_IUri_GetStrProperties(void) {
6353 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6354 hr = pCreateUri(http_urlW, 0, 0, &uri);
6355 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6357 hr = IUri_GetAbsoluteUri(uri, NULL);
6358 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6360 hr = IUri_GetAuthority(uri, NULL);
6361 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6363 hr = IUri_GetDisplayUri(uri, NULL);
6364 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6366 hr = IUri_GetDomain(uri, NULL);
6367 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6369 hr = IUri_GetExtension(uri, NULL);
6370 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6372 hr = IUri_GetFragment(uri, NULL);
6373 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6375 hr = IUri_GetHost(uri, NULL);
6376 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6378 hr = IUri_GetPassword(uri, NULL);
6379 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6381 hr = IUri_GetPath(uri, NULL);
6382 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6384 hr = IUri_GetPathAndQuery(uri, NULL);
6385 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6387 hr = IUri_GetQuery(uri, NULL);
6388 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6390 hr = IUri_GetRawUri(uri, NULL);
6391 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6393 hr = IUri_GetSchemeName(uri, NULL);
6394 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6396 hr = IUri_GetUserInfo(uri, NULL);
6397 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6399 hr = IUri_GetUserName(uri, NULL);
6400 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6402 if(uri) IUri_Release(uri);
6404 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6405 uri_properties test = uri_tests[i];
6409 uriW = a2w(test.uri);
6410 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6411 if(test.create_todo) {
6413 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6414 hr, test.create_expected, i);
6417 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6418 hr, test.create_expected, i);
6422 uri_str_property prop;
6423 BSTR received = NULL;
6425 /* GetAbsoluteUri() tests. */
6426 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6427 hr = IUri_GetAbsoluteUri(uri, &received);
6430 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6431 hr, prop.expected, i);
6434 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6435 "Error: Expected %s but got %s on uri_tests[%d].\n",
6436 prop.value, wine_dbgstr_w(received), i);
6439 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6440 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_tests[%d].\n",
6443 prop.value, wine_dbgstr_w(received), i);
6445 SysFreeString(received);
6448 /* GetAuthority() tests. */
6449 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6450 hr = IUri_GetAuthority(uri, &received);
6453 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6454 hr, prop.expected, i);
6457 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6458 prop.value, wine_dbgstr_w(received), i);
6461 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6462 hr, prop.expected, i);
6463 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6464 prop.value, wine_dbgstr_w(received), i);
6466 SysFreeString(received);
6469 /* GetDisplayUri() tests. */
6470 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6471 hr = IUri_GetDisplayUri(uri, &received);
6474 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6475 hr, prop.expected, i);
6478 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6479 "Error: Expected %s but got %s on uri_test[%d].\n",
6480 prop.value, wine_dbgstr_w(received), i);
6483 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6484 hr, prop.expected, i);
6485 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6486 "Error: Expected %s but got %s on uri_tests[%d].\n",
6487 prop.value, wine_dbgstr_w(received), i);
6489 SysFreeString(received);
6492 /* GetDomain() tests. */
6493 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6494 hr = IUri_GetDomain(uri, &received);
6497 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6498 hr, prop.expected, i);
6501 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6502 prop.value, wine_dbgstr_w(received), i);
6505 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6506 hr, prop.expected, i);
6507 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6508 prop.value, wine_dbgstr_w(received), i);
6510 SysFreeString(received);
6513 /* GetExtension() tests. */
6514 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6515 hr = IUri_GetExtension(uri, &received);
6518 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6519 hr, prop.expected, i);
6522 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6523 prop.value, wine_dbgstr_w(received), i);
6526 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6527 hr, prop.expected, i);
6528 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6529 prop.value, wine_dbgstr_w(received), i);
6531 SysFreeString(received);
6534 /* GetFragment() tests. */
6535 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6536 hr = IUri_GetFragment(uri, &received);
6539 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6540 hr, prop.expected, i);
6543 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6544 prop.value, wine_dbgstr_w(received), i);
6547 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6548 hr, prop.expected, i);
6549 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6550 prop.value, wine_dbgstr_w(received), i);
6552 SysFreeString(received);
6555 /* GetHost() tests. */
6556 prop = test.str_props[Uri_PROPERTY_HOST];
6557 hr = IUri_GetHost(uri, &received);
6560 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6561 hr, prop.expected, i);
6564 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6565 prop.value, wine_dbgstr_w(received), i);
6568 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6569 hr, prop.expected, i);
6570 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6571 prop.value, wine_dbgstr_w(received), i);
6573 SysFreeString(received);
6576 /* GetPassword() tests. */
6577 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6578 hr = IUri_GetPassword(uri, &received);
6581 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6582 hr, prop.expected, i);
6585 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6586 prop.value, wine_dbgstr_w(received), i);
6589 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6590 hr, prop.expected, i);
6591 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6592 prop.value, wine_dbgstr_w(received), i);
6594 SysFreeString(received);
6597 /* GetPath() tests. */
6598 prop = test.str_props[Uri_PROPERTY_PATH];
6599 hr = IUri_GetPath(uri, &received);
6602 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6603 hr, prop.expected, i);
6606 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6607 prop.value, wine_dbgstr_w(received), i);
6610 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6611 hr, prop.expected, i);
6612 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6613 prop.value, wine_dbgstr_w(received), i);
6615 SysFreeString(received);
6618 /* GetPathAndQuery() tests. */
6619 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6620 hr = IUri_GetPathAndQuery(uri, &received);
6623 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6624 hr, prop.expected, i);
6627 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6628 prop.value, wine_dbgstr_w(received), i);
6631 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6632 hr, prop.expected, i);
6633 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6634 prop.value, wine_dbgstr_w(received), i);
6636 SysFreeString(received);
6639 /* GetQuery() tests. */
6640 prop = test.str_props[Uri_PROPERTY_QUERY];
6641 hr = IUri_GetQuery(uri, &received);
6644 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6645 hr, prop.expected, i);
6648 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6649 prop.value, wine_dbgstr_w(received), i);
6652 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6653 hr, prop.expected, i);
6654 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6655 prop.value, wine_dbgstr_w(received), i);
6657 SysFreeString(received);
6660 /* GetRawUri() tests. */
6661 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6662 hr = IUri_GetRawUri(uri, &received);
6665 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6666 hr, prop.expected, i);
6669 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6670 prop.value, wine_dbgstr_w(received), i);
6673 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6674 hr, prop.expected, i);
6675 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6676 prop.value, wine_dbgstr_w(received), i);
6678 SysFreeString(received);
6681 /* GetSchemeName() tests. */
6682 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
6683 hr = IUri_GetSchemeName(uri, &received);
6686 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6687 hr, prop.expected, i);
6690 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6691 prop.value, wine_dbgstr_w(received), i);
6694 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6695 hr, prop.expected, i);
6696 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6697 prop.value, wine_dbgstr_w(received), i);
6699 SysFreeString(received);
6702 /* GetUserInfo() tests. */
6703 prop = test.str_props[Uri_PROPERTY_USER_INFO];
6704 hr = IUri_GetUserInfo(uri, &received);
6707 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6708 hr, prop.expected, i);
6711 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6712 prop.value, wine_dbgstr_w(received), i);
6715 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6716 hr, prop.expected, i);
6717 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6718 prop.value, wine_dbgstr_w(received), i);
6720 SysFreeString(received);
6723 /* GetUserName() tests. */
6724 prop = test.str_props[Uri_PROPERTY_USER_NAME];
6725 hr = IUri_GetUserName(uri, &received);
6728 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6729 hr, prop.expected, i);
6732 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6733 prop.value, wine_dbgstr_w(received), i);
6736 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6737 hr, prop.expected, i);
6738 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6739 prop.value, wine_dbgstr_w(received), i);
6741 SysFreeString(received);
6744 if(uri) IUri_Release(uri);
6750 static void test_IUri_GetDwordProperties(void) {
6755 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
6756 hr = pCreateUri(http_urlW, 0, 0, &uri);
6757 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6759 hr = IUri_GetHostType(uri, NULL);
6760 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6762 hr = IUri_GetPort(uri, NULL);
6763 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6765 hr = IUri_GetScheme(uri, NULL);
6766 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6768 hr = IUri_GetZone(uri, NULL);
6769 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6771 if(uri) IUri_Release(uri);
6773 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6774 uri_properties test = uri_tests[i];
6778 uriW = a2w(test.uri);
6779 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6780 if(test.create_todo) {
6782 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6783 hr, test.create_expected, i);
6786 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6787 hr, test.create_expected, i);
6791 uri_dword_property prop;
6794 /* Assign an insane value so tests don't accidentally pass when
6797 received = -9999999;
6799 /* GetHostType() tests. */
6800 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
6801 hr = IUri_GetHostType(uri, &received);
6804 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6805 hr, prop.expected, i);
6808 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6811 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6812 hr, prop.expected, i);
6813 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6815 received = -9999999;
6817 /* GetPort() tests. */
6818 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
6819 hr = IUri_GetPort(uri, &received);
6822 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6823 hr, prop.expected, i);
6826 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6829 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6830 hr, prop.expected, i);
6831 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6833 received = -9999999;
6835 /* GetScheme() tests. */
6836 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
6837 hr = IUri_GetScheme(uri, &received);
6840 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6841 hr, prop.expected, i);
6844 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6847 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6848 hr, prop.expected, i);
6849 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6851 received = -9999999;
6853 /* GetZone() tests. */
6854 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
6855 hr = IUri_GetZone(uri, &received);
6858 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6859 hr, prop.expected, i);
6862 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6865 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6866 hr, prop.expected, i);
6867 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6871 if(uri) IUri_Release(uri);
6877 static void test_IUri_GetPropertyLength(void) {
6882 /* Make sure it handles invalid args correctly. */
6883 hr = pCreateUri(http_urlW, 0, 0, &uri);
6884 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6886 DWORD received = 0xdeadbeef;
6888 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
6889 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6891 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
6892 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6893 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
6895 if(uri) IUri_Release(uri);
6897 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6898 uri_properties test = uri_tests[i];
6902 uriW = a2w(test.uri);
6903 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6904 if(test.create_todo) {
6906 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6907 hr, test.create_expected, i);
6910 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
6911 hr, test.create_expected, i);
6917 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6918 DWORD expectedLen, brokenLen, receivedLen;
6919 uri_str_property prop = test.str_props[j];
6921 expectedLen = lstrlen(prop.value);
6922 brokenLen = lstrlen(prop.broken_value);
6924 /* This won't be necessary once GetPropertyLength is implemented. */
6927 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
6930 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6931 hr, prop.expected, i, j);
6934 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6935 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6936 expectedLen, receivedLen, i, j);
6939 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6940 hr, prop.expected, i, j);
6941 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6942 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6943 expectedLen, receivedLen, i, j);
6948 if(uri) IUri_Release(uri);
6954 static DWORD compute_expected_props(uri_properties *test)
6958 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
6959 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
6963 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
6964 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
6971 static void test_IUri_GetProperties(void) {
6976 hr = pCreateUri(http_urlW, 0, 0, &uri);
6977 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6979 hr = IUri_GetProperties(uri, NULL);
6980 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6982 if(uri) IUri_Release(uri);
6984 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6985 uri_properties test = uri_tests[i];
6989 uriW = a2w(test.uri);
6990 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6991 if(test.create_todo) {
6993 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6996 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7000 DWORD received = 0, expected_props;
7003 hr = IUri_GetProperties(uri, &received);
7004 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7006 expected_props = compute_expected_props(&test);
7008 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7009 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7010 if(expected_props & (1 << j))
7011 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7013 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7017 if(uri) IUri_Release(uri);
7023 static void test_IUri_HasProperty(void) {
7028 hr = pCreateUri(http_urlW, 0, 0, &uri);
7029 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7031 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7032 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7034 if(uri) IUri_Release(uri);
7036 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7037 uri_properties test = uri_tests[i];
7041 uriW = a2w(test.uri);
7043 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7044 if(test.create_todo) {
7046 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7049 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7053 DWORD expected_props, j;
7055 expected_props = compute_expected_props(&test);
7057 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7058 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7061 hr = IUri_HasProperty(uri, j, &received);
7062 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7065 if(expected_props & (1 << j)) {
7066 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7068 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7073 if(uri) IUri_Release(uri);
7079 static void test_IUri_IsEqual(void) {
7086 /* Make sure IsEqual handles invalid args correctly. */
7087 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7088 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7089 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7090 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7091 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7093 hrA = IUri_IsEqual(uriA, NULL, &equal);
7094 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7095 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7097 hrA = IUri_IsEqual(uriA, uriB, NULL);
7098 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7100 if(uriA) IUri_Release(uriA);
7101 if(uriB) IUri_Release(uriB);
7103 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7104 uri_equality test = equality_tests[i];
7105 LPWSTR uriA_W, uriB_W;
7109 uriA_W = a2w(test.a);
7110 uriB_W = a2w(test.b);
7112 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7113 if(test.create_todo_a) {
7115 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7119 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7123 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7124 if(test.create_todo_b) {
7126 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7130 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7134 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7137 hrA = IUri_IsEqual(uriA, uriB, &equal);
7140 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7144 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7147 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7148 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7151 if(uriA) IUri_Release(uriA);
7152 if(uriB) IUri_Release(uriB);
7159 static void test_CreateUriWithFragment_InvalidArgs(void) {
7161 IUri *uri = (void*) 0xdeadbeef;
7162 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7164 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7165 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7166 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7168 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7169 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7171 /* Original URI can't already contain a fragment component. */
7172 uri = (void*) 0xdeadbeef;
7173 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7174 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7175 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7178 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7179 static void test_CreateUriWithFragment_InvalidFlags(void) {
7182 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7184 IUri *uri = (void*) 0xdeadbeef;
7186 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7187 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7188 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7189 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7193 static void test_CreateUriWithFragment(void) {
7196 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7200 uri_with_fragment test = uri_fragment_tests[i];
7202 uriW = a2w(test.uri);
7203 fragW = a2w(test.fragment);
7205 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7206 if(test.expected_todo) {
7208 ok(hr == test.create_expected,
7209 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7210 hr, test.create_expected, i);
7213 ok(hr == test.create_expected,
7214 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7215 hr, test.create_expected, i);
7218 BSTR received = NULL;
7220 hr = IUri_GetAbsoluteUri(uri, &received);
7221 if(test.expected_todo) {
7224 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7228 ok(!strcmp_aw(test.expected_uri, received),
7229 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7230 test.expected_uri, wine_dbgstr_w(received), i);
7233 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7235 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7236 test.expected_uri, wine_dbgstr_w(received), i);
7239 SysFreeString(received);
7242 if(uri) IUri_Release(uri);
7247 static void test_CreateIUriBuilder(void) {
7249 IUriBuilder *builder = NULL;
7252 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7253 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7256 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7257 hr = pCreateUri(http_urlW, 0, 0, &uri);
7258 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7260 ULONG cur_count, orig_count;
7262 orig_count = get_refcnt(uri);
7263 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7264 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7265 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7267 cur_count = get_refcnt(uri);
7268 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7270 if(builder) IUriBuilder_Release(builder);
7271 cur_count = get_refcnt(uri);
7272 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7274 if(uri) IUri_Release(uri);
7277 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7282 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7283 if(test->uri_todo) {
7285 ok(hr == test->uri_hres,
7286 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7287 hr, test->uri_hres, test_index);
7290 ok(hr == test->uri_hres,
7291 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7292 hr, test->uri_hres, test_index);
7298 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7299 uri_builder_str_property prop = test->expected_str_props[i];
7300 BSTR received = NULL;
7302 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7305 ok(hr == prop.result,
7306 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7307 hr, prop.result, test_index, i);
7310 ok(hr == prop.result,
7311 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7312 hr, prop.result, test_index, i);
7317 ok(!strcmp_aw(prop.expected, received),
7318 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7319 prop.expected, wine_dbgstr_w(received), test_index, i);
7322 ok(!strcmp_aw(prop.expected, received),
7323 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7324 prop.expected, wine_dbgstr_w(received), test_index, i);
7327 SysFreeString(received);
7330 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7331 uri_builder_dword_property prop = test->expected_dword_props[i];
7332 DWORD received = -2;
7334 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7337 ok(hr == prop.result,
7338 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7339 hr, prop.result, test_index, i);
7342 ok(hr == prop.result,
7343 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7344 hr, prop.result, test_index, i);
7349 ok(received == prop.expected,
7350 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7351 prop.expected, received, test_index, i);
7354 ok(received == prop.expected,
7355 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7356 prop.expected, received, test_index, i);
7361 if(uri) IUri_Release(uri);
7364 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7369 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7370 if(test->uri_simple_todo) {
7372 ok(hr == test->uri_simple_hres,
7373 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7374 hr, test->uri_simple_hres, test_index);
7377 ok(hr == test->uri_simple_hres,
7378 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7379 hr, test->uri_simple_hres, test_index);
7385 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7386 uri_builder_str_property prop = test->expected_str_props[i];
7387 BSTR received = NULL;
7389 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7392 ok(hr == prop.result,
7393 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7394 hr, prop.result, test_index, i);
7397 ok(hr == prop.result,
7398 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7399 hr, prop.result, test_index, i);
7404 ok(!strcmp_aw(prop.expected, received),
7405 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7406 prop.expected, wine_dbgstr_w(received), test_index, i);
7409 ok(!strcmp_aw(prop.expected, received),
7410 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7411 prop.expected, wine_dbgstr_w(received), test_index, i);
7414 SysFreeString(received);
7417 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7418 uri_builder_dword_property prop = test->expected_dword_props[i];
7419 DWORD received = -2;
7421 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7424 ok(hr == prop.result,
7425 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7426 hr, prop.result, test_index, i);
7429 ok(hr == prop.result,
7430 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7431 hr, prop.result, test_index, i);
7436 ok(received == prop.expected,
7437 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7438 prop.expected, received, test_index, i);
7441 ok(received == prop.expected,
7442 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7443 prop.expected, received, test_index, i);
7448 if(uri) IUri_Release(uri);
7451 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7456 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7457 test->uri_with_encode_flags, 0, &uri);
7458 if(test->uri_with_todo) {
7460 ok(hr == test->uri_with_hres,
7461 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7462 hr, test->uri_with_hres, test_index);
7465 ok(hr == test->uri_with_hres,
7466 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7467 hr, test->uri_with_hres, test_index);
7473 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7474 uri_builder_str_property prop = test->expected_str_props[i];
7475 BSTR received = NULL;
7477 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7480 ok(hr == prop.result,
7481 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7482 hr, prop.result, test_index, i);
7485 ok(hr == prop.result,
7486 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7487 hr, prop.result, test_index, i);
7492 ok(!strcmp_aw(prop.expected, received),
7493 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7494 prop.expected, wine_dbgstr_w(received), test_index, i);
7497 ok(!strcmp_aw(prop.expected, received),
7498 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7499 prop.expected, wine_dbgstr_w(received), test_index, i);
7502 SysFreeString(received);
7505 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7506 uri_builder_dword_property prop = test->expected_dword_props[i];
7507 DWORD received = -2;
7509 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7512 ok(hr == prop.result,
7513 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7514 hr, prop.result, test_index, i);
7517 ok(hr == prop.result,
7518 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7519 hr, prop.result, test_index, i);
7524 ok(received == prop.expected,
7525 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7526 prop.expected, received, test_index, i);
7529 ok(received == prop.expected,
7530 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7531 prop.expected, received, test_index, i);
7536 if(uri) IUri_Release(uri);
7539 static void test_IUriBuilder_CreateInvalidArgs(void) {
7540 IUriBuilder *builder;
7543 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7544 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7546 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7548 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7549 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7550 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7552 uri = (void*) 0xdeadbeef;
7553 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7554 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7555 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7557 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7558 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7561 uri = (void*) 0xdeadbeef;
7562 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7563 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7565 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7567 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7568 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7571 uri = (void*) 0xdeadbeef;
7572 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7573 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7575 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7577 hr = pCreateUri(http_urlW, 0, 0, &test);
7578 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7580 hr = IUriBuilder_SetIUri(builder, test);
7581 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7583 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7585 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7586 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7587 ok(uri != NULL, "Error: The uri was NULL.\n");
7588 if(uri) IUri_Release(uri);
7591 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7592 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7594 ok(uri != NULL, "Error: uri was NULL.\n");
7595 if(uri) IUri_Release(uri);
7598 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7599 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7601 ok(uri != NULL, "Error: uri was NULL.\n");
7602 if(uri) IUri_Release(uri);
7604 hr = IUriBuilder_SetFragment(builder, NULL);
7605 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7607 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7608 uri = (void*) 0xdeadbeef;
7609 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7610 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7611 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7613 uri = (void*) 0xdeadbeef;
7614 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7615 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7617 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7619 uri = (void*) 0xdeadbeef;
7620 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7621 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7623 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7625 if(test) IUri_Release(test);
7627 if(builder) IUriBuilder_Release(builder);
7630 /* Tests invalid args to the "Get*" functions. */
7631 static void test_IUriBuilder_GetInvalidArgs(void) {
7632 IUriBuilder *builder = NULL;
7635 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7636 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7638 LPCWSTR received = (void*) 0xdeadbeef;
7639 DWORD len = -1, port = -1;
7642 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7643 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7645 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7646 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7648 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7649 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7650 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7652 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7654 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7655 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7657 received = (void*) 0xdeadbeef;
7658 hr = IUriBuilder_GetHost(builder, NULL, &received);
7659 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7661 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7663 hr = IUriBuilder_GetHost(builder, &len, NULL);
7664 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7666 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7668 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7669 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7671 received = (void*) 0xdeadbeef;
7672 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7673 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7675 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7677 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7678 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7680 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7682 hr = IUriBuilder_GetPath(builder, NULL, NULL);
7683 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7685 received = (void*) 0xdeadbeef;
7686 hr = IUriBuilder_GetPath(builder, NULL, &received);
7687 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7689 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7691 hr = IUriBuilder_GetPath(builder, &len, NULL);
7692 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7694 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7696 hr = IUriBuilder_GetPort(builder, NULL, NULL);
7697 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7699 hr = IUriBuilder_GetPort(builder, NULL, &port);
7700 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7702 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
7703 hr = IUriBuilder_GetPort(builder, &set, NULL);
7704 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7706 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
7708 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
7709 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7711 received = (void*) 0xdeadbeef;
7712 hr = IUriBuilder_GetQuery(builder, NULL, &received);
7713 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7715 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7717 hr = IUriBuilder_GetQuery(builder, &len, NULL);
7718 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7720 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7722 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
7723 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7725 received = (void*) 0xdeadbeef;
7726 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
7727 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7729 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7731 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
7732 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7734 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7736 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
7737 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7739 received = (void*) 0xdeadbeef;
7740 hr = IUriBuilder_GetUserName(builder, NULL, &received);
7741 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7743 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7745 hr = IUriBuilder_GetUserName(builder, &len, NULL);
7746 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7748 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7750 if(builder) IUriBuilder_Release(builder);
7753 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
7757 LPCWSTR received = NULL;
7759 const uri_builder_property *prop = NULL;
7761 /* Check if the property was set earlier. */
7762 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7763 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
7764 prop = &(test->properties[i]);
7768 /* Use expected_value unless it's NULL, then use value. */
7769 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7770 hr = IUriBuilder_GetFragment(builder, &len, &received);
7773 ok(hr == (expected ? S_OK : S_FALSE),
7774 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7775 hr, (expected ? S_OK : S_FALSE), test_index);
7779 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7780 expected, wine_dbgstr_w(received), test_index);
7783 ok(lstrlen(expected) == len,
7784 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7785 lstrlen(expected), len, test_index);
7789 ok(hr == (expected ? S_OK : S_FALSE),
7790 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7791 hr, (expected ? S_OK : S_FALSE), test_index);
7792 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7793 expected, wine_dbgstr_w(received), test_index);
7794 ok(lstrlen(expected) == len,
7795 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7796 lstrlen(expected), len, test_index);
7799 /* The property wasn't set earlier, so it should return whatever
7800 * the base IUri contains (if anything).
7803 hr = IUriBuilder_GetIUri(builder, &uri);
7805 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7806 hr, S_OK, test_index);
7809 received = (void*) 0xdeadbeef;
7812 hr = IUriBuilder_GetFragment(builder, &len, &received);
7814 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7815 hr, S_FALSE, test_index);
7817 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7819 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7820 received, test_index);
7823 BOOL has_prop = FALSE;
7824 BSTR expected = NULL;
7826 hr = IUri_GetFragment(uri, &expected);
7828 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7830 has_prop = hr == S_OK;
7832 hr = IUriBuilder_GetFragment(builder, &len, &received);
7835 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7836 hr, S_OK, test_index);
7838 ok(!lstrcmpW(expected, received),
7839 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7840 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7841 ok(lstrlenW(expected) == len,
7842 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7843 lstrlenW(expected), len, test_index);
7847 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7848 hr, S_FALSE, test_index);
7850 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7851 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7855 SysFreeString(expected);
7858 if(uri) IUri_Release(uri);
7862 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
7866 LPCWSTR received = NULL;
7868 const uri_builder_property *prop = NULL;
7870 /* Check if the property was set earlier. */
7871 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7872 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
7873 prop = &(test->properties[i]);
7877 /* Use expected_value unless it's NULL, then use value. */
7878 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7879 hr = IUriBuilder_GetHost(builder, &len, &received);
7882 ok(hr == (expected ? S_OK : S_FALSE),
7883 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7884 hr, (expected ? S_OK : S_FALSE), test_index);
7888 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7889 expected, wine_dbgstr_w(received), test_index);
7892 ok(lstrlen(expected) == len,
7893 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7894 lstrlen(expected), len, test_index);
7898 ok(hr == (expected ? S_OK : S_FALSE),
7899 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7900 hr, (expected ? S_OK : S_FALSE), test_index);
7901 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7902 expected, wine_dbgstr_w(received), test_index);
7903 ok(lstrlen(expected) == len,
7904 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7905 lstrlen(expected), len, test_index);
7908 /* The property wasn't set earlier, so it should return whatever
7909 * the base IUri contains (if anything).
7912 hr = IUriBuilder_GetIUri(builder, &uri);
7914 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7915 hr, S_OK, test_index);
7918 received = (void*) 0xdeadbeef;
7921 hr = IUriBuilder_GetHost(builder, &len, &received);
7923 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7924 hr, S_FALSE, test_index);
7926 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7928 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7929 received, test_index);
7932 BOOL has_prop = FALSE;
7933 BSTR expected = NULL;
7935 hr = IUri_GetHost(uri, &expected);
7937 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7939 has_prop = hr == S_OK;
7941 hr = IUriBuilder_GetHost(builder, &len, &received);
7944 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7945 hr, S_OK, test_index);
7947 ok(!lstrcmpW(expected, received),
7948 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7949 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7950 ok(lstrlenW(expected) == len,
7951 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7952 lstrlenW(expected), len, test_index);
7956 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7957 hr, S_FALSE, test_index);
7959 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7960 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7964 SysFreeString(expected);
7967 if(uri) IUri_Release(uri);
7971 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
7975 LPCWSTR received = NULL;
7977 const uri_builder_property *prop = NULL;
7979 /* Check if the property was set earlier. */
7980 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7981 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
7982 prop = &(test->properties[i]);
7986 /* Use expected_value unless it's NULL, then use value. */
7987 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7988 hr = IUriBuilder_GetPassword(builder, &len, &received);
7991 ok(hr == (expected ? S_OK : S_FALSE),
7992 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7993 hr, (expected ? S_OK : S_FALSE), test_index);
7997 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7998 expected, wine_dbgstr_w(received), test_index);
8001 ok(lstrlen(expected) == len,
8002 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8003 lstrlen(expected), len, test_index);
8007 ok(hr == (expected ? S_OK : S_FALSE),
8008 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8009 hr, (expected ? S_OK : S_FALSE), test_index);
8010 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8011 expected, wine_dbgstr_w(received), test_index);
8012 ok(lstrlen(expected) == len,
8013 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8014 lstrlen(expected), len, test_index);
8017 /* The property wasn't set earlier, so it should return whatever
8018 * the base IUri contains (if anything).
8021 hr = IUriBuilder_GetIUri(builder, &uri);
8023 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8024 hr, S_OK, test_index);
8027 received = (void*) 0xdeadbeef;
8030 hr = IUriBuilder_GetPassword(builder, &len, &received);
8032 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8033 hr, S_FALSE, test_index);
8035 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8037 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8038 received, test_index);
8041 BOOL has_prop = FALSE;
8042 BSTR expected = NULL;
8044 hr = IUri_GetPassword(uri, &expected);
8046 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8048 has_prop = hr == S_OK;
8050 hr = IUriBuilder_GetPassword(builder, &len, &received);
8053 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8054 hr, S_OK, test_index);
8056 ok(!lstrcmpW(expected, received),
8057 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8058 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8059 ok(lstrlenW(expected) == len,
8060 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8061 lstrlenW(expected), len, test_index);
8065 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8066 hr, S_FALSE, test_index);
8068 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8069 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8073 SysFreeString(expected);
8076 if(uri) IUri_Release(uri);
8080 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8084 LPCWSTR received = NULL;
8086 const uri_builder_property *prop = NULL;
8088 /* Check if the property was set earlier. */
8089 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8090 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8091 prop = &(test->properties[i]);
8095 /* Use expected_value unless it's NULL, then use value. */
8096 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8097 hr = IUriBuilder_GetPath(builder, &len, &received);
8100 ok(hr == (expected ? S_OK : S_FALSE),
8101 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8102 hr, (expected ? S_OK : S_FALSE), test_index);
8106 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8107 expected, wine_dbgstr_w(received), test_index);
8110 ok(lstrlen(expected) == len,
8111 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8112 lstrlen(expected), len, test_index);
8116 ok(hr == (expected ? S_OK : S_FALSE),
8117 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8118 hr, (expected ? S_OK : S_FALSE), test_index);
8119 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8120 expected, wine_dbgstr_w(received), test_index);
8121 ok(lstrlen(expected) == len,
8122 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8123 lstrlen(expected), len, test_index);
8126 /* The property wasn't set earlier, so it should return whatever
8127 * the base IUri contains (if anything).
8130 hr = IUriBuilder_GetIUri(builder, &uri);
8132 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8133 hr, S_OK, test_index);
8136 received = (void*) 0xdeadbeef;
8139 hr = IUriBuilder_GetPath(builder, &len, &received);
8141 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8142 hr, S_FALSE, test_index);
8144 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8146 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8147 received, test_index);
8150 BOOL has_prop = FALSE;
8151 BSTR expected = NULL;
8153 hr = IUri_GetPath(uri, &expected);
8155 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8157 has_prop = hr == S_OK;
8159 hr = IUriBuilder_GetPath(builder, &len, &received);
8162 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8163 hr, S_OK, test_index);
8165 ok(!lstrcmpW(expected, received),
8166 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8167 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8168 ok(lstrlenW(expected) == len,
8169 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8170 lstrlenW(expected), len, test_index);
8174 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8175 hr, S_FALSE, test_index);
8177 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8178 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8182 SysFreeString(expected);
8185 if(uri) IUri_Release(uri);
8189 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8192 BOOL has_port = FALSE;
8193 DWORD received = -1;
8195 if(test->port_prop.change) {
8196 DWORD expected = test->port_prop.value;
8198 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8199 if(test->port_prop.todo) {
8202 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8203 hr, S_OK, test_index);
8207 ok(has_port == test->port_prop.set,
8208 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8209 test->port_prop.set, has_port, test_index);
8212 ok(received == expected,
8213 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8214 expected, received, test_index);
8219 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8220 hr, S_OK, test_index);
8221 ok(has_port == test->port_prop.set,
8222 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8223 test->port_prop.set, has_port, test_index);
8224 ok(received == test->port_prop.value,
8225 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8226 test->port_prop.value, received, test_index);
8231 hr = IUriBuilder_GetIUri(builder, &uri);
8233 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8234 hr, S_OK, test_index);
8237 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8239 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8240 hr, S_OK, test_index);
8242 ok(has_port == FALSE,
8243 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8244 has_port, test_index);
8245 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8246 received, test_index);
8251 hr = IUri_GetPort(uri, &expected);
8253 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8256 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8258 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8259 hr, S_OK, test_index);
8262 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8264 ok(received == expected,
8265 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8266 expected, received, test_index);
8270 if(uri) IUri_Release(uri);
8274 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8278 LPCWSTR received = NULL;
8280 const uri_builder_property *prop = NULL;
8282 /* Check if the property was set earlier. */
8283 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8284 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8285 prop = &(test->properties[i]);
8289 /* Use expected_value unless it's NULL, then use value. */
8290 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8291 hr = IUriBuilder_GetQuery(builder, &len, &received);
8294 ok(hr == (expected ? S_OK : S_FALSE),
8295 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8296 hr, (expected ? S_OK : S_FALSE), test_index);
8300 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8301 expected, wine_dbgstr_w(received), test_index);
8304 ok(lstrlen(expected) == len,
8305 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8306 lstrlen(expected), len, test_index);
8310 ok(hr == (expected ? S_OK : S_FALSE),
8311 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8312 hr, (expected ? S_OK : S_FALSE), test_index);
8313 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8314 expected, wine_dbgstr_w(received), test_index);
8315 ok(lstrlen(expected) == len,
8316 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8317 lstrlen(expected), len, test_index);
8320 /* The property wasn't set earlier, so it should return whatever
8321 * the base IUri contains (if anything).
8324 hr = IUriBuilder_GetIUri(builder, &uri);
8326 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8327 hr, S_OK, test_index);
8330 received = (void*) 0xdeadbeef;
8333 hr = IUriBuilder_GetQuery(builder, &len, &received);
8335 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8336 hr, S_FALSE, test_index);
8338 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8340 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8341 received, test_index);
8344 BOOL has_prop = FALSE;
8345 BSTR expected = NULL;
8347 hr = IUri_GetQuery(uri, &expected);
8349 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8351 has_prop = hr == S_OK;
8353 hr = IUriBuilder_GetQuery(builder, &len, &received);
8356 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8357 hr, S_OK, test_index);
8359 ok(!lstrcmpW(expected, received),
8360 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8361 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8362 ok(lstrlenW(expected) == len,
8363 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8364 lstrlenW(expected), len, test_index);
8368 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8369 hr, S_FALSE, test_index);
8371 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8372 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8376 SysFreeString(expected);
8379 if(uri) IUri_Release(uri);
8383 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8387 LPCWSTR received = NULL;
8389 const uri_builder_property *prop = NULL;
8391 /* Check if the property was set earlier. */
8392 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8393 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8394 prop = &(test->properties[i]);
8398 /* Use expected_value unless it's NULL, then use value. */
8399 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8400 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8403 ok(hr == (expected ? S_OK : S_FALSE),
8404 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8405 hr, (expected ? S_OK : S_FALSE), test_index);
8409 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8410 expected, wine_dbgstr_w(received), test_index);
8413 ok(lstrlen(expected) == len,
8414 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8415 lstrlen(expected), len, test_index);
8419 ok(hr == (expected ? S_OK : S_FALSE),
8420 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8421 hr, (expected ? S_OK : S_FALSE), test_index);
8422 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8423 expected, wine_dbgstr_w(received), test_index);
8424 ok(lstrlen(expected) == len,
8425 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8426 lstrlen(expected), len, test_index);
8429 /* The property wasn't set earlier, so it should return whatever
8430 * the base IUri contains (if anything).
8433 hr = IUriBuilder_GetIUri(builder, &uri);
8435 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8436 hr, S_OK, test_index);
8439 received = (void*) 0xdeadbeef;
8442 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8444 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8445 hr, S_FALSE, test_index);
8447 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8449 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8450 received, test_index);
8453 BOOL has_prop = FALSE;
8454 BSTR expected = NULL;
8456 hr = IUri_GetSchemeName(uri, &expected);
8458 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8460 has_prop = hr == S_OK;
8462 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8465 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8466 hr, S_OK, test_index);
8468 ok(!lstrcmpW(expected, received),
8469 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8470 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8471 ok(lstrlenW(expected) == len,
8472 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8473 lstrlenW(expected), len, test_index);
8477 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8478 hr, S_FALSE, test_index);
8480 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8481 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8485 SysFreeString(expected);
8488 if(uri) IUri_Release(uri);
8492 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8496 LPCWSTR received = NULL;
8498 const uri_builder_property *prop = NULL;
8500 /* Check if the property was set earlier. */
8501 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8502 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8503 prop = &(test->properties[i]);
8506 if(prop && prop->value && *prop->value) {
8507 /* Use expected_value unless it's NULL, then use value. */
8508 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8509 hr = IUriBuilder_GetUserName(builder, &len, &received);
8512 ok(hr == (expected ? S_OK : S_FALSE),
8513 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8514 hr, (expected ? S_OK : S_FALSE), test_index);
8518 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8519 expected, wine_dbgstr_w(received), test_index);
8522 ok(lstrlen(expected) == len,
8523 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8524 lstrlen(expected), len, test_index);
8528 ok(hr == (expected ? S_OK : S_FALSE),
8529 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8530 hr, (expected ? S_OK : S_FALSE), test_index);
8531 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8532 expected, wine_dbgstr_w(received), test_index);
8533 ok(lstrlen(expected) == len,
8534 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8535 lstrlen(expected), len, test_index);
8538 /* The property wasn't set earlier, so it should return whatever
8539 * the base IUri contains (if anything).
8542 hr = IUriBuilder_GetIUri(builder, &uri);
8544 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8545 hr, S_OK, test_index);
8548 received = (void*) 0xdeadbeef;
8551 hr = IUriBuilder_GetUserName(builder, &len, &received);
8553 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8554 hr, S_FALSE, test_index);
8556 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8558 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8559 received, test_index);
8562 BSTR expected = NULL;
8563 BOOL has_prop = FALSE;
8565 hr = IUri_GetUserName(uri, &expected);
8567 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8569 has_prop = hr == S_OK;
8571 hr = IUriBuilder_GetUserName(builder, &len, &received);
8574 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8575 hr, S_OK, test_index);
8577 ok(!lstrcmpW(expected, received),
8578 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8579 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8580 ok(lstrlenW(expected) == len,
8581 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8582 lstrlenW(expected), len, test_index);
8586 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8587 hr, S_FALSE, test_index);
8589 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8590 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8594 SysFreeString(expected);
8597 if(uri) IUri_Release(uri);
8601 /* Tests IUriBuilder functions. */
8602 static void test_IUriBuilder(void) {
8604 IUriBuilder *builder;
8607 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8609 uri_builder_test test = uri_builder_tests[i];
8613 uriW = a2w(test.uri);
8614 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8615 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8617 if(FAILED(hr)) continue;
8619 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8620 if(test.create_builder_todo) {
8622 ok(hr == test.create_builder_expected,
8623 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8624 hr, test.create_builder_expected, i);
8627 ok(hr == test.create_builder_expected,
8628 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8629 hr, test.create_builder_expected, i);
8633 BOOL modified = FALSE, received = FALSE;
8635 /* Perform all the string property changes. */
8636 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8637 uri_builder_property prop = test.properties[j];
8639 change_property(builder, &prop, i);
8640 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8641 prop.property != Uri_PROPERTY_HOST)
8643 else if(prop.value && *prop.value)
8645 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8646 /* Host name property can't be NULL, but it can be empty. */
8651 if(test.port_prop.change) {
8652 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8654 if(test.port_prop.todo) {
8656 ok(hr == test.port_prop.expected,
8657 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8658 hr, test.port_prop.expected, i);
8661 ok(hr == test.port_prop.expected,
8662 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8663 hr, test.port_prop.expected, i);
8667 hr = IUriBuilder_HasBeenModified(builder, &received);
8669 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8672 ok(received == modified,
8673 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8674 modified, received, i);
8676 /* Test the "Get*" functions. */
8677 test_IUriBuilder_GetFragment(builder, &test, i);
8678 test_IUriBuilder_GetHost(builder, &test, i);
8679 test_IUriBuilder_GetPassword(builder, &test, i);
8680 test_IUriBuilder_GetPath(builder, &test, i);
8681 test_IUriBuilder_GetPort(builder, &test, i);
8682 test_IUriBuilder_GetQuery(builder, &test, i);
8683 test_IUriBuilder_GetSchemeName(builder, &test, i);
8684 test_IUriBuilder_GetUserName(builder, &test, i);
8686 test_IUriBuilder_CreateUri(builder, &test, i);
8687 test_IUriBuilder_CreateUriSimple(builder, &test, i);
8688 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
8690 if(builder) IUriBuilder_Release(builder);
8691 if(uri) IUri_Release(uri);
8696 static void test_IUriBuilder_HasBeenModified(void) {
8698 IUriBuilder *builder = NULL;
8700 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8701 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8703 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
8707 hr = IUriBuilder_HasBeenModified(builder, NULL);
8708 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8711 hr = IUriBuilder_SetHost(builder, hostW);
8712 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
8715 hr = IUriBuilder_HasBeenModified(builder, &received);
8716 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8719 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8721 hr = pCreateUri(http_urlW, 0, 0, &uri);
8722 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8727 hr = IUriBuilder_SetIUri(builder, uri);
8728 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
8731 hr = IUriBuilder_HasBeenModified(builder, &received);
8732 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8735 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
8737 /* Test what happens with you call SetIUri with the same IUri again. */
8738 hr = IUriBuilder_SetHost(builder, hostW);
8739 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8741 hr = IUriBuilder_HasBeenModified(builder, &received);
8742 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8745 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8747 hr = IUriBuilder_SetIUri(builder, uri);
8748 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8750 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
8751 * reset any of the changes that were made to the IUriBuilder.
8753 hr = IUriBuilder_HasBeenModified(builder, &received);
8754 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8756 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8758 hr = IUriBuilder_GetHost(builder, &len, &prop);
8759 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8761 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8762 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8763 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
8764 lstrlenW(hostW), len);
8767 hr = IUriBuilder_SetIUri(builder, NULL);
8768 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8770 hr = IUriBuilder_SetHost(builder, hostW);
8771 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8772 hr = IUriBuilder_HasBeenModified(builder, &received);
8773 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8776 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8778 hr = IUriBuilder_SetIUri(builder, NULL);
8779 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
8781 hr = IUriBuilder_HasBeenModified(builder, &received);
8782 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8785 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8787 hr = IUriBuilder_GetHost(builder, &len, &prop);
8788 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8790 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8791 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8792 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
8793 lstrlenW(hostW), len);
8796 if(uri) IUri_Release(uri);
8798 if(builder) IUriBuilder_Release(builder);
8801 /* Test IUriBuilder {Get,Set}IUri functions. */
8802 static void test_IUriBuilder_IUriProperty(void) {
8803 IUriBuilder *builder = NULL;
8806 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8807 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8811 hr = IUriBuilder_GetIUri(builder, NULL);
8812 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
8815 hr = pCreateUri(http_urlW, 0, 0, &uri);
8818 ULONG cur_count, orig_count;
8820 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
8821 orig_count = get_refcnt(uri);
8822 hr = IUriBuilder_SetIUri(builder, uri);
8823 cur_count = get_refcnt(uri);
8825 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8826 orig_count+1, cur_count);
8828 hr = IUriBuilder_SetIUri(builder, NULL);
8829 cur_count = get_refcnt(uri);
8831 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8832 orig_count, cur_count);
8834 /* CreateUri* functions will return back the same IUri if nothing has changed. */
8835 hr = IUriBuilder_SetIUri(builder, uri);
8836 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8837 orig_count = get_refcnt(uri);
8839 hr = IUriBuilder_CreateUri(builder, 0, 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",
8848 if(test) IUri_Release(test);
8851 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
8852 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8854 cur_count = get_refcnt(uri);
8855 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8856 orig_count+1, cur_count);
8857 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8859 if(test) IUri_Release(test);
8861 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8865 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
8866 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8868 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8870 if(test) IUri_Release(test);
8872 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8873 * explicitly set (because it's a default flags).
8876 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
8877 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8879 cur_count = get_refcnt(uri);
8880 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8881 orig_count+1, cur_count);
8882 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8884 if(test) IUri_Release(test);
8887 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
8888 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple 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);
8898 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
8899 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8902 cur_count = get_refcnt(uri);
8903 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8904 orig_count+1, cur_count);
8905 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8907 if(test) IUri_Release(test);
8909 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8913 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
8914 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8916 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8918 if(test) IUri_Release(test);
8920 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8921 * explicitly set (because it's a default flags).
8924 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
8925 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8927 cur_count = get_refcnt(uri);
8928 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8929 orig_count+1, cur_count);
8930 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8932 if(test) IUri_Release(test);
8934 if(uri) IUri_Release(uri);
8936 if(builder) IUriBuilder_Release(builder);
8939 static void test_IUriBuilder_RemoveProperties(void) {
8940 IUriBuilder *builder = NULL;
8944 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8945 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8947 /* Properties that can't be removed. */
8948 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
8949 Uri_HAS_SCHEME|Uri_HAS_ZONE;
8951 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
8952 hr = IUriBuilder_RemoveProperties(builder, i << 1);
8953 if((i << 1) & invalid) {
8954 ok(hr == E_INVALIDARG,
8955 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8956 hr, E_INVALIDARG, i);
8959 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8964 /* Also doesn't accept anything that's outside the range of the
8967 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
8968 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
8971 if(builder) IUriBuilder_Release(builder);
8973 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
8974 uri_builder_remove_test test = uri_builder_remove_tests[i];
8978 uriW = a2w(test.uri);
8979 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8983 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8984 if(test.create_builder_todo) {
8986 ok(hr == test.create_builder_expected,
8987 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8988 hr, test.create_builder_expected, i);
8991 ok(hr == test.create_builder_expected,
8992 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8993 hr, test.create_builder_expected, i);
8996 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
8997 if(test.remove_todo) {
8999 ok(hr == test.remove_expected,
9000 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9001 hr, test.remove_expected, i);
9004 ok(hr == test.remove_expected,
9005 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9006 hr, test.remove_expected, i);
9009 IUri *result = NULL;
9011 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9012 if(test.expected_todo) {
9014 ok(hr == test.expected_hres,
9015 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9016 hr, test.expected_hres, i);
9019 ok(hr == test.expected_hres,
9020 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9021 hr, test.expected_hres, i);
9024 BSTR received = NULL;
9026 hr = IUri_GetAbsoluteUri(result, &received);
9027 ok(!strcmp_aw(test.expected_uri, received),
9028 "Error: Expected %s but got %s instead on test %d.\n",
9029 test.expected_uri, wine_dbgstr_w(received), i);
9030 SysFreeString(received);
9032 if(result) IUri_Release(result);
9035 if(builder) IUriBuilder_Release(builder);
9037 if(uri) IUri_Release(uri);
9042 static void test_IUriBuilder_Misc(void) {
9046 hr = pCreateUri(http_urlW, 0, 0, &uri);
9048 IUriBuilder *builder;
9050 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9051 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9056 hr = IUriBuilder_GetPort(builder, &has, &port);
9057 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9059 /* 'has' will be set to FALSE, even though uri had a port. */
9060 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9061 /* Still sets 'port' to 80. */
9062 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9065 if(builder) IUriBuilder_Release(builder);
9067 if(uri) IUri_Release(uri);
9070 static void test_CoInternetCombineIUri(void) {
9072 IUri *base, *relative, *result;
9076 hr = pCreateUri(http_urlW, 0, 0, &base);
9077 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9079 result = (void*) 0xdeadbeef;
9080 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9081 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9082 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9086 hr = pCreateUri(http_urlW, 0, 0, &relative);
9087 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9089 result = (void*) 0xdeadbeef;
9090 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9091 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9092 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9095 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9096 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9098 if(base) IUri_Release(base);
9099 if(relative) IUri_Release(relative);
9101 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9102 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9104 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9105 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9107 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9109 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9110 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9114 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9115 if(uri_combine_tests[i].todo) {
9117 ok(hr == uri_combine_tests[i].expected,
9118 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9119 hr, uri_combine_tests[i].expected, i);
9122 ok(hr == uri_combine_tests[i].expected,
9123 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9124 hr, uri_combine_tests[i]. expected, i);
9129 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9130 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9133 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9136 ok(hr == prop.expected,
9137 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9138 hr, prop.expected, i, j);
9141 ok(!strcmp_aw(prop.value, received) ||
9142 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9143 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9144 prop.value, wine_dbgstr_w(received), i, j);
9147 ok(hr == prop.expected,
9148 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9149 hr, prop.expected, i, j);
9150 ok(!strcmp_aw(prop.value, received) ||
9151 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9152 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9153 prop.value, wine_dbgstr_w(received), i, j);
9155 SysFreeString(received);
9158 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9159 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9162 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9165 ok(hr == prop.expected,
9166 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9167 hr, prop.expected, i, j);
9170 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9171 prop.value, received, i, j);
9174 ok(hr == prop.expected,
9175 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9176 hr, prop.expected, i, j);
9177 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9178 prop.value, received, i, j);
9182 if(result) IUri_Release(result);
9184 if(relative) IUri_Release(relative);
9185 heap_free(relativeW);
9187 if(base) IUri_Release(base);
9192 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9193 REFIID riid, void **ppv)
9195 ok(0, "unexpected call\n");
9196 return E_NOINTERFACE;
9199 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9204 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9209 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9210 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9211 DWORD *pcchResult, DWORD dwReserved)
9213 ok(0, "unexpected call %d\n", ParseAction);
9217 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9218 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9219 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9221 CHECK_EXPECT(CombineUrl);
9222 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9223 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9224 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9225 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9226 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9227 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9228 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9230 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9231 *pcchResult = lstrlenW(combine_resultW);
9236 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9237 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9239 ok(0, "unexpected call\n");
9243 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9244 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9245 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9247 ok(0, "unexpected call\n");
9251 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9252 InternetProtocolInfo_QueryInterface,
9253 InternetProtocolInfo_AddRef,
9254 InternetProtocolInfo_Release,
9255 InternetProtocolInfo_ParseUrl,
9256 InternetProtocolInfo_CombineUrl,
9257 InternetProtocolInfo_CompareUrl,
9258 InternetProtocolInfo_QueryInfo
9261 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9263 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9265 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9266 *ppv = &protocol_info;
9270 ok(0, "unexpected call\n");
9271 return E_NOINTERFACE;
9274 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9279 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9284 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9285 REFIID riid, void **ppv)
9287 ok(0, "unexpected call\n");
9291 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9293 ok(0, "unexpected call\n");
9297 static const IClassFactoryVtbl ClassFactoryVtbl = {
9298 ClassFactory_QueryInterface,
9299 ClassFactory_AddRef,
9300 ClassFactory_Release,
9301 ClassFactory_CreateInstance,
9302 ClassFactory_LockServer
9305 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9307 static void register_protocols(void)
9309 IInternetSession *session;
9312 hres = pCoInternetGetSession(0, &session, 0);
9313 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9317 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9318 winetestW, 0, NULL, 0);
9319 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9321 IInternetSession_Release(session);
9324 static void unregister_protocols(void) {
9325 IInternetSession *session;
9328 hr = pCoInternetGetSession(0, &session, 0);
9329 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9333 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9334 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9336 IInternetSession_Release(session);
9339 static void test_CoInternetCombineIUri_Pluggable(void) {
9343 hr = pCreateUri(combine_baseW, 0, 0, &base);
9344 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9346 IUri *relative = NULL;
9348 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9349 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9351 IUri *result = NULL;
9353 SET_EXPECT(CombineUrl);
9355 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9357 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9359 CHECK_CALLED(CombineUrl);
9362 BSTR received = NULL;
9363 hr = IUri_GetAbsoluteUri(result, &received);
9364 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9366 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9367 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9369 SysFreeString(received);
9371 if(result) IUri_Release(result);
9373 if(relative) IUri_Release(relative);
9375 if(base) IUri_Release(base);
9378 static void test_CoInternetCombineUrlEx(void) {
9380 IUri *base, *result;
9384 hr = pCreateUri(http_urlW, 0, 0, &base);
9385 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9387 result = (void*) 0xdeadbeef;
9388 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9389 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9391 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9394 result = (void*) 0xdeadbeef;
9395 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9396 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9398 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9400 result = (void*) 0xdeadbeef;
9401 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9402 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9404 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9406 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9407 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9409 if(base) IUri_Release(base);
9411 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9412 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9414 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9415 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9417 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9419 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9421 if(uri_combine_tests[i].todo) {
9423 ok(hr == uri_combine_tests[i].expected,
9424 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9425 hr, uri_combine_tests[i].expected, i);
9428 ok(hr == uri_combine_tests[i].expected,
9429 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9430 hr, uri_combine_tests[i]. expected, i);
9435 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9436 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9438 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9440 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9443 ok(hr == prop.expected,
9444 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9445 hr, prop.expected, i, j);
9448 ok(!strcmp_aw(value, received) ||
9449 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9450 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9451 value, wine_dbgstr_w(received), i, j);
9454 ok(hr == prop.expected,
9455 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9456 hr, prop.expected, i, j);
9457 ok(!strcmp_aw(value, received) ||
9458 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9459 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9460 value, wine_dbgstr_w(received), i, j);
9462 SysFreeString(received);
9465 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9466 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9469 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9472 ok(hr == prop.expected,
9473 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9474 hr, prop.expected, i, j);
9477 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9478 prop.value, received, i, j);
9481 ok(hr == prop.expected,
9482 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9483 hr, prop.expected, i, j);
9484 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9485 prop.value, received, i, j);
9489 if(result) IUri_Release(result);
9490 heap_free(relativeW);
9492 if(base) IUri_Release(base);
9497 static void test_CoInternetCombineUrlEx_Pluggable(void) {
9501 hr = pCreateUri(combine_baseW, 0, 0, &base);
9502 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9504 IUri *result = NULL;
9506 SET_EXPECT(CombineUrl);
9508 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9510 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9512 CHECK_CALLED(CombineUrl);
9515 BSTR received = NULL;
9516 hr = IUri_GetAbsoluteUri(result, &received);
9517 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9519 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9520 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9522 SysFreeString(received);
9524 if(result) IUri_Release(result);
9526 if(base) IUri_Release(base);
9529 static void test_CoInternetParseIUri_InvalidArgs(void) {
9535 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9536 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9538 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9540 hr = pCreateUri(http_urlW, 0, 0, &uri);
9541 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9546 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
9547 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9549 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9551 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
9552 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9556 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
9557 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
9559 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9562 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
9563 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9565 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9568 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
9569 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9571 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9574 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
9575 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9577 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9579 expected_len = lstrlenW(http_urlW);
9581 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9582 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
9583 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9584 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
9585 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
9586 expected_len, result);
9588 if(uri) IUri_Release(uri);
9591 static void test_CoInternetParseIUri(void) {
9594 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
9598 uri_parse_test test = uri_parse_tests[i];
9600 uriW = a2w(test.uri);
9601 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
9602 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
9604 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
9605 DWORD result_len = -1;
9607 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
9610 ok(hr == test.expected,
9611 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9612 hr, test.expected, i);
9615 ok(hr == test.expected,
9616 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9617 hr, test.expected, i);
9620 DWORD len = lstrlenA(test.property);
9621 ok(!strcmp_aw(test.property, result),
9622 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
9623 test.property, wine_dbgstr_w(result), i);
9624 ok(len == result_len,
9625 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
9626 len, result_len, i);
9629 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
9633 if(uri) IUri_Release(uri);
9641 hurlmon = GetModuleHandle("urlmon.dll");
9642 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
9643 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
9644 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
9645 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
9646 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
9647 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
9648 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
9651 win_skip("CreateUri is not present, skipping tests.\n");
9655 trace("test CreateUri invalid flags...\n");
9656 test_CreateUri_InvalidFlags();
9658 trace("test CreateUri invalid args...\n");
9659 test_CreateUri_InvalidArgs();
9661 trace("test CreateUri invalid URIs...\n");
9662 test_CreateUri_InvalidUri();
9664 trace("test IUri_GetPropertyBSTR...\n");
9665 test_IUri_GetPropertyBSTR();
9667 trace("test IUri_GetPropertyDWORD...\n");
9668 test_IUri_GetPropertyDWORD();
9670 trace("test IUri_GetStrProperties...\n");
9671 test_IUri_GetStrProperties();
9673 trace("test IUri_GetDwordProperties...\n");
9674 test_IUri_GetDwordProperties();
9676 trace("test IUri_GetPropertyLength...\n");
9677 test_IUri_GetPropertyLength();
9679 trace("test IUri_GetProperties...\n");
9680 test_IUri_GetProperties();
9682 trace("test IUri_HasProperty...\n");
9683 test_IUri_HasProperty();
9685 trace("test IUri_IsEqual...\n");
9686 test_IUri_IsEqual();
9688 trace("test CreateUriWithFragment invalid args...\n");
9689 test_CreateUriWithFragment_InvalidArgs();
9691 trace("test CreateUriWithFragment invalid flags...\n");
9692 test_CreateUriWithFragment_InvalidFlags();
9694 trace("test CreateUriWithFragment...\n");
9695 test_CreateUriWithFragment();
9697 trace("test CreateIUriBuilder...\n");
9698 test_CreateIUriBuilder();
9700 trace("test IUriBuilder_CreateInvalidArgs...\n");
9701 test_IUriBuilder_CreateInvalidArgs();
9703 trace("test IUriBuilder...\n");
9706 trace("test IUriBuilder_GetInvalidArgs...\n");
9707 test_IUriBuilder_GetInvalidArgs();
9709 trace("test IUriBuilder_HasBeenModified...\n");
9710 test_IUriBuilder_HasBeenModified();
9712 trace("test IUriBuilder_IUriProperty...\n");
9713 test_IUriBuilder_IUriProperty();
9715 trace("test IUriBuilder_RemoveProperties...\n");
9716 test_IUriBuilder_RemoveProperties();
9718 trace("test IUriBuilder miscellaneous...\n");
9719 test_IUriBuilder_Misc();
9721 trace("test CoInternetCombineIUri...\n");
9722 test_CoInternetCombineIUri();
9724 trace("test CoInternetCombineUrlEx...\n");
9725 test_CoInternetCombineUrlEx();
9727 trace("test CoInternetParseIUri Invalid Args...\n");
9728 test_CoInternetParseIUri_InvalidArgs();
9730 trace("test CoInternetParseIUri...\n");
9731 test_CoInternetParseIUri();
9733 register_protocols();
9735 trace("test CoInternetCombineIUri pluggable...\n");
9736 test_CoInternetCombineIUri_Pluggable();
9738 trace("test CoInternetCombineUrlEx Pluggable...\n");
9739 test_CoInternetCombineUrlEx_Pluggable();
9741 unregister_protocols();