Jacek Caban : wininet/tests: Added INTERNET_COOKIE_HTTPONLY tests.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 4 14:07:33 CDT 2014


Module: wine
Branch: master
Commit: b4ce0760e5e65f06b91c5afacd12470e1e2c2849
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b4ce0760e5e65f06b91c5afacd12470e1e2c2849

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jul  4 14:45:40 2014 +0200

wininet/tests: Added INTERNET_COOKIE_HTTPONLY tests.

---

 dlls/wininet/tests/internet.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index e2ad17a..17e16ab 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -557,6 +557,46 @@ static void test_complicated_cookie(void)
   todo_wine ok(!ret, "InternetSetCookie succeeded\n");
 }
 
+static void test_cookie_attrs(void)
+{
+    char buf[100];
+    DWORD size, state;
+    BOOL ret;
+
+    if(!GetProcAddress(GetModuleHandleA("wininet.dll"), "InternetGetSecurityInfoByURLA")) {
+        win_skip("Skipping cookie attributes tests. Too old IE.\n");
+        return;
+    }
+
+    ret = InternetSetCookieA("http://cookie.attrs.com/bar", NULL, "A=data; httponly");
+    ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%u)\n", ret, GetLastError());
+
+    SetLastError(0xdeadbeef);
+    state = InternetSetCookieExA("http://cookie.attrs.com/bar", NULL, "A=data; httponly", 0, 0);
+    ok(state == COOKIE_STATE_REJECT && GetLastError() == ERROR_INVALID_OPERATION,
+       "InternetSetCookieEx returned: %x (%u)\n", ret, GetLastError());
+
+    size = sizeof(buf);
+    ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%u)\n", ret, GetLastError());
+
+    state = InternetSetCookieExA("http://cookie.attrs.com/bar",NULL,"A=data; httponly", INTERNET_COOKIE_HTTPONLY, 0);
+    ok(state == COOKIE_STATE_ACCEPT,"InternetSetCookieEx failed: %u\n", GetLastError());
+
+    size = sizeof(buf);
+    ret = InternetGetCookieA("http://cookie.attrs.com/", NULL, buf, &size);
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned: %x (%u)\n", ret, GetLastError());
+
+    size = sizeof(buf);
+    ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, 0, NULL);
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%u)\n", ret, GetLastError());
+
+    size = sizeof(buf);
+    ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
+    ok(ret, "InternetGetCookieEx failed: %u\n", GetLastError());
+    ok(!strcmp(buf, "A=data"), "data = %s\n", buf);
+}
+
 static void test_cookie_url(void)
 {
     WCHAR bufw[512];
@@ -1618,6 +1658,7 @@ START_TEST(internet)
     test_get_cookie();
     test_complicated_cookie();
     test_cookie_url();
+    test_cookie_attrs();
     test_version();
     test_null();
     test_Option_PerConnectionOption();




More information about the wine-cvs mailing list