Aric Stewart : wininet: Complicated cookie value set/get tests.
Alexandre Julliard
julliard at winehq.org
Wed Feb 18 10:15:33 CST 2009
Module: wine
Branch: master
Commit: d2d26205bed2c3a1678af7998688ec7b80af71f7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2d26205bed2c3a1678af7998688ec7b80af71f7
Author: Aric Stewart <aric at codeweavers.com>
Date: Tue Feb 17 10:29:08 2009 -0600
wininet: Complicated cookie value set/get tests.
---
dlls/wininet/tests/internet.c | 97 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index f3277d3..fe3f477 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -244,6 +244,102 @@ static void test_get_cookie(void)
ret ? "TRUE" : "FALSE", GetLastError());
}
+
+static void test_complicated_cookie(void)
+{
+ DWORD len;
+ BOOL ret;
+
+ CHAR buffer[1024];
+
+ ret = InternetSetCookie("http://www.example.com/bar",NULL,"A=B; domain=.example.com");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+ ret = InternetSetCookie("http://www.example.com/bar",NULL,"C=D; domain=.example.com; path=/");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+
+ /* Technically illegal! domain should require 2 dots, but native wininet accepts it */
+ ret = InternetSetCookie("http://www.example.com",NULL,"E=F; domain=example.com");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+ ret = InternetSetCookie("http://www.example.com",NULL,"G=H; domain=.example.com; path=/foo");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+ ret = InternetSetCookie("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+ ret = InternetSetCookie("http://www.example.com/bar/",NULL,"K=L; domain=.example.com");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+ ret = InternetSetCookie("http://www.example.com/bar/",NULL,"M=N; domain=.example.com; path=/foo/");
+ ok(ret == TRUE,"InternetSetCookie failed\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/foobar", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/foobar/", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/foo/bar", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")!=NULL,"M=N missing\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/barfoo", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/barfoo/", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+
+ len = 1024;
+ ret = InternetGetCookie("http://testing.example.com/bar/foo", NULL, buffer, &len);
+ ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
+ ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
+ ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
+ ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
+ ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
+ ok(strstr(buffer,"K=L")!=NULL,"K=L missing\n");
+ ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
+}
+
static void test_null(void)
{
HINTERNET hi, hc;
@@ -683,6 +779,7 @@ START_TEST(internet)
test_InternetCanonicalizeUrlA();
test_InternetQueryOptionA();
test_get_cookie();
+ test_complicated_cookie();
test_version();
test_null();
More information about the wine-cvs
mailing list