summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 14:39:30 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 14:39:30 +0000
commit6a47ac8d13a8a382686dc5ba1cadc64afccf10d0 (patch)
tree405c55c12246abad9e46c68d7fe5d68e70536d8e /net
parent1e5fead8aa598e7d834806f6f8eaef8302074f35 (diff)
downloadchromium_src-6a47ac8d13a8a382686dc5ba1cadc64afccf10d0.zip
chromium_src-6a47ac8d13a8a382686dc5ba1cadc64afccf10d0.tar.gz
chromium_src-6a47ac8d13a8a382686dc5ba1cadc64afccf10d0.tar.bz2
net: remove test flakyness caused by uncorking.
r61546 (reverted r61546, landed r61638, reverted r61672; it was blameless for the first revert.) caused flakyness in the SSLClientSocket tests because the SSL_CONNECT event may be hidden by a SOCKET_SENT event in the case that the test takes over 200ms to run. This patch changes the test to match against either event. http://codereview.chromium.org/3531019 BUG=none TEST=net_unittests git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/socket/ssl_client_socket_unittest.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index e545388..24fbb87 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -35,6 +35,19 @@ class SSLClientSocketTest : public PlatformTest {
//-----------------------------------------------------------------------------
+// LogContainsSSLConnectEndEvent returns true if the given index in the given
+// log is an SSL connect end event. The NSS sockets will cork in an attempt to
+// merge the first application data record with the Finished message when false
+// starting. However, in order to avoid the server timing out the handshake,
+// they'll give up waiting for application data and send the Finished after a
+// timeout. This means that an SSL connect end event may appear as a socket
+// write.
+static bool LogContainsSSLConnectEndEvent(
+ const net::CapturingNetLog::EntryList& log, int i) {
+ return net::LogContainsEndEvent(log, -1, net::NetLog::TYPE_SSL_CONNECT) ||
+ net::LogContainsEndEvent(log, -1, net::NetLog::TYPE_SOCKET_BYTES_SENT);
+};
+
TEST_F(SSLClientSocketTest, Connect) {
net::TestServer test_server(net::TestServer::TYPE_HTTPS, FilePath());
ASSERT_TRUE(test_server.Start());
@@ -71,8 +84,7 @@ TEST_F(SSLClientSocketTest, Connect) {
}
EXPECT_TRUE(sock->IsConnected());
- EXPECT_TRUE(net::LogContainsEndEvent(
- log.entries(), -1, net::NetLog::TYPE_SSL_CONNECT));
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(log.entries(), -1));
sock->Disconnect();
EXPECT_FALSE(sock->IsConnected());
@@ -117,9 +129,7 @@ TEST_F(SSLClientSocketTest, ConnectExpired) {
// 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(net::LogContainsEndEvent(
- log.entries(), -1, net::NetLog::TYPE_SSL_CONNECT));
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(log.entries(), -1));
}
TEST_F(SSLClientSocketTest, ConnectMismatched) {
@@ -162,9 +172,7 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) {
// 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(net::LogContainsEndEvent(
- log.entries(), -1, net::NetLog::TYPE_SSL_CONNECT));
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(log.entries(), -1));
}
// Attempt to connect to a page which requests a client certificate. It should
@@ -208,9 +216,7 @@ TEST_F(SSLClientSocketTest, FLAKY_ConnectClientAuthCertRequested) {
// 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(net::LogContainsEndEvent(
- log.entries(), -1, net::NetLog::TYPE_SSL_CONNECT));
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(log.entries(), -1));
}
// Connect to a server requesting optional client authentication. Send it a
@@ -260,8 +266,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) {
}
EXPECT_TRUE(sock->IsConnected());
- EXPECT_TRUE(net::LogContainsEndEvent(
- log.entries(), -1, net::NetLog::TYPE_SSL_CONNECT));
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(log.entries(), -1));
sock->Disconnect();
EXPECT_FALSE(sock->IsConnected());