wininet/test: Improve tests for InternetGetConnectedStateEx.

Signed-off-by: Bruno Jesus <bjesus@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2017-03-06 23:27:25 -03:00 committed by Alexandre Julliard
parent 67639e6ce7
commit 7207b3dbc9
1 changed files with 42 additions and 7 deletions

View File

@ -1595,12 +1595,16 @@ static void test_InternetGetConnectedStateExA(void)
return;
}
flags = 0;
buffer[0] = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, buffer);
todo_wine
ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
if(!res) {
win_skip("InternetGetConnectedStateExA tests require a valid connection\n");
return;
}
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, buffer);
res = pInternetGetConnectedStateExA(NULL, NULL, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
@ -1608,7 +1612,16 @@ static void test_InternetGetConnectedStateExA(void)
flags = 0;
res = pInternetGetConnectedStateExA(&flags, NULL, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
if (flags & INTERNET_CONNECTION_CONFIGURED)
{
ok(flags & INTERNET_CONNECTION_MODEM, "Modem connection flag missing\n");
ok(flags & ~INTERNET_CONNECTION_LAN, "Mixed Modem and LAN flags\n");
}
else
{
ok(flags & INTERNET_CONNECTION_LAN, "LAN connection flag missing\n");
ok(flags & ~INTERNET_CONNECTION_MODEM, "Mixed Modem and LAN flags\n");
}
buffer[0] = 0;
flags = 0;
@ -1684,12 +1697,16 @@ static void test_InternetGetConnectedStateExW(void)
return;
}
flags = 0;
buffer[0] = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
todo_wine
ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
if(!res) {
win_skip("InternetGetConnectedStateExW tests require a valid connection\n");
return;
}
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
@ -1697,7 +1714,16 @@ static void test_InternetGetConnectedStateExW(void)
flags = 0;
res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
if (flags & INTERNET_CONNECTION_CONFIGURED)
{
ok(flags & INTERNET_CONNECTION_MODEM, "Modem connection flag missing\n");
ok(flags & ~INTERNET_CONNECTION_LAN, "Mixed Modem and LAN flags\n");
}
else
{
ok(flags & INTERNET_CONNECTION_LAN, "LAN connection flag missing\n");
ok(flags & ~INTERNET_CONNECTION_MODEM, "Mixed Modem and LAN flags\n");
}
buffer[0] = 0;
flags = 0;
@ -1731,6 +1757,9 @@ static void test_InternetGetConnectedStateExW(void)
res = pInternetGetConnectedStateExW(&flags, buffer, sz, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
if (flags & INTERNET_CONNECTION_MODEM)
ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
else
ok(sz - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenW(buffer));
buffer[0] = 0;
@ -1738,6 +1767,9 @@ static void test_InternetGetConnectedStateExW(void)
res = pInternetGetConnectedStateExW(&flags, buffer, sz / 2, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
if (flags & INTERNET_CONNECTION_MODEM)
ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
else
ok(sz / 2 - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1, lstrlenW(buffer));
buffer[0] = 0;
@ -1752,6 +1784,9 @@ static void test_InternetGetConnectedStateExW(void)
res = pInternetGetConnectedStateExW(&flags, buffer, 2, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
if (flags & INTERNET_CONNECTION_MODEM)
ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
else
ok(lstrlenW(buffer) == 1, "Expected 1 byte, got %u\n", lstrlenW(buffer));
buffer[0] = 0xDEAD;