Title: [267278] trunk/Tools
Revision
267278
Author
[email protected]
Date
2020-09-18 13:15:50 -0700 (Fri, 18 Sep 2020)

Log Message

Make TLSVersion.NetworkSession API test more robust
https://bugs.webkit.org/show_bug.cgi?id=216704
<rdar://problem/68643674>

Patch by Alex Christensen <[email protected]> on 2020-09-18
Reviewed by Tim Horton.

r265573 made preconnect attempts to legacy TLS servers fail.
This caused the TLSVersion.NetworkSession to assert because the first connection attempt would fail
(and the second would succeed if it was supposed to succeed with the conditions in the test).
The test calls waitForDidFailProvisionalNavigation in cases where it is supposed to fail and
waitForDidFinishNavigation in cases where it supposed to succeed.
Like I did in r266100 with another test, use HTTPServer which allows a variable number of connection attempts.

* TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (267277 => 267278)


--- trunk/Tools/ChangeLog	2020-09-18 19:46:33 UTC (rev 267277)
+++ trunk/Tools/ChangeLog	2020-09-18 20:15:50 UTC (rev 267278)
@@ -1,3 +1,21 @@
+2020-09-18  Alex Christensen  <[email protected]>
+
+        Make TLSVersion.NetworkSession API test more robust
+        https://bugs.webkit.org/show_bug.cgi?id=216704
+        <rdar://problem/68643674>
+
+        Reviewed by Tim Horton.
+
+        r265573 made preconnect attempts to legacy TLS servers fail.
+        This caused the TLSVersion.NetworkSession to assert because the first connection attempt would fail
+        (and the second would succeed if it was supposed to succeed with the conditions in the test).
+        The test calls waitForDidFailProvisionalNavigation in cases where it is supposed to fail and
+        waitForDidFinishNavigation in cases where it supposed to succeed.
+        Like I did in r266100 with another test, use HTTPServer which allows a variable number of connection attempts.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
+        (TestWebKitAPI::TEST):
+
 2020-09-18  Aakash Jain  <[email protected]>
 
         Make ews-app robust against config.json issues

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm (267277 => 267278)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm	2020-09-18 19:46:33 UTC (rev 267277)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm	2020-09-18 20:15:50 UTC (rev 267278)
@@ -164,6 +164,7 @@
 
 TEST(TLSVersion, NetworkSession)
 {
+    HTTPServer server(HTTPServer::respondWithOK, HTTPServer::Protocol::HttpsWithLegacyTLS);
     static auto delegate = adoptNS([TestNavigationDelegate new]);
     auto makeWebViewWith = [&] (WKWebsiteDataStore *store) {
         WKWebViewConfiguration *configuration = [[[WKWebViewConfiguration alloc] init] autorelease];
@@ -177,21 +178,16 @@
         return webView;
     };
     {
-        TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
         auto webView = makeWebViewWith([WKWebsiteDataStore defaultDataStore]);
         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
         [delegate waitForDidFinishNavigation];
     }
     {
-        TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
         auto webView = makeWebViewWith([WKWebsiteDataStore nonPersistentDataStore]);
         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
         [delegate waitForDidFinishNavigation];
     }
     {
-        TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
-            EXPECT_FALSE(ssl);
-        }, tls1_1);
         auto configuration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
         [configuration setLegacyTLSEnabled:NO];
         auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:configuration.get()]);
@@ -201,17 +197,11 @@
     }
     [[NSUserDefaults standardUserDefaults] setBool:NO forKey:defaultsKey];
     {
-        TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
-            EXPECT_FALSE(ssl);
-        }, tls1_1);
         auto webView = makeWebViewWith([WKWebsiteDataStore defaultDataStore]);
         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
         [delegate waitForDidFailProvisionalNavigation];
     }
     {
-        TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
-            EXPECT_FALSE(ssl);
-        }, tls1_1);
         auto webView = makeWebViewWith([WKWebsiteDataStore nonPersistentDataStore]);
         [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
         [delegate waitForDidFailProvisionalNavigation];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to