diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-09 06:03:41 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-09 06:03:41 +0000 |
commit | 7deea3d76ad6278dbd6aa94f54943ae25b471868 (patch) | |
tree | d0ea3796c62c12137fc453265eae1363004a3c45 /net/socket/ssl_client_socket_unittest.cc | |
parent | 56e37a44c338d140e3ec9d9f0667511a10b690f8 (diff) | |
download | chromium_src-7deea3d76ad6278dbd6aa94f54943ae25b471868.zip chromium_src-7deea3d76ad6278dbd6aa94f54943ae25b471868.tar.gz chromium_src-7deea3d76ad6278dbd6aa94f54943ae25b471868.tar.bz2 |
Fix SSLClientSocketTest.CipherSuiteDisables flakiness.
Depending on timing, the test server may shutdown the socket before the unit test resumes, causing an extra read to appear in the NetLog. In testing, this only seemed to happen with TCPClientSocketWin. Make the final assertion check the last or second-to-last entry to accomodate the EOF.
BUG=64843
TEST=SSLClientSocketTest.CipherSuiteDisables
Review URL: http://codereview.chromium.org/6072011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/ssl_client_socket_unittest.cc')
-rw-r--r-- | net/socket/ssl_client_socket_unittest.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 1058cf7..3df20bb 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -58,8 +58,8 @@ class SSLClientSocketTest : public PlatformTest { // write. static bool LogContainsSSLConnectEndEvent( const net::CapturingNetLog::EntryList& log, int i) { - return net::LogContainsEndEvent(log, -1, net::NetLog::TYPE_SSL_CONNECT) || - net::LogContainsEvent(log, -1, net::NetLog::TYPE_SOCKET_BYTES_SENT, + return net::LogContainsEndEvent(log, i, net::NetLog::TYPE_SSL_CONNECT) || + net::LogContainsEvent(log, i, net::NetLog::TYPE_SOCKET_BYTES_SENT, net::NetLog::PHASE_NONE); }; @@ -543,8 +543,7 @@ TEST_F(SSLClientSocketTest, PrematureApplicationData) { // TODO(rsleevi): Not implemented for Schannel. As Schannel is only used when // performing client authentication, it will not be tested here. -// Flaky, http://crbug.com/64843. -TEST_F(SSLClientSocketTest, FLAKY_CipherSuiteDisables) { +TEST_F(SSLClientSocketTest, CipherSuiteDisables) { // Rather than exhaustively disabling every RC4 ciphersuite defined at // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml, // only disabling those cipher suites that the test server actually @@ -609,5 +608,14 @@ TEST_F(SSLClientSocketTest, FLAKY_CipherSuiteDisables) { // We cannot test sock->IsConnected(), as the NSS implementation disconnects // the socket when it encounters an error, whereas other implementations // leave it connected. - EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1)); + // Because this an error that the test server is mutually aware of, as opposed + // to being an error such as a certificate name mismatch, which is + // client-only, the exact index of the SSL connect end depends on how + // quickly the test server closes the underlying socket. If the test server + // closes before the IO message loop pumps messages, there may be a 0-byte + // Read event in the NetLog due to TCPClientSocket picking up the EOF. As a + // result, the SSL connect end event will be the second-to-last entry, + // rather than the last entry. + EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1) || + LogContainsSSLConnectEndEvent(entries, -2)); } |