wininet tests for ftp and file schemes.

Nick Cronin quintok at gmail.com
Wed Jun 21 10:14:54 CDT 2006


Skipped content of type multipart/alternative-------------- next part --------------
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 56e38f1..e417bc3 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -40,6 +40,58 @@
 #define TEST_URL2_EXTRA "?arg=1"
 #define TEST_URL3 "file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml"
 
+#define TEST_URL_FTP1 "ftp"
+#define TEST_URL_FTP2 "ftp:"
+#define TEST_URL_FTP3 "ftp:/"
+#define TEST_URL_FTP4 "ftp://"
+#define TEST_URL_FTP5 "ftp://ftp.winehq.org"
+#define TEST_URL_FTP6 "ftp://ftp.winehq.org/"
+#define TEST_URL_FTP6_RESULT "/"
+#define TEST_URL_FTP7 "ftp://ftp.winehq.org//"
+#define TEST_URL_FTP7_RESULT "//"
+#define TEST_URL_FTP8 "ftp://ftp.winehq.org/request.html"
+#define TEST_URL_FTP8_RESULT "/request.html"
+#define TEST_URL_FTP9 "ftp://ftp.winehq.org/request.html#request"
+#define TEST_URL_FTP9_RESULT "/request.html"
+
+#define TEST_URL_FILE1 "file"
+#define TEST_URL_FILE2 "file:"
+#define TEST_URL_FILE3 "file:/"
+#define TEST_URL_FILE4 "file://"
+#define TEST_URL_FILE5 "file:///"
+#define TEST_URL_FILE6 "file://localhost"
+#define TEST_URL_FILE7 "file://localhost/"
+#define TEST_URL_FILE8 "file:///localhost"
+#define TEST_URL_FILE8_RESULT "\\localhost"
+#define TEST_URL_FILE9 "file:///localhost/"
+#define TEST_URL_FILE9_RESULT "\\localhost\\"
+#define TEST_URL_FILE10 "file://C|"
+#define TEST_URL_FILE10_RESULT "C:"
+#define TEST_URL_FILE11 "file://C:"
+#define TEST_URL_FILE11_RESULT "C:"
+#define TEST_URL_FILE12 "file://C|/"
+#define TEST_URL_FILE12_RESULT "C:\\"
+#define TEST_URL_FILE13 "file://C:/"
+#define TEST_URL_FILE13_RESULT "C:\\"
+#define TEST_URL_FILE14 "file:///C:/Program%20Files"
+#define TEST_URL_FILE14_RESULT "C:\\Program Files"
+#define TEST_URL_FILE15 "file://C:/Program%20Files"
+#define TEST_URL_FILE15_RESULT "C:\\Program%20Files"
+#define TEST_URL_FILE16 "file:///C:\\fileURLs\\?"
+#define TEST_URL_FILE16_RESULT "C:\\fileURLs\\"
+#define TEST_URL_FILE17 "file:///C:\\fileURLs\\testof?.txt"
+#define TEST_URL_FILE17_RESULT "C:\\fileURLs\\testof"
+#define TEST_URL_FILE18 "file:///C:\\fileURLs\\testof%3F.txt"
+#define TEST_URL_FILE18_RESULT "C:\\fileURLs\\testof?.txt"
+#define TEST_URL_FILE19 "file://C:\\fileURLs\\?"
+#define TEST_URL_FILE19_RESULT "C:\\fileURLs\\"
+#define TEST_URL_FILE20 "file://C:\\fileURLs\\testof?.txt"
+#define TEST_URL_FILE20_RESULT "C:\\fileURLs\\testof"
+#define TEST_URL_FILE21 "file://C:\\fileURLs\\testof%3F.txt"
+#define TEST_URL_FILE21_RESULT "C:\\fileURLs\\testof%3F.txt"
+#define TEST_URL_FILE22 "file:///C:/Program Files"
+#define TEST_URL_FILE22_RESULT "C:\\Program Files"
+
 #define CREATE_URL1 "http://username:[email protected]/site/about"
 #define CREATE_URL2 "http://[email protected]/site/about"
 #define CREATE_URL3 "http://username:"
@@ -210,6 +262,194 @@ static void InternetCrackUrl_test(void)
   ok(!strcmp(urlComponents.lpszUrlPath, "/blank"), "lpszUrlPath was \"%s\" instead of \"/blank\"\n", urlComponents.lpszUrlPath);
 }
 
+static void InternetCrackUrl_test_FtpScheme(void)
+{
+  URL_COMPONENTSA urlSrc, urlComponents;
+  char protocol[32], hostName[1024], userName[1024];
+  char password[1024], extra[1024], path[1024];
+
+  ZeroMemory(&urlSrc, sizeof(urlSrc));
+  urlSrc.dwStructSize = sizeof(urlSrc);
+  urlSrc.lpszScheme = protocol;
+  urlSrc.lpszHostName = hostName;
+  urlSrc.lpszUserName = userName;
+  urlSrc.lpszPassword = password;
+  urlSrc.lpszUrlPath = path;
+  urlSrc.lpszExtraInfo = extra;
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP1, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP2, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP3, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP4, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP5, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP6, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FTP6_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FTP6_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP7, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FTP7_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FTP7_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP8, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FTP8_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FTP8_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FTP9, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FTP9_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FTP9_RESULT );
+}
+
+static void InternetCrackUrl_test_FileScheme(void)
+{
+
+  URL_COMPONENTSA urlSrc, urlComponents;
+  char protocol[32], hostName[1024], userName[1024];
+  char password[1024], extra[1024], path[1024];
+
+  ZeroMemory(&urlSrc, sizeof(urlSrc));
+  urlSrc.dwStructSize = sizeof(urlSrc);
+  urlSrc.lpszScheme = protocol;
+  urlSrc.lpszHostName = hostName;
+  urlSrc.lpszUserName = userName;
+  urlSrc.lpszPassword = password;
+  urlSrc.lpszUrlPath = path;
+  urlSrc.lpszExtraInfo = extra;
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE1, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE2, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE3, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE4, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE5, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE6, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE7, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, "" ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, "" );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE8, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE8_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE8_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE9, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE9_RESULT ) == 0,
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE9_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE10, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE10_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE10_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE11, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE11_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE11_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE12, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE12_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE12_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE13, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE13_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE13_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE14, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE14_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE14_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE15, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE15_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE15_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE16, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE16_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE16_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE17, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE17_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE17_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE18, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE18_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE18_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE19, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE19_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE19_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE20, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE20_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE20_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE21, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE21_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE21_RESULT );
+
+  copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
+  InternetCrackUrlA( TEST_URL_FILE22, 0, ICU_DECODE, &urlComponents );
+  ok( strcmp( urlComponents.lpszUrlPath, TEST_URL_FILE22_RESULT ) == 0, 
+     "InternetCrackUrl returned \"%s\" expected was \"%s\"\n", urlComponents.lpszUrlPath, TEST_URL_FILE22_RESULT );
+}
+
 static void InternetCrackUrlW_test(void)
 {
     WCHAR url[] = {
@@ -684,6 +924,8 @@ static void InternetCreateUrlA_test(void
 START_TEST(url)
 {
     InternetCrackUrl_test();
+    InternetCrackUrl_test_FtpScheme();
+    InternetCrackUrl_test_FileScheme();
     InternetCrackUrlW_test();
     InternetCreateUrlA_test();
 }


More information about the wine-patches mailing list