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);
65 DEFINE_EXPECT(ParseUrl);
67 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
68 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
69 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
70 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
71 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
72 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
73 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
75 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
76 '.','o','r','g','/',0};
77 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
78 '.','o','r','g','/','#','F','r','a','g',0};
80 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
81 'e','s','t','i','n','g',0};
82 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
83 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
85 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
87 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
88 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
90 static PARSEACTION parse_action;
91 static DWORD parse_flags;
93 typedef struct _uri_create_flag_test {
96 } uri_create_flag_test;
98 static const uri_create_flag_test invalid_flag_tests[] = {
99 /* Set of invalid flag combinations to test for. */
100 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
101 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
102 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
103 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
104 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
107 typedef struct _uri_str_property {
111 const char* broken_value;
114 typedef struct _uri_dword_property {
118 } uri_dword_property;
120 typedef struct _uri_properties {
123 HRESULT create_expected;
126 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
127 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
130 static const uri_properties uri_tests[] = {
131 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
133 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
134 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
135 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
136 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
137 {"",S_FALSE,FALSE}, /* EXTENSION */
138 {"",S_FALSE,FALSE}, /* FRAGMENT */
139 {"www.winehq.org",S_OK,FALSE}, /* HOST */
140 {"",S_FALSE,FALSE}, /* PASSWORD */
141 {"/",S_OK,FALSE}, /* PATH */
142 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
143 {"",S_FALSE,FALSE}, /* QUERY */
144 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
145 {"http",S_OK,FALSE}, /* SCHEME_NAME */
146 {"",S_FALSE,FALSE}, /* USER_INFO */
147 {"",S_FALSE,FALSE} /* USER_NAME */
150 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
151 {80,S_OK,FALSE}, /* PORT */
152 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
153 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
156 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
158 {"http://winehq.org/tests",S_OK,FALSE},
159 {"winehq.org",S_OK,FALSE},
160 {"http://winehq.org/tests",S_OK,FALSE},
161 {"winehq.org",S_OK,FALSE},
164 {"winehq.org",S_OK,FALSE},
166 {"/tests",S_OK,FALSE},
167 {"/tests",S_OK,FALSE},
169 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
175 {Uri_HOST_DNS,S_OK,FALSE},
177 {URL_SCHEME_HTTP,S_OK,FALSE},
178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
181 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
183 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
184 {"www.winehq.org",S_OK,FALSE},
185 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
186 {"winehq.org",S_OK,FALSE},
189 {"www.winehq.org",S_OK,FALSE},
192 {"/?query=x&return=y",S_OK,FALSE},
193 {"?query=x&return=y",S_OK,FALSE},
194 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
200 {Uri_HOST_DNS,S_OK,FALSE},
202 {URL_SCHEME_HTTP,S_OK,FALSE},
203 {URLZONE_INVALID,E_NOTIMPL,FALSE},
206 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
208 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
209 {"usEr%3Ainfo@example.com",S_OK,FALSE},
210 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
211 {"example.com",S_OK,FALSE},
214 {"example.com",S_OK,FALSE},
216 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
217 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
219 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
221 {"usEr%3Ainfo",S_OK,FALSE},
222 {"usEr%3Ainfo",S_OK,FALSE}
225 {Uri_HOST_DNS,S_OK,FALSE},
227 {URL_SCHEME_HTTP,S_OK,FALSE},
228 {URLZONE_INVALID,E_NOTIMPL,FALSE},
231 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
233 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
234 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
235 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
236 {"winehq.org",S_OK,FALSE},
239 {"ftp.winehq.org",S_OK,FALSE},
241 {"/dir/foo%20bar.txt",S_OK,FALSE},
242 {"/dir/foo%20bar.txt",S_OK,FALSE},
244 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
246 {"winepass:wine",S_OK,FALSE},
247 {"winepass",S_OK,FALSE}
250 {Uri_HOST_DNS,S_OK,FALSE},
252 {URL_SCHEME_FTP,S_OK,FALSE},
253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
256 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
258 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
260 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
266 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
267 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
269 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
275 {Uri_HOST_UNKNOWN,S_OK,FALSE},
277 {URL_SCHEME_FILE,S_OK,FALSE},
278 {URLZONE_INVALID,E_NOTIMPL,FALSE}
281 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
283 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
285 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
291 {"/tests/test%20file.README.txt",S_OK,FALSE},
292 {"/tests/test%20file.README.txt",S_OK,FALSE},
294 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
300 {Uri_HOST_UNKNOWN,S_OK,FALSE},
302 {URL_SCHEME_FILE,S_OK,FALSE},
303 {URLZONE_INVALID,E_NOTIMPL,FALSE}
306 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
308 {"urn:nothing:should:happen here",S_OK,FALSE},
310 {"urn:nothing:should:happen here",S_OK,FALSE},
316 {"nothing:should:happen here",S_OK,FALSE},
317 {"nothing:should:happen here",S_OK,FALSE},
319 {"urn:nothing:should:happen here",S_OK,FALSE},
325 {Uri_HOST_UNKNOWN,S_OK,FALSE},
327 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
328 {URLZONE_INVALID,E_NOTIMPL,FALSE}
331 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
333 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
334 {"127.0.0.1",S_OK,FALSE},
335 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
339 {"127.0.0.1",S_OK,FALSE},
341 {"/test%20dir/test.txt",S_OK,FALSE},
342 {"/test%20dir/test.txt",S_OK,FALSE},
344 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
350 {Uri_HOST_IPV4,S_OK,FALSE},
352 {URL_SCHEME_HTTP,S_OK,FALSE},
353 {URLZONE_INVALID,E_NOTIMPL,FALSE}
356 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
358 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
359 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
360 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
364 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
369 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
375 {Uri_HOST_IPV6,S_OK,FALSE},
377 {URL_SCHEME_HTTP,S_OK,FALSE},
378 {URLZONE_INVALID,E_NOTIMPL,FALSE}
381 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
383 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
384 {"[::13.1.68.3]",S_OK,FALSE},
385 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
389 {"::13.1.68.3",S_OK,FALSE},
394 {"ftp://[::13.1.68.3]",S_OK,FALSE},
400 {Uri_HOST_IPV6,S_OK,FALSE},
402 {URL_SCHEME_FTP,S_OK,FALSE},
403 {URLZONE_INVALID,E_NOTIMPL,FALSE}
406 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
408 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
409 {"[fedc:ba98::3210]",S_OK,FALSE},
410 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
414 {"fedc:ba98::3210",S_OK,FALSE},
419 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
425 {Uri_HOST_IPV6,S_OK,FALSE},
427 {URL_SCHEME_HTTP,S_OK,FALSE},
428 {URLZONE_INVALID,E_NOTIMPL,FALSE}
431 { "1234://www.winehq.org", 0, S_OK, FALSE,
433 {"1234://www.winehq.org/",S_OK,FALSE},
434 {"www.winehq.org",S_OK,FALSE},
435 {"1234://www.winehq.org/",S_OK,FALSE},
436 {"winehq.org",S_OK,FALSE},
439 {"www.winehq.org",S_OK,FALSE},
444 {"1234://www.winehq.org",S_OK,FALSE},
450 {Uri_HOST_DNS,S_OK,FALSE},
452 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
453 {URLZONE_INVALID,E_NOTIMPL,FALSE}
456 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
457 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
459 {"file:///C:/test/test.mp3",S_OK,FALSE},
461 {"file:///C:/test/test.mp3",S_OK,FALSE},
467 {"/C:/test/test.mp3",S_OK,FALSE},
468 {"/C:/test/test.mp3",S_OK,FALSE},
470 {"C:/test/test.mp3",S_OK,FALSE},
476 {Uri_HOST_UNKNOWN,S_OK,FALSE},
478 {URL_SCHEME_FILE,S_OK,FALSE},
479 {URLZONE_INVALID,E_NOTIMPL,FALSE}
482 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
483 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
485 {"file://server/test.mp3",S_OK,FALSE},
486 {"server",S_OK,FALSE},
487 {"file://server/test.mp3",S_OK,FALSE},
491 {"server",S_OK,FALSE},
493 {"/test.mp3",S_OK,FALSE},
494 {"/test.mp3",S_OK,FALSE},
496 {"\\\\Server/test.mp3",S_OK,FALSE},
502 {Uri_HOST_DNS,S_OK,FALSE},
504 {URL_SCHEME_FILE,S_OK,FALSE},
505 {URLZONE_INVALID,E_NOTIMPL,FALSE}
508 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
510 {"*:www.winehq.org/test",S_OK,FALSE},
511 {"www.winehq.org",S_OK,FALSE},
512 {"*:www.winehq.org/test",S_OK,FALSE},
513 {"winehq.org",S_OK,FALSE},
516 {"www.winehq.org",S_OK,FALSE},
518 {"/test",S_OK,FALSE},
519 {"/test",S_OK,FALSE},
521 {"www.winehq.org/test",S_OK,FALSE},
527 {Uri_HOST_DNS,S_OK,FALSE},
529 {URL_SCHEME_WILDCARD,S_OK,FALSE},
530 {URLZONE_INVALID,E_NOTIMPL,FALSE}
533 /* Valid since the '*' is the only character in the scheme name. */
534 { "*:www.winehq.org/test", 0, S_OK, FALSE,
536 {"*:www.winehq.org/test",S_OK,FALSE},
537 {"www.winehq.org",S_OK,FALSE},
538 {"*:www.winehq.org/test",S_OK,FALSE},
539 {"winehq.org",S_OK,FALSE},
542 {"www.winehq.org",S_OK,FALSE},
544 {"/test",S_OK,FALSE},
545 {"/test",S_OK,FALSE},
547 {"*:www.winehq.org/test",S_OK,FALSE},
553 {Uri_HOST_DNS,S_OK,FALSE},
555 {URL_SCHEME_WILDCARD,S_OK,FALSE},
556 {URLZONE_INVALID,E_NOTIMPL,FALSE}
559 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
561 {"/../some dir/test.ext",S_OK,FALSE},
563 {"/../some dir/test.ext",S_OK,FALSE},
569 {"/../some dir/test.ext",S_OK,FALSE},
570 {"/../some dir/test.ext",S_OK,FALSE},
572 {"/../some dir/test.ext",S_OK,FALSE},
578 {Uri_HOST_UNKNOWN,S_OK,FALSE},
580 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
581 {URLZONE_INVALID,E_NOTIMPL,FALSE}
584 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
586 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
588 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
594 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
595 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
597 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
603 {Uri_HOST_UNKNOWN,S_OK,FALSE},
605 {URL_SCHEME_WILDCARD,S_OK,FALSE},
606 {URLZONE_INVALID,E_NOTIMPL,FALSE}
609 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
610 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
612 {"zip:/.//google.com",S_OK,FALSE},
614 {"zip:/.//google.com",S_OK,FALSE},
620 {"/.//google.com",S_OK,FALSE},
621 {"/.//google.com",S_OK,FALSE},
623 {"zip://google.com",S_OK,FALSE},
629 {Uri_HOST_UNKNOWN,S_OK,FALSE},
631 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
632 {URLZONE_INVALID,E_NOTIMPL,FALSE}
635 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
636 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
638 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
639 {"user:pass:word@winehq.org",S_OK,FALSE},
640 {"ftp://winehq.org/",S_OK,FALSE},
641 {"winehq.org",S_OK,FALSE},
644 {"winehq.org",S_OK,FALSE},
645 {"pass:word",S_OK,FALSE},
649 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
651 {"user:pass:word",S_OK,FALSE},
655 {Uri_HOST_DNS,S_OK,FALSE},
657 {URL_SCHEME_FTP,S_OK,FALSE},
658 {URLZONE_INVALID,E_NOTIMPL,FALSE}
661 /* Make sure % encoded unreserved characters are decoded. */
662 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
664 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
665 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
666 {"ftp://ftp.google.com/",S_OK,FALSE},
667 {"google.com",S_OK,FALSE},
670 {"ftp.google.com",S_OK,FALSE},
675 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
677 {"wINe:PASS",S_OK,FALSE},
681 {Uri_HOST_DNS,S_OK,FALSE},
683 {URL_SCHEME_FTP,S_OK,FALSE},
684 {URLZONE_INVALID,E_NOTIMPL,FALSE}
687 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
688 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
690 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
691 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
692 {"ftp://ftp.google.com/",S_OK,FALSE},
693 {"google.com",S_OK,FALSE},
696 {"ftp.google.com",S_OK,FALSE},
697 {"PA%7B%7D",S_OK,FALSE},
701 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
703 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
704 {"w%5D%5Be",S_OK,FALSE}
707 {Uri_HOST_DNS,S_OK,FALSE},
709 {URL_SCHEME_FTP,S_OK,FALSE},
710 {URLZONE_INVALID,E_NOTIMPL,FALSE}
713 /* You're allowed to have an empty password portion in the userinfo section. */
714 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
716 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
717 {"empty:@ftp.google.com",S_OK,FALSE},
718 {"ftp://ftp.google.com/",S_OK,FALSE},
719 {"google.com",S_OK,FALSE},
722 {"ftp.google.com",S_OK,FALSE},
727 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
729 {"empty:",S_OK,FALSE},
733 {Uri_HOST_DNS,S_OK,FALSE},
735 {URL_SCHEME_FTP,S_OK,FALSE},
736 {URLZONE_INVALID,E_NOTIMPL,FALSE}
739 /* Make sure forbidden characters in "userinfo" get encoded. */
740 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
742 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
743 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
744 {"ftp://ftp.google.com/",S_OK,FALSE},
745 {"google.com",S_OK,FALSE},
748 {"ftp.google.com",S_OK,FALSE},
753 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
755 {"%22%20%22weird",S_OK,FALSE},
756 {"%22%20%22weird",S_OK,FALSE}
759 {Uri_HOST_DNS,S_OK,FALSE},
761 {URL_SCHEME_FTP,S_OK,FALSE},
762 {URLZONE_INVALID,E_NOTIMPL,FALSE}
765 /* Make sure the forbidden characters don't get percent encoded. */
766 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
768 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
769 {"\" \"weird@ftp.google.com",S_OK,FALSE},
770 {"ftp://ftp.google.com/",S_OK,FALSE},
771 {"google.com",S_OK,FALSE},
774 {"ftp.google.com",S_OK,FALSE},
779 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
781 {"\" \"weird",S_OK,FALSE},
782 {"\" \"weird",S_OK,FALSE}
785 {Uri_HOST_DNS,S_OK,FALSE},
787 {URL_SCHEME_FTP,S_OK,FALSE},
788 {URLZONE_INVALID,E_NOTIMPL,FALSE}
791 /* Make sure already percent encoded characters don't get unencoded. */
792 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
794 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
795 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
796 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
797 {"google.com",S_OK,FALSE},
800 {"ftp.google.com",S_OK,FALSE},
802 {"/\"%20\"weird",S_OK,FALSE},
803 {"/\"%20\"weird",S_OK,FALSE},
805 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
807 {"\"%20\"weird",S_OK,FALSE},
808 {"\"%20\"weird",S_OK,FALSE}
811 {Uri_HOST_DNS,S_OK,FALSE},
813 {URL_SCHEME_FTP,S_OK,FALSE},
814 {URLZONE_INVALID,E_NOTIMPL,FALSE}
817 /* Allowed to have invalid % encoded because its an unknown scheme type. */
818 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
820 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
821 {"%xy:word@winehq.org",S_OK,FALSE},
822 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
823 {"winehq.org",S_OK,FALSE},
826 {"winehq.org",S_OK,FALSE},
831 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
833 {"%xy:word",S_OK,FALSE},
837 {Uri_HOST_DNS,S_OK,FALSE},
839 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
840 {URLZONE_INVALID,E_NOTIMPL,FALSE}
843 /* Unreserved, percent encoded characters aren't decoded in the userinfo becuase the scheme
846 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
848 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
849 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
850 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
851 {"winehq.org",S_OK,FALSE},
854 {"winehq.org",S_OK,FALSE},
855 {"%52%53ord",S_OK,FALSE},
859 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
861 {"%2E:%52%53ord",S_OK,FALSE},
865 {Uri_HOST_DNS,S_OK,FALSE},
867 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
868 {URLZONE_INVALID,E_NOTIMPL,FALSE}
871 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
873 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
874 {"[](),'test':word@winehq.org",S_OK,FALSE},
875 {"ftp://winehq.org/",S_OK,FALSE},
876 {"winehq.org",S_OK,FALSE},
879 {"winehq.org",S_OK,FALSE},
884 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
886 {"[](),'test':word",S_OK,FALSE},
887 {"[](),'test'",S_OK,FALSE}
890 {Uri_HOST_DNS,S_OK,FALSE},
892 {URL_SCHEME_FTP,S_OK,FALSE},
893 {URLZONE_INVALID,E_NOTIMPL,FALSE}
896 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
898 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
900 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
907 {"/?:word@winehq.org/",S_OK,FALSE},
908 {"?:word@winehq.org/",S_OK,FALSE},
909 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
915 {Uri_HOST_DNS,S_OK,FALSE},
917 {URL_SCHEME_FTP,S_OK,FALSE},
918 {URLZONE_INVALID,E_NOTIMPL,FALSE}
921 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
923 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
925 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
928 {"#:word@winehq.org/",S_OK,FALSE},
934 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
940 {Uri_HOST_DNS,S_OK,FALSE},
942 {URL_SCHEME_FTP,S_OK,FALSE},
943 {URLZONE_INVALID,E_NOTIMPL,FALSE}
946 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
947 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
949 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
950 {"test\\:word@winehq.org",S_OK,FALSE},
951 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
952 {"winehq.org",S_OK,FALSE},
955 {"winehq.org",S_OK,FALSE},
960 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
962 {"test\\:word",S_OK,FALSE},
963 {"test\\",S_OK,FALSE}
966 {Uri_HOST_DNS,S_OK,FALSE},
968 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
969 {URLZONE_INVALID,E_NOTIMPL,FALSE}
972 /* It normalizes IPv4 addresses correctly. */
973 { "http://127.000.000.100/", 0, S_OK, FALSE,
975 {"http://127.0.0.100/",S_OK,FALSE},
976 {"127.0.0.100",S_OK,FALSE},
977 {"http://127.0.0.100/",S_OK,FALSE},
981 {"127.0.0.100",S_OK,FALSE},
986 {"http://127.000.000.100/",S_OK,FALSE},
992 {Uri_HOST_IPV4,S_OK,FALSE},
994 {URL_SCHEME_HTTP,S_OK,FALSE},
995 {URLZONE_INVALID,E_NOTIMPL,FALSE}
998 /* Make sure it normalizes partial IPv4 addresses correctly. */
999 { "http://127.0/", 0, S_OK, FALSE,
1001 {"http://127.0.0.0/",S_OK,FALSE},
1002 {"127.0.0.0",S_OK,FALSE},
1003 {"http://127.0.0.0/",S_OK,FALSE},
1007 {"127.0.0.0",S_OK,FALSE},
1012 {"http://127.0/",S_OK,FALSE},
1013 {"http",S_OK,FALSE},
1018 {Uri_HOST_IPV4,S_OK,FALSE},
1020 {URL_SCHEME_HTTP,S_OK,FALSE},
1021 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1024 /* Make sure it converts implicit IPv4's correctly. */
1025 { "http://123456/", 0, S_OK, FALSE,
1027 {"http://0.1.226.64/",S_OK,FALSE},
1028 {"0.1.226.64",S_OK,FALSE},
1029 {"http://0.1.226.64/",S_OK,FALSE},
1033 {"0.1.226.64",S_OK,FALSE},
1038 {"http://123456/",S_OK,FALSE},
1039 {"http",S_OK,FALSE},
1044 {Uri_HOST_IPV4,S_OK,FALSE},
1046 {URL_SCHEME_HTTP,S_OK,FALSE},
1047 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1051 { "http://4294967295/", 0, S_OK, FALSE,
1053 {"http://255.255.255.255/",S_OK,FALSE},
1054 {"255.255.255.255",S_OK,FALSE},
1055 {"http://255.255.255.255/",S_OK,FALSE},
1059 {"255.255.255.255",S_OK,FALSE},
1064 {"http://4294967295/",S_OK,FALSE},
1065 {"http",S_OK,FALSE},
1070 {Uri_HOST_IPV4,S_OK,FALSE},
1072 {URL_SCHEME_HTTP,S_OK,FALSE},
1073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1077 { "http://4294967296/", 0, S_OK, FALSE,
1079 {"http://4294967296/",S_OK,FALSE},
1080 {"4294967296",S_OK,FALSE},
1081 {"http://4294967296/",S_OK,FALSE},
1085 {"4294967296",S_OK,FALSE},
1090 {"http://4294967296/",S_OK,FALSE},
1091 {"http",S_OK,FALSE},
1096 {Uri_HOST_DNS,S_OK,FALSE},
1098 {URL_SCHEME_HTTP,S_OK,FALSE},
1099 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1102 /* Window's doesn't normalize IP address for unknown schemes. */
1103 { "1234://4294967295/", 0, S_OK, FALSE,
1105 {"1234://4294967295/",S_OK,FALSE},
1106 {"4294967295",S_OK,FALSE},
1107 {"1234://4294967295/",S_OK,FALSE},
1111 {"4294967295",S_OK,FALSE},
1116 {"1234://4294967295/",S_OK,FALSE},
1117 {"1234",S_OK,FALSE},
1122 {Uri_HOST_IPV4,S_OK,FALSE},
1124 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1125 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1128 /* Window's doesn't normalize IP address for unknown schemes. */
1129 { "1234://127.001/", 0, S_OK, FALSE,
1131 {"1234://127.001/",S_OK,FALSE},
1132 {"127.001",S_OK,FALSE},
1133 {"1234://127.001/",S_OK,FALSE},
1137 {"127.001",S_OK,FALSE},
1142 {"1234://127.001/",S_OK,FALSE},
1143 {"1234",S_OK,FALSE},
1148 {Uri_HOST_IPV4,S_OK,FALSE},
1150 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1151 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1154 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1156 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1157 {"[fedc:ba98::3210]",S_OK,FALSE},
1158 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1162 {"fedc:ba98::3210",S_OK,FALSE},
1167 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1168 {"http",S_OK,FALSE},
1173 {Uri_HOST_IPV6,S_OK,FALSE},
1175 {URL_SCHEME_HTTP,S_OK,FALSE},
1176 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1179 { "http://[::]", 0, S_OK, FALSE,
1181 {"http://[::]/",S_OK,FALSE},
1182 {"[::]",S_OK,FALSE},
1183 {"http://[::]/",S_OK,FALSE},
1192 {"http://[::]",S_OK,FALSE},
1193 {"http",S_OK,FALSE},
1198 {Uri_HOST_IPV6,S_OK,FALSE},
1200 {URL_SCHEME_HTTP,S_OK,FALSE},
1201 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1204 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1206 {"http://[fedc:ba98::]/",S_OK,FALSE},
1207 {"[fedc:ba98::]",S_OK,FALSE},
1208 {"http://[fedc:ba98::]/",S_OK,FALSE},
1212 {"fedc:ba98::",S_OK,FALSE},
1217 {"http://[FEDC:BA98::]",S_OK,FALSE},
1218 {"http",S_OK,FALSE},
1223 {Uri_HOST_IPV6,S_OK,FALSE},
1225 {URL_SCHEME_HTTP,S_OK,FALSE},
1226 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1229 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1230 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1232 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1233 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1234 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1238 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1243 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1244 {"http",S_OK,FALSE},
1249 {Uri_HOST_IPV6,S_OK,FALSE},
1251 {URL_SCHEME_HTTP,S_OK,FALSE},
1252 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1255 { "http://[v2.34]/", 0, S_OK, FALSE,
1257 {"http://[v2.34]/",S_OK,FALSE},
1258 {"[v2.34]",S_OK,FALSE},
1259 {"http://[v2.34]/",S_OK,FALSE},
1263 {"[v2.34]",S_OK,FALSE},
1268 {"http://[v2.34]/",S_OK,FALSE},
1269 {"http",S_OK,FALSE},
1274 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1276 {URL_SCHEME_HTTP,S_OK,FALSE},
1277 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1280 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1281 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1283 {"http://[xyz:12345.com/test",S_OK,FALSE},
1284 {"[xyz:12345.com",S_OK,FALSE},
1285 {"http://[xyz:12345.com/test",S_OK,FALSE},
1286 {"[xyz:12345.com",S_OK,FALSE},
1289 {"[xyz:12345.com",S_OK,FALSE},
1291 {"/test",S_OK,FALSE},
1292 {"/test",S_OK,FALSE},
1294 {"http://[xyz:12345.com/test",S_OK,FALSE},
1295 {"http",S_OK,FALSE},
1300 {Uri_HOST_DNS,S_OK,FALSE},
1302 {URL_SCHEME_HTTP,S_OK,FALSE},
1303 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1306 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1307 * of the host name (respectively).
1309 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1311 {"ftp://www.[works].com/",S_OK,FALSE},
1312 {"www.[works].com",S_OK,FALSE},
1313 {"ftp://www.[works].com/",S_OK,FALSE},
1314 {"[works].com",S_OK,FALSE},
1317 {"www.[works].com",S_OK,FALSE},
1322 {"ftp://www.[works].com/",S_OK,FALSE},
1328 {Uri_HOST_DNS,S_OK,FALSE},
1330 {URL_SCHEME_FTP,S_OK,FALSE},
1331 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1334 /* Considers ':' a delimiter since it appears after the ']'. */
1335 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1337 {"http://www.google.com]:12345/",S_OK,FALSE},
1338 {"www.google.com]:12345",S_OK,FALSE},
1339 {"http://www.google.com]:12345/",S_OK,FALSE},
1340 {"google.com]",S_OK,FALSE},
1343 {"www.google.com]",S_OK,FALSE},
1348 {"http://www.google.com]:12345/",S_OK,FALSE},
1349 {"http",S_OK,FALSE},
1354 {Uri_HOST_DNS,S_OK,FALSE},
1356 {URL_SCHEME_HTTP,S_OK,FALSE},
1357 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1360 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1361 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1363 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1364 {"w%XXw%GEw.google.com",S_OK,FALSE},
1365 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1366 {"google.com",S_OK,FALSE},
1369 {"w%XXw%GEw.google.com",S_OK,FALSE},
1374 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1380 {Uri_HOST_DNS,S_OK,FALSE},
1382 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1383 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1386 /* Unknown scheme types hostname doesn't get lower cased. */
1387 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1389 {"zip://GOOGLE.com/",S_OK,FALSE},
1390 {"GOOGLE.com",S_OK,FALSE},
1391 {"zip://GOOGLE.com/",S_OK,FALSE},
1392 {"GOOGLE.com",S_OK,FALSE},
1395 {"GOOGLE.com",S_OK,FALSE},
1400 {"zip://GOOGLE.com/",S_OK,FALSE},
1406 {Uri_HOST_DNS,S_OK,FALSE},
1408 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1409 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1412 /* Hostname get's lower cased for known scheme types. */
1413 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1415 {"http://www.google.com/",S_OK,FALSE},
1416 {"www.google.com",S_OK,FALSE},
1417 {"http://www.google.com/",S_OK,FALSE},
1418 {"google.com",S_OK,FALSE},
1421 {"www.google.com",S_OK,FALSE},
1426 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1427 {"http",S_OK,FALSE},
1432 {Uri_HOST_DNS,S_OK,FALSE},
1434 {URL_SCHEME_HTTP,S_OK,FALSE},
1435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1438 /* Characters that get % encoded in the hostname also have their percent
1439 * encoded forms lower cased.
1441 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1443 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1444 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1445 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1446 {"%7cgoogle%7c.com",S_OK,FALSE},
1449 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1454 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1455 {"http",S_OK,FALSE},
1460 {Uri_HOST_DNS,S_OK,FALSE},
1462 {URL_SCHEME_HTTP,S_OK,FALSE},
1463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1466 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1467 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1469 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1470 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1471 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1475 {"1:2:3:4:5:6::",S_OK,FALSE},
1480 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1481 {"http",S_OK,FALSE},
1486 {Uri_HOST_IPV6,S_OK,FALSE},
1488 {URL_SCHEME_HTTP,S_OK,FALSE},
1489 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1492 /* IPv4 addresses get normalized. */
1493 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1495 {"http://[::1.2.3.0]/",S_OK,FALSE},
1496 {"[::1.2.3.0]",S_OK,FALSE},
1497 {"http://[::1.2.3.0]/",S_OK,FALSE},
1501 {"::1.2.3.0",S_OK,FALSE},
1506 {"http://[::001.002.003.000]",S_OK,FALSE},
1507 {"http",S_OK,FALSE},
1512 {Uri_HOST_IPV6,S_OK,FALSE},
1514 {URL_SCHEME_HTTP,S_OK,FALSE},
1515 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1518 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1519 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1521 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1522 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1523 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1527 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1532 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1538 {Uri_HOST_IPV6,S_OK,FALSE},
1540 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1544 /* IPv4 address is converted into 2 h16 components. */
1545 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1547 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1548 {"[ffff::c0de:6f20]",S_OK,FALSE},
1549 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1553 {"ffff::c0de:6f20",S_OK,FALSE},
1558 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1559 {"http",S_OK,FALSE},
1564 {Uri_HOST_IPV6,S_OK,FALSE},
1566 {URL_SCHEME_HTTP,S_OK,FALSE},
1567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1570 /* Max value for a port. */
1571 { "http://google.com:65535", 0, S_OK, FALSE,
1573 {"http://google.com:65535/",S_OK,FALSE},
1574 {"google.com:65535",S_OK,FALSE},
1575 {"http://google.com:65535/",S_OK,FALSE},
1576 {"google.com",S_OK,FALSE},
1579 {"google.com",S_OK,FALSE},
1584 {"http://google.com:65535",S_OK,FALSE},
1585 {"http",S_OK,FALSE},
1590 {Uri_HOST_DNS,S_OK,FALSE},
1592 {URL_SCHEME_HTTP,S_OK,FALSE},
1593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1596 { "zip://google.com:65536", 0, S_OK, FALSE,
1598 {"zip://google.com:65536/",S_OK,FALSE},
1599 {"google.com:65536",S_OK,FALSE},
1600 {"zip://google.com:65536/",S_OK,FALSE},
1601 {"google.com:65536",S_OK,FALSE},
1604 {"google.com:65536",S_OK,FALSE},
1609 {"zip://google.com:65536",S_OK,FALSE},
1615 {Uri_HOST_DNS,S_OK,FALSE},
1617 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1618 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1621 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1623 {"zip://google.com:65536:25/",S_OK,FALSE},
1624 {"google.com:65536:25",S_OK,FALSE},
1625 {"zip://google.com:65536:25/",S_OK,FALSE},
1626 {"google.com:65536:25",S_OK,FALSE},
1629 {"google.com:65536:25",S_OK,FALSE},
1634 {"zip://google.com:65536:25",S_OK,FALSE},
1640 {Uri_HOST_DNS,S_OK,FALSE},
1642 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1643 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1646 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1648 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1649 {"[::ffff]:abcd",S_OK,FALSE},
1650 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1654 {"[::ffff]:abcd",S_OK,FALSE},
1659 {"zip://[::ffff]:abcd",S_OK,FALSE},
1665 {Uri_HOST_DNS,S_OK,FALSE},
1667 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1668 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1671 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1673 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1674 {"127.0.0.1:abcd",S_OK,FALSE},
1675 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1676 {"0.1:abcd",S_OK,FALSE},
1679 {"127.0.0.1:abcd",S_OK,FALSE},
1684 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1690 {Uri_HOST_DNS,S_OK,FALSE},
1692 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1693 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1696 /* Port is just copied over. */
1697 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1699 {"http://google.com:00035",S_OK,FALSE},
1700 {"google.com:00035",S_OK,FALSE},
1701 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1702 {"google.com",S_OK,FALSE},
1705 {"google.com",S_OK,FALSE},
1710 {"http://google.com:00035",S_OK,FALSE},
1711 {"http",S_OK,FALSE},
1716 {Uri_HOST_DNS,S_OK,FALSE},
1718 {URL_SCHEME_HTTP,S_OK,FALSE},
1719 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1722 /* Default port is copied over. */
1723 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1725 {"http://google.com:80",S_OK,FALSE},
1726 {"google.com:80",S_OK,FALSE},
1727 {"http://google.com:80",S_OK,FALSE},
1728 {"google.com",S_OK,FALSE},
1731 {"google.com",S_OK,FALSE},
1736 {"http://google.com:80",S_OK,FALSE},
1737 {"http",S_OK,FALSE},
1742 {Uri_HOST_DNS,S_OK,FALSE},
1744 {URL_SCHEME_HTTP,S_OK,FALSE},
1745 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1748 { "http://google.com.uk", 0, S_OK, FALSE,
1750 {"http://google.com.uk/",S_OK,FALSE},
1751 {"google.com.uk",S_OK,FALSE},
1752 {"http://google.com.uk/",S_OK,FALSE},
1753 {"google.com.uk",S_OK,FALSE},
1756 {"google.com.uk",S_OK,FALSE},
1761 {"http://google.com.uk",S_OK,FALSE},
1762 {"http",S_OK,FALSE},
1767 {Uri_HOST_DNS,S_OK,FALSE},
1769 {URL_SCHEME_HTTP,S_OK,FALSE},
1770 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1773 { "http://google.com.com", 0, S_OK, FALSE,
1775 {"http://google.com.com/",S_OK,FALSE},
1776 {"google.com.com",S_OK,FALSE},
1777 {"http://google.com.com/",S_OK,FALSE},
1778 {"com.com",S_OK,FALSE},
1781 {"google.com.com",S_OK,FALSE},
1786 {"http://google.com.com",S_OK,FALSE},
1787 {"http",S_OK,FALSE},
1792 {Uri_HOST_DNS,S_OK,FALSE},
1794 {URL_SCHEME_HTTP,S_OK,FALSE},
1795 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1798 { "http://google.uk.1", 0, S_OK, FALSE,
1800 {"http://google.uk.1/",S_OK,FALSE},
1801 {"google.uk.1",S_OK,FALSE},
1802 {"http://google.uk.1/",S_OK,FALSE},
1803 {"google.uk.1",S_OK,FALSE},
1806 {"google.uk.1",S_OK,FALSE},
1811 {"http://google.uk.1",S_OK,FALSE},
1812 {"http",S_OK,FALSE},
1817 {Uri_HOST_DNS,S_OK,FALSE},
1819 {URL_SCHEME_HTTP,S_OK,FALSE},
1820 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1823 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1824 { "http://google.foo.uk", 0, S_OK, FALSE,
1826 {"http://google.foo.uk/",S_OK,FALSE},
1827 {"google.foo.uk",S_OK,FALSE},
1828 {"http://google.foo.uk/",S_OK,FALSE},
1829 {"foo.uk",S_OK,FALSE},
1832 {"google.foo.uk",S_OK,FALSE},
1837 {"http://google.foo.uk",S_OK,FALSE},
1838 {"http",S_OK,FALSE},
1843 {Uri_HOST_DNS,S_OK,FALSE},
1845 {URL_SCHEME_HTTP,S_OK,FALSE},
1846 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1849 { "http://.com", 0, S_OK, FALSE,
1851 {"http://.com/",S_OK,FALSE},
1852 {".com",S_OK,FALSE},
1853 {"http://.com/",S_OK,FALSE},
1854 {".com",S_OK,FALSE},
1857 {".com",S_OK,FALSE},
1862 {"http://.com",S_OK,FALSE},
1863 {"http",S_OK,FALSE},
1868 {Uri_HOST_DNS,S_OK,FALSE},
1870 {URL_SCHEME_HTTP,S_OK,FALSE},
1871 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1874 { "http://.uk", 0, S_OK, FALSE,
1876 {"http://.uk/",S_OK,FALSE},
1878 {"http://.uk/",S_OK,FALSE},
1887 {"http://.uk",S_OK,FALSE},
1888 {"http",S_OK,FALSE},
1893 {Uri_HOST_DNS,S_OK,FALSE},
1895 {URL_SCHEME_HTTP,S_OK,FALSE},
1896 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1899 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1901 {"http://www.co.google.com.[]/",S_OK,FALSE},
1902 {"www.co.google.com.[]",S_OK,FALSE},
1903 {"http://www.co.google.com.[]/",S_OK,FALSE},
1904 {"google.com.[]",S_OK,FALSE},
1907 {"www.co.google.com.[]",S_OK,FALSE},
1912 {"http://www.co.google.com.[]",S_OK,FALSE},
1913 {"http",S_OK,FALSE},
1918 {Uri_HOST_DNS,S_OK,FALSE},
1920 {URL_SCHEME_HTTP,S_OK,FALSE},
1921 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1924 { "http://co.uk", 0, S_OK, FALSE,
1926 {"http://co.uk/",S_OK,FALSE},
1927 {"co.uk",S_OK,FALSE},
1928 {"http://co.uk/",S_OK,FALSE},
1932 {"co.uk",S_OK,FALSE},
1937 {"http://co.uk",S_OK,FALSE},
1938 {"http",S_OK,FALSE},
1943 {Uri_HOST_DNS,S_OK,FALSE},
1945 {URL_SCHEME_HTTP,S_OK,FALSE},
1946 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1949 { "http://www.co.google.us.test", 0, S_OK, FALSE,
1951 {"http://www.co.google.us.test/",S_OK,FALSE},
1952 {"www.co.google.us.test",S_OK,FALSE},
1953 {"http://www.co.google.us.test/",S_OK,FALSE},
1954 {"us.test",S_OK,FALSE},
1957 {"www.co.google.us.test",S_OK,FALSE},
1962 {"http://www.co.google.us.test",S_OK,FALSE},
1963 {"http",S_OK,FALSE},
1968 {Uri_HOST_DNS,S_OK,FALSE},
1970 {URL_SCHEME_HTTP,S_OK,FALSE},
1971 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1974 { "http://gov.uk", 0, S_OK, FALSE,
1976 {"http://gov.uk/",S_OK,FALSE},
1977 {"gov.uk",S_OK,FALSE},
1978 {"http://gov.uk/",S_OK,FALSE},
1982 {"gov.uk",S_OK,FALSE},
1987 {"http://gov.uk",S_OK,FALSE},
1988 {"http",S_OK,FALSE},
1993 {Uri_HOST_DNS,S_OK,FALSE},
1995 {URL_SCHEME_HTTP,S_OK,FALSE},
1996 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1999 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2001 {"zip://www.google.com\\test",S_OK,FALSE},
2002 {"www.google.com\\test",S_OK,FALSE},
2003 {"zip://www.google.com\\test",S_OK,FALSE},
2004 {"google.com\\test",S_OK,FALSE},
2007 {"www.google.com\\test",S_OK,FALSE},
2012 {"zip://www.google.com\\test",S_OK,FALSE},
2018 {Uri_HOST_DNS,S_OK,FALSE},
2020 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2021 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2024 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2026 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2028 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2034 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2035 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2037 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2043 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2045 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2046 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2049 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2050 * are decoded and all '%' are encoded.
2052 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2054 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2056 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2058 {".mp3",S_OK,FALSE},
2062 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2063 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2065 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2066 {"file",S_OK,FALSE},
2071 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2073 {URL_SCHEME_FILE,S_OK,FALSE},
2074 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2077 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2078 * is decoded and only %'s in front of invalid hex digits are encoded.
2080 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2082 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2084 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2086 {".mp3",S_OK,FALSE},
2090 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2091 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2093 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2094 {"file",S_OK,FALSE},
2099 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2101 {URL_SCHEME_FILE,S_OK,FALSE},
2102 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2105 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2106 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2108 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2109 {"[::1.2.3.0]",S_OK,FALSE},
2110 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2114 {"::1.2.3.0",S_OK,FALSE},
2116 {"/%3F%23.T/test",S_OK,FALSE},
2117 {"/%3F%23.T/test",S_OK,FALSE},
2119 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2120 {"http",S_OK,FALSE},
2125 {Uri_HOST_IPV6,S_OK,FALSE},
2127 {URL_SCHEME_HTTP,S_OK,FALSE},
2128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2131 /* Forbidden characters are always encoded for file URIs. */
2132 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2134 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2136 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2138 {".mp3",S_OK,FALSE},
2142 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2143 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2145 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2146 {"file",S_OK,FALSE},
2151 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2153 {URL_SCHEME_FILE,S_OK,FALSE},
2154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2157 /* Forbidden characters are never encoded for unknown scheme types. */
2158 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2160 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2161 {"4294967295",S_OK,FALSE},
2162 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2166 {"4294967295",S_OK,FALSE},
2168 {"/<|>\" test<|>",S_OK,FALSE},
2169 {"/<|>\" test<|>",S_OK,FALSE},
2171 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2172 {"1234",S_OK,FALSE},
2177 {Uri_HOST_IPV4,S_OK,FALSE},
2179 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2183 /* Make sure forbidden characters are percent encoded. */
2184 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2186 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2187 {"gov.uk",S_OK,FALSE},
2188 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2192 {"gov.uk",S_OK,FALSE},
2194 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2195 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2197 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2198 {"http",S_OK,FALSE},
2203 {Uri_HOST_DNS,S_OK,FALSE},
2205 {URL_SCHEME_HTTP,S_OK,FALSE},
2206 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2209 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2211 {"http://gov.uk/",S_OK,FALSE},
2212 {"gov.uk",S_OK,FALSE},
2213 {"http://gov.uk/",S_OK,FALSE},
2217 {"gov.uk",S_OK,FALSE},
2222 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2223 {"http",S_OK,FALSE},
2228 {Uri_HOST_DNS,S_OK,FALSE},
2230 {URL_SCHEME_HTTP,S_OK,FALSE},
2231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2234 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2236 {"http://gov.uk/",S_OK,FALSE},
2237 {"gov.uk",S_OK,FALSE},
2238 {"http://gov.uk/",S_OK,FALSE},
2242 {"gov.uk",S_OK,FALSE},
2247 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2248 {"http",S_OK,FALSE},
2253 {Uri_HOST_DNS,S_OK,FALSE},
2255 {URL_SCHEME_HTTP,S_OK,FALSE},
2256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2259 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2261 {"http://gov.uk/",S_OK,FALSE},
2262 {"gov.uk",S_OK,FALSE},
2263 {"http://gov.uk/",S_OK,FALSE},
2267 {"gov.uk",S_OK,FALSE},
2272 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2273 {"http",S_OK,FALSE},
2278 {Uri_HOST_DNS,S_OK,FALSE},
2280 {URL_SCHEME_HTTP,S_OK,FALSE},
2281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2284 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2286 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2288 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2290 {".mp3",S_OK,FALSE},
2294 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2295 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2297 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2298 {"file",S_OK,FALSE},
2303 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2305 {URL_SCHEME_FILE,S_OK,FALSE},
2306 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2309 /* Dot removal happens for unknown scheme types. */
2310 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2312 {"zip://gov.uk/",S_OK,FALSE},
2313 {"gov.uk",S_OK,FALSE},
2314 {"zip://gov.uk/",S_OK,FALSE},
2318 {"gov.uk",S_OK,FALSE},
2323 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2329 {Uri_HOST_DNS,S_OK,FALSE},
2331 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2332 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2335 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2336 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2338 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2339 {"gov.uk",S_OK,FALSE},
2340 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2344 {"gov.uk",S_OK,FALSE},
2346 {"/test/test2/../../.",S_OK,FALSE},
2347 {"/test/test2/../../.",S_OK,FALSE},
2349 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2350 {"http",S_OK,FALSE},
2355 {Uri_HOST_DNS,S_OK,FALSE},
2357 {URL_SCHEME_HTTP,S_OK,FALSE},
2358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2361 /* Dot removal doesn't happen for wildcard scheme types. */
2362 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2364 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2365 {"gov.uk",S_OK,FALSE},
2366 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2370 {"gov.uk",S_OK,FALSE},
2372 {"/test/test2/../../.",S_OK,FALSE},
2373 {"/test/test2/../../.",S_OK,FALSE},
2375 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2381 {Uri_HOST_DNS,S_OK,FALSE},
2383 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2387 /* Forbidden characters are encoded for opaque known scheme types. */
2388 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2390 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2392 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2394 {".com%22",S_OK,FALSE},
2398 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2399 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2401 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2402 {"mailto",S_OK,FALSE},
2407 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2409 {URL_SCHEME_MAILTO,S_OK,FALSE},
2410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2413 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2415 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2417 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2419 {".com",S_OK,FALSE},
2423 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2424 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2426 {"news:test.tes<|>t.com",S_OK,FALSE},
2427 {"news",S_OK,FALSE},
2432 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2434 {URL_SCHEME_NEWS,S_OK,FALSE},
2435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2438 /* Don't encode forbidden characters. */
2439 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2441 {"news:test.tes<|>t.com",S_OK,FALSE},
2443 {"news:test.tes<|>t.com",S_OK,FALSE},
2445 {".com",S_OK,FALSE},
2449 {"test.tes<|>t.com",S_OK,FALSE},
2450 {"test.tes<|>t.com",S_OK,FALSE},
2452 {"news:test.tes<|>t.com",S_OK,FALSE},
2453 {"news",S_OK,FALSE},
2458 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2460 {URL_SCHEME_NEWS,S_OK,FALSE},
2461 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2464 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2465 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2467 {"urn:test.tes<|>t.com",S_OK,FALSE},
2469 {"urn:test.tes<|>t.com",S_OK,FALSE},
2471 {".com",S_OK,FALSE},
2475 {"test.tes<|>t.com",S_OK,FALSE},
2476 {"test.tes<|>t.com",S_OK,FALSE},
2478 {"urn:test.tes<|>t.com",S_OK,FALSE},
2484 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2486 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2490 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2491 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2493 {"news:test.test.com",S_OK,FALSE},
2495 {"news:test.test.com",S_OK,FALSE},
2497 {".com",S_OK,FALSE},
2501 {"test.test.com",S_OK,FALSE},
2502 {"test.test.com",S_OK,FALSE},
2504 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2505 {"news",S_OK,FALSE},
2510 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2512 {URL_SCHEME_NEWS,S_OK,FALSE},
2513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2516 /* Percent encoded characters are still decoded for known scheme types. */
2517 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2519 {"news:test.test.com",S_OK,FALSE},
2521 {"news:test.test.com",S_OK,FALSE},
2523 {".com",S_OK,FALSE},
2527 {"test.test.com",S_OK,FALSE},
2528 {"test.test.com",S_OK,FALSE},
2530 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2531 {"news",S_OK,FALSE},
2536 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2538 {URL_SCHEME_NEWS,S_OK,FALSE},
2539 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2542 /* Percent encoded characters aren't decoded for unknown scheme types. */
2543 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2545 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2547 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2549 {".com",S_OK,FALSE},
2553 {"test.%74%65%73%74.com",S_OK,FALSE},
2554 {"test.%74%65%73%74.com",S_OK,FALSE},
2556 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2562 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2564 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2565 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2568 /* Unknown scheme types can have invalid % encoded data in query string. */
2569 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2571 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2572 {"www.winehq.org",S_OK,FALSE},
2573 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2574 {"winehq.org",S_OK,FALSE},
2577 {"www.winehq.org",S_OK,FALSE},
2580 {"/?query=%xx&return=y",S_OK,FALSE},
2581 {"?query=%xx&return=y",S_OK,FALSE},
2582 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2588 {Uri_HOST_DNS,S_OK,FALSE},
2590 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2591 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2594 /* Known scheme types can have invalid % encoded data with the right flags. */
2595 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2597 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2598 {"www.winehq.org",S_OK,FALSE},
2599 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2600 {"winehq.org",S_OK,FALSE},
2603 {"www.winehq.org",S_OK,FALSE},
2606 {"/?query=%xx&return=y",S_OK,FALSE},
2607 {"?query=%xx&return=y",S_OK,FALSE},
2608 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2609 {"http",S_OK,FALSE},
2614 {Uri_HOST_DNS,S_OK,FALSE},
2616 {URL_SCHEME_HTTP,S_OK,FALSE},
2617 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2620 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2621 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2623 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2624 {"www.winehq.org",S_OK,FALSE},
2625 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2626 {"winehq.org",S_OK,FALSE},
2629 {"www.winehq.org",S_OK,FALSE},
2632 {"/?query=<|>&return=y",S_OK,FALSE},
2633 {"?query=<|>&return=y",S_OK,FALSE},
2634 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2635 {"http",S_OK,FALSE},
2640 {Uri_HOST_DNS,S_OK,FALSE},
2642 {URL_SCHEME_HTTP,S_OK,FALSE},
2643 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2646 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2647 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2649 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2650 {"www.winehq.org",S_OK,FALSE},
2651 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2652 {"winehq.org",S_OK,FALSE},
2655 {"www.winehq.org",S_OK,FALSE},
2658 {"/?query=<|>&return=y",S_OK,FALSE},
2659 {"?query=<|>&return=y",S_OK,FALSE},
2660 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2661 {"http",S_OK,FALSE},
2666 {Uri_HOST_DNS,S_OK,FALSE},
2668 {URL_SCHEME_HTTP,S_OK,FALSE},
2669 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2672 /* Forbidden characters are encoded for known scheme types. */
2673 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2675 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2676 {"www.winehq.org",S_OK,FALSE},
2677 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2678 {"winehq.org",S_OK,FALSE},
2681 {"www.winehq.org",S_OK,FALSE},
2684 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2685 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2686 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2687 {"http",S_OK,FALSE},
2692 {Uri_HOST_DNS,S_OK,FALSE},
2694 {URL_SCHEME_HTTP,S_OK,FALSE},
2695 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2698 /* Forbidden characters are not encoded for unknown scheme types. */
2699 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2701 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2702 {"www.winehq.org",S_OK,FALSE},
2703 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2704 {"winehq.org",S_OK,FALSE},
2707 {"www.winehq.org",S_OK,FALSE},
2710 {"/?query=<|>&return=y",S_OK,FALSE},
2711 {"?query=<|>&return=y",S_OK,FALSE},
2712 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2718 {Uri_HOST_DNS,S_OK,FALSE},
2720 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2721 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2724 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2725 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2727 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2728 {"www.winehq.org",S_OK,FALSE},
2729 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2730 {"winehq.org",S_OK,FALSE},
2733 {"www.winehq.org",S_OK,FALSE},
2736 {"/?query=01&return=y",S_OK,FALSE},
2737 {"?query=01&return=y",S_OK,FALSE},
2738 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2739 {"http",S_OK,FALSE},
2744 {Uri_HOST_DNS,S_OK,FALSE},
2746 {URL_SCHEME_HTTP,S_OK,FALSE},
2747 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2750 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2751 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2753 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2754 {"www.winehq.org",S_OK,FALSE},
2755 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2756 {"winehq.org",S_OK,FALSE},
2759 {"www.winehq.org",S_OK,FALSE},
2762 {"/?query=%30%31&return=y",S_OK,FALSE},
2763 {"?query=%30%31&return=y",S_OK,FALSE},
2764 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2770 {Uri_HOST_DNS,S_OK,FALSE},
2772 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2773 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2776 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2777 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2779 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2780 {"www.winehq.org",S_OK,FALSE},
2781 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2782 {"winehq.org",S_OK,FALSE},
2785 {"www.winehq.org",S_OK,FALSE},
2788 {"/?query=%30%31&return=y",S_OK,FALSE},
2789 {"?query=%30%31&return=y",S_OK,FALSE},
2790 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2791 {"http",S_OK,FALSE},
2796 {Uri_HOST_DNS,S_OK,FALSE},
2798 {URL_SCHEME_HTTP,S_OK,FALSE},
2799 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2802 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2804 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2805 {"www.winehq.org",S_OK,FALSE},
2806 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2807 {"winehq.org",S_OK,FALSE},
2810 {"www.winehq.org",S_OK,FALSE},
2813 {"?query=12&return=y",S_OK,FALSE},
2814 {"?query=12&return=y",S_OK,FALSE},
2815 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2816 {"http",S_OK,FALSE},
2821 {Uri_HOST_DNS,S_OK,FALSE},
2823 {URL_SCHEME_HTTP,S_OK,FALSE},
2824 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2827 /* Unknown scheme types can have invalid % encoded data in fragments. */
2828 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2830 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2831 {"www.winehq.org",S_OK,FALSE},
2832 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2833 {"winehq.org",S_OK,FALSE},
2835 {"#Te%xx",S_OK,FALSE},
2836 {"www.winehq.org",S_OK,FALSE},
2838 {"/tests/",S_OK,FALSE},
2839 {"/tests/",S_OK,FALSE},
2841 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2847 {Uri_HOST_DNS,S_OK,FALSE},
2849 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2850 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2853 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2854 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2856 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2857 {"www.winehq.org",S_OK,FALSE},
2858 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2859 {"winehq.org",S_OK,FALSE},
2861 {"#Te<|>",S_OK,FALSE},
2862 {"www.winehq.org",S_OK,FALSE},
2864 {"/tests/",S_OK,FALSE},
2865 {"/tests/",S_OK,FALSE},
2867 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2873 {Uri_HOST_DNS,S_OK,FALSE},
2875 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2876 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2879 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2880 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2882 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2883 {"www.winehq.org",S_OK,FALSE},
2884 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2885 {"winehq.org",S_OK,FALSE},
2887 {"#Te%3C%7C%3E",S_OK,FALSE},
2888 {"www.winehq.org",S_OK,FALSE},
2890 {"/tests/",S_OK,FALSE},
2891 {"/tests/",S_OK,FALSE},
2893 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2894 {"http",S_OK,FALSE},
2899 {Uri_HOST_DNS,S_OK,FALSE},
2901 {URL_SCHEME_HTTP,S_OK,FALSE},
2902 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2905 /* Forbidden characters aren't encoded in the fragment with this flag. */
2906 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2908 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2909 {"www.winehq.org",S_OK,FALSE},
2910 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2911 {"winehq.org",S_OK,FALSE},
2913 {"#Te<|>",S_OK,FALSE},
2914 {"www.winehq.org",S_OK,FALSE},
2916 {"/tests/",S_OK,FALSE},
2917 {"/tests/",S_OK,FALSE},
2919 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2920 {"http",S_OK,FALSE},
2925 {Uri_HOST_DNS,S_OK,FALSE},
2927 {URL_SCHEME_HTTP,S_OK,FALSE},
2928 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2931 /* Forbidden characters aren't encoded in the fragment with this flag. */
2932 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2934 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2935 {"www.winehq.org",S_OK,FALSE},
2936 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2937 {"winehq.org",S_OK,FALSE},
2939 {"#Te<|>",S_OK,FALSE},
2940 {"www.winehq.org",S_OK,FALSE},
2942 {"/tests/",S_OK,FALSE},
2943 {"/tests/",S_OK,FALSE},
2945 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2946 {"http",S_OK,FALSE},
2951 {Uri_HOST_DNS,S_OK,FALSE},
2953 {URL_SCHEME_HTTP,S_OK,FALSE},
2954 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2957 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2958 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2960 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2961 {"www.winehq.org",S_OK,FALSE},
2962 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2963 {"winehq.org",S_OK,FALSE},
2965 {"#Te%30%31%32",S_OK,FALSE},
2966 {"www.winehq.org",S_OK,FALSE},
2968 {"/tests/",S_OK,FALSE},
2969 {"/tests/",S_OK,FALSE},
2971 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2977 {Uri_HOST_DNS,S_OK,FALSE},
2979 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2980 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2983 /* Percent encoded, unreserved characters are decoded for known schemes. */
2984 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2986 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2987 {"www.winehq.org",S_OK,FALSE},
2988 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2989 {"winehq.org",S_OK,FALSE},
2991 {"#Te012",S_OK,FALSE},
2992 {"www.winehq.org",S_OK,FALSE},
2994 {"/tests/",S_OK,FALSE},
2995 {"/tests/",S_OK,FALSE},
2997 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2998 {"http",S_OK,FALSE},
3003 {Uri_HOST_DNS,S_OK,FALSE},
3005 {URL_SCHEME_HTTP,S_OK,FALSE},
3006 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3009 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3010 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3012 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3013 {"www.winehq.org",S_OK,FALSE},
3014 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3015 {"winehq.org",S_OK,FALSE},
3017 {"#Te012",S_OK,FALSE},
3018 {"www.winehq.org",S_OK,FALSE},
3020 {"/tests/",S_OK,FALSE},
3021 {"/tests/",S_OK,FALSE},
3023 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3024 {"http",S_OK,FALSE},
3029 {Uri_HOST_DNS,S_OK,FALSE},
3031 {URL_SCHEME_HTTP,S_OK,FALSE},
3032 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3035 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3036 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3038 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3039 {"www.winehq.org",S_OK,FALSE},
3040 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3041 {"winehq.org",S_OK,FALSE},
3043 {"#Te%30%31%32",S_OK,FALSE},
3044 {"www.winehq.org",S_OK,FALSE},
3046 {"/tests/",S_OK,FALSE},
3047 {"/tests/",S_OK,FALSE},
3049 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3050 {"http",S_OK,FALSE},
3055 {Uri_HOST_DNS,S_OK,FALSE},
3057 {URL_SCHEME_HTTP,S_OK,FALSE},
3058 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3061 /* Leading/Trailing whitespace is removed. */
3062 { " http://google.com/ ", 0, S_OK, FALSE,
3064 {"http://google.com/",S_OK,FALSE},
3065 {"google.com",S_OK,FALSE},
3066 {"http://google.com/",S_OK,FALSE},
3067 {"google.com",S_OK,FALSE},
3070 {"google.com",S_OK,FALSE},
3075 {"http://google.com/",S_OK,FALSE},
3076 {"http",S_OK,FALSE},
3081 {Uri_HOST_DNS,S_OK,FALSE},
3083 {URL_SCHEME_HTTP,S_OK,FALSE},
3084 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3087 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3089 {"http://google.com/",S_OK,FALSE},
3090 {"google.com",S_OK,FALSE},
3091 {"http://google.com/",S_OK,FALSE},
3092 {"google.com",S_OK,FALSE},
3095 {"google.com",S_OK,FALSE},
3100 {"http://google.com/",S_OK,FALSE},
3101 {"http",S_OK,FALSE},
3106 {Uri_HOST_DNS,S_OK,FALSE},
3108 {URL_SCHEME_HTTP,S_OK,FALSE},
3109 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3112 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3114 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3115 {"g%0aoogle.co%0dm",S_OK,FALSE},
3116 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3117 {"g%0aoogle.co%0dm",S_OK,FALSE},
3120 {"g%0aoogle.co%0dm",S_OK,FALSE},
3122 {"/%0A%0A%0A",S_OK,FALSE},
3123 {"/%0A%0A%0A",S_OK,FALSE},
3125 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3126 {"http",S_OK,FALSE},
3131 {Uri_HOST_DNS,S_OK,FALSE},
3133 {URL_SCHEME_HTTP,S_OK,FALSE},
3134 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3137 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3139 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3140 {"g\noogle.co\rm",S_OK,FALSE},
3141 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3142 {"g\noogle.co\rm",S_OK,FALSE},
3145 {"g\noogle.co\rm",S_OK,FALSE},
3147 {"/\n\n\n",S_OK,FALSE},
3148 {"/\n\n\n",S_OK,FALSE},
3150 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3156 {Uri_HOST_DNS,S_OK,FALSE},
3158 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3159 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3162 /* Since file URLs are usually hierarchical, it returns an empty string
3163 * for the absolute URI property since it was declared as an opaque URI.
3165 { "file:index.html", 0, S_OK, FALSE,
3169 {"file:index.html",S_OK,FALSE},
3171 {".html",S_OK,FALSE},
3175 {"index.html",S_OK,FALSE},
3176 {"index.html",S_OK,FALSE},
3178 {"file:index.html",S_OK,FALSE},
3179 {"file",S_OK,FALSE},
3184 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3186 {URL_SCHEME_FILE,S_OK,FALSE},
3187 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3190 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3191 { "http:test.com/index.html", 0, S_OK, FALSE,
3195 {"http:test.com/index.html",S_OK,FALSE},
3197 {".html",S_OK,FALSE},
3201 {"test.com/index.html",S_OK,FALSE},
3202 {"test.com/index.html",S_OK,FALSE},
3204 {"http:test.com/index.html",S_OK,FALSE},
3205 {"http",S_OK,FALSE},
3210 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3212 {URL_SCHEME_HTTP,S_OK,FALSE},
3213 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3216 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3220 {"ftp:test.com/index.html",S_OK,FALSE},
3222 {".html",S_OK,FALSE},
3226 {"test.com/index.html",S_OK,FALSE},
3227 {"test.com/index.html",S_OK,FALSE},
3229 {"ftp:test.com/index.html",S_OK,FALSE},
3235 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3237 {URL_SCHEME_FTP,S_OK,FALSE},
3238 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3241 { "file://C|/test.mp3", 0, S_OK, FALSE,
3243 {"file:///C:/test.mp3",S_OK,FALSE},
3245 {"file:///C:/test.mp3",S_OK,FALSE},
3247 {".mp3",S_OK,FALSE},
3251 {"/C:/test.mp3",S_OK,FALSE},
3252 {"/C:/test.mp3",S_OK,FALSE},
3254 {"file://C|/test.mp3",S_OK,FALSE},
3255 {"file",S_OK,FALSE},
3260 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3262 {URL_SCHEME_FILE,S_OK,FALSE},
3263 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3266 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3268 {"file:///C:/test.mp3",S_OK,FALSE},
3270 {"file:///C:/test.mp3",S_OK,FALSE},
3272 {".mp3",S_OK,FALSE},
3276 {"/C:/test.mp3",S_OK,FALSE},
3277 {"/C:/test.mp3",S_OK,FALSE},
3279 {"file:///C|/test.mp3",S_OK,FALSE},
3280 {"file",S_OK,FALSE},
3285 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3287 {URL_SCHEME_FILE,S_OK,FALSE},
3288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3291 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3294 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3296 {"file://c:\\dir\\index.html",S_OK,FALSE},
3298 {"file://c:\\dir\\index.html",S_OK,FALSE},
3300 {".html",S_OK,FALSE},
3304 {"c:\\dir\\index.html",S_OK,FALSE},
3305 {"c:\\dir\\index.html",S_OK,FALSE},
3307 {"file://c:/dir/index.html",S_OK,FALSE},
3308 {"file",S_OK,FALSE},
3313 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3315 {URL_SCHEME_FILE,S_OK,FALSE},
3316 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3319 /* Extra '/' after "file://" is removed. */
3320 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3322 {"file://c:\\dir\\index.html",S_OK,FALSE},
3324 {"file://c:\\dir\\index.html",S_OK,FALSE},
3326 {".html",S_OK,FALSE},
3330 {"c:\\dir\\index.html",S_OK,FALSE},
3331 {"c:\\dir\\index.html",S_OK,FALSE},
3333 {"file:///c:/dir/index.html",S_OK,FALSE},
3334 {"file",S_OK,FALSE},
3339 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3341 {URL_SCHEME_FILE,S_OK,FALSE},
3342 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3345 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3346 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3348 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3350 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3352 {".html",S_OK,FALSE},
3356 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3357 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3359 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3360 {"file",S_OK,FALSE},
3365 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3367 {URL_SCHEME_FILE,S_OK,FALSE},
3368 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3371 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3373 {"file://c:\\dir\\index.html",S_OK,FALSE},
3375 {"file://c:\\dir\\index.html",S_OK,FALSE},
3377 {".html",S_OK,FALSE},
3381 {"c:\\dir\\index.html",S_OK,FALSE},
3382 {"c:\\dir\\index.html",S_OK,FALSE},
3384 {"file://c|/dir\\index.html",S_OK,FALSE},
3385 {"file",S_OK,FALSE},
3390 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3392 {URL_SCHEME_FILE,S_OK,FALSE},
3393 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3396 /* The backslashes after the scheme name are converted to forward slashes. */
3397 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3399 {"file://c:\\dir\\index.html",S_OK,FALSE},
3401 {"file://c:\\dir\\index.html",S_OK,FALSE},
3403 {".html",S_OK,FALSE},
3407 {"c:\\dir\\index.html",S_OK,FALSE},
3408 {"c:\\dir\\index.html",S_OK,FALSE},
3410 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3411 {"file",S_OK,FALSE},
3416 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3418 {URL_SCHEME_FILE,S_OK,FALSE},
3419 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3422 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3424 {"file:///c:/dir/index.html",S_OK,FALSE},
3426 {"file:///c:/dir/index.html",S_OK,FALSE},
3428 {".html",S_OK,FALSE},
3432 {"/c:/dir/index.html",S_OK,FALSE},
3433 {"/c:/dir/index.html",S_OK,FALSE},
3435 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3436 {"file",S_OK,FALSE},
3441 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3443 {URL_SCHEME_FILE,S_OK,FALSE},
3444 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3447 { "http:\\\\google.com", 0, S_OK, FALSE,
3449 {"http://google.com/",S_OK,FALSE},
3450 {"google.com",S_OK,FALSE},
3451 {"http://google.com/",S_OK,FALSE},
3452 {"google.com",S_OK,FALSE},
3455 {"google.com",S_OK,FALSE},
3460 {"http:\\\\google.com",S_OK,FALSE},
3461 {"http",S_OK,FALSE},
3466 {Uri_HOST_DNS,S_OK,FALSE},
3468 {URL_SCHEME_HTTP,S_OK,FALSE},
3469 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3472 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3473 { "zip:\\\\google.com", 0, S_OK, FALSE,
3475 {"zip:\\\\google.com",S_OK,FALSE},
3477 {"zip:\\\\google.com",S_OK,FALSE},
3479 {".com",S_OK,FALSE},
3483 {"\\\\google.com",S_OK,FALSE},
3484 {"\\\\google.com",S_OK,FALSE},
3486 {"zip:\\\\google.com",S_OK,FALSE},
3492 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3494 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3495 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3498 /* Dot segments aren't removed. */
3499 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3501 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3503 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3505 {".html",S_OK,FALSE},
3509 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3510 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3512 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3513 {"file",S_OK,FALSE},
3518 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3520 {URL_SCHEME_FILE,S_OK,FALSE},
3521 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3524 /* Forbidden characters aren't percent encoded. */
3525 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3527 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3529 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3531 {".html",S_OK,FALSE},
3535 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3536 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3538 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3539 {"file",S_OK,FALSE},
3544 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3546 {URL_SCHEME_FILE,S_OK,FALSE},
3547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3550 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3551 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3555 {"file:c:/dir/../../index.html",S_OK,FALSE},
3557 {".html",S_OK,FALSE},
3561 {"c:/dir/../../index.html",S_OK,FALSE},
3562 {"c:/dir/../../index.html",S_OK,FALSE},
3564 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3565 {"file",S_OK,FALSE},
3570 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3572 {URL_SCHEME_FILE,S_OK,FALSE},
3573 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3576 /* '/' are still converted to '\' even though it's an opaque URI. */
3577 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3581 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3583 {".html",S_OK,FALSE},
3587 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3588 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3590 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3591 {"file",S_OK,FALSE},
3596 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3598 {URL_SCHEME_FILE,S_OK,FALSE},
3599 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3602 /* Forbidden characters aren't percent encoded. */
3603 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3607 {"file:c:\\in^|dex.html",S_OK,FALSE},
3609 {".html",S_OK,FALSE},
3613 {"c:\\in^|dex.html",S_OK,FALSE},
3614 {"c:\\in^|dex.html",S_OK,FALSE},
3616 {"file:c:\\in^|dex.html",S_OK,FALSE},
3617 {"file",S_OK,FALSE},
3622 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3624 {URL_SCHEME_FILE,S_OK,FALSE},
3625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3628 /* Doesn't have a UserName since the ':' appears at the beginning of the
3631 { "http://:password@gov.uk", 0, S_OK, FALSE,
3633 {"http://:password@gov.uk/",S_OK,FALSE},
3634 {":password@gov.uk",S_OK,FALSE},
3635 {"http://gov.uk/",S_OK,FALSE},
3639 {"gov.uk",S_OK,FALSE},
3640 {"password",S_OK,FALSE},
3644 {"http://:password@gov.uk",S_OK,FALSE},
3645 {"http",S_OK,FALSE},
3646 {":password",S_OK,FALSE},
3650 {Uri_HOST_DNS,S_OK,FALSE},
3652 {URL_SCHEME_HTTP,S_OK,FALSE},
3653 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3656 /* Has a UserName since the userinfo section doesn't contain a password. */
3657 { "http://@gov.uk", 0, S_OK, FALSE,
3659 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3660 {"@gov.uk",S_OK,FALSE},
3661 {"http://gov.uk/",S_OK,FALSE},
3665 {"gov.uk",S_OK,FALSE},
3670 {"http://@gov.uk",S_OK,FALSE},
3671 {"http",S_OK,FALSE},
3676 {Uri_HOST_DNS,S_OK,FALSE},
3678 {URL_SCHEME_HTTP,S_OK,FALSE},
3679 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3682 /* ":@" not included in the absolute URI. */
3683 { "http://:@gov.uk", 0, S_OK, FALSE,
3685 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3686 {":@gov.uk",S_OK,FALSE},
3687 {"http://gov.uk/",S_OK,FALSE},
3691 {"gov.uk",S_OK,FALSE},
3696 {"http://:@gov.uk",S_OK,FALSE},
3697 {"http",S_OK,FALSE},
3702 {Uri_HOST_DNS,S_OK,FALSE},
3704 {URL_SCHEME_HTTP,S_OK,FALSE},
3705 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3708 /* '@' is included because it's an unknown scheme type. */
3709 { "zip://@gov.uk", 0, S_OK, FALSE,
3711 {"zip://@gov.uk/",S_OK,FALSE},
3712 {"@gov.uk",S_OK,FALSE},
3713 {"zip://@gov.uk/",S_OK,FALSE},
3717 {"gov.uk",S_OK,FALSE},
3722 {"zip://@gov.uk",S_OK,FALSE},
3728 {Uri_HOST_DNS,S_OK,FALSE},
3730 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3731 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3734 /* ":@" are included because it's an unknown scheme type. */
3735 { "zip://:@gov.uk", 0, S_OK, FALSE,
3737 {"zip://:@gov.uk/",S_OK,FALSE},
3738 {":@gov.uk",S_OK,FALSE},
3739 {"zip://:@gov.uk/",S_OK,FALSE},
3743 {"gov.uk",S_OK,FALSE},
3748 {"zip://:@gov.uk",S_OK,FALSE},
3754 {Uri_HOST_DNS,S_OK,FALSE},
3756 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3757 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3760 { "about:blank", 0, S_OK, FALSE,
3762 {"about:blank",S_OK,FALSE},
3764 {"about:blank",S_OK,FALSE},
3770 {"blank",S_OK,FALSE},
3771 {"blank",S_OK,FALSE},
3773 {"about:blank",S_OK,FALSE},
3774 {"about",S_OK,FALSE},
3779 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3781 {URL_SCHEME_ABOUT,S_OK,FALSE},
3782 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3785 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3787 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3789 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3791 {".htm",S_OK,FALSE},
3795 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3796 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3798 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3804 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3806 {URL_SCHEME_MK,S_OK,FALSE},
3807 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3810 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3812 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3814 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3816 {".htm",S_OK,FALSE},
3820 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3821 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3823 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3829 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3831 {URL_SCHEME_MK,S_OK,FALSE},
3832 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3835 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3836 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3838 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3839 {"server",S_OK,FALSE},
3840 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3842 {".html",S_OK,FALSE},
3844 {"server",S_OK,FALSE},
3846 {"\\dir\\index.html",S_OK,FALSE},
3847 {"\\dir\\index.html",S_OK,FALSE},
3849 {"file://server/dir/index.html",S_OK,FALSE},
3850 {"file",S_OK,FALSE},
3855 {Uri_HOST_DNS,S_OK,FALSE},
3857 {URL_SCHEME_FILE,S_OK,FALSE},
3858 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3861 /* When CreateUri generates an IUri, it still displays the default port in the
3864 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3866 {"http://google.com:80/",S_OK,FALSE},
3867 {"google.com:80",S_OK,FALSE},
3868 {"http://google.com:80/",S_OK,FALSE},
3869 {"google.com",S_OK,FALSE},
3872 {"google.com",S_OK,FALSE},
3877 {"http://google.com:80/",S_OK,FALSE},
3878 {"http",S_OK,FALSE},
3883 {Uri_HOST_DNS,S_OK,FALSE},
3885 {URL_SCHEME_HTTP,S_OK,FALSE},
3886 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3889 /* For res URIs the host is everything up until the first '/'. */
3890 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3892 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3893 {"C:\\dir\\file.exe",S_OK,FALSE},
3894 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3896 {".html",S_OK,FALSE},
3898 {"C:\\dir\\file.exe",S_OK,FALSE},
3900 {"/DATA/test.html",S_OK,FALSE},
3901 {"/DATA/test.html",S_OK,FALSE},
3903 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3909 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3911 {URL_SCHEME_RES,S_OK,FALSE},
3912 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3915 /* Res URI can contain a '|' in the host name. */
3916 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3918 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3919 {"c:\\di|r\\file.exe",S_OK,FALSE},
3920 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3924 {"c:\\di|r\\file.exe",S_OK,FALSE},
3926 {"/test",S_OK,FALSE},
3927 {"/test",S_OK,FALSE},
3929 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3935 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3937 {URL_SCHEME_RES,S_OK,FALSE},
3938 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3941 /* Res URIs can have invalid percent encoded values. */
3942 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3944 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3945 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3946 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3950 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3952 {"/test",S_OK,FALSE},
3953 {"/test",S_OK,FALSE},
3955 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3961 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3963 {URL_SCHEME_RES,S_OK,FALSE},
3964 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3967 /* Res doesn't get forbidden characters percent encoded in it's path. */
3968 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3970 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3971 {"c:\\test",S_OK,FALSE},
3972 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3976 {"c:\\test",S_OK,FALSE},
3978 {"/tes<|>t",S_OK,FALSE},
3979 {"/tes<|>t",S_OK,FALSE},
3981 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3987 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3989 {URL_SCHEME_RES,S_OK,FALSE},
3990 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3993 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
3995 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
3997 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
3999 {".jpg",S_OK,FALSE},
4003 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4004 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4006 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4012 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4014 {URL_SCHEME_MK,S_OK,FALSE},
4015 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4018 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4020 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4022 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4024 {".jpg",S_OK,FALSE},
4028 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4029 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4031 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4037 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4039 {URL_SCHEME_MK,S_OK,FALSE},
4040 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4043 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4045 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4047 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4049 {".jpg",S_OK,FALSE},
4053 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4054 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4056 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4062 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4064 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4065 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4068 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4070 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4072 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4074 {".jpg",S_OK,FALSE},
4078 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4079 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4081 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4087 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4089 {URL_SCHEME_MK,S_OK,FALSE},
4090 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4093 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4095 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4097 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4099 {".jpg",S_OK,FALSE},
4103 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4104 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4106 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4112 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4114 {URL_SCHEME_MK,S_OK,FALSE},
4115 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4118 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4120 {"mk:images/xxx.jpg",S_OK,FALSE},
4122 {"mk:images/xxx.jpg",S_OK,FALSE},
4124 {".jpg",S_OK,FALSE},
4128 {"images/xxx.jpg",S_OK,FALSE},
4129 {"images/xxx.jpg",S_OK,FALSE},
4131 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4137 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4139 {URL_SCHEME_MK,S_OK,FALSE},
4140 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4145 typedef struct _invalid_uri {
4151 static const invalid_uri invalid_uri_tests[] = {
4152 /* Has to have a scheme name. */
4153 {"://www.winehq.org",0,FALSE},
4154 /* Window's doesn't like URI's which are implicitly file paths without the
4155 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4157 {"C:/test/test.mp3",0,FALSE},
4158 {"\\\\Server/test/test.mp3",0,FALSE},
4159 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4160 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4161 /* Invalid schemes. */
4162 {"*abcd://not.valid.com",0,FALSE},
4163 {"*a*b*c*d://not.valid.com",0,FALSE},
4164 /* Not allowed to have invalid % encoded data. */
4165 {"ftp://google.co%XX/",0,FALSE},
4166 /* To many h16 components. */
4167 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4168 /* Not enough room for IPv4 address. */
4169 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4170 /* Not enough h16 components. */
4171 {"http://[1:2:3:4]",0,FALSE},
4172 /* Not enough components including IPv4. */
4173 {"http://[1:192.0.1.0]",0,FALSE},
4174 /* Not allowed to have partial IPv4 in IPv6. */
4175 {"http://[::192.0]",0,FALSE},
4176 /* Can't have elision of 1 h16 at beginning of address. */
4177 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4178 /* Can't have elision of 1 h16 at end of address. */
4179 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4180 /* Expects a valid IP Literal. */
4181 {"ftp://[not.valid.uri]/",0,FALSE},
4182 /* Expects valid port for a known scheme type. */
4183 {"ftp://www.winehq.org:123fgh",0,FALSE},
4184 /* Port exceeds USHORT_MAX for known scheme type. */
4185 {"ftp://www.winehq.org:65536",0,FALSE},
4186 /* Invalid port with IPv4 address. */
4187 {"http://www.winehq.org:1abcd",0,FALSE},
4188 /* Invalid port with IPv6 address. */
4189 {"http://[::ffff]:32xy",0,FALSE},
4190 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4191 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4192 /* Not allowed to have invalid % encoded data in opaque URI path. */
4193 {"news:test%XX",0,FALSE},
4194 {"mailto:wine@winehq%G8.com",0,FALSE},
4195 /* Known scheme types can't have invalid % encoded data in query string. */
4196 {"http://google.com/?query=te%xx",0,FALSE},
4197 /* Invalid % encoded data in fragment of know scheme type. */
4198 {"ftp://google.com/#Test%xx",0,FALSE},
4199 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4200 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4201 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4202 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4203 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4204 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4205 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4206 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4207 /* res URIs aren't allowed to have forbidden dos path characters in the
4210 {"res://c:\\te<st\\test/test",0,FALSE},
4211 {"res://c:\\te>st\\test/test",0,FALSE},
4212 {"res://c:\\te\"st\\test/test",0,FALSE},
4213 {"res://c:\\test/te%xxst",0,FALSE}
4216 typedef struct _uri_equality {
4218 DWORD create_flags_a;
4221 DWORD create_flags_b;
4227 static const uri_equality equality_tests[] = {
4229 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4230 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4234 /* http://www.winehq.org/test%20dir */
4235 "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,
4236 "http://www.winehq.org/test dir",0,FALSE,
4240 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4241 "file:///c:/test.mp3",0,FALSE,
4245 "ftp://ftp.winehq.org/",0,FALSE,
4246 "ftp://ftp.winehq.org",0,FALSE,
4250 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4251 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4255 "http://google.com/TEST",0,FALSE,
4256 "http://google.com/test",0,FALSE,
4260 "http://GOOGLE.com/",0,FALSE,
4261 "http://google.com/",0,FALSE,
4264 /* Performs case insensitive compare of host names (for known scheme types). */
4266 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4267 "ftp://google.com/",0,FALSE,
4271 "zip://GOOGLE.com/",0,FALSE,
4272 "zip://google.com/",0,FALSE,
4276 "file:///c:/TEST/TeST/",0,FALSE,
4277 "file:///c:/test/test/",0,FALSE,
4281 "file:///server/TEST",0,FALSE,
4282 "file:///SERVER/TEST",0,FALSE,
4286 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4287 "http://google.com/",0,FALSE,
4291 "ftp://google.com:21/",0,FALSE,
4292 "ftp://google.com/",0,FALSE,
4296 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4297 "http://google.com/",0,FALSE,
4301 "http://google.com:70/",0,FALSE,
4302 "http://google.com:71/",0,FALSE,
4307 typedef struct _uri_with_fragment {
4309 const char* fragment;
4311 HRESULT create_expected;
4314 const char* expected_uri;
4316 } uri_with_fragment;
4318 static const uri_with_fragment uri_fragment_tests[] = {
4320 "http://google.com/","#fragment",0,S_OK,FALSE,
4321 "http://google.com/#fragment",FALSE
4324 "http://google.com/","fragment",0,S_OK,FALSE,
4325 "http://google.com/#fragment",FALSE
4328 "zip://test.com/","?test",0,S_OK,FALSE,
4329 "zip://test.com/#?test",FALSE
4331 /* The fragment can be empty. */
4333 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4334 "ftp://ftp.google.com/#",FALSE
4338 typedef struct _uri_builder_property {
4341 const char *expected_value;
4342 Uri_PROPERTY property;
4345 } uri_builder_property;
4347 typedef struct _uri_builder_port {
4355 typedef struct _uri_builder_str_property {
4356 const char* expected;
4359 } uri_builder_str_property;
4361 typedef struct _uri_builder_dword_property {
4365 } uri_builder_dword_property;
4367 typedef struct _uri_builder_test {
4370 HRESULT create_builder_expected;
4371 BOOL create_builder_todo;
4373 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4375 uri_builder_port port_prop;
4381 DWORD uri_simple_encode_flags;
4382 HRESULT uri_simple_hres;
4383 BOOL uri_simple_todo;
4385 DWORD uri_with_flags;
4386 DWORD uri_with_builder_flags;
4387 DWORD uri_with_encode_flags;
4388 HRESULT uri_with_hres;
4391 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4392 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4395 static const uri_builder_test uri_builder_tests[] = {
4396 { "http://google.com/",0,S_OK,FALSE,
4398 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4399 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4400 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4401 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4408 {"http://username:password@google.com/?query=x#fragment",S_OK},
4409 {"username:password@google.com",S_OK},
4410 {"http://google.com/?query=x#fragment",S_OK},
4411 {"google.com",S_OK},
4414 {"google.com",S_OK},
4419 {"http://username:password@google.com/?query=x#fragment",S_OK},
4421 {"username:password",S_OK},
4425 {Uri_HOST_DNS,S_OK},
4427 {URL_SCHEME_HTTP,S_OK},
4428 {URLZONE_INVALID,E_NOTIMPL}
4431 { "http://google.com/",0,S_OK,FALSE,
4433 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4435 {TRUE,TRUE,120,S_OK,FALSE},
4440 {"test://google.com:120/",S_OK},
4441 {"google.com:120",S_OK},
4442 {"test://google.com:120/",S_OK},
4443 {"google.com",S_OK},
4446 {"google.com",S_OK},
4451 {"test://google.com:120/",S_OK},
4457 {Uri_HOST_DNS,S_OK},
4459 {URL_SCHEME_UNKNOWN,S_OK},
4460 {URLZONE_INVALID,E_NOTIMPL}
4463 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4465 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4466 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4467 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4474 {"http://[::192.2.3.4]/",S_OK},
4475 {"[::192.2.3.4]",S_OK},
4476 {"http://[::192.2.3.4]/",S_OK},
4480 {"::192.2.3.4",S_OK},
4485 {"http://[::192.2.3.4]/",S_OK},
4491 {Uri_HOST_IPV6,S_OK},
4493 {URL_SCHEME_HTTP,S_OK},
4494 {URLZONE_INVALID,E_NOTIMPL}
4497 { "http://google.com/",0,S_OK,FALSE,
4499 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4506 {"http://google.com/#Frag",S_OK},
4507 {"google.com",S_OK},
4508 {"http://google.com/#Frag",S_OK},
4509 {"google.com",S_OK},
4512 {"google.com",S_OK},
4517 {"http://google.com/#Frag",S_OK},
4523 {Uri_HOST_DNS,S_OK},
4525 {URL_SCHEME_HTTP,S_OK},
4526 {URLZONE_INVALID,E_NOTIMPL}
4529 { "http://google.com/",0,S_OK,FALSE,
4531 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4538 {"http://google.com/#",S_OK},
4539 {"google.com",S_OK},
4540 {"http://google.com/#",S_OK},
4541 {"google.com",S_OK},
4544 {"google.com",S_OK},
4549 {"http://google.com/#",S_OK},
4555 {Uri_HOST_DNS,S_OK},
4557 {URL_SCHEME_HTTP,S_OK},
4558 {URLZONE_INVALID,E_NOTIMPL}
4561 { "http://google.com/",0,S_OK,FALSE,
4563 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4570 {"http://::password@google.com/",S_OK},
4571 {"::password@google.com",S_OK},
4572 {"http://google.com/",S_OK},
4573 {"google.com",S_OK},
4576 {"google.com",S_OK},
4581 {"http://::password@google.com/",S_OK},
4583 {"::password",S_OK},
4587 {Uri_HOST_DNS,S_OK},
4589 {URL_SCHEME_HTTP,S_OK},
4590 {URLZONE_INVALID,E_NOTIMPL}
4593 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4595 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4598 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4600 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4602 {":password@test/test",S_OK},
4603 {":password@",S_OK},
4604 {":password@test/test",S_OK},
4613 {":password@test/test",S_OK},
4619 {Uri_HOST_UNKNOWN,S_OK},
4621 {URL_SCHEME_UNKNOWN,S_OK},
4622 {URLZONE_INVALID,E_NOTIMPL}
4625 { "http://google.com/",0,S_OK,FALSE,
4627 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4634 {"http://google.com/test/test",S_OK},
4635 {"google.com",S_OK},
4636 {"http://google.com/test/test",S_OK},
4637 {"google.com",S_OK},
4640 {"google.com",S_OK},
4642 {"/test/test",S_OK},
4643 {"/test/test",S_OK},
4645 {"http://google.com/test/test",S_OK},
4651 {Uri_HOST_DNS,S_OK},
4653 {URL_SCHEME_HTTP,S_OK},
4654 {URLZONE_INVALID,E_NOTIMPL}
4657 { "zip:testing/test",0,S_OK,FALSE,
4659 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4683 {Uri_HOST_UNKNOWN,S_OK},
4685 {URL_SCHEME_UNKNOWN,S_OK},
4686 {URLZONE_INVALID,E_NOTIMPL}
4689 { "http://google.com/",0,S_OK,FALSE,
4693 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4694 {TRUE,FALSE,555,S_OK,FALSE},
4699 {"http://google.com/",S_OK},
4700 {"google.com",S_OK},
4701 {"http://google.com/",S_OK},
4702 {"google.com",S_OK},
4705 {"google.com",S_OK},
4710 {"http://google.com/",S_OK},
4716 {Uri_HOST_DNS,S_OK},
4717 /* Still returns 80, even though earlier the port was disabled. */
4719 {URL_SCHEME_HTTP,S_OK},
4720 {URLZONE_INVALID,E_NOTIMPL}
4723 { "http://google.com/",0,S_OK,FALSE,
4727 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4728 * you'll get 122345 instead.
4730 {TRUE,122345,222,S_OK,FALSE},
4735 {"http://google.com:222/",S_OK},
4736 {"google.com:222",S_OK},
4737 {"http://google.com:222/",S_OK},
4738 {"google.com",S_OK},
4741 {"google.com",S_OK},
4746 {"http://google.com:222/",S_OK},
4752 {Uri_HOST_DNS,S_OK},
4754 {URL_SCHEME_HTTP,S_OK},
4755 {URLZONE_INVALID,E_NOTIMPL}
4758 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4759 { "http://google.com/",0,S_OK,FALSE,
4763 {TRUE,TRUE,999999,S_OK,FALSE},
4768 {"http://google.com:999999/",S_OK},
4769 {"google.com:999999",S_OK},
4770 {"http://google.com:999999/",S_OK},
4771 {"google.com",S_OK},
4774 {"google.com",S_OK},
4779 {"http://google.com:999999/",S_OK},
4785 {Uri_HOST_DNS,S_OK},
4787 {URL_SCHEME_HTTP,S_OK},
4788 {URLZONE_INVALID,E_NOTIMPL}
4791 { "http://google.com/",0,S_OK,FALSE,
4793 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
4801 {"http://google.com/?test",S_OK},
4802 {"google.com",S_OK},
4803 {"http://google.com/?test",S_OK},
4804 {"google.com",S_OK},
4807 {"google.com",S_OK},
4812 {"http://google.com/?test",S_OK},
4818 {Uri_HOST_DNS,S_OK},
4820 {URL_SCHEME_HTTP,S_OK},
4821 {URLZONE_INVALID,E_NOTIMPL}
4824 { "http://:password@google.com/",0,S_OK,FALSE,
4833 {"http://:password@google.com/",S_OK},
4834 {":password@google.com",S_OK},
4835 {"http://google.com/",S_OK},
4836 {"google.com",S_OK},
4839 {"google.com",S_OK},
4844 {"http://:password@google.com/",S_OK},
4850 {Uri_HOST_DNS,S_OK},
4852 {URL_SCHEME_HTTP,S_OK},
4853 {URLZONE_INVALID,E_NOTIMPL}
4856 /* IUriBuilder doesn't need a base IUri to build a IUri. */
4857 { NULL,0,S_OK,FALSE,
4859 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4860 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4867 {"http://google.com/",S_OK},
4868 {"google.com",S_OK},
4869 {"http://google.com/",S_OK},
4870 {"google.com",S_OK},
4873 {"google.com",S_OK},
4878 {"http://google.com/",S_OK},
4884 {Uri_HOST_DNS,S_OK},
4886 {URL_SCHEME_HTTP,S_OK},
4887 {URLZONE_INVALID,E_NOTIMPL}
4890 /* Can't set the scheme name to NULL. */
4891 { "zip://google.com/",0,S_OK,FALSE,
4893 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4900 {"zip://google.com/",S_OK},
4901 {"google.com",S_OK},
4902 {"zip://google.com/",S_OK},
4903 {"google.com",S_OK},
4906 {"google.com",S_OK},
4911 {"zip://google.com/",S_OK},
4917 {Uri_HOST_DNS,S_OK},
4919 {URL_SCHEME_UNKNOWN,S_OK},
4920 {URLZONE_INVALID,E_NOTIMPL}
4923 /* Can't set the scheme name to an empty string. */
4924 { "zip://google.com/",0,S_OK,FALSE,
4926 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4933 {"zip://google.com/",S_OK},
4934 {"google.com",S_OK},
4935 {"zip://google.com/",S_OK},
4936 {"google.com",S_OK},
4939 {"google.com",S_OK},
4944 {"zip://google.com/",S_OK},
4950 {Uri_HOST_DNS,S_OK},
4952 {URL_SCHEME_UNKNOWN,S_OK},
4953 {URLZONE_INVALID,E_NOTIMPL}
4956 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
4957 * CreateUriSimple always uses the flags the base IUri was created with (if any).
4959 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
4964 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4966 {"http://google.com/../../",S_OK},
4967 {"google.com",S_OK},
4968 {"http://google.com/../../",S_OK},
4969 {"google.com",S_OK},
4972 {"google.com",S_OK},
4977 {"http://google.com/../../",S_OK},
4983 {Uri_HOST_DNS,S_OK},
4985 {URL_SCHEME_HTTP,S_OK},
4986 {URLZONE_INVALID,E_NOTIMPL}
4989 { "http://google.com/",0,S_OK,FALSE,
4991 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4996 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4998 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4999 {"google.com",S_OK},
5000 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5001 {"google.com",S_OK},
5003 {"#Fr%3C%7C%3Eg",S_OK},
5004 {"google.com",S_OK},
5009 {"http://google.com/#Fr<|>g",S_OK},
5015 {Uri_HOST_DNS,S_OK},
5017 {URL_SCHEME_HTTP,S_OK},
5018 {URLZONE_INVALID,E_NOTIMPL}
5021 { "http://google.com/",0,S_OK,FALSE,
5023 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5026 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5028 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5030 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5031 {"google.com",S_OK},
5032 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5033 {"google.com",S_OK},
5035 {"#Fr%3C%7C%3Eg",S_OK},
5036 {"google.com",S_OK},
5041 {"http://google.com/#Fr<|>g",S_OK},
5047 {Uri_HOST_DNS,S_OK},
5049 {URL_SCHEME_HTTP,S_OK},
5050 {URLZONE_INVALID,E_NOTIMPL}
5053 { NULL,0,S_OK,FALSE,
5055 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5056 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5059 0,INET_E_INVALID_URL,FALSE,
5060 0,INET_E_INVALID_URL,FALSE,
5061 0,0,0,INET_E_INVALID_URL,FALSE
5063 { "http://google.com/",0,S_OK,FALSE,
5065 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5068 0,INET_E_INVALID_URL,FALSE,
5069 0,INET_E_INVALID_URL,FALSE,
5070 0,0,0,INET_E_INVALID_URL,FALSE
5072 /* File scheme's can't have a username set. */
5073 { "file://google.com/",0,S_OK,FALSE,
5075 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5078 0,INET_E_INVALID_URL,FALSE,
5079 0,INET_E_INVALID_URL,FALSE,
5080 0,0,0,INET_E_INVALID_URL,FALSE
5082 /* File schemes can't have a password set. */
5083 { "file://google.com/",0,S_OK,FALSE,
5085 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5088 0,INET_E_INVALID_URL,FALSE,
5089 0,INET_E_INVALID_URL,FALSE,
5090 0,0,0,INET_E_INVALID_URL,FALSE
5092 /* UserName can't contain any character that is a delimeter for another
5093 * component that appears after it in a normal URI.
5095 { "http://google.com/",0,S_OK,FALSE,
5097 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5100 0,INET_E_INVALID_URL,FALSE,
5101 0,INET_E_INVALID_URL,FALSE,
5102 0,0,0,INET_E_INVALID_URL,FALSE
5104 { "http://google.com/",0,S_OK,FALSE,
5106 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5109 0,INET_E_INVALID_URL,FALSE,
5110 0,INET_E_INVALID_URL,FALSE,
5111 0,0,0,INET_E_INVALID_URL,FALSE
5113 { "http://google.com/",0,S_OK,FALSE,
5115 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5118 0,INET_E_INVALID_URL,FALSE,
5119 0,INET_E_INVALID_URL,FALSE,
5120 0,0,0,INET_E_INVALID_URL,FALSE
5122 { "http://google.com/",0,S_OK,FALSE,
5124 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5127 0,INET_E_INVALID_URL,FALSE,
5128 0,INET_E_INVALID_URL,FALSE,
5129 0,0,0,INET_E_INVALID_URL,FALSE
5131 { "http://google.com/",0,S_OK,FALSE,
5133 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5136 0,INET_E_INVALID_URL,FALSE,
5137 0,INET_E_INVALID_URL,FALSE,
5138 0,0,0,INET_E_INVALID_URL,FALSE
5140 { "http://google.com/",0,S_OK,FALSE,
5142 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5145 0,INET_E_INVALID_URL,FALSE,
5146 0,INET_E_INVALID_URL,FALSE,
5147 0,0,0,INET_E_INVALID_URL,FALSE
5149 { "http://google.com/",0,S_OK,FALSE,
5151 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5154 0,INET_E_INVALID_URL,FALSE,
5155 0,INET_E_INVALID_URL,FALSE,
5156 0,0,0,INET_E_INVALID_URL,FALSE
5158 { "http://google.com/",0,S_OK,FALSE,
5160 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5163 0,INET_E_INVALID_URL,FALSE,
5164 0,INET_E_INVALID_URL,FALSE,
5165 0,0,0,INET_E_INVALID_URL,FALSE
5167 { "http://google.com/",0,S_OK,FALSE,
5169 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5172 0,INET_E_INVALID_URL,FALSE,
5173 0,INET_E_INVALID_URL,FALSE,
5174 0,0,0,INET_E_INVALID_URL,FALSE
5176 { "http://google.com/",0,S_OK,FALSE,
5178 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5181 0,INET_E_INVALID_URL,FALSE,
5182 0,INET_E_INVALID_URL,FALSE,
5183 0,0,0,INET_E_INVALID_URL,FALSE
5185 { "http://google.com/",0,S_OK,FALSE,
5187 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5190 0,INET_E_INVALID_URL,FALSE,
5191 0,INET_E_INVALID_URL,FALSE,
5192 0,0,0,INET_E_INVALID_URL,FALSE
5194 { "http://google.com/",0,S_OK,FALSE,
5196 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5199 0,INET_E_INVALID_URL,FALSE,
5200 0,INET_E_INVALID_URL,FALSE,
5201 0,0,0,INET_E_INVALID_URL,FALSE
5203 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5204 { "http://google.com/",0,S_OK,FALSE,
5206 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5213 {"http://winehq.org:test/",S_OK},
5214 {"winehq.org:test",S_OK},
5215 {"http://winehq.org:test/",S_OK},
5216 {"winehq.org:test",S_OK},
5219 {"winehq.org:test",S_OK},
5224 {"http://winehq.org:test/",S_OK},
5230 {Uri_HOST_DNS,S_OK},
5232 {URL_SCHEME_HTTP,S_OK},
5233 {URLZONE_INVALID,E_NOTIMPL}
5236 /* Can't set the host name to NULL. */
5237 { "http://google.com/",0,S_OK,FALSE,
5239 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5246 {"http://google.com/",S_OK},
5247 {"google.com",S_OK},
5248 {"http://google.com/",S_OK},
5249 {"google.com",S_OK},
5252 {"google.com",S_OK},
5257 {"http://google.com/",S_OK},
5263 {Uri_HOST_DNS,S_OK},
5265 {URL_SCHEME_HTTP,S_OK},
5266 {URLZONE_INVALID,E_NOTIMPL}
5269 /* Can set the host name to an empty string. */
5270 { "http://google.com/",0,S_OK,FALSE,
5272 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5296 {Uri_HOST_UNKNOWN,S_OK},
5298 {URL_SCHEME_HTTP,S_OK},
5299 {URLZONE_INVALID,E_NOTIMPL}
5302 { "http://google.com/",0,S_OK,FALSE,
5304 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5307 0,INET_E_INVALID_URL,FALSE,
5308 0,INET_E_INVALID_URL,FALSE,
5309 0,0,0,INET_E_INVALID_URL,FALSE
5311 { "http://google.com/",0,S_OK,FALSE,
5313 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5316 0,INET_E_INVALID_URL,FALSE,
5317 0,INET_E_INVALID_URL,FALSE,
5318 0,0,0,INET_E_INVALID_URL,FALSE
5320 { "http://google.com/",0,S_OK,FALSE,
5322 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5325 0,INET_E_INVALID_URL,FALSE,
5326 0,INET_E_INVALID_URL,FALSE,
5327 0,0,0,INET_E_INVALID_URL,FALSE
5331 typedef struct _uri_builder_remove_test {
5334 HRESULT create_builder_expected;
5335 BOOL create_builder_todo;
5337 DWORD remove_properties;
5338 HRESULT remove_expected;
5341 const char *expected_uri;
5342 DWORD expected_flags;
5343 HRESULT expected_hres;
5345 } uri_builder_remove_test;
5347 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5348 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5349 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5350 "http://google.com/",0,S_OK,FALSE
5352 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5353 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5354 "http://winehq.org/",0,S_OK,FALSE
5356 { "zip://google.com?Test=x",0,S_OK,FALSE,
5357 Uri_HAS_HOST,S_OK,FALSE,
5358 "zip:/?Test=x",0,S_OK,FALSE
5360 /* Doesn't remove the whole userinfo component. */
5361 { "http://username:pass@google.com/",0,S_OK,FALSE,
5362 Uri_HAS_USER_INFO,S_OK,FALSE,
5363 "http://username:pass@google.com/",0,S_OK,FALSE
5365 /* Doesn't remove the domain. */
5366 { "http://google.com/",0,S_OK,FALSE,
5367 Uri_HAS_DOMAIN,S_OK,FALSE,
5368 "http://google.com/",0,S_OK,FALSE
5370 { "http://google.com:120/",0,S_OK,FALSE,
5371 Uri_HAS_AUTHORITY,S_OK,FALSE,
5372 "http://google.com:120/",0,S_OK,FALSE
5374 { "http://google.com/test.com/",0,S_OK,FALSE,
5375 Uri_HAS_EXTENSION,S_OK,FALSE,
5376 "http://google.com/test.com/",0,S_OK,FALSE
5378 { "http://google.com/?test=x",0,S_OK,FALSE,
5379 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5380 "http://google.com/?test=x",0,S_OK,FALSE
5382 /* Can't remove the scheme name. */
5383 { "http://google.com/?test=x",0,S_OK,FALSE,
5384 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5385 "http://google.com/?test=x",0,S_OK,FALSE
5389 typedef struct _uri_combine_str_property {
5393 const char *broken_value;
5394 const char *value_ex;
5395 } uri_combine_str_property;
5397 typedef struct _uri_combine_test {
5398 const char *base_uri;
5399 DWORD base_create_flags;
5400 const char *relative_uri;
5401 DWORD relative_create_flags;
5402 DWORD combine_flags;
5406 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5407 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5410 static const uri_combine_test uri_combine_tests[] = {
5411 { "http://google.com/fun/stuff",0,
5412 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5415 {"http://google.com/not/fun/stuff",S_OK},
5416 {"google.com",S_OK},
5417 {"http://google.com/not/fun/stuff",S_OK},
5418 {"google.com",S_OK},
5421 {"google.com",S_OK},
5423 {"/not/fun/stuff",S_OK},
5424 {"/not/fun/stuff",S_OK},
5426 {"http://google.com/not/fun/stuff",S_OK},
5432 {Uri_HOST_DNS,S_OK},
5434 {URL_SCHEME_HTTP,S_OK},
5435 {URLZONE_INVALID,E_NOTIMPL}
5438 { "http://google.com/test",0,
5439 "zip://test.com/cool",0,
5442 {"zip://test.com/cool",S_OK},
5444 {"zip://test.com/cool",S_OK},
5453 {"zip://test.com/cool",S_OK},
5459 {Uri_HOST_DNS,S_OK},
5461 {URL_SCHEME_UNKNOWN,S_OK},
5462 {URLZONE_INVALID,E_NOTIMPL}
5465 { "http://google.com/use/base/path",0,
5466 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5469 {"http://google.com/use/base/path?relative",S_OK},
5470 {"google.com",S_OK},
5471 {"http://google.com/use/base/path?relative",S_OK},
5472 {"google.com",S_OK},
5475 {"google.com",S_OK},
5477 {"/use/base/path",S_OK},
5478 {"/use/base/path?relative",S_OK},
5480 {"http://google.com/use/base/path?relative",S_OK},
5486 {Uri_HOST_DNS,S_OK},
5488 {URL_SCHEME_HTTP,S_OK},
5489 {URLZONE_INVALID,E_NOTIMPL}
5492 { "http://google.com/path",0,
5493 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5496 {"http://google.com/testing",S_OK},
5497 {"google.com",S_OK},
5498 {"http://google.com/testing",S_OK},
5499 {"google.com",S_OK},
5502 {"google.com",S_OK},
5507 {"http://google.com/testing",S_OK},
5513 {Uri_HOST_DNS,S_OK},
5515 {URL_SCHEME_HTTP,S_OK},
5516 {URLZONE_INVALID,E_NOTIMPL}
5519 { "http://google.com/path",0,
5520 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5521 URL_DONT_SIMPLIFY,S_OK,FALSE,
5523 {"http://google.com:80/test/../test/.././testing",S_OK},
5524 {"google.com",S_OK},
5525 {"http://google.com:80/test/../test/.././testing",S_OK},
5526 {"google.com",S_OK},
5529 {"google.com",S_OK},
5531 {"/test/../test/.././testing",S_OK},
5532 {"/test/../test/.././testing",S_OK},
5534 {"http://google.com:80/test/../test/.././testing",S_OK},
5540 {Uri_HOST_DNS,S_OK},
5542 {URL_SCHEME_HTTP,S_OK},
5543 {URLZONE_INVALID,E_NOTIMPL}
5546 { "http://winehq.org/test/abc",0,
5547 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5550 {"http://winehq.org/test/testing/test",S_OK},
5551 {"winehq.org",S_OK},
5552 {"http://winehq.org/test/testing/test",S_OK},
5553 {"winehq.org",S_OK},
5556 {"winehq.org",S_OK},
5558 {"/test/testing/test",S_OK},
5559 {"/test/testing/test",S_OK},
5561 {"http://winehq.org/test/testing/test",S_OK},
5567 {Uri_HOST_DNS,S_OK},
5569 {URL_SCHEME_HTTP,S_OK},
5570 {URLZONE_INVALID,E_NOTIMPL}
5573 { "http://winehq.org/test/abc",0,
5574 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5575 URL_DONT_SIMPLIFY,S_OK,FALSE,
5577 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5578 /* Default port is hidden in the authority. */
5579 {"winehq.org",S_OK},
5580 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5581 {"winehq.org",S_OK},
5584 {"winehq.org",S_OK},
5586 {"/test/testing/abc/../test",S_OK},
5587 {"/test/testing/abc/../test",S_OK},
5589 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5595 {Uri_HOST_DNS,S_OK},
5597 {URL_SCHEME_HTTP,S_OK},
5598 {URLZONE_INVALID,E_NOTIMPL}
5601 { "http://winehq.org/test?query",0,
5602 "testing",Uri_CREATE_ALLOW_RELATIVE,
5605 {"http://winehq.org/testing",S_OK},
5606 {"winehq.org",S_OK},
5607 {"http://winehq.org/testing",S_OK},
5608 {"winehq.org",S_OK},
5611 {"winehq.org",S_OK},
5616 {"http://winehq.org/testing",S_OK},
5622 {Uri_HOST_DNS,S_OK},
5624 {URL_SCHEME_HTTP,S_OK},
5625 {URLZONE_INVALID,E_NOTIMPL}
5628 { "http://winehq.org/test#frag",0,
5629 "testing",Uri_CREATE_ALLOW_RELATIVE,
5632 {"http://winehq.org/testing",S_OK},
5633 {"winehq.org",S_OK},
5634 {"http://winehq.org/testing",S_OK},
5635 {"winehq.org",S_OK},
5638 {"winehq.org",S_OK},
5643 {"http://winehq.org/testing",S_OK},
5649 {Uri_HOST_DNS,S_OK},
5651 {URL_SCHEME_HTTP,S_OK},
5652 {URLZONE_INVALID,E_NOTIMPL}
5655 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5656 "test",Uri_CREATE_ALLOW_RELATIVE,
5676 {Uri_HOST_UNKNOWN,S_OK},
5678 {URL_SCHEME_UNKNOWN,S_OK},
5679 {URLZONE_INVALID,E_NOTIMPL}
5682 { "file:///c:/test/test",0,
5683 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5684 URL_FILE_USE_PATHURL,S_OK,FALSE,
5686 {"file://c:\\testing.mp3",S_OK},
5688 {"file://c:\\testing.mp3",S_OK},
5694 {"c:\\testing.mp3",S_OK},
5695 {"c:\\testing.mp3",S_OK},
5697 {"file://c:\\testing.mp3",S_OK},
5703 {Uri_HOST_UNKNOWN,S_OK},
5705 {URL_SCHEME_FILE,S_OK},
5706 {URLZONE_INVALID,E_NOTIMPL}
5709 { "file:///c:/test/test",0,
5710 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5713 {"file:///c:/testing.mp3",S_OK},
5715 {"file:///c:/testing.mp3",S_OK},
5721 {"/c:/testing.mp3",S_OK},
5722 {"/c:/testing.mp3",S_OK},
5724 {"file:///c:/testing.mp3",S_OK},
5730 {Uri_HOST_UNKNOWN,S_OK},
5732 {URL_SCHEME_FILE,S_OK},
5733 {URLZONE_INVALID,E_NOTIMPL}
5736 { "file://test.com/test/test",0,
5737 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5738 URL_FILE_USE_PATHURL,S_OK,FALSE,
5740 {"file://\\\\test.com\\testing.mp3",S_OK},
5742 {"file://\\\\test.com\\testing.mp3",S_OK},
5748 {"\\testing.mp3",S_OK},
5749 {"\\testing.mp3",S_OK},
5751 {"file://\\\\test.com\\testing.mp3",S_OK},
5757 {Uri_HOST_DNS,S_OK},
5759 {URL_SCHEME_FILE,S_OK},
5760 {URLZONE_INVALID,E_NOTIMPL}
5763 /* URL_DONT_SIMPLIFY has no effect. */
5764 { "http://google.com/test",0,
5765 "zip://test.com/cool/../cool/test",0,
5766 URL_DONT_SIMPLIFY,S_OK,FALSE,
5768 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5770 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5776 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5777 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5779 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5780 * On IE 7 it reduces the path in the Raw URI.
5782 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5788 {Uri_HOST_DNS,S_OK},
5790 {URL_SCHEME_UNKNOWN,S_OK},
5791 {URLZONE_INVALID,E_NOTIMPL}
5794 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5795 * resulting URI is converted into a dos path.
5797 { "http://google.com/test",0,
5798 "file:///c:/test/",0,
5799 URL_FILE_USE_PATHURL,S_OK,FALSE,
5801 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5803 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5809 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5810 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5812 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5818 {Uri_HOST_UNKNOWN,S_OK},
5820 {URL_SCHEME_FILE,S_OK},
5821 {URLZONE_INVALID,E_NOTIMPL}
5824 { "http://google.com/test",0,
5825 "http://test.com/test#%30test",0,
5826 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
5828 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5830 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5833 {"#0test",S_OK,FALSE,NULL,"#%30test"},
5839 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
5840 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
5846 {Uri_HOST_DNS,S_OK},
5848 {URL_SCHEME_HTTP,S_OK},
5849 {URLZONE_INVALID,E_NOTIMPL}
5852 /* Windows validates the path component from the relative Uri. */
5853 { "http://google.com/test",0,
5854 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
5855 0,E_INVALIDARG,FALSE
5857 /* Windows doesn't validate the query from the relative Uri. */
5858 { "http://google.com/test",0,
5859 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5862 {"http://google.com/test?Tes%XXt",S_OK},
5863 {"google.com",S_OK},
5864 {"http://google.com/test?Tes%XXt",S_OK},
5865 {"google.com",S_OK},
5868 {"google.com",S_OK},
5871 {"/test?Tes%XXt",S_OK},
5873 {"http://google.com/test?Tes%XXt",S_OK},
5879 {Uri_HOST_DNS,S_OK},
5881 {URL_SCHEME_HTTP,S_OK},
5882 {URLZONE_INVALID,E_NOTIMPL}
5885 /* Windows doesn't validate the fragment from the relative Uri. */
5886 { "http://google.com/test",0,
5887 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5890 {"http://google.com/test#Tes%XXt",S_OK},
5891 {"google.com",S_OK},
5892 {"http://google.com/test#Tes%XXt",S_OK},
5893 {"google.com",S_OK},
5896 {"google.com",S_OK},
5901 {"http://google.com/test#Tes%XXt",S_OK},
5907 {Uri_HOST_DNS,S_OK},
5909 {URL_SCHEME_HTTP,S_OK},
5910 {URLZONE_INVALID,E_NOTIMPL}
5913 /* Creates an IUri which contains an invalid dos path char. */
5914 { "file:///c:/test",0,
5915 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
5916 URL_FILE_USE_PATHURL,S_OK,FALSE,
5918 {"file://c:\\test<ing",S_OK},
5920 {"file://c:\\test<ing",S_OK},
5926 {"c:\\test<ing",S_OK},
5927 {"c:\\test<ing",S_OK},
5929 {"file://c:\\test<ing",S_OK},
5935 {Uri_HOST_UNKNOWN,S_OK},
5937 {URL_SCHEME_FILE,S_OK},
5938 {URLZONE_INVALID,E_NOTIMPL}
5941 /* Appends the path after the drive letter (if any). */
5942 { "file:///c:/test",0,
5943 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
5946 {"file:///c:/c:/testing",S_OK},
5948 {"file:///c:/c:/testing",S_OK},
5954 {"/c:/c:/testing",S_OK},
5955 {"/c:/c:/testing",S_OK},
5957 {"file:///c:/c:/testing",S_OK},
5963 {Uri_HOST_UNKNOWN,S_OK},
5965 {URL_SCHEME_FILE,S_OK},
5966 {URLZONE_INVALID,E_NOTIMPL}
5969 /* A '/' is added if the base URI doesn't have a path and the
5970 * relative URI doesn't contain a path (since the base URI is
5973 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
5974 "?test",Uri_CREATE_ALLOW_RELATIVE,
5977 {"http://google.com/?test",S_OK},
5978 {"google.com",S_OK},
5979 {"http://google.com/?test",S_OK},
5980 {"google.com",S_OK},
5983 {"google.com",S_OK},
5988 {"http://google.com/?test",S_OK},
5994 {Uri_HOST_DNS,S_OK},
5996 {URL_SCHEME_HTTP,S_OK},
5997 {URLZONE_INVALID,E_NOTIMPL}
6000 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6001 "?test",Uri_CREATE_ALLOW_RELATIVE,
6004 {"zip://google.com/?test",S_OK},
6005 {"google.com",S_OK},
6006 {"zip://google.com/?test",S_OK},
6007 {"google.com",S_OK},
6010 {"google.com",S_OK},
6015 {"zip://google.com/?test",S_OK},
6021 {Uri_HOST_DNS,S_OK},
6023 {URL_SCHEME_UNKNOWN,S_OK},
6024 {URLZONE_INVALID,E_NOTIMPL}
6027 /* No path is appended since the base URI is opaque. */
6029 "?test",Uri_CREATE_ALLOW_RELATIVE,
6049 {Uri_HOST_UNKNOWN,S_OK},
6051 {URL_SCHEME_UNKNOWN,S_OK},
6052 {URLZONE_INVALID,E_NOTIMPL}
6056 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6059 {"file:///c:/testing/test",S_OK},
6061 {"file:///c:/testing/test",S_OK},
6067 {"/c:/testing/test",S_OK},
6068 {"/c:/testing/test",S_OK},
6070 {"file:///c:/testing/test",S_OK},
6076 {Uri_HOST_UNKNOWN,S_OK},
6078 {URL_SCHEME_FILE,S_OK},
6079 {URLZONE_INVALID,E_NOTIMPL}
6082 { "http://winehq.org/dir/testfile",0,
6083 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6086 {"http://winehq.org/dir/test?querystring",S_OK},
6087 {"winehq.org",S_OK},
6088 {"http://winehq.org/dir/test?querystring",S_OK},
6089 {"winehq.org",S_OK},
6092 {"winehq.org",S_OK},
6095 {"/dir/test?querystring",S_OK},
6096 {"?querystring",S_OK},
6097 {"http://winehq.org/dir/test?querystring",S_OK},
6103 {Uri_HOST_DNS,S_OK},
6105 {URL_SCHEME_HTTP,S_OK},
6106 {URLZONE_INVALID,E_NOTIMPL}
6109 { "http://winehq.org/dir/test",0,
6110 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6113 {"http://winehq.org/dir/test?querystring",S_OK},
6114 {"winehq.org",S_OK},
6115 {"http://winehq.org/dir/test?querystring",S_OK},
6116 {"winehq.org",S_OK},
6119 {"winehq.org",S_OK},
6122 {"/dir/test?querystring",S_OK},
6123 {"?querystring",S_OK},
6124 {"http://winehq.org/dir/test?querystring",S_OK},
6130 {Uri_HOST_DNS,S_OK},
6132 {URL_SCHEME_HTTP,S_OK},
6133 {URLZONE_INVALID,E_NOTIMPL}
6136 { "http://winehq.org/dir/test?querystring",0,
6137 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6140 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6141 {"winehq.org",S_OK},
6142 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6143 {"winehq.org",S_OK},
6146 {"winehq.org",S_OK},
6149 {"/dir/test?querystring",S_OK},
6150 {"?querystring",S_OK},
6151 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6157 {Uri_HOST_DNS,S_OK},
6159 {URL_SCHEME_HTTP,S_OK},
6160 {URLZONE_INVALID,E_NOTIMPL}
6165 typedef struct _uri_parse_test {
6170 const char *property;
6175 static const uri_parse_test uri_parse_tests[] = {
6176 /* PARSE_CANONICALIZE tests. */
6177 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6178 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6179 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6180 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6181 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6182 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6183 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6184 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6185 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6186 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6187 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6188 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6190 /* PARSE_FRIENDLY tests. */
6191 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6192 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6194 /* PARSE_ROOTDOCUMENT tests. */
6195 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6196 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6197 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6198 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6199 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6200 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6202 /* PARSE_DOCUMENT tests. */
6203 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6204 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6205 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6206 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6207 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6208 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6210 /* PARSE_PATH_FROM_URL tests. */
6211 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6212 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6213 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6214 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6215 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6217 /* PARSE_URL_FROM_PATH tests. */
6218 /* This function almost seems to useless (just returns the absolute uri). */
6219 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6220 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6221 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6222 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6223 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6225 /* PARSE_SCHEMA tests. */
6226 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6227 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6229 /* PARSE_SITE tests. */
6230 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6231 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6232 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6233 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6235 /* PARSE_DOMAIN tests. */
6236 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6237 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6238 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6239 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6241 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6242 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6243 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6244 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6245 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6248 static inline LPWSTR a2w(LPCSTR str) {
6252 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6253 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6254 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6260 static inline BOOL heap_free(void* mem) {
6261 return HeapFree(GetProcessHeap(), 0, mem);
6264 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6265 LPWSTR strAW = a2w(strA);
6266 DWORD ret = lstrcmpW(strAW, strB);
6271 static inline ULONG get_refcnt(IUri *uri) {
6273 return IUri_Release(uri);
6276 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6281 valueW = a2w(prop->value);
6282 switch(prop->property) {
6283 case Uri_PROPERTY_FRAGMENT:
6284 hr = IUriBuilder_SetFragment(builder, valueW);
6287 ok(hr == prop->expected,
6288 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6289 hr, prop->expected, test_index);
6292 ok(hr == prop->expected,
6293 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6294 hr, prop->expected, test_index);
6297 case Uri_PROPERTY_HOST:
6298 hr = IUriBuilder_SetHost(builder, valueW);
6301 ok(hr == prop->expected,
6302 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6303 hr, prop->expected, test_index);
6306 ok(hr == prop->expected,
6307 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6308 hr, prop->expected, test_index);
6311 case Uri_PROPERTY_PASSWORD:
6312 hr = IUriBuilder_SetPassword(builder, valueW);
6315 ok(hr == prop->expected,
6316 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6317 hr, prop->expected, test_index);
6320 ok(hr == prop->expected,
6321 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6322 hr, prop->expected, test_index);
6325 case Uri_PROPERTY_PATH:
6326 hr = IUriBuilder_SetPath(builder, valueW);
6329 ok(hr == prop->expected,
6330 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6331 hr, prop->expected, test_index);
6334 ok(hr == prop->expected,
6335 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6336 hr, prop->expected, test_index);
6339 case Uri_PROPERTY_QUERY:
6340 hr = IUriBuilder_SetQuery(builder, valueW);
6343 ok(hr == prop->expected,
6344 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6345 hr, prop->expected, test_index);
6348 ok(hr == prop->expected,
6349 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6350 hr, prop->expected, test_index);
6353 case Uri_PROPERTY_SCHEME_NAME:
6354 hr = IUriBuilder_SetSchemeName(builder, valueW);
6357 ok(hr == prop->expected,
6358 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6359 hr, prop->expected, test_index);
6362 ok(hr == prop->expected,
6363 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6364 hr, prop->expected, test_index);
6367 case Uri_PROPERTY_USER_NAME:
6368 hr = IUriBuilder_SetUserName(builder, valueW);
6371 ok(hr == prop->expected,
6372 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6373 hr, prop->expected, test_index);
6376 ok(hr == prop->expected,
6377 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6378 hr, prop->expected, test_index);
6382 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6389 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6392 static void test_CreateUri_InvalidFlags(void) {
6395 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6397 IUri *uri = (void*) 0xdeadbeef;
6399 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6400 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6401 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6402 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6406 static void test_CreateUri_InvalidArgs(void) {
6408 IUri *uri = (void*) 0xdeadbeef;
6410 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6411 static const WCHAR emptyW[] = {0};
6413 hr = pCreateUri(http_urlW, 0, 0, NULL);
6414 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6416 hr = pCreateUri(NULL, 0, 0, &uri);
6417 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6418 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6420 uri = (void*) 0xdeadbeef;
6421 hr = pCreateUri(invalidW, 0, 0, &uri);
6422 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6423 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6425 uri = (void*) 0xdeadbeef;
6426 hr = pCreateUri(emptyW, 0, 0, &uri);
6427 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6428 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6431 static void test_CreateUri_InvalidUri(void) {
6434 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6435 invalid_uri test = invalid_uri_tests[i];
6440 uriW = a2w(test.uri);
6441 hr = pCreateUri(uriW, test.flags, 0, &uri);
6444 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6445 hr, E_INVALIDARG, i);
6448 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6449 hr, E_INVALIDARG, i);
6451 if(uri) IUri_Release(uri);
6457 static void test_IUri_GetPropertyBSTR(void) {
6462 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6463 hr = pCreateUri(http_urlW, 0, 0, &uri);
6464 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6466 BSTR received = NULL;
6468 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6469 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6471 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6472 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6473 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6474 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6475 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6476 SysFreeString(received);
6478 /* Make sure it handles the ZONE property correctly. */
6480 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6481 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6482 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6483 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6484 SysFreeString(received);
6486 if(uri) IUri_Release(uri);
6488 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6489 uri_properties test = uri_tests[i];
6493 uriW = a2w(test.uri);
6494 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6495 if(test.create_todo) {
6497 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6498 hr, test.create_expected, i);
6501 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6502 hr, test.create_expected, i);
6508 /* Checks all the string properties of the uri. */
6509 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6510 BSTR received = NULL;
6511 uri_str_property prop = test.str_props[j];
6513 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6516 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6517 hr, prop.expected, i, j);
6520 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6521 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6522 prop.value, wine_dbgstr_w(received), i, j);
6525 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6526 hr, prop.expected, i, j);
6527 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6528 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6529 prop.value, wine_dbgstr_w(received), i, j);
6532 SysFreeString(received);
6536 if(uri) IUri_Release(uri);
6542 static void test_IUri_GetPropertyDWORD(void) {
6547 hr = pCreateUri(http_urlW, 0, 0, &uri);
6548 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6550 DWORD received = 0xdeadbeef;
6552 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6553 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6555 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6556 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6557 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6559 if(uri) IUri_Release(uri);
6561 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6562 uri_properties test = uri_tests[i];
6566 uriW = a2w(test.uri);
6567 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6568 if(test.create_todo) {
6570 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6571 hr, test.create_expected, i);
6574 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6575 hr, test.create_expected, i);
6581 /* Checks all the DWORD properties of the uri. */
6582 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6584 uri_dword_property prop = test.dword_props[j];
6586 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6589 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6590 hr, prop.expected, i, j);
6593 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6594 prop.value, received, i, j);
6597 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6598 hr, prop.expected, i, j);
6599 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6600 prop.value, received, i, j);
6605 if(uri) IUri_Release(uri);
6611 /* Tests all the 'Get*' property functions which deal with strings. */
6612 static void test_IUri_GetStrProperties(void) {
6617 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6618 hr = pCreateUri(http_urlW, 0, 0, &uri);
6619 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6621 hr = IUri_GetAbsoluteUri(uri, NULL);
6622 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6624 hr = IUri_GetAuthority(uri, NULL);
6625 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6627 hr = IUri_GetDisplayUri(uri, NULL);
6628 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6630 hr = IUri_GetDomain(uri, NULL);
6631 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6633 hr = IUri_GetExtension(uri, NULL);
6634 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6636 hr = IUri_GetFragment(uri, NULL);
6637 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6639 hr = IUri_GetHost(uri, NULL);
6640 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6642 hr = IUri_GetPassword(uri, NULL);
6643 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6645 hr = IUri_GetPath(uri, NULL);
6646 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6648 hr = IUri_GetPathAndQuery(uri, NULL);
6649 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6651 hr = IUri_GetQuery(uri, NULL);
6652 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6654 hr = IUri_GetRawUri(uri, NULL);
6655 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6657 hr = IUri_GetSchemeName(uri, NULL);
6658 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6660 hr = IUri_GetUserInfo(uri, NULL);
6661 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6663 hr = IUri_GetUserName(uri, NULL);
6664 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6666 if(uri) IUri_Release(uri);
6668 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6669 uri_properties test = uri_tests[i];
6673 uriW = a2w(test.uri);
6674 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6675 if(test.create_todo) {
6677 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6678 hr, test.create_expected, i);
6681 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6682 hr, test.create_expected, i);
6686 uri_str_property prop;
6687 BSTR received = NULL;
6689 /* GetAbsoluteUri() tests. */
6690 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6691 hr = IUri_GetAbsoluteUri(uri, &received);
6694 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6695 hr, prop.expected, i);
6698 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6699 "Error: Expected %s but got %s on uri_tests[%d].\n",
6700 prop.value, wine_dbgstr_w(received), i);
6703 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6704 hr, prop.expected, i);
6705 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6706 "Error: Expected %s but got %s on uri_tests[%d].\n",
6707 prop.value, wine_dbgstr_w(received), i);
6709 SysFreeString(received);
6712 /* GetAuthority() tests. */
6713 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6714 hr = IUri_GetAuthority(uri, &received);
6717 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6718 hr, prop.expected, i);
6721 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6722 prop.value, wine_dbgstr_w(received), i);
6725 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6726 hr, prop.expected, i);
6727 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6728 prop.value, wine_dbgstr_w(received), i);
6730 SysFreeString(received);
6733 /* GetDisplayUri() tests. */
6734 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6735 hr = IUri_GetDisplayUri(uri, &received);
6738 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6739 hr, prop.expected, i);
6742 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6743 "Error: Expected %s but got %s on uri_test[%d].\n",
6744 prop.value, wine_dbgstr_w(received), i);
6747 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6748 hr, prop.expected, i);
6749 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6750 "Error: Expected %s but got %s on uri_tests[%d].\n",
6751 prop.value, wine_dbgstr_w(received), i);
6753 SysFreeString(received);
6756 /* GetDomain() tests. */
6757 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6758 hr = IUri_GetDomain(uri, &received);
6761 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6762 hr, prop.expected, i);
6765 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6766 prop.value, wine_dbgstr_w(received), i);
6769 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6770 hr, prop.expected, i);
6771 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6772 prop.value, wine_dbgstr_w(received), i);
6774 SysFreeString(received);
6777 /* GetExtension() tests. */
6778 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6779 hr = IUri_GetExtension(uri, &received);
6782 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6783 hr, prop.expected, i);
6786 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6787 prop.value, wine_dbgstr_w(received), i);
6790 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6791 hr, prop.expected, i);
6792 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6793 prop.value, wine_dbgstr_w(received), i);
6795 SysFreeString(received);
6798 /* GetFragment() tests. */
6799 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6800 hr = IUri_GetFragment(uri, &received);
6803 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6804 hr, prop.expected, i);
6807 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6808 prop.value, wine_dbgstr_w(received), i);
6811 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6812 hr, prop.expected, i);
6813 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6814 prop.value, wine_dbgstr_w(received), i);
6816 SysFreeString(received);
6819 /* GetHost() tests. */
6820 prop = test.str_props[Uri_PROPERTY_HOST];
6821 hr = IUri_GetHost(uri, &received);
6824 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6825 hr, prop.expected, i);
6828 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6829 prop.value, wine_dbgstr_w(received), i);
6832 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6833 hr, prop.expected, i);
6834 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6835 prop.value, wine_dbgstr_w(received), i);
6837 SysFreeString(received);
6840 /* GetPassword() tests. */
6841 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6842 hr = IUri_GetPassword(uri, &received);
6845 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6846 hr, prop.expected, i);
6849 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6850 prop.value, wine_dbgstr_w(received), i);
6853 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6854 hr, prop.expected, i);
6855 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6856 prop.value, wine_dbgstr_w(received), i);
6858 SysFreeString(received);
6861 /* GetPath() tests. */
6862 prop = test.str_props[Uri_PROPERTY_PATH];
6863 hr = IUri_GetPath(uri, &received);
6866 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6867 hr, prop.expected, i);
6870 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6871 prop.value, wine_dbgstr_w(received), i);
6874 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6875 hr, prop.expected, i);
6876 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6877 prop.value, wine_dbgstr_w(received), i);
6879 SysFreeString(received);
6882 /* GetPathAndQuery() tests. */
6883 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6884 hr = IUri_GetPathAndQuery(uri, &received);
6887 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6888 hr, prop.expected, i);
6891 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6892 prop.value, wine_dbgstr_w(received), i);
6895 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6896 hr, prop.expected, i);
6897 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6898 prop.value, wine_dbgstr_w(received), i);
6900 SysFreeString(received);
6903 /* GetQuery() tests. */
6904 prop = test.str_props[Uri_PROPERTY_QUERY];
6905 hr = IUri_GetQuery(uri, &received);
6908 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6909 hr, prop.expected, i);
6912 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6913 prop.value, wine_dbgstr_w(received), i);
6916 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6917 hr, prop.expected, i);
6918 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6919 prop.value, wine_dbgstr_w(received), i);
6921 SysFreeString(received);
6924 /* GetRawUri() tests. */
6925 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6926 hr = IUri_GetRawUri(uri, &received);
6929 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6930 hr, prop.expected, i);
6933 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6934 prop.value, wine_dbgstr_w(received), i);
6937 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6938 hr, prop.expected, i);
6939 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6940 prop.value, wine_dbgstr_w(received), i);
6942 SysFreeString(received);
6945 /* GetSchemeName() tests. */
6946 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
6947 hr = IUri_GetSchemeName(uri, &received);
6950 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6951 hr, prop.expected, i);
6954 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6955 prop.value, wine_dbgstr_w(received), i);
6958 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6959 hr, prop.expected, i);
6960 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6961 prop.value, wine_dbgstr_w(received), i);
6963 SysFreeString(received);
6966 /* GetUserInfo() tests. */
6967 prop = test.str_props[Uri_PROPERTY_USER_INFO];
6968 hr = IUri_GetUserInfo(uri, &received);
6971 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6972 hr, prop.expected, i);
6975 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6976 prop.value, wine_dbgstr_w(received), i);
6979 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6980 hr, prop.expected, i);
6981 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6982 prop.value, wine_dbgstr_w(received), i);
6984 SysFreeString(received);
6987 /* GetUserName() tests. */
6988 prop = test.str_props[Uri_PROPERTY_USER_NAME];
6989 hr = IUri_GetUserName(uri, &received);
6992 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6993 hr, prop.expected, i);
6996 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6997 prop.value, wine_dbgstr_w(received), i);
7000 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7001 hr, prop.expected, i);
7002 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7003 prop.value, wine_dbgstr_w(received), i);
7005 SysFreeString(received);
7008 if(uri) IUri_Release(uri);
7014 static void test_IUri_GetDwordProperties(void) {
7019 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7020 hr = pCreateUri(http_urlW, 0, 0, &uri);
7021 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7023 hr = IUri_GetHostType(uri, NULL);
7024 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7026 hr = IUri_GetPort(uri, NULL);
7027 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7029 hr = IUri_GetScheme(uri, NULL);
7030 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7032 hr = IUri_GetZone(uri, NULL);
7033 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7035 if(uri) IUri_Release(uri);
7037 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7038 uri_properties test = uri_tests[i];
7042 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 on uri_tests[%d].\n",
7047 hr, test.create_expected, i);
7050 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7051 hr, test.create_expected, i);
7055 uri_dword_property prop;
7058 /* Assign an insane value so tests don't accidentally pass when
7061 received = -9999999;
7063 /* GetHostType() tests. */
7064 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7065 hr = IUri_GetHostType(uri, &received);
7068 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7069 hr, prop.expected, i);
7072 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7075 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7076 hr, prop.expected, i);
7077 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7079 received = -9999999;
7081 /* GetPort() tests. */
7082 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7083 hr = IUri_GetPort(uri, &received);
7086 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7087 hr, prop.expected, i);
7090 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7093 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7094 hr, prop.expected, i);
7095 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7097 received = -9999999;
7099 /* GetScheme() tests. */
7100 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7101 hr = IUri_GetScheme(uri, &received);
7104 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7105 hr, prop.expected, i);
7108 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7111 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7112 hr, prop.expected, i);
7113 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7115 received = -9999999;
7117 /* GetZone() tests. */
7118 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7119 hr = IUri_GetZone(uri, &received);
7122 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7123 hr, prop.expected, i);
7126 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7129 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7130 hr, prop.expected, i);
7131 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7135 if(uri) IUri_Release(uri);
7141 static void test_IUri_GetPropertyLength(void) {
7146 /* Make sure it handles invalid args correctly. */
7147 hr = pCreateUri(http_urlW, 0, 0, &uri);
7148 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7150 DWORD received = 0xdeadbeef;
7152 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7153 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7155 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7156 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7157 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7159 if(uri) IUri_Release(uri);
7161 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7162 uri_properties test = uri_tests[i];
7166 uriW = a2w(test.uri);
7167 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7168 if(test.create_todo) {
7170 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7171 hr, test.create_expected, i);
7174 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7175 hr, test.create_expected, i);
7181 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7182 DWORD expectedLen, brokenLen, receivedLen;
7183 uri_str_property prop = test.str_props[j];
7185 expectedLen = lstrlen(prop.value);
7186 brokenLen = lstrlen(prop.broken_value);
7188 /* This won't be necessary once GetPropertyLength is implemented. */
7191 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7194 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7195 hr, prop.expected, i, j);
7198 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7199 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7200 expectedLen, receivedLen, i, j);
7203 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7204 hr, prop.expected, i, j);
7205 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7206 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7207 expectedLen, receivedLen, i, j);
7212 if(uri) IUri_Release(uri);
7218 static DWORD compute_expected_props(uri_properties *test)
7222 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7223 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7227 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7228 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7235 static void test_IUri_GetProperties(void) {
7240 hr = pCreateUri(http_urlW, 0, 0, &uri);
7241 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7243 hr = IUri_GetProperties(uri, NULL);
7244 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7246 if(uri) IUri_Release(uri);
7248 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7249 uri_properties test = uri_tests[i];
7253 uriW = a2w(test.uri);
7254 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7255 if(test.create_todo) {
7257 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7260 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7264 DWORD received = 0, expected_props;
7267 hr = IUri_GetProperties(uri, &received);
7268 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7270 expected_props = compute_expected_props(&test);
7272 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7273 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7274 if(expected_props & (1 << j))
7275 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7277 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7281 if(uri) IUri_Release(uri);
7287 static void test_IUri_HasProperty(void) {
7292 hr = pCreateUri(http_urlW, 0, 0, &uri);
7293 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7295 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7296 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7298 if(uri) IUri_Release(uri);
7300 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7301 uri_properties test = uri_tests[i];
7305 uriW = a2w(test.uri);
7307 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7308 if(test.create_todo) {
7310 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7313 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7317 DWORD expected_props, j;
7319 expected_props = compute_expected_props(&test);
7321 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7322 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7325 hr = IUri_HasProperty(uri, j, &received);
7326 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7329 if(expected_props & (1 << j)) {
7330 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7332 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7337 if(uri) IUri_Release(uri);
7343 static void test_IUri_IsEqual(void) {
7350 /* Make sure IsEqual handles invalid args correctly. */
7351 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7352 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7353 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7354 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7355 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7357 hrA = IUri_IsEqual(uriA, NULL, &equal);
7358 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7359 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7361 hrA = IUri_IsEqual(uriA, uriB, NULL);
7362 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7364 if(uriA) IUri_Release(uriA);
7365 if(uriB) IUri_Release(uriB);
7367 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7368 uri_equality test = equality_tests[i];
7369 LPWSTR uriA_W, uriB_W;
7373 uriA_W = a2w(test.a);
7374 uriB_W = a2w(test.b);
7376 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7377 if(test.create_todo_a) {
7379 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7383 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7387 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7388 if(test.create_todo_b) {
7390 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7394 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7398 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7401 hrA = IUri_IsEqual(uriA, uriB, &equal);
7404 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7408 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7411 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7412 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7415 if(uriA) IUri_Release(uriA);
7416 if(uriB) IUri_Release(uriB);
7423 static void test_CreateUriWithFragment_InvalidArgs(void) {
7425 IUri *uri = (void*) 0xdeadbeef;
7426 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7428 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7429 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7430 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7432 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7433 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7435 /* Original URI can't already contain a fragment component. */
7436 uri = (void*) 0xdeadbeef;
7437 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7438 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7439 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7442 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7443 static void test_CreateUriWithFragment_InvalidFlags(void) {
7446 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7448 IUri *uri = (void*) 0xdeadbeef;
7450 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7451 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7452 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7453 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7457 static void test_CreateUriWithFragment(void) {
7460 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7464 uri_with_fragment test = uri_fragment_tests[i];
7466 uriW = a2w(test.uri);
7467 fragW = a2w(test.fragment);
7469 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7470 if(test.expected_todo) {
7472 ok(hr == test.create_expected,
7473 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7474 hr, test.create_expected, i);
7477 ok(hr == test.create_expected,
7478 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7479 hr, test.create_expected, i);
7482 BSTR received = NULL;
7484 hr = IUri_GetAbsoluteUri(uri, &received);
7485 if(test.expected_todo) {
7488 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7492 ok(!strcmp_aw(test.expected_uri, received),
7493 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7494 test.expected_uri, wine_dbgstr_w(received), i);
7497 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7499 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7500 test.expected_uri, wine_dbgstr_w(received), i);
7503 SysFreeString(received);
7506 if(uri) IUri_Release(uri);
7512 static void test_CreateIUriBuilder(void) {
7514 IUriBuilder *builder = NULL;
7517 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7518 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7521 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7522 hr = pCreateUri(http_urlW, 0, 0, &uri);
7523 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7525 ULONG cur_count, orig_count;
7527 orig_count = get_refcnt(uri);
7528 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7529 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7530 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7532 cur_count = get_refcnt(uri);
7533 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7535 if(builder) IUriBuilder_Release(builder);
7536 cur_count = get_refcnt(uri);
7537 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7539 if(uri) IUri_Release(uri);
7542 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7547 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7548 if(test->uri_todo) {
7550 ok(hr == test->uri_hres,
7551 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7552 hr, test->uri_hres, test_index);
7555 ok(hr == test->uri_hres,
7556 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7557 hr, test->uri_hres, test_index);
7563 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7564 uri_builder_str_property prop = test->expected_str_props[i];
7565 BSTR received = NULL;
7567 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7570 ok(hr == prop.result,
7571 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7572 hr, prop.result, test_index, i);
7575 ok(hr == prop.result,
7576 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7577 hr, prop.result, test_index, i);
7582 ok(!strcmp_aw(prop.expected, received),
7583 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7584 prop.expected, wine_dbgstr_w(received), test_index, i);
7587 ok(!strcmp_aw(prop.expected, received),
7588 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7589 prop.expected, wine_dbgstr_w(received), test_index, i);
7592 SysFreeString(received);
7595 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7596 uri_builder_dword_property prop = test->expected_dword_props[i];
7597 DWORD received = -2;
7599 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7602 ok(hr == prop.result,
7603 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7604 hr, prop.result, test_index, i);
7607 ok(hr == prop.result,
7608 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7609 hr, prop.result, test_index, i);
7614 ok(received == prop.expected,
7615 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7616 prop.expected, received, test_index, i);
7619 ok(received == prop.expected,
7620 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7621 prop.expected, received, test_index, i);
7626 if(uri) IUri_Release(uri);
7629 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7634 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7635 if(test->uri_simple_todo) {
7637 ok(hr == test->uri_simple_hres,
7638 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7639 hr, test->uri_simple_hres, test_index);
7642 ok(hr == test->uri_simple_hres,
7643 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7644 hr, test->uri_simple_hres, test_index);
7650 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7651 uri_builder_str_property prop = test->expected_str_props[i];
7652 BSTR received = NULL;
7654 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7657 ok(hr == prop.result,
7658 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7659 hr, prop.result, test_index, i);
7662 ok(hr == prop.result,
7663 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7664 hr, prop.result, test_index, i);
7669 ok(!strcmp_aw(prop.expected, received),
7670 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7671 prop.expected, wine_dbgstr_w(received), test_index, i);
7674 ok(!strcmp_aw(prop.expected, received),
7675 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7676 prop.expected, wine_dbgstr_w(received), test_index, i);
7679 SysFreeString(received);
7682 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7683 uri_builder_dword_property prop = test->expected_dword_props[i];
7684 DWORD received = -2;
7686 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7689 ok(hr == prop.result,
7690 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7691 hr, prop.result, test_index, i);
7694 ok(hr == prop.result,
7695 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7696 hr, prop.result, test_index, i);
7701 ok(received == prop.expected,
7702 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7703 prop.expected, received, test_index, i);
7706 ok(received == prop.expected,
7707 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7708 prop.expected, received, test_index, i);
7713 if(uri) IUri_Release(uri);
7716 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7721 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7722 test->uri_with_encode_flags, 0, &uri);
7723 if(test->uri_with_todo) {
7725 ok(hr == test->uri_with_hres,
7726 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7727 hr, test->uri_with_hres, test_index);
7730 ok(hr == test->uri_with_hres,
7731 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7732 hr, test->uri_with_hres, test_index);
7738 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7739 uri_builder_str_property prop = test->expected_str_props[i];
7740 BSTR received = NULL;
7742 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7745 ok(hr == prop.result,
7746 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7747 hr, prop.result, test_index, i);
7750 ok(hr == prop.result,
7751 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7752 hr, prop.result, test_index, i);
7757 ok(!strcmp_aw(prop.expected, received),
7758 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7759 prop.expected, wine_dbgstr_w(received), test_index, i);
7762 ok(!strcmp_aw(prop.expected, received),
7763 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7764 prop.expected, wine_dbgstr_w(received), test_index, i);
7767 SysFreeString(received);
7770 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7771 uri_builder_dword_property prop = test->expected_dword_props[i];
7772 DWORD received = -2;
7774 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7777 ok(hr == prop.result,
7778 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7779 hr, prop.result, test_index, i);
7782 ok(hr == prop.result,
7783 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7784 hr, prop.result, test_index, i);
7789 ok(received == prop.expected,
7790 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7791 prop.expected, received, test_index, i);
7794 ok(received == prop.expected,
7795 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7796 prop.expected, received, test_index, i);
7801 if(uri) IUri_Release(uri);
7804 static void test_IUriBuilder_CreateInvalidArgs(void) {
7805 IUriBuilder *builder;
7808 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7809 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7811 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7813 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7814 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7815 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7817 uri = (void*) 0xdeadbeef;
7818 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7819 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7820 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7822 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7823 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7826 uri = (void*) 0xdeadbeef;
7827 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7828 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7830 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7832 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7833 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7836 uri = (void*) 0xdeadbeef;
7837 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7838 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7840 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7842 hr = pCreateUri(http_urlW, 0, 0, &test);
7843 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7845 hr = IUriBuilder_SetIUri(builder, test);
7846 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7848 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7850 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7851 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7852 ok(uri != NULL, "Error: The uri was NULL.\n");
7853 if(uri) IUri_Release(uri);
7856 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7857 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7859 ok(uri != NULL, "Error: uri was NULL.\n");
7860 if(uri) IUri_Release(uri);
7863 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7864 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7866 ok(uri != NULL, "Error: uri was NULL.\n");
7867 if(uri) IUri_Release(uri);
7869 hr = IUriBuilder_SetFragment(builder, NULL);
7870 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7872 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7873 uri = (void*) 0xdeadbeef;
7874 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7875 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7876 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7878 uri = (void*) 0xdeadbeef;
7879 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7880 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7882 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7884 uri = (void*) 0xdeadbeef;
7885 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7886 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7888 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7890 if(test) IUri_Release(test);
7892 if(builder) IUriBuilder_Release(builder);
7895 /* Tests invalid args to the "Get*" functions. */
7896 static void test_IUriBuilder_GetInvalidArgs(void) {
7897 IUriBuilder *builder = NULL;
7900 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7901 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7903 LPCWSTR received = (void*) 0xdeadbeef;
7904 DWORD len = -1, port = -1;
7907 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7908 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7910 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7911 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7913 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7914 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7915 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7917 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7919 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7920 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7922 received = (void*) 0xdeadbeef;
7923 hr = IUriBuilder_GetHost(builder, NULL, &received);
7924 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7926 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7928 hr = IUriBuilder_GetHost(builder, &len, NULL);
7929 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7931 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7933 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7934 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7936 received = (void*) 0xdeadbeef;
7937 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7938 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7940 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7942 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7943 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7945 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7947 hr = IUriBuilder_GetPath(builder, NULL, NULL);
7948 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7950 received = (void*) 0xdeadbeef;
7951 hr = IUriBuilder_GetPath(builder, NULL, &received);
7952 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7954 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7956 hr = IUriBuilder_GetPath(builder, &len, NULL);
7957 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7959 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7961 hr = IUriBuilder_GetPort(builder, NULL, NULL);
7962 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7964 hr = IUriBuilder_GetPort(builder, NULL, &port);
7965 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7967 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
7968 hr = IUriBuilder_GetPort(builder, &set, NULL);
7969 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7971 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
7973 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
7974 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7976 received = (void*) 0xdeadbeef;
7977 hr = IUriBuilder_GetQuery(builder, NULL, &received);
7978 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7980 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7982 hr = IUriBuilder_GetQuery(builder, &len, NULL);
7983 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7985 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7987 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
7988 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7990 received = (void*) 0xdeadbeef;
7991 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
7992 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7994 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7996 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
7997 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7999 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8001 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8002 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8004 received = (void*) 0xdeadbeef;
8005 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8006 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8008 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8010 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8011 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8013 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8015 if(builder) IUriBuilder_Release(builder);
8018 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8022 LPCWSTR received = NULL;
8024 const uri_builder_property *prop = NULL;
8026 /* Check if the property was set earlier. */
8027 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8028 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8029 prop = &(test->properties[i]);
8033 /* Use expected_value unless it's NULL, then use value. */
8034 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8035 hr = IUriBuilder_GetFragment(builder, &len, &received);
8038 ok(hr == (expected ? S_OK : S_FALSE),
8039 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8040 hr, (expected ? S_OK : S_FALSE), test_index);
8044 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8045 expected, wine_dbgstr_w(received), test_index);
8048 ok(lstrlen(expected) == len,
8049 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8050 lstrlen(expected), len, test_index);
8054 ok(hr == (expected ? S_OK : S_FALSE),
8055 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8056 hr, (expected ? S_OK : S_FALSE), test_index);
8057 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8058 expected, wine_dbgstr_w(received), test_index);
8059 ok(lstrlen(expected) == len,
8060 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8061 lstrlen(expected), len, test_index);
8064 /* The property wasn't set earlier, so it should return whatever
8065 * the base IUri contains (if anything).
8068 hr = IUriBuilder_GetIUri(builder, &uri);
8070 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8071 hr, S_OK, test_index);
8074 received = (void*) 0xdeadbeef;
8077 hr = IUriBuilder_GetFragment(builder, &len, &received);
8079 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8080 hr, S_FALSE, test_index);
8082 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8084 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8085 received, test_index);
8088 BOOL has_prop = FALSE;
8089 BSTR expected = NULL;
8091 hr = IUri_GetFragment(uri, &expected);
8093 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8095 has_prop = hr == S_OK;
8097 hr = IUriBuilder_GetFragment(builder, &len, &received);
8100 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8101 hr, S_OK, test_index);
8103 ok(!lstrcmpW(expected, received),
8104 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8105 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8106 ok(lstrlenW(expected) == len,
8107 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8108 lstrlenW(expected), len, test_index);
8112 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8113 hr, S_FALSE, test_index);
8115 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8116 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8120 SysFreeString(expected);
8123 if(uri) IUri_Release(uri);
8127 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8131 LPCWSTR received = NULL;
8133 const uri_builder_property *prop = NULL;
8135 /* Check if the property was set earlier. */
8136 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8137 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8138 prop = &(test->properties[i]);
8142 /* Use expected_value unless it's NULL, then use value. */
8143 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8144 hr = IUriBuilder_GetHost(builder, &len, &received);
8147 ok(hr == (expected ? S_OK : S_FALSE),
8148 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8149 hr, (expected ? S_OK : S_FALSE), test_index);
8153 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8154 expected, wine_dbgstr_w(received), test_index);
8157 ok(lstrlen(expected) == len,
8158 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8159 lstrlen(expected), len, test_index);
8163 ok(hr == (expected ? S_OK : S_FALSE),
8164 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8165 hr, (expected ? S_OK : S_FALSE), test_index);
8166 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8167 expected, wine_dbgstr_w(received), test_index);
8168 ok(lstrlen(expected) == len,
8169 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8170 lstrlen(expected), len, test_index);
8173 /* The property wasn't set earlier, so it should return whatever
8174 * the base IUri contains (if anything).
8177 hr = IUriBuilder_GetIUri(builder, &uri);
8179 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8180 hr, S_OK, test_index);
8183 received = (void*) 0xdeadbeef;
8186 hr = IUriBuilder_GetHost(builder, &len, &received);
8188 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8189 hr, S_FALSE, test_index);
8191 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8193 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8194 received, test_index);
8197 BOOL has_prop = FALSE;
8198 BSTR expected = NULL;
8200 hr = IUri_GetHost(uri, &expected);
8202 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8204 has_prop = hr == S_OK;
8206 hr = IUriBuilder_GetHost(builder, &len, &received);
8209 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8210 hr, S_OK, test_index);
8212 ok(!lstrcmpW(expected, received),
8213 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8214 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8215 ok(lstrlenW(expected) == len,
8216 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8217 lstrlenW(expected), len, test_index);
8221 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8222 hr, S_FALSE, test_index);
8224 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8225 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8229 SysFreeString(expected);
8232 if(uri) IUri_Release(uri);
8236 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8240 LPCWSTR received = NULL;
8242 const uri_builder_property *prop = NULL;
8244 /* Check if the property was set earlier. */
8245 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8246 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8247 prop = &(test->properties[i]);
8251 /* Use expected_value unless it's NULL, then use value. */
8252 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8253 hr = IUriBuilder_GetPassword(builder, &len, &received);
8256 ok(hr == (expected ? S_OK : S_FALSE),
8257 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8258 hr, (expected ? S_OK : S_FALSE), test_index);
8262 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8263 expected, wine_dbgstr_w(received), test_index);
8266 ok(lstrlen(expected) == len,
8267 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8268 lstrlen(expected), len, test_index);
8272 ok(hr == (expected ? S_OK : S_FALSE),
8273 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8274 hr, (expected ? S_OK : S_FALSE), test_index);
8275 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8276 expected, wine_dbgstr_w(received), test_index);
8277 ok(lstrlen(expected) == len,
8278 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8279 lstrlen(expected), len, test_index);
8282 /* The property wasn't set earlier, so it should return whatever
8283 * the base IUri contains (if anything).
8286 hr = IUriBuilder_GetIUri(builder, &uri);
8288 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8289 hr, S_OK, test_index);
8292 received = (void*) 0xdeadbeef;
8295 hr = IUriBuilder_GetPassword(builder, &len, &received);
8297 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8298 hr, S_FALSE, test_index);
8300 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8302 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8303 received, test_index);
8306 BOOL has_prop = FALSE;
8307 BSTR expected = NULL;
8309 hr = IUri_GetPassword(uri, &expected);
8311 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8313 has_prop = hr == S_OK;
8315 hr = IUriBuilder_GetPassword(builder, &len, &received);
8318 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8319 hr, S_OK, test_index);
8321 ok(!lstrcmpW(expected, received),
8322 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8323 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8324 ok(lstrlenW(expected) == len,
8325 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8326 lstrlenW(expected), len, test_index);
8330 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8331 hr, S_FALSE, test_index);
8333 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8334 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8338 SysFreeString(expected);
8341 if(uri) IUri_Release(uri);
8345 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8349 LPCWSTR received = NULL;
8351 const uri_builder_property *prop = NULL;
8353 /* Check if the property was set earlier. */
8354 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8355 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8356 prop = &(test->properties[i]);
8360 /* Use expected_value unless it's NULL, then use value. */
8361 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8362 hr = IUriBuilder_GetPath(builder, &len, &received);
8365 ok(hr == (expected ? S_OK : S_FALSE),
8366 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8367 hr, (expected ? S_OK : S_FALSE), test_index);
8371 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8372 expected, wine_dbgstr_w(received), test_index);
8375 ok(lstrlen(expected) == len,
8376 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8377 lstrlen(expected), len, test_index);
8381 ok(hr == (expected ? S_OK : S_FALSE),
8382 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8383 hr, (expected ? S_OK : S_FALSE), test_index);
8384 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8385 expected, wine_dbgstr_w(received), test_index);
8386 ok(lstrlen(expected) == len,
8387 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8388 lstrlen(expected), len, test_index);
8391 /* The property wasn't set earlier, so it should return whatever
8392 * the base IUri contains (if anything).
8395 hr = IUriBuilder_GetIUri(builder, &uri);
8397 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8398 hr, S_OK, test_index);
8401 received = (void*) 0xdeadbeef;
8404 hr = IUriBuilder_GetPath(builder, &len, &received);
8406 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8407 hr, S_FALSE, test_index);
8409 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8411 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8412 received, test_index);
8415 BOOL has_prop = FALSE;
8416 BSTR expected = NULL;
8418 hr = IUri_GetPath(uri, &expected);
8420 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8422 has_prop = hr == S_OK;
8424 hr = IUriBuilder_GetPath(builder, &len, &received);
8427 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8428 hr, S_OK, test_index);
8430 ok(!lstrcmpW(expected, received),
8431 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8432 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8433 ok(lstrlenW(expected) == len,
8434 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8435 lstrlenW(expected), len, test_index);
8439 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8440 hr, S_FALSE, test_index);
8442 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8443 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8447 SysFreeString(expected);
8450 if(uri) IUri_Release(uri);
8454 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8457 BOOL has_port = FALSE;
8458 DWORD received = -1;
8460 if(test->port_prop.change) {
8461 DWORD expected = test->port_prop.value;
8463 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8464 if(test->port_prop.todo) {
8467 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8468 hr, S_OK, test_index);
8472 ok(has_port == test->port_prop.set,
8473 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8474 test->port_prop.set, has_port, test_index);
8477 ok(received == expected,
8478 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8479 expected, received, test_index);
8484 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8485 hr, S_OK, test_index);
8486 ok(has_port == test->port_prop.set,
8487 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8488 test->port_prop.set, has_port, test_index);
8489 ok(received == test->port_prop.value,
8490 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8491 test->port_prop.value, received, test_index);
8496 hr = IUriBuilder_GetIUri(builder, &uri);
8498 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8499 hr, S_OK, test_index);
8502 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8504 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8505 hr, S_OK, test_index);
8507 ok(has_port == FALSE,
8508 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8509 has_port, test_index);
8510 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8511 received, test_index);
8516 hr = IUri_GetPort(uri, &expected);
8518 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8521 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8523 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8524 hr, S_OK, test_index);
8527 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8529 ok(received == expected,
8530 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8531 expected, received, test_index);
8535 if(uri) IUri_Release(uri);
8539 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8543 LPCWSTR received = NULL;
8545 const uri_builder_property *prop = NULL;
8547 /* Check if the property was set earlier. */
8548 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8549 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8550 prop = &(test->properties[i]);
8554 /* Use expected_value unless it's NULL, then use value. */
8555 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8556 hr = IUriBuilder_GetQuery(builder, &len, &received);
8559 ok(hr == (expected ? S_OK : S_FALSE),
8560 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8561 hr, (expected ? S_OK : S_FALSE), test_index);
8565 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8566 expected, wine_dbgstr_w(received), test_index);
8569 ok(lstrlen(expected) == len,
8570 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8571 lstrlen(expected), len, test_index);
8575 ok(hr == (expected ? S_OK : S_FALSE),
8576 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8577 hr, (expected ? S_OK : S_FALSE), test_index);
8578 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8579 expected, wine_dbgstr_w(received), test_index);
8580 ok(lstrlen(expected) == len,
8581 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8582 lstrlen(expected), len, test_index);
8585 /* The property wasn't set earlier, so it should return whatever
8586 * the base IUri contains (if anything).
8589 hr = IUriBuilder_GetIUri(builder, &uri);
8591 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8592 hr, S_OK, test_index);
8595 received = (void*) 0xdeadbeef;
8598 hr = IUriBuilder_GetQuery(builder, &len, &received);
8600 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8601 hr, S_FALSE, test_index);
8603 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8605 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8606 received, test_index);
8609 BOOL has_prop = FALSE;
8610 BSTR expected = NULL;
8612 hr = IUri_GetQuery(uri, &expected);
8614 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8616 has_prop = hr == S_OK;
8618 hr = IUriBuilder_GetQuery(builder, &len, &received);
8621 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8622 hr, S_OK, test_index);
8624 ok(!lstrcmpW(expected, received),
8625 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8626 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8627 ok(lstrlenW(expected) == len,
8628 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8629 lstrlenW(expected), len, test_index);
8633 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8634 hr, S_FALSE, test_index);
8636 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8637 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8641 SysFreeString(expected);
8644 if(uri) IUri_Release(uri);
8648 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8652 LPCWSTR received = NULL;
8654 const uri_builder_property *prop = NULL;
8656 /* Check if the property was set earlier. */
8657 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8658 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8659 prop = &(test->properties[i]);
8663 /* Use expected_value unless it's NULL, then use value. */
8664 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8665 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8668 ok(hr == (expected ? S_OK : S_FALSE),
8669 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8670 hr, (expected ? S_OK : S_FALSE), test_index);
8674 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8675 expected, wine_dbgstr_w(received), test_index);
8678 ok(lstrlen(expected) == len,
8679 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8680 lstrlen(expected), len, test_index);
8684 ok(hr == (expected ? S_OK : S_FALSE),
8685 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8686 hr, (expected ? S_OK : S_FALSE), test_index);
8687 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8688 expected, wine_dbgstr_w(received), test_index);
8689 ok(lstrlen(expected) == len,
8690 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8691 lstrlen(expected), len, test_index);
8694 /* The property wasn't set earlier, so it should return whatever
8695 * the base IUri contains (if anything).
8698 hr = IUriBuilder_GetIUri(builder, &uri);
8700 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8701 hr, S_OK, test_index);
8704 received = (void*) 0xdeadbeef;
8707 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8709 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8710 hr, S_FALSE, test_index);
8712 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8714 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8715 received, test_index);
8718 BOOL has_prop = FALSE;
8719 BSTR expected = NULL;
8721 hr = IUri_GetSchemeName(uri, &expected);
8723 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8725 has_prop = hr == S_OK;
8727 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8730 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8731 hr, S_OK, test_index);
8733 ok(!lstrcmpW(expected, received),
8734 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8735 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8736 ok(lstrlenW(expected) == len,
8737 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8738 lstrlenW(expected), len, test_index);
8742 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8743 hr, S_FALSE, test_index);
8745 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8746 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8750 SysFreeString(expected);
8753 if(uri) IUri_Release(uri);
8757 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8761 LPCWSTR received = NULL;
8763 const uri_builder_property *prop = NULL;
8765 /* Check if the property was set earlier. */
8766 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8767 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8768 prop = &(test->properties[i]);
8771 if(prop && prop->value && *prop->value) {
8772 /* Use expected_value unless it's NULL, then use value. */
8773 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8774 hr = IUriBuilder_GetUserName(builder, &len, &received);
8777 ok(hr == (expected ? S_OK : S_FALSE),
8778 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8779 hr, (expected ? S_OK : S_FALSE), test_index);
8783 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8784 expected, wine_dbgstr_w(received), test_index);
8787 ok(lstrlen(expected) == len,
8788 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8789 lstrlen(expected), len, test_index);
8793 ok(hr == (expected ? S_OK : S_FALSE),
8794 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8795 hr, (expected ? S_OK : S_FALSE), test_index);
8796 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8797 expected, wine_dbgstr_w(received), test_index);
8798 ok(lstrlen(expected) == len,
8799 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8800 lstrlen(expected), len, test_index);
8803 /* The property wasn't set earlier, so it should return whatever
8804 * the base IUri contains (if anything).
8807 hr = IUriBuilder_GetIUri(builder, &uri);
8809 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8810 hr, S_OK, test_index);
8813 received = (void*) 0xdeadbeef;
8816 hr = IUriBuilder_GetUserName(builder, &len, &received);
8818 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8819 hr, S_FALSE, test_index);
8821 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8823 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8824 received, test_index);
8827 BSTR expected = NULL;
8828 BOOL has_prop = FALSE;
8830 hr = IUri_GetUserName(uri, &expected);
8832 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8834 has_prop = hr == S_OK;
8836 hr = IUriBuilder_GetUserName(builder, &len, &received);
8839 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8840 hr, S_OK, test_index);
8842 ok(!lstrcmpW(expected, received),
8843 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8844 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8845 ok(lstrlenW(expected) == len,
8846 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8847 lstrlenW(expected), len, test_index);
8851 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8852 hr, S_FALSE, test_index);
8854 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8855 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8859 SysFreeString(expected);
8862 if(uri) IUri_Release(uri);
8866 /* Tests IUriBuilder functions. */
8867 static void test_IUriBuilder(void) {
8869 IUriBuilder *builder;
8872 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8874 uri_builder_test test = uri_builder_tests[i];
8878 uriW = a2w(test.uri);
8879 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8880 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8882 if(FAILED(hr)) continue;
8884 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8885 if(test.create_builder_todo) {
8887 ok(hr == test.create_builder_expected,
8888 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8889 hr, test.create_builder_expected, i);
8892 ok(hr == test.create_builder_expected,
8893 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8894 hr, test.create_builder_expected, i);
8898 BOOL modified = FALSE, received = FALSE;
8900 /* Perform all the string property changes. */
8901 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8902 uri_builder_property prop = test.properties[j];
8904 change_property(builder, &prop, i);
8905 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8906 prop.property != Uri_PROPERTY_HOST)
8908 else if(prop.value && *prop.value)
8910 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8911 /* Host name property can't be NULL, but it can be empty. */
8916 if(test.port_prop.change) {
8917 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8919 if(test.port_prop.todo) {
8921 ok(hr == test.port_prop.expected,
8922 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8923 hr, test.port_prop.expected, i);
8926 ok(hr == test.port_prop.expected,
8927 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8928 hr, test.port_prop.expected, i);
8932 hr = IUriBuilder_HasBeenModified(builder, &received);
8934 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8937 ok(received == modified,
8938 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8939 modified, received, i);
8941 /* Test the "Get*" functions. */
8942 test_IUriBuilder_GetFragment(builder, &test, i);
8943 test_IUriBuilder_GetHost(builder, &test, i);
8944 test_IUriBuilder_GetPassword(builder, &test, i);
8945 test_IUriBuilder_GetPath(builder, &test, i);
8946 test_IUriBuilder_GetPort(builder, &test, i);
8947 test_IUriBuilder_GetQuery(builder, &test, i);
8948 test_IUriBuilder_GetSchemeName(builder, &test, i);
8949 test_IUriBuilder_GetUserName(builder, &test, i);
8951 test_IUriBuilder_CreateUri(builder, &test, i);
8952 test_IUriBuilder_CreateUriSimple(builder, &test, i);
8953 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
8955 if(builder) IUriBuilder_Release(builder);
8956 if(uri) IUri_Release(uri);
8961 static void test_IUriBuilder_HasBeenModified(void) {
8963 IUriBuilder *builder = NULL;
8965 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8966 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8968 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
8972 hr = IUriBuilder_HasBeenModified(builder, NULL);
8973 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8976 hr = IUriBuilder_SetHost(builder, hostW);
8977 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
8980 hr = IUriBuilder_HasBeenModified(builder, &received);
8981 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8984 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8986 hr = pCreateUri(http_urlW, 0, 0, &uri);
8987 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8992 hr = IUriBuilder_SetIUri(builder, uri);
8993 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
8996 hr = IUriBuilder_HasBeenModified(builder, &received);
8997 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9000 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9002 /* Test what happens with you call SetIUri with the same IUri again. */
9003 hr = IUriBuilder_SetHost(builder, hostW);
9004 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9006 hr = IUriBuilder_HasBeenModified(builder, &received);
9007 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9010 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9012 hr = IUriBuilder_SetIUri(builder, uri);
9013 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9015 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9016 * reset any of the changes that were made to the IUriBuilder.
9018 hr = IUriBuilder_HasBeenModified(builder, &received);
9019 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9021 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9023 hr = IUriBuilder_GetHost(builder, &len, &prop);
9024 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9026 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9027 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9028 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9029 lstrlenW(hostW), len);
9032 hr = IUriBuilder_SetIUri(builder, NULL);
9033 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9035 hr = IUriBuilder_SetHost(builder, hostW);
9036 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9037 hr = IUriBuilder_HasBeenModified(builder, &received);
9038 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9041 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9043 hr = IUriBuilder_SetIUri(builder, NULL);
9044 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9046 hr = IUriBuilder_HasBeenModified(builder, &received);
9047 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9050 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9052 hr = IUriBuilder_GetHost(builder, &len, &prop);
9053 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9055 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9056 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9057 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9058 lstrlenW(hostW), len);
9061 if(uri) IUri_Release(uri);
9063 if(builder) IUriBuilder_Release(builder);
9066 /* Test IUriBuilder {Get,Set}IUri functions. */
9067 static void test_IUriBuilder_IUriProperty(void) {
9068 IUriBuilder *builder = NULL;
9071 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9072 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9076 hr = IUriBuilder_GetIUri(builder, NULL);
9077 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9080 hr = pCreateUri(http_urlW, 0, 0, &uri);
9083 ULONG cur_count, orig_count;
9085 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9086 orig_count = get_refcnt(uri);
9087 hr = IUriBuilder_SetIUri(builder, uri);
9088 cur_count = get_refcnt(uri);
9090 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9091 orig_count+1, cur_count);
9093 hr = IUriBuilder_SetIUri(builder, NULL);
9094 cur_count = get_refcnt(uri);
9096 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9097 orig_count, cur_count);
9099 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9100 hr = IUriBuilder_SetIUri(builder, uri);
9101 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9102 orig_count = get_refcnt(uri);
9104 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9105 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9107 cur_count = get_refcnt(uri);
9108 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9109 orig_count+1, cur_count);
9110 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9113 if(test) IUri_Release(test);
9116 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9117 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9119 cur_count = get_refcnt(uri);
9120 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9121 orig_count+1, cur_count);
9122 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9124 if(test) IUri_Release(test);
9126 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9130 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9131 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9133 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9135 if(test) IUri_Release(test);
9137 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9138 * explicitly set (because it's a default flags).
9141 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9142 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9144 cur_count = get_refcnt(uri);
9145 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9146 orig_count+1, cur_count);
9147 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9149 if(test) IUri_Release(test);
9152 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9153 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9155 cur_count = get_refcnt(uri);
9156 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9157 orig_count+1, cur_count);
9158 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9160 if(test) IUri_Release(test);
9163 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9164 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9167 cur_count = get_refcnt(uri);
9168 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9169 orig_count+1, cur_count);
9170 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9172 if(test) IUri_Release(test);
9174 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9178 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9179 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9181 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9183 if(test) IUri_Release(test);
9185 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9186 * explicitly set (because it's a default flags).
9189 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9190 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9192 cur_count = get_refcnt(uri);
9193 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9194 orig_count+1, cur_count);
9195 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9197 if(test) IUri_Release(test);
9199 if(uri) IUri_Release(uri);
9201 if(builder) IUriBuilder_Release(builder);
9204 static void test_IUriBuilder_RemoveProperties(void) {
9205 IUriBuilder *builder = NULL;
9209 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9210 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9212 /* Properties that can't be removed. */
9213 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9214 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9216 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9217 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9218 if((i << 1) & invalid) {
9219 ok(hr == E_INVALIDARG,
9220 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9221 hr, E_INVALIDARG, i);
9224 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9229 /* Also doesn't accept anything that's outside the range of the
9232 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9233 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9236 if(builder) IUriBuilder_Release(builder);
9238 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9239 uri_builder_remove_test test = uri_builder_remove_tests[i];
9243 uriW = a2w(test.uri);
9244 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9248 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9249 if(test.create_builder_todo) {
9251 ok(hr == test.create_builder_expected,
9252 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9253 hr, test.create_builder_expected, i);
9256 ok(hr == test.create_builder_expected,
9257 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9258 hr, test.create_builder_expected, i);
9261 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9262 if(test.remove_todo) {
9264 ok(hr == test.remove_expected,
9265 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9266 hr, test.remove_expected, i);
9269 ok(hr == test.remove_expected,
9270 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9271 hr, test.remove_expected, i);
9274 IUri *result = NULL;
9276 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9277 if(test.expected_todo) {
9279 ok(hr == test.expected_hres,
9280 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9281 hr, test.expected_hres, i);
9284 ok(hr == test.expected_hres,
9285 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9286 hr, test.expected_hres, i);
9289 BSTR received = NULL;
9291 hr = IUri_GetAbsoluteUri(result, &received);
9292 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9293 ok(!strcmp_aw(test.expected_uri, received),
9294 "Error: Expected %s but got %s instead on test %d.\n",
9295 test.expected_uri, wine_dbgstr_w(received), i);
9296 SysFreeString(received);
9298 if(result) IUri_Release(result);
9301 if(builder) IUriBuilder_Release(builder);
9303 if(uri) IUri_Release(uri);
9308 static void test_IUriBuilder_Misc(void) {
9312 hr = pCreateUri(http_urlW, 0, 0, &uri);
9314 IUriBuilder *builder;
9316 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9317 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9322 hr = IUriBuilder_GetPort(builder, &has, &port);
9323 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9325 /* 'has' will be set to FALSE, even though uri had a port. */
9326 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9327 /* Still sets 'port' to 80. */
9328 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9331 if(builder) IUriBuilder_Release(builder);
9333 if(uri) IUri_Release(uri);
9336 static void test_IUriBuilderFactory(void) {
9339 IUriBuilderFactory *factory;
9340 IUriBuilder *builder;
9342 hr = pCreateUri(http_urlW, 0, 0, &uri);
9343 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9346 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9347 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9348 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9351 builder = (void*) 0xdeadbeef;
9352 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9353 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9355 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9357 builder = (void*) 0xdeadbeef;
9358 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9359 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9361 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9363 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9364 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9368 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9369 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9372 IUri *tmp = (void*) 0xdeadbeef;
9376 hr = IUriBuilder_GetIUri(builder, &tmp);
9377 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9379 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9381 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9382 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9385 if(builder) IUriBuilder_Release(builder);
9387 builder = (void*) 0xdeadbeef;
9388 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9389 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9391 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9393 builder = (void*) 0xdeadbeef;
9394 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9395 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9397 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9399 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9400 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9404 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9405 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9410 hr = IUriBuilder_GetIUri(builder, &tmp);
9411 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9413 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9414 if(uri) IUri_Release(uri);
9416 if(builder) IUriBuilder_Release(builder);
9418 if(factory) IUriBuilderFactory_Release(factory);
9420 if(uri) IUri_Release(uri);
9423 static void test_CoInternetCombineIUri(void) {
9425 IUri *base, *relative, *result;
9429 hr = pCreateUri(http_urlW, 0, 0, &base);
9430 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9432 result = (void*) 0xdeadbeef;
9433 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9434 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9435 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9439 hr = pCreateUri(http_urlW, 0, 0, &relative);
9440 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9442 result = (void*) 0xdeadbeef;
9443 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9444 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9445 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9448 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9449 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9451 if(base) IUri_Release(base);
9452 if(relative) IUri_Release(relative);
9454 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9455 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9457 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9458 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9460 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9462 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9463 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9467 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9468 if(uri_combine_tests[i].todo) {
9470 ok(hr == uri_combine_tests[i].expected,
9471 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9472 hr, uri_combine_tests[i].expected, i);
9475 ok(hr == uri_combine_tests[i].expected,
9476 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9477 hr, uri_combine_tests[i]. expected, i);
9482 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9483 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9486 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9489 ok(hr == prop.expected,
9490 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9491 hr, prop.expected, i, j);
9494 ok(!strcmp_aw(prop.value, received) ||
9495 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9496 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9497 prop.value, wine_dbgstr_w(received), i, j);
9500 ok(hr == prop.expected,
9501 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9502 hr, prop.expected, i, j);
9503 ok(!strcmp_aw(prop.value, received) ||
9504 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9505 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9506 prop.value, wine_dbgstr_w(received), i, j);
9508 SysFreeString(received);
9511 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9512 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9515 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9518 ok(hr == prop.expected,
9519 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9520 hr, prop.expected, i, j);
9523 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9524 prop.value, received, i, j);
9527 ok(hr == prop.expected,
9528 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9529 hr, prop.expected, i, j);
9530 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9531 prop.value, received, i, j);
9535 if(result) IUri_Release(result);
9537 if(relative) IUri_Release(relative);
9538 heap_free(relativeW);
9540 if(base) IUri_Release(base);
9545 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9546 REFIID riid, void **ppv)
9548 ok(0, "unexpected call\n");
9549 return E_NOINTERFACE;
9552 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9557 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9562 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9563 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9564 DWORD *pcchResult, DWORD dwReserved)
9566 CHECK_EXPECT(ParseUrl);
9567 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9568 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9569 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9570 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9571 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9573 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9574 *pcchResult = lstrlenW(parse_resultW);
9579 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9580 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9581 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9583 CHECK_EXPECT(CombineUrl);
9584 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9585 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9586 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9587 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9588 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9589 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9590 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9592 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9593 *pcchResult = lstrlenW(combine_resultW);
9598 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9599 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9601 ok(0, "unexpected call\n");
9605 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9606 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9607 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9609 ok(0, "unexpected call\n");
9613 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9614 InternetProtocolInfo_QueryInterface,
9615 InternetProtocolInfo_AddRef,
9616 InternetProtocolInfo_Release,
9617 InternetProtocolInfo_ParseUrl,
9618 InternetProtocolInfo_CombineUrl,
9619 InternetProtocolInfo_CompareUrl,
9620 InternetProtocolInfo_QueryInfo
9623 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9625 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9627 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9628 *ppv = &protocol_info;
9632 ok(0, "unexpected call\n");
9633 return E_NOINTERFACE;
9636 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9641 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9646 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9647 REFIID riid, void **ppv)
9649 ok(0, "unexpected call\n");
9653 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9655 ok(0, "unexpected call\n");
9659 static const IClassFactoryVtbl ClassFactoryVtbl = {
9660 ClassFactory_QueryInterface,
9661 ClassFactory_AddRef,
9662 ClassFactory_Release,
9663 ClassFactory_CreateInstance,
9664 ClassFactory_LockServer
9667 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9669 static void register_protocols(void)
9671 IInternetSession *session;
9674 hres = pCoInternetGetSession(0, &session, 0);
9675 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9679 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9680 winetestW, 0, NULL, 0);
9681 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9683 IInternetSession_Release(session);
9686 static void unregister_protocols(void) {
9687 IInternetSession *session;
9690 hr = pCoInternetGetSession(0, &session, 0);
9691 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9695 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9696 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9698 IInternetSession_Release(session);
9701 static void test_CoInternetCombineIUri_Pluggable(void) {
9705 hr = pCreateUri(combine_baseW, 0, 0, &base);
9706 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9708 IUri *relative = NULL;
9710 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9711 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9713 IUri *result = NULL;
9715 SET_EXPECT(CombineUrl);
9717 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9719 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9721 CHECK_CALLED(CombineUrl);
9724 BSTR received = NULL;
9725 hr = IUri_GetAbsoluteUri(result, &received);
9726 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9728 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9729 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9731 SysFreeString(received);
9733 if(result) IUri_Release(result);
9735 if(relative) IUri_Release(relative);
9737 if(base) IUri_Release(base);
9740 static void test_CoInternetCombineUrlEx(void) {
9742 IUri *base, *result;
9746 hr = pCreateUri(http_urlW, 0, 0, &base);
9747 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9749 result = (void*) 0xdeadbeef;
9750 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9751 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9753 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9756 result = (void*) 0xdeadbeef;
9757 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9758 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9760 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9762 result = (void*) 0xdeadbeef;
9763 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9764 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9766 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9768 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9769 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9771 if(base) IUri_Release(base);
9773 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9774 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9776 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9777 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9779 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9781 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9783 if(uri_combine_tests[i].todo) {
9785 ok(hr == uri_combine_tests[i].expected,
9786 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9787 hr, uri_combine_tests[i].expected, i);
9790 ok(hr == uri_combine_tests[i].expected,
9791 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9792 hr, uri_combine_tests[i]. expected, i);
9797 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9798 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9800 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9802 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9805 ok(hr == prop.expected,
9806 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9807 hr, prop.expected, i, j);
9810 ok(!strcmp_aw(value, received) ||
9811 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9812 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9813 value, wine_dbgstr_w(received), i, j);
9816 ok(hr == prop.expected,
9817 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9818 hr, prop.expected, i, j);
9819 ok(!strcmp_aw(value, received) ||
9820 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9821 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9822 value, wine_dbgstr_w(received), i, j);
9824 SysFreeString(received);
9827 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9828 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9831 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9834 ok(hr == prop.expected,
9835 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9836 hr, prop.expected, i, j);
9839 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9840 prop.value, received, i, j);
9843 ok(hr == prop.expected,
9844 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9845 hr, prop.expected, i, j);
9846 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9847 prop.value, received, i, j);
9851 if(result) IUri_Release(result);
9852 heap_free(relativeW);
9854 if(base) IUri_Release(base);
9859 static void test_CoInternetCombineUrlEx_Pluggable(void) {
9863 hr = pCreateUri(combine_baseW, 0, 0, &base);
9864 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9866 IUri *result = NULL;
9868 SET_EXPECT(CombineUrl);
9870 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9872 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9874 CHECK_CALLED(CombineUrl);
9877 BSTR received = NULL;
9878 hr = IUri_GetAbsoluteUri(result, &received);
9879 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9881 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9882 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9884 SysFreeString(received);
9886 if(result) IUri_Release(result);
9888 if(base) IUri_Release(base);
9891 static void test_CoInternetParseIUri_InvalidArgs(void) {
9897 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9898 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9900 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9902 hr = pCreateUri(http_urlW, 0, 0, &uri);
9903 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9908 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
9909 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9911 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9913 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
9914 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9918 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
9919 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
9921 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9924 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
9925 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9927 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9930 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
9931 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9933 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9936 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
9937 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9939 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9941 expected_len = lstrlenW(http_urlW);
9943 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9944 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
9945 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9946 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
9947 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
9948 expected_len, result);
9950 if(uri) IUri_Release(uri);
9953 static void test_CoInternetParseIUri(void) {
9956 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
9960 uri_parse_test test = uri_parse_tests[i];
9962 uriW = a2w(test.uri);
9963 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
9964 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
9966 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
9967 DWORD result_len = -1;
9969 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
9972 ok(hr == test.expected,
9973 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9974 hr, test.expected, i);
9977 ok(hr == test.expected,
9978 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9979 hr, test.expected, i);
9982 DWORD len = lstrlenA(test.property);
9983 ok(!strcmp_aw(test.property, result),
9984 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
9985 test.property, wine_dbgstr_w(result), i);
9986 ok(len == result_len,
9987 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
9988 len, result_len, i);
9991 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
9995 if(uri) IUri_Release(uri);
10000 static void test_CoInternetParseIUri_Pluggable(void) {
10004 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10005 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10006 if(SUCCEEDED(hr)) {
10010 SET_EXPECT(ParseUrl);
10012 parse_action = PARSE_CANONICALIZE;
10013 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10015 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10016 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10018 CHECK_CALLED(ParseUrl);
10020 if(SUCCEEDED(hr)) {
10021 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10022 lstrlenW(parse_resultW), result_len);
10023 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10024 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10027 if(uri) IUri_Release(uri);
10033 hurlmon = GetModuleHandle("urlmon.dll");
10034 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10035 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10036 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10037 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10038 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10039 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10040 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10043 win_skip("CreateUri is not present, skipping tests.\n");
10047 trace("test CreateUri invalid flags...\n");
10048 test_CreateUri_InvalidFlags();
10050 trace("test CreateUri invalid args...\n");
10051 test_CreateUri_InvalidArgs();
10053 trace("test CreateUri invalid URIs...\n");
10054 test_CreateUri_InvalidUri();
10056 trace("test IUri_GetPropertyBSTR...\n");
10057 test_IUri_GetPropertyBSTR();
10059 trace("test IUri_GetPropertyDWORD...\n");
10060 test_IUri_GetPropertyDWORD();
10062 trace("test IUri_GetStrProperties...\n");
10063 test_IUri_GetStrProperties();
10065 trace("test IUri_GetDwordProperties...\n");
10066 test_IUri_GetDwordProperties();
10068 trace("test IUri_GetPropertyLength...\n");
10069 test_IUri_GetPropertyLength();
10071 trace("test IUri_GetProperties...\n");
10072 test_IUri_GetProperties();
10074 trace("test IUri_HasProperty...\n");
10075 test_IUri_HasProperty();
10077 trace("test IUri_IsEqual...\n");
10078 test_IUri_IsEqual();
10080 trace("test CreateUriWithFragment invalid args...\n");
10081 test_CreateUriWithFragment_InvalidArgs();
10083 trace("test CreateUriWithFragment invalid flags...\n");
10084 test_CreateUriWithFragment_InvalidFlags();
10086 trace("test CreateUriWithFragment...\n");
10087 test_CreateUriWithFragment();
10089 trace("test CreateIUriBuilder...\n");
10090 test_CreateIUriBuilder();
10092 trace("test IUriBuilder_CreateInvalidArgs...\n");
10093 test_IUriBuilder_CreateInvalidArgs();
10095 trace("test IUriBuilder...\n");
10096 test_IUriBuilder();
10098 trace("test IUriBuilder_GetInvalidArgs...\n");
10099 test_IUriBuilder_GetInvalidArgs();
10101 trace("test IUriBuilder_HasBeenModified...\n");
10102 test_IUriBuilder_HasBeenModified();
10104 trace("test IUriBuilder_IUriProperty...\n");
10105 test_IUriBuilder_IUriProperty();
10107 trace("test IUriBuilder_RemoveProperties...\n");
10108 test_IUriBuilder_RemoveProperties();
10110 trace("test IUriBuilder miscellaneous...\n");
10111 test_IUriBuilder_Misc();
10113 trace("test IUriBuilderFactory...\n");
10114 test_IUriBuilderFactory();
10116 trace("test CoInternetCombineIUri...\n");
10117 test_CoInternetCombineIUri();
10119 trace("test CoInternetCombineUrlEx...\n");
10120 test_CoInternetCombineUrlEx();
10122 trace("test CoInternetParseIUri Invalid Args...\n");
10123 test_CoInternetParseIUri_InvalidArgs();
10125 trace("test CoInternetParseIUri...\n");
10126 test_CoInternetParseIUri();
10128 register_protocols();
10130 trace("test CoInternetCombineIUri pluggable...\n");
10131 test_CoInternetCombineIUri_Pluggable();
10133 trace("test CoInternetCombineUrlEx Pluggable...\n");
10134 test_CoInternetCombineUrlEx_Pluggable();
10136 trace("test CoInternetParseIUri pluggable...\n");
10137 test_CoInternetParseIUri_Pluggable();
10139 unregister_protocols();