From df6143325a78dea3ab5d62baff2affc6b9f00b43 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 25 Jan 2017 08:59:56 +0000 Subject: [PATCH] urlmon/tests: Windows 10 has changed the behaviour of domain detection. The changes seem to be for the better, so the new values are not marked as broken. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/urlmon/tests/uri.c | 98 ++++++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 26 deletions(-) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index da5a739c496..4f31f2bb50e 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -115,6 +115,8 @@ typedef struct _uri_str_property { HRESULT expected; BOOL todo; const char* broken_value; + const char* value2; + HRESULT expected2; } uri_str_property; typedef struct _uri_dword_property { @@ -1957,7 +1959,7 @@ static const uri_properties uri_tests[] = { {"http://google.com.uk/",S_OK,FALSE}, {"google.com.uk",S_OK,FALSE}, {"http://google.com.uk/",S_OK,FALSE}, - {"google.com.uk",S_OK,FALSE}, + {"google.com.uk",S_OK,FALSE,NULL,"com.uk",S_OK}, /* cf. google.co.uk below */ {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, {"google.com.uk",S_OK,FALSE}, @@ -1977,6 +1979,31 @@ static const uri_properties uri_tests[] = { {URLZONE_INVALID,E_NOTIMPL,FALSE} } }, + { "http://google.co.uk", 0, S_OK, FALSE, + { + {"http://google.co.uk/",S_OK,FALSE}, + {"google.co.uk",S_OK,FALSE}, + {"http://google.co.uk/",S_OK,FALSE}, + {"google.co.uk",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"google.co.uk",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/",S_OK,FALSE}, + {"/",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"http://google.co.uk",S_OK,FALSE}, + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, { "http://google.com.com", 0, S_OK, FALSE, { {"http://google.com.com/",S_OK,FALSE}, @@ -2007,7 +2034,7 @@ static const uri_properties uri_tests[] = { {"http://google.uk.1/",S_OK,FALSE}, {"google.uk.1",S_OK,FALSE}, {"http://google.uk.1/",S_OK,FALSE}, - {"google.uk.1",S_OK,FALSE}, + {"google.uk.1",S_OK,FALSE,NULL,"uk.1",S_OK}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, {"google.uk.1",S_OK,FALSE}, @@ -2083,7 +2110,7 @@ static const uri_properties uri_tests[] = { {"http://.uk/",S_OK,FALSE}, {".uk",S_OK,FALSE}, {"http://.uk/",S_OK,FALSE}, - {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE,NULL,".uk",S_OK}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, {".uk",S_OK,FALSE}, @@ -2108,7 +2135,7 @@ static const uri_properties uri_tests[] = { {"http://www.co.google.com.[]/",S_OK,FALSE}, {"www.co.google.com.[]",S_OK,FALSE}, {"http://www.co.google.com.[]/",S_OK,FALSE}, - {"google.com.[]",S_OK,FALSE}, + {"google.com.[]",S_OK,FALSE,NULL,"com.[]",S_OK}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, {"www.co.google.com.[]",S_OK,FALSE}, @@ -7318,6 +7345,7 @@ typedef struct _uri_parse_test { const char *property; HRESULT expected; BOOL todo; + const char *property2; } uri_parse_test; static const uri_parse_test uri_parse_tests[] = { @@ -7381,7 +7409,7 @@ static const uri_parse_test uri_parse_tests[] = { {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE}, /* PARSE_DOMAIN tests. */ - {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE}, + {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE,"com.uk"}, {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE}, {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE}, {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE}, @@ -7615,9 +7643,12 @@ static void test_IUri_GetPropertyBSTR(void) { hr = IUri_GetPropertyBSTR(uri, j, &received, 0); todo_wine_if(prop.todo) { - ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n", + ok(hr == prop.expected || + (prop.value2 && hr == prop.expected2), + "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n", hr, prop.expected, i, j); - ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)), + ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) || + broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)), "Expected %s but got %s on uri_tests[%d].str_props[%d].\n", prop.value, wine_dbgstr_w(received), i, j); } @@ -7800,9 +7831,11 @@ static void test_IUri_GetStrProperties(void) { prop = test.str_props[Uri_PROPERTY_DOMAIN]; hr = IUri_GetDomain(uri, &received); todo_wine_if(prop.todo) { - ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + ok(hr == prop.expected || (prop.value2 && hr == prop.expected2), + "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", hr, prop.expected, i); - ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)), + "Error: Expected %s but got %s on uri_tests[%d].\n", prop.value, wine_dbgstr_w(received), i); } SysFreeString(received); @@ -8080,9 +8113,11 @@ static void test_IUri_GetPropertyLength(void) { hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0); todo_wine_if(prop.todo) { - ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n", + ok(hr == prop.expected || (prop.value2 && hr == prop.expected2), + "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n", hr, prop.expected, i, j); - ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)), + ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) || + broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)), "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n", expectedLen, receivedLen, i, j); } @@ -8095,18 +8130,25 @@ static void test_IUri_GetPropertyLength(void) { } } -static DWORD compute_expected_props(uri_properties *test) +static DWORD compute_expected_props(uri_properties *test, DWORD *mask) { DWORD ret = 0, i; + *mask = 0; + for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) { if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK) ret |= 1<str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL || + test->str_props[i-Uri_PROPERTY_STRING_START].expected == + test->str_props[i-Uri_PROPERTY_STRING_START].expected2) + *mask |= 1<dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK) ret |= 1<