wininet/tests: Added INTERNET_COOKIE_HTTPONLY tests.
This commit is contained in:
parent
db441cf58f
commit
b4ce0760e5
|
@ -557,6 +557,46 @@ static void test_complicated_cookie(void)
|
||||||
todo_wine ok(!ret, "InternetSetCookie succeeded\n");
|
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)
|
static void test_cookie_url(void)
|
||||||
{
|
{
|
||||||
WCHAR bufw[512];
|
WCHAR bufw[512];
|
||||||
|
@ -1618,6 +1658,7 @@ START_TEST(internet)
|
||||||
test_get_cookie();
|
test_get_cookie();
|
||||||
test_complicated_cookie();
|
test_complicated_cookie();
|
||||||
test_cookie_url();
|
test_cookie_url();
|
||||||
|
test_cookie_attrs();
|
||||||
test_version();
|
test_version();
|
||||||
test_null();
|
test_null();
|
||||||
test_Option_PerConnectionOption();
|
test_Option_PerConnectionOption();
|
||||||
|
|
Loading…
Reference in New Issue