summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorerikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:54:07 +0000
committererikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:54:07 +0000
commit0107dbdf9eaa3d5c60d070c1ccfaee2972bdfec3 (patch)
treee29490bb35672e3703c4da61687489db757b572f /net/spdy
parente7ad932e9a04827ef75dc8c8975be25719ab9462 (diff)
downloadchromium_src-0107dbdf9eaa3d5c60d070c1ccfaee2972bdfec3.zip
chromium_src-0107dbdf9eaa3d5c60d070c1ccfaee2972bdfec3.tar.gz
chromium_src-0107dbdf9eaa3d5c60d070c1ccfaee2972bdfec3.tar.bz2
Fix SpdyHttpStreamTest windows tsan bug.
BUG=50929 TEST=net_unittests Review URL: http://codereview.chromium.org/2836079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_http_stream_unittest.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/net/spdy/spdy_http_stream_unittest.cc b/net/spdy/spdy_http_stream_unittest.cc
index 7f78142..1287820 100644
--- a/net/spdy/spdy_http_stream_unittest.cc
+++ b/net/spdy/spdy_http_stream_unittest.cc
@@ -47,7 +47,6 @@ TEST_F(SpdyHttpStreamTest, SendRequest) {
EnableCompression(false);
SpdySession::SetSSLMode(false);
- SpdySessionDependencies session_deps;
scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
MockWrite writes[] = {
CreateMockWrite(*req.get(), 1),
@@ -102,8 +101,10 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) {
MockWrite writes[] = {
CreateMockWrite(*req.get(), 1),
};
+ scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
MockRead reads[] = {
- MockRead(false, 0, 2), // EOF
+ CreateMockRead(*resp, 2),
+ MockRead(false, 0, 3) // EOF
};
HostPortPair host_port_pair("www.google.com", 80);
@@ -133,10 +134,17 @@ TEST_F(SpdyHttpStreamTest, SpdyURLTest) {
else
FAIL() << "No url is set in spdy_header!";
- MessageLoop::current()->RunAllPending();
- EXPECT_TRUE(http_session_->spdy_session_pool()->HasSession(pair));
- http_session_->spdy_session_pool()->CloseAllSessions();
- EXPECT_TRUE(!data()->at_read_eof());
+ // This triggers the MockWrite and read 2
+ callback.WaitForResult();
+
+ // This triggers read 3. The empty read causes the session to shut down.
+ data()->CompleteRead();
+
+ // Because we abandoned the stream, we don't expect to find a session in the
+ // pool anymore.
+ EXPECT_TRUE(!http_session_->spdy_session_pool()->HasSession(pair));
+ EXPECT_TRUE(data()->at_read_eof());
+ EXPECT_TRUE(data()->at_write_eof());
}
// TODO(willchan): Write a longer test for SpdyStream that exercises all