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}
6084 typedef struct _uri_parse_test {
6089 const char *property;
6094 static const uri_parse_test uri_parse_tests[] = {
6095 /* PARSE_CANONICALIZE tests. */
6096 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6097 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6098 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6099 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6100 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6101 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6102 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6103 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6104 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6105 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6106 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6107 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6109 /* PARSE_FRIENDLY tests. */
6110 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6111 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6113 /* PARSE_ROOTDOCUMENT tests. */
6114 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6115 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6116 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6117 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6118 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6119 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6121 /* PARSE_DOCUMENT tests. */
6122 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6123 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6124 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6125 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6126 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6127 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6129 /* PARSE_PATH_FROM_URL tests. */
6130 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6131 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6132 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6133 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6134 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6136 /* PARSE_URL_FROM_PATH tests. */
6137 /* This function almost seems to useless (just returns the absolute uri). */
6138 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6139 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6140 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6141 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6142 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6144 /* PARSE_SCHEMA tests. */
6145 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6146 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6148 /* PARSE_SITE tests. */
6149 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6150 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6151 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6152 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6154 /* PARSE_DOMAIN tests. */
6155 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6156 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6157 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6158 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6160 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6161 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6162 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6163 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6164 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6167 static inline LPWSTR a2w(LPCSTR str) {
6171 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6172 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6173 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6179 static inline BOOL heap_free(void* mem) {
6180 return HeapFree(GetProcessHeap(), 0, mem);
6183 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6184 LPWSTR strAW = a2w(strA);
6185 DWORD ret = lstrcmpW(strAW, strB);
6190 static inline ULONG get_refcnt(IUri *uri) {
6192 return IUri_Release(uri);
6195 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6200 valueW = a2w(prop->value);
6201 switch(prop->property) {
6202 case Uri_PROPERTY_FRAGMENT:
6203 hr = IUriBuilder_SetFragment(builder, valueW);
6206 ok(hr == prop->expected,
6207 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6208 hr, prop->expected, test_index);
6211 ok(hr == prop->expected,
6212 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6213 hr, prop->expected, test_index);
6216 case Uri_PROPERTY_HOST:
6217 hr = IUriBuilder_SetHost(builder, valueW);
6220 ok(hr == prop->expected,
6221 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6222 hr, prop->expected, test_index);
6225 ok(hr == prop->expected,
6226 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6227 hr, prop->expected, test_index);
6230 case Uri_PROPERTY_PASSWORD:
6231 hr = IUriBuilder_SetPassword(builder, valueW);
6234 ok(hr == prop->expected,
6235 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6236 hr, prop->expected, test_index);
6239 ok(hr == prop->expected,
6240 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6241 hr, prop->expected, test_index);
6244 case Uri_PROPERTY_PATH:
6245 hr = IUriBuilder_SetPath(builder, valueW);
6248 ok(hr == prop->expected,
6249 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6250 hr, prop->expected, test_index);
6253 ok(hr == prop->expected,
6254 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6255 hr, prop->expected, test_index);
6258 case Uri_PROPERTY_QUERY:
6259 hr = IUriBuilder_SetQuery(builder, valueW);
6262 ok(hr == prop->expected,
6263 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6264 hr, prop->expected, test_index);
6267 ok(hr == prop->expected,
6268 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6269 hr, prop->expected, test_index);
6272 case Uri_PROPERTY_SCHEME_NAME:
6273 hr = IUriBuilder_SetSchemeName(builder, valueW);
6276 ok(hr == prop->expected,
6277 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6278 hr, prop->expected, test_index);
6281 ok(hr == prop->expected,
6282 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6283 hr, prop->expected, test_index);
6286 case Uri_PROPERTY_USER_NAME:
6287 hr = IUriBuilder_SetUserName(builder, valueW);
6290 ok(hr == prop->expected,
6291 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6292 hr, prop->expected, test_index);
6295 ok(hr == prop->expected,
6296 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6297 hr, prop->expected, test_index);
6301 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6308 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6311 static void test_CreateUri_InvalidFlags(void) {
6314 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6316 IUri *uri = (void*) 0xdeadbeef;
6318 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6319 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6320 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6321 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6325 static void test_CreateUri_InvalidArgs(void) {
6327 IUri *uri = (void*) 0xdeadbeef;
6329 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6330 static const WCHAR emptyW[] = {0};
6332 hr = pCreateUri(http_urlW, 0, 0, NULL);
6333 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6335 hr = pCreateUri(NULL, 0, 0, &uri);
6336 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6337 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6339 uri = (void*) 0xdeadbeef;
6340 hr = pCreateUri(invalidW, 0, 0, &uri);
6341 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6342 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6344 uri = (void*) 0xdeadbeef;
6345 hr = pCreateUri(emptyW, 0, 0, &uri);
6346 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6347 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6350 static void test_CreateUri_InvalidUri(void) {
6353 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6354 invalid_uri test = invalid_uri_tests[i];
6359 uriW = a2w(test.uri);
6360 hr = pCreateUri(uriW, test.flags, 0, &uri);
6363 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6364 hr, E_INVALIDARG, i);
6367 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6368 hr, E_INVALIDARG, i);
6370 if(uri) IUri_Release(uri);
6376 static void test_IUri_GetPropertyBSTR(void) {
6381 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6382 hr = pCreateUri(http_urlW, 0, 0, &uri);
6383 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6385 BSTR received = NULL;
6387 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6388 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6390 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6391 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6392 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6393 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6394 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6395 SysFreeString(received);
6397 /* Make sure it handles the ZONE property correctly. */
6399 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6400 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6401 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6402 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6403 SysFreeString(received);
6405 if(uri) IUri_Release(uri);
6407 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6408 uri_properties test = uri_tests[i];
6412 uriW = a2w(test.uri);
6413 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6414 if(test.create_todo) {
6416 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6417 hr, test.create_expected, i);
6420 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6421 hr, test.create_expected, i);
6427 /* Checks all the string properties of the uri. */
6428 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6429 BSTR received = NULL;
6430 uri_str_property prop = test.str_props[j];
6432 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6435 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6436 hr, prop.expected, i, j);
6439 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6440 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6441 prop.value, wine_dbgstr_w(received), i, j);
6444 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6445 hr, prop.expected, i, j);
6446 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6447 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6448 prop.value, wine_dbgstr_w(received), i, j);
6451 SysFreeString(received);
6455 if(uri) IUri_Release(uri);
6461 static void test_IUri_GetPropertyDWORD(void) {
6466 hr = pCreateUri(http_urlW, 0, 0, &uri);
6467 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6469 DWORD received = 0xdeadbeef;
6471 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6472 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6474 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6475 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6476 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6478 if(uri) IUri_Release(uri);
6480 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6481 uri_properties test = uri_tests[i];
6485 uriW = a2w(test.uri);
6486 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6487 if(test.create_todo) {
6489 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6490 hr, test.create_expected, i);
6493 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6494 hr, test.create_expected, i);
6500 /* Checks all the DWORD properties of the uri. */
6501 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6503 uri_dword_property prop = test.dword_props[j];
6505 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6508 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6509 hr, prop.expected, i, j);
6512 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6513 prop.value, received, i, j);
6516 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6517 hr, prop.expected, i, j);
6518 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6519 prop.value, received, i, j);
6524 if(uri) IUri_Release(uri);
6530 /* Tests all the 'Get*' property functions which deal with strings. */
6531 static void test_IUri_GetStrProperties(void) {
6536 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6537 hr = pCreateUri(http_urlW, 0, 0, &uri);
6538 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6540 hr = IUri_GetAbsoluteUri(uri, NULL);
6541 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6543 hr = IUri_GetAuthority(uri, NULL);
6544 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6546 hr = IUri_GetDisplayUri(uri, NULL);
6547 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6549 hr = IUri_GetDomain(uri, NULL);
6550 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6552 hr = IUri_GetExtension(uri, NULL);
6553 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6555 hr = IUri_GetFragment(uri, NULL);
6556 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6558 hr = IUri_GetHost(uri, NULL);
6559 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6561 hr = IUri_GetPassword(uri, NULL);
6562 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6564 hr = IUri_GetPath(uri, NULL);
6565 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6567 hr = IUri_GetPathAndQuery(uri, NULL);
6568 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6570 hr = IUri_GetQuery(uri, NULL);
6571 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6573 hr = IUri_GetRawUri(uri, NULL);
6574 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6576 hr = IUri_GetSchemeName(uri, NULL);
6577 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6579 hr = IUri_GetUserInfo(uri, NULL);
6580 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6582 hr = IUri_GetUserName(uri, NULL);
6583 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6585 if(uri) IUri_Release(uri);
6587 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6588 uri_properties test = uri_tests[i];
6592 uriW = a2w(test.uri);
6593 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6594 if(test.create_todo) {
6596 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6597 hr, test.create_expected, i);
6600 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6601 hr, test.create_expected, i);
6605 uri_str_property prop;
6606 BSTR received = NULL;
6608 /* GetAbsoluteUri() tests. */
6609 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6610 hr = IUri_GetAbsoluteUri(uri, &received);
6613 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6614 hr, prop.expected, i);
6617 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6618 "Error: Expected %s but got %s on uri_tests[%d].\n",
6619 prop.value, wine_dbgstr_w(received), i);
6622 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6623 hr, prop.expected, i);
6624 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6625 "Error: Expected %s but got %s on uri_tests[%d].\n",
6626 prop.value, wine_dbgstr_w(received), i);
6628 SysFreeString(received);
6631 /* GetAuthority() tests. */
6632 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6633 hr = IUri_GetAuthority(uri, &received);
6636 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6637 hr, prop.expected, i);
6640 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6641 prop.value, wine_dbgstr_w(received), i);
6644 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6645 hr, prop.expected, i);
6646 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6647 prop.value, wine_dbgstr_w(received), i);
6649 SysFreeString(received);
6652 /* GetDisplayUri() tests. */
6653 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6654 hr = IUri_GetDisplayUri(uri, &received);
6657 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6658 hr, prop.expected, i);
6661 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6662 "Error: Expected %s but got %s on uri_test[%d].\n",
6663 prop.value, wine_dbgstr_w(received), i);
6666 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6667 hr, prop.expected, i);
6668 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6669 "Error: Expected %s but got %s on uri_tests[%d].\n",
6670 prop.value, wine_dbgstr_w(received), i);
6672 SysFreeString(received);
6675 /* GetDomain() tests. */
6676 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6677 hr = IUri_GetDomain(uri, &received);
6680 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6681 hr, prop.expected, i);
6684 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6685 prop.value, wine_dbgstr_w(received), i);
6688 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6689 hr, prop.expected, i);
6690 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6691 prop.value, wine_dbgstr_w(received), i);
6693 SysFreeString(received);
6696 /* GetExtension() tests. */
6697 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6698 hr = IUri_GetExtension(uri, &received);
6701 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6702 hr, prop.expected, i);
6705 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6706 prop.value, wine_dbgstr_w(received), i);
6709 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6710 hr, prop.expected, i);
6711 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6712 prop.value, wine_dbgstr_w(received), i);
6714 SysFreeString(received);
6717 /* GetFragment() tests. */
6718 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6719 hr = IUri_GetFragment(uri, &received);
6722 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6723 hr, prop.expected, i);
6726 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6727 prop.value, wine_dbgstr_w(received), i);
6730 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6731 hr, prop.expected, i);
6732 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6733 prop.value, wine_dbgstr_w(received), i);
6735 SysFreeString(received);
6738 /* GetHost() tests. */
6739 prop = test.str_props[Uri_PROPERTY_HOST];
6740 hr = IUri_GetHost(uri, &received);
6743 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6744 hr, prop.expected, i);
6747 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6748 prop.value, wine_dbgstr_w(received), i);
6751 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6752 hr, prop.expected, i);
6753 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6754 prop.value, wine_dbgstr_w(received), i);
6756 SysFreeString(received);
6759 /* GetPassword() tests. */
6760 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6761 hr = IUri_GetPassword(uri, &received);
6764 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6765 hr, prop.expected, i);
6768 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6769 prop.value, wine_dbgstr_w(received), i);
6772 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6773 hr, prop.expected, i);
6774 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6775 prop.value, wine_dbgstr_w(received), i);
6777 SysFreeString(received);
6780 /* GetPath() tests. */
6781 prop = test.str_props[Uri_PROPERTY_PATH];
6782 hr = IUri_GetPath(uri, &received);
6785 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6786 hr, prop.expected, i);
6789 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6790 prop.value, wine_dbgstr_w(received), i);
6793 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6794 hr, prop.expected, i);
6795 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6796 prop.value, wine_dbgstr_w(received), i);
6798 SysFreeString(received);
6801 /* GetPathAndQuery() tests. */
6802 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6803 hr = IUri_GetPathAndQuery(uri, &received);
6806 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6807 hr, prop.expected, i);
6810 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6811 prop.value, wine_dbgstr_w(received), i);
6814 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6815 hr, prop.expected, i);
6816 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6817 prop.value, wine_dbgstr_w(received), i);
6819 SysFreeString(received);
6822 /* GetQuery() tests. */
6823 prop = test.str_props[Uri_PROPERTY_QUERY];
6824 hr = IUri_GetQuery(uri, &received);
6827 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6828 hr, prop.expected, i);
6831 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6832 prop.value, wine_dbgstr_w(received), i);
6835 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6836 hr, prop.expected, i);
6837 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6838 prop.value, wine_dbgstr_w(received), i);
6840 SysFreeString(received);
6843 /* GetRawUri() tests. */
6844 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6845 hr = IUri_GetRawUri(uri, &received);
6848 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6849 hr, prop.expected, i);
6852 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6853 prop.value, wine_dbgstr_w(received), i);
6856 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6857 hr, prop.expected, i);
6858 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6859 prop.value, wine_dbgstr_w(received), i);
6861 SysFreeString(received);
6864 /* GetSchemeName() tests. */
6865 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
6866 hr = IUri_GetSchemeName(uri, &received);
6869 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6870 hr, prop.expected, i);
6873 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6874 prop.value, wine_dbgstr_w(received), i);
6877 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6878 hr, prop.expected, i);
6879 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6880 prop.value, wine_dbgstr_w(received), i);
6882 SysFreeString(received);
6885 /* GetUserInfo() tests. */
6886 prop = test.str_props[Uri_PROPERTY_USER_INFO];
6887 hr = IUri_GetUserInfo(uri, &received);
6890 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6891 hr, prop.expected, i);
6894 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6895 prop.value, wine_dbgstr_w(received), i);
6898 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6899 hr, prop.expected, i);
6900 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6901 prop.value, wine_dbgstr_w(received), i);
6903 SysFreeString(received);
6906 /* GetUserName() tests. */
6907 prop = test.str_props[Uri_PROPERTY_USER_NAME];
6908 hr = IUri_GetUserName(uri, &received);
6911 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6912 hr, prop.expected, i);
6915 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6916 prop.value, wine_dbgstr_w(received), i);
6919 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6920 hr, prop.expected, i);
6921 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6922 prop.value, wine_dbgstr_w(received), i);
6924 SysFreeString(received);
6927 if(uri) IUri_Release(uri);
6933 static void test_IUri_GetDwordProperties(void) {
6938 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
6939 hr = pCreateUri(http_urlW, 0, 0, &uri);
6940 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6942 hr = IUri_GetHostType(uri, NULL);
6943 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6945 hr = IUri_GetPort(uri, NULL);
6946 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6948 hr = IUri_GetScheme(uri, NULL);
6949 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6951 hr = IUri_GetZone(uri, NULL);
6952 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6954 if(uri) IUri_Release(uri);
6956 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6957 uri_properties test = uri_tests[i];
6961 uriW = a2w(test.uri);
6962 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6963 if(test.create_todo) {
6965 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6966 hr, test.create_expected, i);
6969 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6970 hr, test.create_expected, i);
6974 uri_dword_property prop;
6977 /* Assign an insane value so tests don't accidentally pass when
6980 received = -9999999;
6982 /* GetHostType() tests. */
6983 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
6984 hr = IUri_GetHostType(uri, &received);
6987 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6988 hr, prop.expected, i);
6991 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6994 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6995 hr, prop.expected, i);
6996 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6998 received = -9999999;
7000 /* GetPort() tests. */
7001 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7002 hr = IUri_GetPort(uri, &received);
7005 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7006 hr, prop.expected, i);
7009 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7012 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7013 hr, prop.expected, i);
7014 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7016 received = -9999999;
7018 /* GetScheme() tests. */
7019 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7020 hr = IUri_GetScheme(uri, &received);
7023 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7024 hr, prop.expected, i);
7027 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7030 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7031 hr, prop.expected, i);
7032 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7034 received = -9999999;
7036 /* GetZone() tests. */
7037 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7038 hr = IUri_GetZone(uri, &received);
7041 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7042 hr, prop.expected, i);
7045 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7048 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7049 hr, prop.expected, i);
7050 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7054 if(uri) IUri_Release(uri);
7060 static void test_IUri_GetPropertyLength(void) {
7065 /* Make sure it handles invalid args correctly. */
7066 hr = pCreateUri(http_urlW, 0, 0, &uri);
7067 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7069 DWORD received = 0xdeadbeef;
7071 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7072 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7074 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7075 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7076 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7078 if(uri) IUri_Release(uri);
7080 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7081 uri_properties test = uri_tests[i];
7085 uriW = a2w(test.uri);
7086 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7087 if(test.create_todo) {
7089 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7090 hr, test.create_expected, i);
7093 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7094 hr, test.create_expected, i);
7100 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7101 DWORD expectedLen, brokenLen, receivedLen;
7102 uri_str_property prop = test.str_props[j];
7104 expectedLen = lstrlen(prop.value);
7105 brokenLen = lstrlen(prop.broken_value);
7107 /* This won't be necessary once GetPropertyLength is implemented. */
7110 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7113 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7114 hr, prop.expected, i, j);
7117 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7118 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7119 expectedLen, receivedLen, i, j);
7122 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7123 hr, prop.expected, i, j);
7124 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7125 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7126 expectedLen, receivedLen, i, j);
7131 if(uri) IUri_Release(uri);
7137 static DWORD compute_expected_props(uri_properties *test)
7141 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7142 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7146 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7147 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7154 static void test_IUri_GetProperties(void) {
7159 hr = pCreateUri(http_urlW, 0, 0, &uri);
7160 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7162 hr = IUri_GetProperties(uri, NULL);
7163 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7165 if(uri) IUri_Release(uri);
7167 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7168 uri_properties test = uri_tests[i];
7172 uriW = a2w(test.uri);
7173 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7174 if(test.create_todo) {
7176 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7179 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7183 DWORD received = 0, expected_props;
7186 hr = IUri_GetProperties(uri, &received);
7187 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7189 expected_props = compute_expected_props(&test);
7191 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7192 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7193 if(expected_props & (1 << j))
7194 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7196 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7200 if(uri) IUri_Release(uri);
7206 static void test_IUri_HasProperty(void) {
7211 hr = pCreateUri(http_urlW, 0, 0, &uri);
7212 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7214 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7215 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7217 if(uri) IUri_Release(uri);
7219 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7220 uri_properties test = uri_tests[i];
7224 uriW = a2w(test.uri);
7226 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7227 if(test.create_todo) {
7229 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7232 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7236 DWORD expected_props, j;
7238 expected_props = compute_expected_props(&test);
7240 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7241 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7244 hr = IUri_HasProperty(uri, j, &received);
7245 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7248 if(expected_props & (1 << j)) {
7249 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7251 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7256 if(uri) IUri_Release(uri);
7262 static void test_IUri_IsEqual(void) {
7269 /* Make sure IsEqual handles invalid args correctly. */
7270 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7271 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7272 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7273 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7274 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7276 hrA = IUri_IsEqual(uriA, NULL, &equal);
7277 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7278 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7280 hrA = IUri_IsEqual(uriA, uriB, NULL);
7281 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7283 if(uriA) IUri_Release(uriA);
7284 if(uriB) IUri_Release(uriB);
7286 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7287 uri_equality test = equality_tests[i];
7288 LPWSTR uriA_W, uriB_W;
7292 uriA_W = a2w(test.a);
7293 uriB_W = a2w(test.b);
7295 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7296 if(test.create_todo_a) {
7298 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7302 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7306 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7307 if(test.create_todo_b) {
7309 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7313 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7317 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7320 hrA = IUri_IsEqual(uriA, uriB, &equal);
7323 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7327 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7330 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7331 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7334 if(uriA) IUri_Release(uriA);
7335 if(uriB) IUri_Release(uriB);
7342 static void test_CreateUriWithFragment_InvalidArgs(void) {
7344 IUri *uri = (void*) 0xdeadbeef;
7345 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7347 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7348 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7349 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7351 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7352 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7354 /* Original URI can't already contain a fragment component. */
7355 uri = (void*) 0xdeadbeef;
7356 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7357 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7358 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7361 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7362 static void test_CreateUriWithFragment_InvalidFlags(void) {
7365 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7367 IUri *uri = (void*) 0xdeadbeef;
7369 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7370 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7371 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7372 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7376 static void test_CreateUriWithFragment(void) {
7379 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7383 uri_with_fragment test = uri_fragment_tests[i];
7385 uriW = a2w(test.uri);
7386 fragW = a2w(test.fragment);
7388 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7389 if(test.expected_todo) {
7391 ok(hr == test.create_expected,
7392 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7393 hr, test.create_expected, i);
7396 ok(hr == test.create_expected,
7397 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7398 hr, test.create_expected, i);
7401 BSTR received = NULL;
7403 hr = IUri_GetAbsoluteUri(uri, &received);
7404 if(test.expected_todo) {
7407 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7411 ok(!strcmp_aw(test.expected_uri, received),
7412 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7413 test.expected_uri, wine_dbgstr_w(received), i);
7416 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7418 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7419 test.expected_uri, wine_dbgstr_w(received), i);
7422 SysFreeString(received);
7425 if(uri) IUri_Release(uri);
7431 static void test_CreateIUriBuilder(void) {
7433 IUriBuilder *builder = NULL;
7436 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7437 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7440 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7441 hr = pCreateUri(http_urlW, 0, 0, &uri);
7442 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7444 ULONG cur_count, orig_count;
7446 orig_count = get_refcnt(uri);
7447 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7448 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7449 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7451 cur_count = get_refcnt(uri);
7452 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7454 if(builder) IUriBuilder_Release(builder);
7455 cur_count = get_refcnt(uri);
7456 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7458 if(uri) IUri_Release(uri);
7461 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7466 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7467 if(test->uri_todo) {
7469 ok(hr == test->uri_hres,
7470 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7471 hr, test->uri_hres, test_index);
7474 ok(hr == test->uri_hres,
7475 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7476 hr, test->uri_hres, test_index);
7482 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7483 uri_builder_str_property prop = test->expected_str_props[i];
7484 BSTR received = NULL;
7486 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7489 ok(hr == prop.result,
7490 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7491 hr, prop.result, test_index, i);
7494 ok(hr == prop.result,
7495 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7496 hr, prop.result, test_index, i);
7501 ok(!strcmp_aw(prop.expected, received),
7502 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7503 prop.expected, wine_dbgstr_w(received), test_index, i);
7506 ok(!strcmp_aw(prop.expected, received),
7507 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7508 prop.expected, wine_dbgstr_w(received), test_index, i);
7511 SysFreeString(received);
7514 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7515 uri_builder_dword_property prop = test->expected_dword_props[i];
7516 DWORD received = -2;
7518 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7521 ok(hr == prop.result,
7522 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7523 hr, prop.result, test_index, i);
7526 ok(hr == prop.result,
7527 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7528 hr, prop.result, test_index, i);
7533 ok(received == prop.expected,
7534 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7535 prop.expected, received, test_index, i);
7538 ok(received == prop.expected,
7539 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7540 prop.expected, received, test_index, i);
7545 if(uri) IUri_Release(uri);
7548 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7553 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7554 if(test->uri_simple_todo) {
7556 ok(hr == test->uri_simple_hres,
7557 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7558 hr, test->uri_simple_hres, test_index);
7561 ok(hr == test->uri_simple_hres,
7562 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7563 hr, test->uri_simple_hres, test_index);
7569 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7570 uri_builder_str_property prop = test->expected_str_props[i];
7571 BSTR received = NULL;
7573 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7576 ok(hr == prop.result,
7577 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7578 hr, prop.result, test_index, i);
7581 ok(hr == prop.result,
7582 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7583 hr, prop.result, test_index, i);
7588 ok(!strcmp_aw(prop.expected, received),
7589 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7590 prop.expected, wine_dbgstr_w(received), test_index, i);
7593 ok(!strcmp_aw(prop.expected, received),
7594 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7595 prop.expected, wine_dbgstr_w(received), test_index, i);
7598 SysFreeString(received);
7601 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7602 uri_builder_dword_property prop = test->expected_dword_props[i];
7603 DWORD received = -2;
7605 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7608 ok(hr == prop.result,
7609 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7610 hr, prop.result, test_index, i);
7613 ok(hr == prop.result,
7614 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7615 hr, prop.result, test_index, i);
7620 ok(received == prop.expected,
7621 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7622 prop.expected, received, test_index, i);
7625 ok(received == prop.expected,
7626 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7627 prop.expected, received, test_index, i);
7632 if(uri) IUri_Release(uri);
7635 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7640 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7641 test->uri_with_encode_flags, 0, &uri);
7642 if(test->uri_with_todo) {
7644 ok(hr == test->uri_with_hres,
7645 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7646 hr, test->uri_with_hres, test_index);
7649 ok(hr == test->uri_with_hres,
7650 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7651 hr, test->uri_with_hres, test_index);
7657 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7658 uri_builder_str_property prop = test->expected_str_props[i];
7659 BSTR received = NULL;
7661 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7664 ok(hr == prop.result,
7665 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7666 hr, prop.result, test_index, i);
7669 ok(hr == prop.result,
7670 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7671 hr, prop.result, test_index, i);
7676 ok(!strcmp_aw(prop.expected, received),
7677 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7678 prop.expected, wine_dbgstr_w(received), test_index, i);
7681 ok(!strcmp_aw(prop.expected, received),
7682 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7683 prop.expected, wine_dbgstr_w(received), test_index, i);
7686 SysFreeString(received);
7689 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7690 uri_builder_dword_property prop = test->expected_dword_props[i];
7691 DWORD received = -2;
7693 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7696 ok(hr == prop.result,
7697 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7698 hr, prop.result, test_index, i);
7701 ok(hr == prop.result,
7702 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7703 hr, prop.result, test_index, i);
7708 ok(received == prop.expected,
7709 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7710 prop.expected, received, test_index, i);
7713 ok(received == prop.expected,
7714 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7715 prop.expected, received, test_index, i);
7720 if(uri) IUri_Release(uri);
7723 static void test_IUriBuilder_CreateInvalidArgs(void) {
7724 IUriBuilder *builder;
7727 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7728 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7730 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7732 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7733 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7734 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7736 uri = (void*) 0xdeadbeef;
7737 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7738 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7739 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7741 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7742 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7745 uri = (void*) 0xdeadbeef;
7746 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7747 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7749 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7751 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7752 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7755 uri = (void*) 0xdeadbeef;
7756 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7757 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7759 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7761 hr = pCreateUri(http_urlW, 0, 0, &test);
7762 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7764 hr = IUriBuilder_SetIUri(builder, test);
7765 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7767 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7769 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7770 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7771 ok(uri != NULL, "Error: The uri was NULL.\n");
7772 if(uri) IUri_Release(uri);
7775 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7776 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7778 ok(uri != NULL, "Error: uri was NULL.\n");
7779 if(uri) IUri_Release(uri);
7782 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7783 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7785 ok(uri != NULL, "Error: uri was NULL.\n");
7786 if(uri) IUri_Release(uri);
7788 hr = IUriBuilder_SetFragment(builder, NULL);
7789 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7791 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7792 uri = (void*) 0xdeadbeef;
7793 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7794 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7795 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7797 uri = (void*) 0xdeadbeef;
7798 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7799 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7801 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7803 uri = (void*) 0xdeadbeef;
7804 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7805 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7807 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7809 if(test) IUri_Release(test);
7811 if(builder) IUriBuilder_Release(builder);
7814 /* Tests invalid args to the "Get*" functions. */
7815 static void test_IUriBuilder_GetInvalidArgs(void) {
7816 IUriBuilder *builder = NULL;
7819 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7820 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7822 LPCWSTR received = (void*) 0xdeadbeef;
7823 DWORD len = -1, port = -1;
7826 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7827 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7829 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7830 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7832 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7833 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7834 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7836 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7838 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7839 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7841 received = (void*) 0xdeadbeef;
7842 hr = IUriBuilder_GetHost(builder, NULL, &received);
7843 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7845 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7847 hr = IUriBuilder_GetHost(builder, &len, NULL);
7848 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7850 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7852 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7853 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7855 received = (void*) 0xdeadbeef;
7856 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7857 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7859 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7861 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7862 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7864 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7866 hr = IUriBuilder_GetPath(builder, NULL, NULL);
7867 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7869 received = (void*) 0xdeadbeef;
7870 hr = IUriBuilder_GetPath(builder, NULL, &received);
7871 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7873 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7875 hr = IUriBuilder_GetPath(builder, &len, NULL);
7876 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7878 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7880 hr = IUriBuilder_GetPort(builder, NULL, NULL);
7881 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7883 hr = IUriBuilder_GetPort(builder, NULL, &port);
7884 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7886 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
7887 hr = IUriBuilder_GetPort(builder, &set, NULL);
7888 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7890 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
7892 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
7893 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7895 received = (void*) 0xdeadbeef;
7896 hr = IUriBuilder_GetQuery(builder, NULL, &received);
7897 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7899 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7901 hr = IUriBuilder_GetQuery(builder, &len, NULL);
7902 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7904 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7906 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
7907 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7909 received = (void*) 0xdeadbeef;
7910 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
7911 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7913 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7915 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
7916 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7918 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7920 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
7921 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7923 received = (void*) 0xdeadbeef;
7924 hr = IUriBuilder_GetUserName(builder, NULL, &received);
7925 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7927 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7929 hr = IUriBuilder_GetUserName(builder, &len, NULL);
7930 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7932 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7934 if(builder) IUriBuilder_Release(builder);
7937 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
7941 LPCWSTR received = NULL;
7943 const uri_builder_property *prop = NULL;
7945 /* Check if the property was set earlier. */
7946 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7947 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
7948 prop = &(test->properties[i]);
7952 /* Use expected_value unless it's NULL, then use value. */
7953 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7954 hr = IUriBuilder_GetFragment(builder, &len, &received);
7957 ok(hr == (expected ? S_OK : S_FALSE),
7958 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7959 hr, (expected ? S_OK : S_FALSE), test_index);
7963 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7964 expected, wine_dbgstr_w(received), test_index);
7967 ok(lstrlen(expected) == len,
7968 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7969 lstrlen(expected), len, test_index);
7973 ok(hr == (expected ? S_OK : S_FALSE),
7974 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7975 hr, (expected ? S_OK : S_FALSE), test_index);
7976 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7977 expected, wine_dbgstr_w(received), test_index);
7978 ok(lstrlen(expected) == len,
7979 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7980 lstrlen(expected), len, test_index);
7983 /* The property wasn't set earlier, so it should return whatever
7984 * the base IUri contains (if anything).
7987 hr = IUriBuilder_GetIUri(builder, &uri);
7989 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7990 hr, S_OK, test_index);
7993 received = (void*) 0xdeadbeef;
7996 hr = IUriBuilder_GetFragment(builder, &len, &received);
7998 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7999 hr, S_FALSE, test_index);
8001 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8003 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8004 received, test_index);
8007 BOOL has_prop = FALSE;
8008 BSTR expected = NULL;
8010 hr = IUri_GetFragment(uri, &expected);
8012 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8014 has_prop = hr == S_OK;
8016 hr = IUriBuilder_GetFragment(builder, &len, &received);
8019 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8020 hr, S_OK, test_index);
8022 ok(!lstrcmpW(expected, received),
8023 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8024 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8025 ok(lstrlenW(expected) == len,
8026 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8027 lstrlenW(expected), len, test_index);
8031 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8032 hr, S_FALSE, test_index);
8034 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8035 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8039 SysFreeString(expected);
8042 if(uri) IUri_Release(uri);
8046 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8050 LPCWSTR received = NULL;
8052 const uri_builder_property *prop = NULL;
8054 /* Check if the property was set earlier. */
8055 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8056 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8057 prop = &(test->properties[i]);
8061 /* Use expected_value unless it's NULL, then use value. */
8062 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8063 hr = IUriBuilder_GetHost(builder, &len, &received);
8066 ok(hr == (expected ? S_OK : S_FALSE),
8067 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8068 hr, (expected ? S_OK : S_FALSE), test_index);
8072 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8073 expected, wine_dbgstr_w(received), test_index);
8076 ok(lstrlen(expected) == len,
8077 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8078 lstrlen(expected), len, test_index);
8082 ok(hr == (expected ? S_OK : S_FALSE),
8083 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8084 hr, (expected ? S_OK : S_FALSE), test_index);
8085 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8086 expected, wine_dbgstr_w(received), test_index);
8087 ok(lstrlen(expected) == len,
8088 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8089 lstrlen(expected), len, test_index);
8092 /* The property wasn't set earlier, so it should return whatever
8093 * the base IUri contains (if anything).
8096 hr = IUriBuilder_GetIUri(builder, &uri);
8098 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8099 hr, S_OK, test_index);
8102 received = (void*) 0xdeadbeef;
8105 hr = IUriBuilder_GetHost(builder, &len, &received);
8107 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8108 hr, S_FALSE, test_index);
8110 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8112 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8113 received, test_index);
8116 BOOL has_prop = FALSE;
8117 BSTR expected = NULL;
8119 hr = IUri_GetHost(uri, &expected);
8121 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8123 has_prop = hr == S_OK;
8125 hr = IUriBuilder_GetHost(builder, &len, &received);
8128 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8129 hr, S_OK, test_index);
8131 ok(!lstrcmpW(expected, received),
8132 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8133 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8134 ok(lstrlenW(expected) == len,
8135 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8136 lstrlenW(expected), len, test_index);
8140 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8141 hr, S_FALSE, test_index);
8143 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8144 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8148 SysFreeString(expected);
8151 if(uri) IUri_Release(uri);
8155 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8159 LPCWSTR received = NULL;
8161 const uri_builder_property *prop = NULL;
8163 /* Check if the property was set earlier. */
8164 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8165 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8166 prop = &(test->properties[i]);
8170 /* Use expected_value unless it's NULL, then use value. */
8171 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8172 hr = IUriBuilder_GetPassword(builder, &len, &received);
8175 ok(hr == (expected ? S_OK : S_FALSE),
8176 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8177 hr, (expected ? S_OK : S_FALSE), test_index);
8181 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8182 expected, wine_dbgstr_w(received), test_index);
8185 ok(lstrlen(expected) == len,
8186 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8187 lstrlen(expected), len, test_index);
8191 ok(hr == (expected ? S_OK : S_FALSE),
8192 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8193 hr, (expected ? S_OK : S_FALSE), test_index);
8194 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8195 expected, wine_dbgstr_w(received), test_index);
8196 ok(lstrlen(expected) == len,
8197 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8198 lstrlen(expected), len, test_index);
8201 /* The property wasn't set earlier, so it should return whatever
8202 * the base IUri contains (if anything).
8205 hr = IUriBuilder_GetIUri(builder, &uri);
8207 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8208 hr, S_OK, test_index);
8211 received = (void*) 0xdeadbeef;
8214 hr = IUriBuilder_GetPassword(builder, &len, &received);
8216 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8217 hr, S_FALSE, test_index);
8219 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8221 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8222 received, test_index);
8225 BOOL has_prop = FALSE;
8226 BSTR expected = NULL;
8228 hr = IUri_GetPassword(uri, &expected);
8230 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8232 has_prop = hr == S_OK;
8234 hr = IUriBuilder_GetPassword(builder, &len, &received);
8237 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8238 hr, S_OK, test_index);
8240 ok(!lstrcmpW(expected, received),
8241 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8242 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8243 ok(lstrlenW(expected) == len,
8244 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8245 lstrlenW(expected), len, test_index);
8249 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8250 hr, S_FALSE, test_index);
8252 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8253 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8257 SysFreeString(expected);
8260 if(uri) IUri_Release(uri);
8264 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8268 LPCWSTR received = NULL;
8270 const uri_builder_property *prop = NULL;
8272 /* Check if the property was set earlier. */
8273 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8274 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8275 prop = &(test->properties[i]);
8279 /* Use expected_value unless it's NULL, then use value. */
8280 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8281 hr = IUriBuilder_GetPath(builder, &len, &received);
8284 ok(hr == (expected ? S_OK : S_FALSE),
8285 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8286 hr, (expected ? S_OK : S_FALSE), test_index);
8290 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8291 expected, wine_dbgstr_w(received), test_index);
8294 ok(lstrlen(expected) == len,
8295 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8296 lstrlen(expected), len, test_index);
8300 ok(hr == (expected ? S_OK : S_FALSE),
8301 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8302 hr, (expected ? S_OK : S_FALSE), test_index);
8303 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8304 expected, wine_dbgstr_w(received), test_index);
8305 ok(lstrlen(expected) == len,
8306 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8307 lstrlen(expected), len, test_index);
8310 /* The property wasn't set earlier, so it should return whatever
8311 * the base IUri contains (if anything).
8314 hr = IUriBuilder_GetIUri(builder, &uri);
8316 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8317 hr, S_OK, test_index);
8320 received = (void*) 0xdeadbeef;
8323 hr = IUriBuilder_GetPath(builder, &len, &received);
8325 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8326 hr, S_FALSE, test_index);
8328 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8330 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8331 received, test_index);
8334 BOOL has_prop = FALSE;
8335 BSTR expected = NULL;
8337 hr = IUri_GetPath(uri, &expected);
8339 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8341 has_prop = hr == S_OK;
8343 hr = IUriBuilder_GetPath(builder, &len, &received);
8346 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8347 hr, S_OK, test_index);
8349 ok(!lstrcmpW(expected, received),
8350 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8351 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8352 ok(lstrlenW(expected) == len,
8353 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8354 lstrlenW(expected), len, test_index);
8358 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8359 hr, S_FALSE, test_index);
8361 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8362 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8366 SysFreeString(expected);
8369 if(uri) IUri_Release(uri);
8373 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8376 BOOL has_port = FALSE;
8377 DWORD received = -1;
8379 if(test->port_prop.change) {
8380 DWORD expected = test->port_prop.value;
8382 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8383 if(test->port_prop.todo) {
8386 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8387 hr, S_OK, test_index);
8391 ok(has_port == test->port_prop.set,
8392 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8393 test->port_prop.set, has_port, test_index);
8396 ok(received == expected,
8397 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8398 expected, received, test_index);
8403 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8404 hr, S_OK, test_index);
8405 ok(has_port == test->port_prop.set,
8406 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8407 test->port_prop.set, has_port, test_index);
8408 ok(received == test->port_prop.value,
8409 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8410 test->port_prop.value, received, test_index);
8415 hr = IUriBuilder_GetIUri(builder, &uri);
8417 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8418 hr, S_OK, test_index);
8421 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8423 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8424 hr, S_OK, test_index);
8426 ok(has_port == FALSE,
8427 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8428 has_port, test_index);
8429 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8430 received, test_index);
8435 hr = IUri_GetPort(uri, &expected);
8437 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8440 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8442 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8443 hr, S_OK, test_index);
8446 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8448 ok(received == expected,
8449 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8450 expected, received, test_index);
8454 if(uri) IUri_Release(uri);
8458 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8462 LPCWSTR received = NULL;
8464 const uri_builder_property *prop = NULL;
8466 /* Check if the property was set earlier. */
8467 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8468 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8469 prop = &(test->properties[i]);
8473 /* Use expected_value unless it's NULL, then use value. */
8474 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8475 hr = IUriBuilder_GetQuery(builder, &len, &received);
8478 ok(hr == (expected ? S_OK : S_FALSE),
8479 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8480 hr, (expected ? S_OK : S_FALSE), test_index);
8484 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8485 expected, wine_dbgstr_w(received), test_index);
8488 ok(lstrlen(expected) == len,
8489 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8490 lstrlen(expected), len, test_index);
8494 ok(hr == (expected ? S_OK : S_FALSE),
8495 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8496 hr, (expected ? S_OK : S_FALSE), test_index);
8497 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8498 expected, wine_dbgstr_w(received), test_index);
8499 ok(lstrlen(expected) == len,
8500 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8501 lstrlen(expected), len, test_index);
8504 /* The property wasn't set earlier, so it should return whatever
8505 * the base IUri contains (if anything).
8508 hr = IUriBuilder_GetIUri(builder, &uri);
8510 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8511 hr, S_OK, test_index);
8514 received = (void*) 0xdeadbeef;
8517 hr = IUriBuilder_GetQuery(builder, &len, &received);
8519 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8520 hr, S_FALSE, test_index);
8522 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8524 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8525 received, test_index);
8528 BOOL has_prop = FALSE;
8529 BSTR expected = NULL;
8531 hr = IUri_GetQuery(uri, &expected);
8533 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8535 has_prop = hr == S_OK;
8537 hr = IUriBuilder_GetQuery(builder, &len, &received);
8540 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8541 hr, S_OK, test_index);
8543 ok(!lstrcmpW(expected, received),
8544 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8545 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8546 ok(lstrlenW(expected) == len,
8547 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8548 lstrlenW(expected), len, test_index);
8552 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8553 hr, S_FALSE, test_index);
8555 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8556 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8560 SysFreeString(expected);
8563 if(uri) IUri_Release(uri);
8567 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8571 LPCWSTR received = NULL;
8573 const uri_builder_property *prop = NULL;
8575 /* Check if the property was set earlier. */
8576 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8577 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8578 prop = &(test->properties[i]);
8582 /* Use expected_value unless it's NULL, then use value. */
8583 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8584 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8587 ok(hr == (expected ? S_OK : S_FALSE),
8588 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8589 hr, (expected ? S_OK : S_FALSE), test_index);
8593 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8594 expected, wine_dbgstr_w(received), test_index);
8597 ok(lstrlen(expected) == len,
8598 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8599 lstrlen(expected), len, test_index);
8603 ok(hr == (expected ? S_OK : S_FALSE),
8604 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8605 hr, (expected ? S_OK : S_FALSE), test_index);
8606 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8607 expected, wine_dbgstr_w(received), test_index);
8608 ok(lstrlen(expected) == len,
8609 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8610 lstrlen(expected), len, test_index);
8613 /* The property wasn't set earlier, so it should return whatever
8614 * the base IUri contains (if anything).
8617 hr = IUriBuilder_GetIUri(builder, &uri);
8619 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8620 hr, S_OK, test_index);
8623 received = (void*) 0xdeadbeef;
8626 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8628 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8629 hr, S_FALSE, test_index);
8631 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8633 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8634 received, test_index);
8637 BOOL has_prop = FALSE;
8638 BSTR expected = NULL;
8640 hr = IUri_GetSchemeName(uri, &expected);
8642 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8644 has_prop = hr == S_OK;
8646 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8649 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8650 hr, S_OK, test_index);
8652 ok(!lstrcmpW(expected, received),
8653 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8654 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8655 ok(lstrlenW(expected) == len,
8656 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8657 lstrlenW(expected), len, test_index);
8661 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8662 hr, S_FALSE, test_index);
8664 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8665 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8669 SysFreeString(expected);
8672 if(uri) IUri_Release(uri);
8676 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8680 LPCWSTR received = NULL;
8682 const uri_builder_property *prop = NULL;
8684 /* Check if the property was set earlier. */
8685 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8686 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8687 prop = &(test->properties[i]);
8690 if(prop && prop->value && *prop->value) {
8691 /* Use expected_value unless it's NULL, then use value. */
8692 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8693 hr = IUriBuilder_GetUserName(builder, &len, &received);
8696 ok(hr == (expected ? S_OK : S_FALSE),
8697 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8698 hr, (expected ? S_OK : S_FALSE), test_index);
8702 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8703 expected, wine_dbgstr_w(received), test_index);
8706 ok(lstrlen(expected) == len,
8707 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8708 lstrlen(expected), len, test_index);
8712 ok(hr == (expected ? S_OK : S_FALSE),
8713 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8714 hr, (expected ? S_OK : S_FALSE), test_index);
8715 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8716 expected, wine_dbgstr_w(received), test_index);
8717 ok(lstrlen(expected) == len,
8718 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8719 lstrlen(expected), len, test_index);
8722 /* The property wasn't set earlier, so it should return whatever
8723 * the base IUri contains (if anything).
8726 hr = IUriBuilder_GetIUri(builder, &uri);
8728 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8729 hr, S_OK, test_index);
8732 received = (void*) 0xdeadbeef;
8735 hr = IUriBuilder_GetUserName(builder, &len, &received);
8737 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8738 hr, S_FALSE, test_index);
8740 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8742 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8743 received, test_index);
8746 BSTR expected = NULL;
8747 BOOL has_prop = FALSE;
8749 hr = IUri_GetUserName(uri, &expected);
8751 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8753 has_prop = hr == S_OK;
8755 hr = IUriBuilder_GetUserName(builder, &len, &received);
8758 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8759 hr, S_OK, test_index);
8761 ok(!lstrcmpW(expected, received),
8762 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8763 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8764 ok(lstrlenW(expected) == len,
8765 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8766 lstrlenW(expected), len, test_index);
8770 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8771 hr, S_FALSE, test_index);
8773 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8774 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8778 SysFreeString(expected);
8781 if(uri) IUri_Release(uri);
8785 /* Tests IUriBuilder functions. */
8786 static void test_IUriBuilder(void) {
8788 IUriBuilder *builder;
8791 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8793 uri_builder_test test = uri_builder_tests[i];
8797 uriW = a2w(test.uri);
8798 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8799 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8801 if(FAILED(hr)) continue;
8803 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8804 if(test.create_builder_todo) {
8806 ok(hr == test.create_builder_expected,
8807 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8808 hr, test.create_builder_expected, i);
8811 ok(hr == test.create_builder_expected,
8812 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8813 hr, test.create_builder_expected, i);
8817 BOOL modified = FALSE, received = FALSE;
8819 /* Perform all the string property changes. */
8820 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8821 uri_builder_property prop = test.properties[j];
8823 change_property(builder, &prop, i);
8824 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8825 prop.property != Uri_PROPERTY_HOST)
8827 else if(prop.value && *prop.value)
8829 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8830 /* Host name property can't be NULL, but it can be empty. */
8835 if(test.port_prop.change) {
8836 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8838 if(test.port_prop.todo) {
8840 ok(hr == test.port_prop.expected,
8841 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8842 hr, test.port_prop.expected, i);
8845 ok(hr == test.port_prop.expected,
8846 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8847 hr, test.port_prop.expected, i);
8851 hr = IUriBuilder_HasBeenModified(builder, &received);
8853 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8856 ok(received == modified,
8857 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8858 modified, received, i);
8860 /* Test the "Get*" functions. */
8861 test_IUriBuilder_GetFragment(builder, &test, i);
8862 test_IUriBuilder_GetHost(builder, &test, i);
8863 test_IUriBuilder_GetPassword(builder, &test, i);
8864 test_IUriBuilder_GetPath(builder, &test, i);
8865 test_IUriBuilder_GetPort(builder, &test, i);
8866 test_IUriBuilder_GetQuery(builder, &test, i);
8867 test_IUriBuilder_GetSchemeName(builder, &test, i);
8868 test_IUriBuilder_GetUserName(builder, &test, i);
8870 test_IUriBuilder_CreateUri(builder, &test, i);
8871 test_IUriBuilder_CreateUriSimple(builder, &test, i);
8872 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
8874 if(builder) IUriBuilder_Release(builder);
8875 if(uri) IUri_Release(uri);
8880 static void test_IUriBuilder_HasBeenModified(void) {
8882 IUriBuilder *builder = NULL;
8884 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8885 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8887 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
8891 hr = IUriBuilder_HasBeenModified(builder, NULL);
8892 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8895 hr = IUriBuilder_SetHost(builder, hostW);
8896 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
8899 hr = IUriBuilder_HasBeenModified(builder, &received);
8900 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8903 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8905 hr = pCreateUri(http_urlW, 0, 0, &uri);
8906 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8911 hr = IUriBuilder_SetIUri(builder, uri);
8912 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
8915 hr = IUriBuilder_HasBeenModified(builder, &received);
8916 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8919 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
8921 /* Test what happens with you call SetIUri with the same IUri again. */
8922 hr = IUriBuilder_SetHost(builder, hostW);
8923 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8925 hr = IUriBuilder_HasBeenModified(builder, &received);
8926 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8929 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8931 hr = IUriBuilder_SetIUri(builder, uri);
8932 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8934 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
8935 * reset any of the changes that were made to the IUriBuilder.
8937 hr = IUriBuilder_HasBeenModified(builder, &received);
8938 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8940 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8942 hr = IUriBuilder_GetHost(builder, &len, &prop);
8943 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8945 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8946 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8947 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
8948 lstrlenW(hostW), len);
8951 hr = IUriBuilder_SetIUri(builder, NULL);
8952 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8954 hr = IUriBuilder_SetHost(builder, hostW);
8955 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8956 hr = IUriBuilder_HasBeenModified(builder, &received);
8957 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8960 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8962 hr = IUriBuilder_SetIUri(builder, NULL);
8963 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
8965 hr = IUriBuilder_HasBeenModified(builder, &received);
8966 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8969 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8971 hr = IUriBuilder_GetHost(builder, &len, &prop);
8972 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8974 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8975 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8976 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
8977 lstrlenW(hostW), len);
8980 if(uri) IUri_Release(uri);
8982 if(builder) IUriBuilder_Release(builder);
8985 /* Test IUriBuilder {Get,Set}IUri functions. */
8986 static void test_IUriBuilder_IUriProperty(void) {
8987 IUriBuilder *builder = NULL;
8990 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8991 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8995 hr = IUriBuilder_GetIUri(builder, NULL);
8996 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
8999 hr = pCreateUri(http_urlW, 0, 0, &uri);
9002 ULONG cur_count, orig_count;
9004 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9005 orig_count = get_refcnt(uri);
9006 hr = IUriBuilder_SetIUri(builder, uri);
9007 cur_count = get_refcnt(uri);
9009 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9010 orig_count+1, cur_count);
9012 hr = IUriBuilder_SetIUri(builder, NULL);
9013 cur_count = get_refcnt(uri);
9015 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9016 orig_count, cur_count);
9018 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9019 hr = IUriBuilder_SetIUri(builder, uri);
9020 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9021 orig_count = get_refcnt(uri);
9023 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9024 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9026 cur_count = get_refcnt(uri);
9027 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9028 orig_count+1, cur_count);
9029 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9032 if(test) IUri_Release(test);
9035 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9036 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9038 cur_count = get_refcnt(uri);
9039 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9040 orig_count+1, cur_count);
9041 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9043 if(test) IUri_Release(test);
9045 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9049 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9050 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9052 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9054 if(test) IUri_Release(test);
9056 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9057 * explicitly set (because it's a default flags).
9060 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9061 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9063 cur_count = get_refcnt(uri);
9064 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9065 orig_count+1, cur_count);
9066 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9068 if(test) IUri_Release(test);
9071 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9072 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9074 cur_count = get_refcnt(uri);
9075 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9076 orig_count+1, cur_count);
9077 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9079 if(test) IUri_Release(test);
9082 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9083 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9086 cur_count = get_refcnt(uri);
9087 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9088 orig_count+1, cur_count);
9089 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9091 if(test) IUri_Release(test);
9093 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9097 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9098 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9100 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9102 if(test) IUri_Release(test);
9104 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9105 * explicitly set (because it's a default flags).
9108 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9109 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9111 cur_count = get_refcnt(uri);
9112 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9113 orig_count+1, cur_count);
9114 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9116 if(test) IUri_Release(test);
9118 if(uri) IUri_Release(uri);
9120 if(builder) IUriBuilder_Release(builder);
9123 static void test_IUriBuilder_RemoveProperties(void) {
9124 IUriBuilder *builder = NULL;
9128 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9129 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9131 /* Properties that can't be removed. */
9132 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9133 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9135 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9136 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9137 if((i << 1) & invalid) {
9138 ok(hr == E_INVALIDARG,
9139 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9140 hr, E_INVALIDARG, i);
9143 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9148 /* Also doesn't accept anything that's outside the range of the
9151 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9152 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9155 if(builder) IUriBuilder_Release(builder);
9157 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9158 uri_builder_remove_test test = uri_builder_remove_tests[i];
9162 uriW = a2w(test.uri);
9163 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9167 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9168 if(test.create_builder_todo) {
9170 ok(hr == test.create_builder_expected,
9171 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9172 hr, test.create_builder_expected, i);
9175 ok(hr == test.create_builder_expected,
9176 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9177 hr, test.create_builder_expected, i);
9180 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9181 if(test.remove_todo) {
9183 ok(hr == test.remove_expected,
9184 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9185 hr, test.remove_expected, i);
9188 ok(hr == test.remove_expected,
9189 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9190 hr, test.remove_expected, i);
9193 IUri *result = NULL;
9195 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9196 if(test.expected_todo) {
9198 ok(hr == test.expected_hres,
9199 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9200 hr, test.expected_hres, i);
9203 ok(hr == test.expected_hres,
9204 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9205 hr, test.expected_hres, i);
9208 BSTR received = NULL;
9210 hr = IUri_GetAbsoluteUri(result, &received);
9211 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9212 ok(!strcmp_aw(test.expected_uri, received),
9213 "Error: Expected %s but got %s instead on test %d.\n",
9214 test.expected_uri, wine_dbgstr_w(received), i);
9215 SysFreeString(received);
9217 if(result) IUri_Release(result);
9220 if(builder) IUriBuilder_Release(builder);
9222 if(uri) IUri_Release(uri);
9227 static void test_IUriBuilder_Misc(void) {
9231 hr = pCreateUri(http_urlW, 0, 0, &uri);
9233 IUriBuilder *builder;
9235 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9236 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9241 hr = IUriBuilder_GetPort(builder, &has, &port);
9242 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9244 /* 'has' will be set to FALSE, even though uri had a port. */
9245 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9246 /* Still sets 'port' to 80. */
9247 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9250 if(builder) IUriBuilder_Release(builder);
9252 if(uri) IUri_Release(uri);
9255 static void test_IUriBuilderFactory(void) {
9258 IUriBuilderFactory *factory;
9259 IUriBuilder *builder;
9261 hr = pCreateUri(http_urlW, 0, 0, &uri);
9262 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9265 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9266 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9267 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9270 builder = (void*) 0xdeadbeef;
9271 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9272 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9274 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9276 builder = (void*) 0xdeadbeef;
9277 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9278 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9280 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9282 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9283 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9287 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9288 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9291 IUri *tmp = (void*) 0xdeadbeef;
9295 hr = IUriBuilder_GetIUri(builder, &tmp);
9296 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9298 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9300 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9301 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9304 if(builder) IUriBuilder_Release(builder);
9306 builder = (void*) 0xdeadbeef;
9307 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9308 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9310 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9312 builder = (void*) 0xdeadbeef;
9313 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9314 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9316 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9318 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9319 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9323 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9324 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9329 hr = IUriBuilder_GetIUri(builder, &tmp);
9330 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9332 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9333 if(uri) IUri_Release(uri);
9335 if(builder) IUriBuilder_Release(builder);
9337 if(factory) IUriBuilderFactory_Release(factory);
9339 if(uri) IUri_Release(uri);
9342 static void test_CoInternetCombineIUri(void) {
9344 IUri *base, *relative, *result;
9348 hr = pCreateUri(http_urlW, 0, 0, &base);
9349 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9351 result = (void*) 0xdeadbeef;
9352 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9353 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9354 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9358 hr = pCreateUri(http_urlW, 0, 0, &relative);
9359 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9361 result = (void*) 0xdeadbeef;
9362 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9363 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9364 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9367 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9368 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9370 if(base) IUri_Release(base);
9371 if(relative) IUri_Release(relative);
9373 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9374 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9376 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9377 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9379 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9381 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9382 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9386 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9387 if(uri_combine_tests[i].todo) {
9389 ok(hr == uri_combine_tests[i].expected,
9390 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9391 hr, uri_combine_tests[i].expected, i);
9394 ok(hr == uri_combine_tests[i].expected,
9395 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9396 hr, uri_combine_tests[i]. expected, i);
9401 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9402 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9405 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9408 ok(hr == prop.expected,
9409 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9410 hr, prop.expected, i, j);
9413 ok(!strcmp_aw(prop.value, received) ||
9414 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9415 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9416 prop.value, wine_dbgstr_w(received), i, j);
9419 ok(hr == prop.expected,
9420 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9421 hr, prop.expected, i, j);
9422 ok(!strcmp_aw(prop.value, received) ||
9423 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9424 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9425 prop.value, wine_dbgstr_w(received), i, j);
9427 SysFreeString(received);
9430 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9431 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9434 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9437 ok(hr == prop.expected,
9438 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9439 hr, prop.expected, i, j);
9442 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9443 prop.value, received, i, j);
9446 ok(hr == prop.expected,
9447 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9448 hr, prop.expected, i, j);
9449 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9450 prop.value, received, i, j);
9454 if(result) IUri_Release(result);
9456 if(relative) IUri_Release(relative);
9457 heap_free(relativeW);
9459 if(base) IUri_Release(base);
9464 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9465 REFIID riid, void **ppv)
9467 ok(0, "unexpected call\n");
9468 return E_NOINTERFACE;
9471 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9476 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9481 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9482 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9483 DWORD *pcchResult, DWORD dwReserved)
9485 CHECK_EXPECT(ParseUrl);
9486 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9487 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9488 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9489 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9490 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9492 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9493 *pcchResult = lstrlenW(parse_resultW);
9498 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9499 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9500 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9502 CHECK_EXPECT(CombineUrl);
9503 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9504 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9505 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9506 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9507 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9508 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9509 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9511 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9512 *pcchResult = lstrlenW(combine_resultW);
9517 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9518 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9520 ok(0, "unexpected call\n");
9524 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9525 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9526 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9528 ok(0, "unexpected call\n");
9532 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9533 InternetProtocolInfo_QueryInterface,
9534 InternetProtocolInfo_AddRef,
9535 InternetProtocolInfo_Release,
9536 InternetProtocolInfo_ParseUrl,
9537 InternetProtocolInfo_CombineUrl,
9538 InternetProtocolInfo_CompareUrl,
9539 InternetProtocolInfo_QueryInfo
9542 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9544 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9546 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9547 *ppv = &protocol_info;
9551 ok(0, "unexpected call\n");
9552 return E_NOINTERFACE;
9555 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9560 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9565 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9566 REFIID riid, void **ppv)
9568 ok(0, "unexpected call\n");
9572 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9574 ok(0, "unexpected call\n");
9578 static const IClassFactoryVtbl ClassFactoryVtbl = {
9579 ClassFactory_QueryInterface,
9580 ClassFactory_AddRef,
9581 ClassFactory_Release,
9582 ClassFactory_CreateInstance,
9583 ClassFactory_LockServer
9586 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9588 static void register_protocols(void)
9590 IInternetSession *session;
9593 hres = pCoInternetGetSession(0, &session, 0);
9594 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9598 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9599 winetestW, 0, NULL, 0);
9600 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9602 IInternetSession_Release(session);
9605 static void unregister_protocols(void) {
9606 IInternetSession *session;
9609 hr = pCoInternetGetSession(0, &session, 0);
9610 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9614 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9615 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9617 IInternetSession_Release(session);
9620 static void test_CoInternetCombineIUri_Pluggable(void) {
9624 hr = pCreateUri(combine_baseW, 0, 0, &base);
9625 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9627 IUri *relative = NULL;
9629 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9630 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9632 IUri *result = NULL;
9634 SET_EXPECT(CombineUrl);
9636 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9638 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9640 CHECK_CALLED(CombineUrl);
9643 BSTR received = NULL;
9644 hr = IUri_GetAbsoluteUri(result, &received);
9645 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9647 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9648 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9650 SysFreeString(received);
9652 if(result) IUri_Release(result);
9654 if(relative) IUri_Release(relative);
9656 if(base) IUri_Release(base);
9659 static void test_CoInternetCombineUrlEx(void) {
9661 IUri *base, *result;
9665 hr = pCreateUri(http_urlW, 0, 0, &base);
9666 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9668 result = (void*) 0xdeadbeef;
9669 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9670 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9672 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9675 result = (void*) 0xdeadbeef;
9676 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9677 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9679 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9681 result = (void*) 0xdeadbeef;
9682 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9683 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9685 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9687 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9688 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9690 if(base) IUri_Release(base);
9692 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9693 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9695 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9696 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9698 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9700 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9702 if(uri_combine_tests[i].todo) {
9704 ok(hr == uri_combine_tests[i].expected,
9705 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9706 hr, uri_combine_tests[i].expected, i);
9709 ok(hr == uri_combine_tests[i].expected,
9710 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9711 hr, uri_combine_tests[i]. expected, i);
9716 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9717 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9719 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9721 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9724 ok(hr == prop.expected,
9725 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9726 hr, prop.expected, i, j);
9729 ok(!strcmp_aw(value, received) ||
9730 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9731 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9732 value, wine_dbgstr_w(received), i, j);
9735 ok(hr == prop.expected,
9736 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9737 hr, prop.expected, i, j);
9738 ok(!strcmp_aw(value, received) ||
9739 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9740 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9741 value, wine_dbgstr_w(received), i, j);
9743 SysFreeString(received);
9746 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9747 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9750 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9753 ok(hr == prop.expected,
9754 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9755 hr, prop.expected, i, j);
9758 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9759 prop.value, received, i, j);
9762 ok(hr == prop.expected,
9763 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9764 hr, prop.expected, i, j);
9765 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9766 prop.value, received, i, j);
9770 if(result) IUri_Release(result);
9771 heap_free(relativeW);
9773 if(base) IUri_Release(base);
9778 static void test_CoInternetCombineUrlEx_Pluggable(void) {
9782 hr = pCreateUri(combine_baseW, 0, 0, &base);
9783 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9785 IUri *result = NULL;
9787 SET_EXPECT(CombineUrl);
9789 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9791 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9793 CHECK_CALLED(CombineUrl);
9796 BSTR received = NULL;
9797 hr = IUri_GetAbsoluteUri(result, &received);
9798 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9800 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9801 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9803 SysFreeString(received);
9805 if(result) IUri_Release(result);
9807 if(base) IUri_Release(base);
9810 static void test_CoInternetParseIUri_InvalidArgs(void) {
9816 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9817 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9819 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9821 hr = pCreateUri(http_urlW, 0, 0, &uri);
9822 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9827 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
9828 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9830 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9832 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
9833 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9837 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
9838 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
9840 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9843 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
9844 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9846 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9849 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
9850 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9852 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9855 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
9856 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9858 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9860 expected_len = lstrlenW(http_urlW);
9862 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9863 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
9864 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9865 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
9866 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
9867 expected_len, result);
9869 if(uri) IUri_Release(uri);
9872 static void test_CoInternetParseIUri(void) {
9875 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
9879 uri_parse_test test = uri_parse_tests[i];
9881 uriW = a2w(test.uri);
9882 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
9883 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
9885 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
9886 DWORD result_len = -1;
9888 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
9891 ok(hr == test.expected,
9892 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9893 hr, test.expected, i);
9896 ok(hr == test.expected,
9897 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
9898 hr, test.expected, i);
9901 DWORD len = lstrlenA(test.property);
9902 ok(!strcmp_aw(test.property, result),
9903 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
9904 test.property, wine_dbgstr_w(result), i);
9905 ok(len == result_len,
9906 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
9907 len, result_len, i);
9910 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
9914 if(uri) IUri_Release(uri);
9919 static void test_CoInternetParseIUri_Pluggable(void) {
9923 hr = pCreateUri(parse_urlW, 0, 0, &uri);
9924 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
9929 SET_EXPECT(ParseUrl);
9931 parse_action = PARSE_CANONICALIZE;
9932 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
9934 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
9935 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9937 CHECK_CALLED(ParseUrl);
9940 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
9941 lstrlenW(parse_resultW), result_len);
9942 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
9943 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
9946 if(uri) IUri_Release(uri);
9952 hurlmon = GetModuleHandle("urlmon.dll");
9953 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
9954 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
9955 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
9956 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
9957 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
9958 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
9959 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
9962 win_skip("CreateUri is not present, skipping tests.\n");
9966 trace("test CreateUri invalid flags...\n");
9967 test_CreateUri_InvalidFlags();
9969 trace("test CreateUri invalid args...\n");
9970 test_CreateUri_InvalidArgs();
9972 trace("test CreateUri invalid URIs...\n");
9973 test_CreateUri_InvalidUri();
9975 trace("test IUri_GetPropertyBSTR...\n");
9976 test_IUri_GetPropertyBSTR();
9978 trace("test IUri_GetPropertyDWORD...\n");
9979 test_IUri_GetPropertyDWORD();
9981 trace("test IUri_GetStrProperties...\n");
9982 test_IUri_GetStrProperties();
9984 trace("test IUri_GetDwordProperties...\n");
9985 test_IUri_GetDwordProperties();
9987 trace("test IUri_GetPropertyLength...\n");
9988 test_IUri_GetPropertyLength();
9990 trace("test IUri_GetProperties...\n");
9991 test_IUri_GetProperties();
9993 trace("test IUri_HasProperty...\n");
9994 test_IUri_HasProperty();
9996 trace("test IUri_IsEqual...\n");
9997 test_IUri_IsEqual();
9999 trace("test CreateUriWithFragment invalid args...\n");
10000 test_CreateUriWithFragment_InvalidArgs();
10002 trace("test CreateUriWithFragment invalid flags...\n");
10003 test_CreateUriWithFragment_InvalidFlags();
10005 trace("test CreateUriWithFragment...\n");
10006 test_CreateUriWithFragment();
10008 trace("test CreateIUriBuilder...\n");
10009 test_CreateIUriBuilder();
10011 trace("test IUriBuilder_CreateInvalidArgs...\n");
10012 test_IUriBuilder_CreateInvalidArgs();
10014 trace("test IUriBuilder...\n");
10015 test_IUriBuilder();
10017 trace("test IUriBuilder_GetInvalidArgs...\n");
10018 test_IUriBuilder_GetInvalidArgs();
10020 trace("test IUriBuilder_HasBeenModified...\n");
10021 test_IUriBuilder_HasBeenModified();
10023 trace("test IUriBuilder_IUriProperty...\n");
10024 test_IUriBuilder_IUriProperty();
10026 trace("test IUriBuilder_RemoveProperties...\n");
10027 test_IUriBuilder_RemoveProperties();
10029 trace("test IUriBuilder miscellaneous...\n");
10030 test_IUriBuilder_Misc();
10032 trace("test IUriBuilderFactory...\n");
10033 test_IUriBuilderFactory();
10035 trace("test CoInternetCombineIUri...\n");
10036 test_CoInternetCombineIUri();
10038 trace("test CoInternetCombineUrlEx...\n");
10039 test_CoInternetCombineUrlEx();
10041 trace("test CoInternetParseIUri Invalid Args...\n");
10042 test_CoInternetParseIUri_InvalidArgs();
10044 trace("test CoInternetParseIUri...\n");
10045 test_CoInternetParseIUri();
10047 register_protocols();
10049 trace("test CoInternetCombineIUri pluggable...\n");
10050 test_CoInternetCombineIUri_Pluggable();
10052 trace("test CoInternetCombineUrlEx Pluggable...\n");
10053 test_CoInternetCombineUrlEx_Pluggable();
10055 trace("test CoInternetParseIUri pluggable...\n");
10056 test_CoInternetParseIUri_Pluggable();
10058 unregister_protocols();