Module: wine Branch: master Commit: 6b8e853e948a410949d203112b435df4c802f3e8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6b8e853e948a410949d203112...
Author: Owen Rudge orudge@codeweavers.com Date: Mon Apr 23 21:12:26 2018 +0100
wsdapi/tests: Add tests for Scopes and XAddrs lists.
Signed-off-by: Owen Rudge orudge@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wsdapi/tests/discovery.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/dlls/wsdapi/tests/discovery.c b/dlls/wsdapi/tests/discovery.c index 242c908..0576c8f 100644 --- a/dlls/wsdapi/tests/discovery.c +++ b/dlls/wsdapi/tests/discovery.c @@ -508,7 +508,8 @@ static void Publish_tests(void) WSADATA wsaData; BOOL messageOK, hello_message_seen = FALSE, endpoint_reference_seen = FALSE, app_sequence_seen = FALSE; BOOL metadata_version_seen = FALSE, any_header_seen = FALSE, wine_ns_seen = FALSE, body_hello_seen = FALSE; - BOOL any_body_seen = FALSE, types_seen = FALSE, xml_namespaces_seen = FALSE; + BOOL any_body_seen = FALSE, types_seen = FALSE, xml_namespaces_seen = FALSE, scopes_seen = FALSE; + BOOL xaddrs_seen = FALSE; int ret, i; HRESULT rc; ULONG ref; @@ -525,7 +526,9 @@ static void Publish_tests(void) static const WCHAR prefix[] = {'w','i','n','e',0}; static const WCHAR uri2[] = {'h','t','t','p',':','/','/','m','o','r','e','.','t','e','s','t','s','/',0}; static const WCHAR prefix2[] = {'g','r','o','g',0}; + static const WCHAR uri3[] = {'h','t','t','p',':','/','/','t','h','i','r','d','.','u','r','l','/',0}; WSD_NAME_LIST types_list; + WSD_URI_LIST scopes_list, xaddrs_list;
rc = WSDCreateDiscoveryPublisher(NULL, &publisher); ok(rc == S_OK, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: %08x\n", rc); @@ -616,14 +619,29 @@ static void Publish_tests(void) types_list.Next->Next = NULL; types_list.Next->Element = &header_any_name;
+ /* Create scopes and xaddrs lists */ + scopes_list.Next = malloc(sizeof(WSD_URI_LIST)); + scopes_list.Element = uri; + + scopes_list.Next->Next = NULL; + scopes_list.Next->Element = uri2; + + xaddrs_list.Next = malloc(sizeof(WSD_URI_LIST)); + xaddrs_list.Element = uri2; + + xaddrs_list.Next->Next = NULL; + xaddrs_list.Next->Element = uri3; + /* Publish the service */ - rc = IWSDiscoveryPublisher_PublishEx(publisher, publisherIdW, 1, 1, 1, sequenceIdW, &types_list, NULL, NULL, - header_any_element, NULL, NULL, endpoint_any_element, body_any_element); + rc = IWSDiscoveryPublisher_PublishEx(publisher, publisherIdW, 1, 1, 1, sequenceIdW, &types_list, &scopes_list, + &xaddrs_list, header_any_element, NULL, NULL, endpoint_any_element, body_any_element);
WSDFreeLinkedMemory(header_any_element); WSDFreeLinkedMemory(body_any_element); WSDFreeLinkedMemory(endpoint_any_element); free(types_list.Next); + free(scopes_list.Next); + free(xaddrs_list.Next);
ok(rc == S_OK, "Publish failed: %08x\n", rc);
@@ -661,9 +679,12 @@ static void Publish_tests(void) body_hello_seen = (strstr(msg, "soap:Body<wsd:Hello") != NULL); any_body_seen = (strstr(msg, "wine:BeerBodyTest</wine:Beer>") != NULL); types_seen = (strstr(msg, "wsd:Typesgrog:Cider wine:Beer</wsd:Types>") != NULL); + scopes_seen = (strstr(msg, "wsd:Scopeshttp://wine.test/ http://more.tests/</wsd:Scopes>") != NULL); + xaddrs_seen = (strstr(msg, "wsd:XAddrshttp://more.tests/ http://third.url/</wsd:XAddrs>") != NULL); xml_namespaces_seen = (strstr(msg, "xmlns:wine="http://wine.test/%5C" xmlns:grog="http://more.tests/%5C"") != NULL); messageOK = hello_message_seen && endpoint_reference_seen && app_sequence_seen && metadata_version_seen && - any_header_seen && wine_ns_seen && body_hello_seen && any_body_seen && types_seen && xml_namespaces_seen; + any_header_seen && wine_ns_seen && body_hello_seen && any_body_seen && types_seen && xml_namespaces_seen && + scopes_seen && xaddrs_seen;
if (messageOK) break; } @@ -686,6 +707,8 @@ static void Publish_tests(void) ok(any_body_seen == TRUE, "Custom body element not received\n"); ok(types_seen == TRUE, "Types not received\n"); ok(xml_namespaces_seen == TRUE, "XML namespaces not received\n"); + ok(scopes_seen == TRUE, "Scopes not received\n"); + ok(xaddrs_seen == TRUE, "XAddrs not received\n");
after_publish_test: