wininet: Simple tests for InternetGetCookie's parameters.
This commit is contained in:
parent
68d18612a0
commit
24b886d916
|
@ -264,6 +264,12 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
||||||
TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName),
|
TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName),
|
||||||
lpCookieData, lpdwSize);
|
lpCookieData, lpdwSize);
|
||||||
|
|
||||||
|
if (!lpszUrl)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INTERNET_UNRECOGNIZED_SCHEME);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
|
COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
|
||||||
|
|
||||||
LIST_FOR_EACH(cursor, &domain_list)
|
LIST_FOR_EACH(cursor, &domain_list)
|
||||||
|
|
|
@ -125,7 +125,10 @@ static void test_null(void)
|
||||||
static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
|
static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
|
||||||
static const WCHAR szEmpty[] = { 0 };
|
static const WCHAR szEmpty[] = { 0 };
|
||||||
static const WCHAR szUrl[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
|
static const WCHAR szUrl[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
|
||||||
|
static const WCHAR szExpect[] = { 's','e','r','v','e','r',';',' ','s','e','r','v','e','r',0 };
|
||||||
|
WCHAR buffer[0x20];
|
||||||
BOOL r;
|
BOOL r;
|
||||||
|
DWORD sz;
|
||||||
|
|
||||||
hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
|
hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
|
||||||
ok(hi != NULL, "open failed\n");
|
ok(hi != NULL, "open failed\n");
|
||||||
|
@ -184,6 +187,33 @@ static void test_null(void)
|
||||||
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
|
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
|
||||||
}
|
}
|
||||||
ok(r == FALSE, "return wrong\n");
|
ok(r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
sz = 0;
|
||||||
|
r = InternetGetCookieW(NULL, NULL, NULL, &sz);
|
||||||
|
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
|
||||||
|
ok( r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
r = InternetGetCookieW(szServer, NULL, NULL, &sz);
|
||||||
|
todo_wine {
|
||||||
|
ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
|
||||||
|
}
|
||||||
|
ok( r == FALSE, "return wrong\n");
|
||||||
|
|
||||||
|
sz = 0;
|
||||||
|
r = InternetGetCookieW(szUrl, szServer, NULL, &sz);
|
||||||
|
ok( r == TRUE, "return wrong\n");
|
||||||
|
todo_wine {
|
||||||
|
ok( sz == 30, "sz wrong\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
sz = 0x20;
|
||||||
|
memset(buffer, 0, sizeof buffer);
|
||||||
|
r = InternetGetCookieW(szUrl, szServer, buffer, &sz);
|
||||||
|
ok( r == TRUE, "return wrong\n");
|
||||||
|
todo_wine {
|
||||||
|
ok( sz == lstrlenW(buffer), "sz wrong\n");
|
||||||
|
ok( !lstrcmpW(szExpect, buffer), "cookie data wrong\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(internet)
|
START_TEST(internet)
|
||||||
|
|
Loading…
Reference in New Issue