⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267278 in webkit


Ignore:
Timestamp:
Sep 18, 2020, 1:15:50 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Alex Christensen <achristensen@webkit.org> 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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r267277 r267278  
     12020-09-18  Alex Christensen  <achristensen@webkit.org>
     2
     3        Make TLSVersion.NetworkSession API test more robust
     4        https://bugs.webkit.org/show_bug.cgi?id=216704
     5        <rdar://problem/68643674>
     6
     7        Reviewed by Tim Horton.
     8
     9        r265573 made preconnect attempts to legacy TLS servers fail.
     10        This caused the TLSVersion.NetworkSession to assert because the first connection attempt would fail
     11        (and the second would succeed if it was supposed to succeed with the conditions in the test).
     12        The test calls waitForDidFailProvisionalNavigation in cases where it is supposed to fail and
     13        waitForDidFinishNavigation in cases where it supposed to succeed.
     14        Like I did in r266100 with another test, use HTTPServer which allows a variable number of connection attempts.
     15
     16        * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
     17        (TestWebKitAPI::TEST):
     18
    1192020-09-18  Aakash Jain  <aakash_jain@apple.com>
    220
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm

    r266150 r267278  
    165165TEST(TLSVersion, NetworkSession)
    166166{
     167    HTTPServer server(HTTPServer::respondWithOK, HTTPServer::Protocol::HttpsWithLegacyTLS);
    167168    static auto delegate = adoptNS([TestNavigationDelegate new]);
    168169    auto makeWebViewWith = [&] (WKWebsiteDataStore *store) {
     
    178179    };
    179180    {
    180         TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
    181181        auto webView = makeWebViewWith([WKWebsiteDataStore defaultDataStore]);
    182182        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
     
    184184    }
    185185    {
    186         TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
    187186        auto webView = makeWebViewWith([WKWebsiteDataStore nonPersistentDataStore]);
    188187        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
     
    190189    }
    191190    {
    192         TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
    193             EXPECT_FALSE(ssl);
    194         }, tls1_1);
    195191        auto configuration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] initNonPersistentConfiguration]);
    196192        [configuration setLegacyTLSEnabled:NO];
     
    202198    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:defaultsKey];
    203199    {
    204         TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
    205             EXPECT_FALSE(ssl);
    206         }, tls1_1);
    207200        auto webView = makeWebViewWith([WKWebsiteDataStore defaultDataStore]);
    208201        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
     
    210203    }
    211204    {
    212         TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
    213             EXPECT_FALSE(ssl);
    214         }, tls1_1);
    215205        auto webView = makeWebViewWith([WKWebsiteDataStore nonPersistentDataStore]);
    216206        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
Note: See TracChangeset for help on using the changeset viewer.