Title: [266100] trunk/Tools
Revision
266100
Author
commit-qu...@webkit.org
Date
2020-08-24 20:36:45 -0700 (Mon, 24 Aug 2020)

Log Message

Make TLSVersion.DefaultBehavior more robust
https://bugs.webkit.org/show_bug.cgi?id=215791

Patch by Alex Christensen <achristen...@webkit.org> on 2020-08-24
Reviewed by Darin Adler.

After r265573 sometimes it would assert, which is not a problem because it was failing the first connection
then succeeding the second connection as intended and as happens in the real internet.
Use HTTPServer which accepts a variable number of connections to keep the test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/HTTPServer.h:
* TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK):
(TestWebKitAPI::HTTPServer::respondWithOK):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (266099 => 266100)


--- trunk/Tools/ChangeLog	2020-08-25 02:44:39 UTC (rev 266099)
+++ trunk/Tools/ChangeLog	2020-08-25 03:36:45 UTC (rev 266100)
@@ -1,3 +1,21 @@
+2020-08-24  Alex Christensen  <achristen...@webkit.org>
+
+        Make TLSVersion.DefaultBehavior more robust
+        https://bugs.webkit.org/show_bug.cgi?id=215791
+
+        Reviewed by Darin Adler.
+
+        After r265573 sometimes it would assert, which is not a problem because it was failing the first connection
+        then succeeding the second connection as intended and as happens in the real internet.
+        Use HTTPServer which accepts a variable number of connections to keep the test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/cocoa/HTTPServer.h:
+        * TestWebKitAPI/cocoa/HTTPServer.mm:
+        (TestWebKitAPI::HTTPServer::respondWithChallengeThenOK):
+        (TestWebKitAPI::HTTPServer::respondWithOK):
+
 2020-08-24  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Unreviewed, fix the internal iOS 13.4 build

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm (266099 => 266100)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm	2020-08-25 02:44:39 UTC (rev 266099)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm	2020-08-25 03:36:45 UTC (rev 266100)
@@ -144,9 +144,11 @@
 const uint16_t tls1_1 = 0x0302;
 static NSString *defaultsKey = @"WebKitEnableLegacyTLS";
 
+#if HAVE(NETWORK_FRAMEWORK)
+
 TEST(TLSVersion, DefaultBehavior)
 {
-    TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
+    HTTPServer server(HTTPServer::respondWithOK, HTTPServer::Protocol::HttpsWithLegacyTLS);
     auto delegate = adoptNS([TestNavigationDelegate new]);
     auto webView = adoptNS([WKWebView new]);
     [webView setNavigationDelegate:delegate.get()];
@@ -158,6 +160,8 @@
     [delegate waitForDidFinishNavigation];
 }
 
+#endif // HAVE(NETWORK_FRAMEWORK)
+
 #if HAVE(TLS_VERSION_DURING_CHALLENGE)
 
 TEST(TLSVersion, NetworkSession)

Modified: trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h (266099 => 266100)


--- trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h	2020-08-25 02:44:39 UTC (rev 266099)
+++ trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.h	2020-08-25 03:36:45 UTC (rev 266100)
@@ -54,8 +54,9 @@
     size_t totalRequests() const;
     void cancel();
 
+    static void respondWithOK(Connection);
     static void respondWithChallengeThenOK(Connection);
-    
+
 private:
     static RetainPtr<nw_parameters_t> listenerParameters(Protocol, CertificateVerifier&&, RetainPtr<SecIdentityRef>&&, Optional<uint16_t> port);
     static void respondToRequests(Connection, Ref<RequestData>);

Modified: trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm (266099 => 266100)


--- trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm	2020-08-25 02:44:39 UTC (rev 266099)
+++ trunk/Tools/TestWebKitAPI/cocoa/HTTPServer.mm	2020-08-25 03:36:45 UTC (rev 266100)
@@ -150,17 +150,22 @@
         "Content-Length: 0\r\n"
         "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
         connection.send(challengeHeader, [connection] {
-            connection.receiveHTTPRequest([connection] (Vector<char>&&) {
-                connection.send(
-                    "HTTP/1.1 200 OK\r\n"
-                    "Content-Length: 13\r\n\r\n"
-                    "Hello, World!"
-                );
-            });
+            respondWithOK(connection);
         });
     });
 }
 
+void HTTPServer::respondWithOK(Connection connection)
+{
+    connection.receiveHTTPRequest([connection] (Vector<char>&&) {
+        connection.send(
+            "HTTP/1.1 200 OK\r\n"
+            "Content-Length: 13\r\n\r\n"
+            "Hello, World!"
+        );
+    });
+}
+
 size_t HTTPServer::totalRequests() const
 {
     return m_requestData->requestCount;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to