Jacek Caban : urlmon/tests: Skip https tests on platforms that don' t support them.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 22 07:44:58 CDT 2015


Module: wine
Branch: master
Commit: ab3744d2752e98eedd223810df01ef20a80f68f7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab3744d2752e98eedd223810df01ef20a80f68f7

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Jun 19 13:42:36 2015 +0200

urlmon/tests: Skip https tests on platforms that don't support them.

Based on patch by Huw Davies.

---

 dlls/urlmon/tests/url.c | 68 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 50 insertions(+), 18 deletions(-)

diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c
index dd3a52d..96ee6cc 100644
--- a/dlls/urlmon/tests/url.c
+++ b/dlls/urlmon/tests/url.c
@@ -3851,6 +3851,32 @@ static void register_protocols(void)
     IInternetSession_Release(session);
 }
 
+static BOOL can_do_https(void)
+{
+    HINTERNET ses, con, req;
+    BOOL ret;
+
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+    ok(ses != NULL, "InternetOpen failed\n");
+
+    con = InternetConnectA(ses, "test.winehq.org", INTERNET_DEFAULT_HTTPS_PORT,
+            NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    ok(con != NULL, "InternetConnect failed\n");
+
+    req = HttpOpenRequestA(con, "GET", "/tests/hello.html", NULL, NULL, NULL,
+            INTERNET_FLAG_SECURE, 0);
+    ok(req != NULL, "HttpOpenRequest failed\n");
+
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
+    ok(ret || broken(GetLastError() == ERROR_INTERNET_CANNOT_CONNECT),
+        "request failed: %u\n", GetLastError());
+
+    InternetCloseHandle(req);
+    InternetCloseHandle(con);
+    InternetCloseHandle(ses);
+    return ret;
+}
+
 START_TEST(url)
 {
     HMODULE hurlmon;
@@ -3930,25 +3956,34 @@ START_TEST(url)
         trace("file test (no callback)...\n");
         test_BindToStorage(FILE_TEST, BINDTEST_NO_CALLBACK, TYMED_ISTREAM);
 
-        trace("synchronous https test (invalid CN, dialog)\n");
-        onsecurityproblem_hres = S_FALSE;
-        http_is_first = TRUE;
-        test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
+        if(can_do_https()) {
+            trace("synchronous https test (invalid CN, dialog)\n");
+            onsecurityproblem_hres = S_FALSE;
+            http_is_first = TRUE;
+            test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
 
-        bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
+            bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
+
+            trace("asynchronous https test (invalid CN, fail)\n");
+            onsecurityproblem_hres = E_FAIL;
+            test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
 
-        trace("asynchronous https test (invalid CN, fail)\n");
-        onsecurityproblem_hres = E_FAIL;
-        test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
+            trace("asynchronous https test (invalid CN, accept)\n");
+            onsecurityproblem_hres = S_OK;
+            test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
+
+            trace("asynchronous https test (invalid CN, dialog 2)\n");
+            onsecurityproblem_hres = S_FALSE;
+            test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
+            invalid_cn_accepted = FALSE;
 
-        trace("asynchronous https test (invalid CN, accept)\n");
-        onsecurityproblem_hres = S_OK;
-        test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
+            trace("asynchronous https test...\n");
+            test_BindToStorage(HTTPS_TEST, 0, TYMED_ISTREAM);
+        }else {
+            win_skip("Skipping https testt\n");
+        }
 
-        trace("asynchronous https test (invalid CN, dialog 2)\n");
-        onsecurityproblem_hres = S_FALSE;
-        test_BindToStorage(HTTPS_TEST, BINDTEST_INVALID_CN, TYMED_ISTREAM);
-        invalid_cn_accepted = FALSE;
+        bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
 
         trace("winetest test (async switch)...\n");
         test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_ASYNC_SWITCH, TYMED_ISTREAM);
@@ -4003,9 +4038,6 @@ START_TEST(url)
         trace("winetest test (no callback)...\n");
         test_BindToStorage(WINETEST_TEST, BINDTEST_EMULATE|BINDTEST_NO_CALLBACK|BINDTEST_USE_CACHE, TYMED_ISTREAM);
 
-        trace("asynchronous https test...\n");
-        test_BindToStorage(HTTPS_TEST, 0, TYMED_ISTREAM);
-
         trace("emulated https test...\n");
         test_BindToStorage(HTTPS_TEST, BINDTEST_EMULATE, TYMED_ISTREAM);
 




More information about the wine-cvs mailing list