diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2018-08-31 14:05:29 +1000 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2018-08-31 14:05:29 +1000 |
commit | 1eca8ee24c6658cd058dcc3e833eab53084e4981 (patch) | |
tree | b6128de744b04595ef6db8015b91f2ec6bb84fa7 /gtests/ssl_gtest | |
parent | b6b433ab55ed5ebd7f0b910e8acccbe1878a4ded (diff) | |
download | nss-hg-1eca8ee24c6658cd058dcc3e833eab53084e4981.tar.gz |
Bug 1486667 - Cleanup server alert expectation before exiting the test, a=bustage
Diffstat (limited to 'gtests/ssl_gtest')
-rw-r--r-- | gtests/ssl_gtest/ssl_auth_unittest.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtests/ssl_gtest/ssl_auth_unittest.cc b/gtests/ssl_gtest/ssl_auth_unittest.cc index bf31dd319..1e882911c 100644 --- a/gtests/ssl_gtest/ssl_auth_unittest.cc +++ b/gtests/ssl_gtest/ssl_auth_unittest.cc @@ -137,8 +137,10 @@ static void SetDeferredAuthCertificateCallback(std::shared_ptr<TlsAgent> agent, auto args = new AuthCompleteArgs(agent, code); agent->SetAuthCertificateCallback( [args](TlsAgent*, PRBool, PRBool) -> SECStatus { + // This can't be 0 or we race the message from the client to the server, + // and tests assume that we lose that race. std::shared_ptr<Poller::Timer> timer_handle; - Poller::Instance()->SetTimer(0U, args, CallAuthComplete, &timer_handle); + Poller::Instance()->SetTimer(1U, args, CallAuthComplete, &timer_handle); return SECWouldBlock; }); } @@ -158,8 +160,13 @@ TEST_P(TlsConnectTls13, ServerAuthRejectAsync) { TEST_P(TlsConnectGenericPre13, ServerAuthRejectAsync) { SetDeferredAuthCertificateCallback(client_, SEC_ERROR_EXPIRED_CERTIFICATE); client_->ExpectSendAlert(kTlsAlertCertificateExpired); + server_->ExpectReceiveAlert(kTlsAlertCertificateExpired); ConnectExpectFailOneSide(TlsAgent::CLIENT); client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_FAILED); + + // The server might not receive the alert that the client sends, which would + // cause the test to fail when it cleans up. Reset expectations. + server_->ExpectReceiveAlert(kTlsAlertCloseNotify, kTlsAlertWarning); } TEST_P(TlsConnectGeneric, ClientAuth) { |