Chromium Code Reviews| Index: net/http/http_pipelined_connection_impl_unittest.cc |
| =================================================================== |
| --- net/http/http_pipelined_connection_impl_unittest.cc (revision 175290) |
| +++ net/http/http_pipelined_connection_impl_unittest.cc (working copy) |
| @@ -574,6 +574,8 @@ |
| MockRead reads[] = { |
| MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n\r\n"), |
| MockRead(SYNCHRONOUS, 4, "ok.html"), |
| + MockRead(ASYNC, OK, 6), // Connection closed message. Not read before the |
| + // ERR_SOCKET_NOT_CONNECTED. |
|
mmenke
2013/01/07 21:57:15
Greedily reading data would run right off the end
|
| }; |
| Initialize(reads, arraysize(reads), writes, arraysize(writes)); |
| @@ -940,20 +942,25 @@ |
| class StreamDeleter { |
| public: |
| - StreamDeleter(HttpStream* stream) : |
| - stream_(stream), |
| - ALLOW_THIS_IN_INITIALIZER_LIST(callback_( |
| - base::Bind(&StreamDeleter::OnIOComplete, base::Unretained(this)))) { |
| + StreamDeleter(HttpStream* stream) |
| + : stream_(stream), |
| + ALLOW_THIS_IN_INITIALIZER_LIST(callback_( |
| + base::Bind(&StreamDeleter::OnIOComplete, base::Unretained(this)))) { |
| } |
| + ~StreamDeleter() { |
| + EXPECT_FALSE(stream_); |
| + } |
| + |
| const CompletionCallback& callback() { return callback_; } |
| private: |
| void OnIOComplete(int result) { |
| - delete stream_; |
| + // stream_->Close(true); |
| + stream_.reset(); |
| } |
| - HttpStream* stream_; |
| + scoped_ptr<HttpStream> stream_; |
| CompletionCallback callback_; |
| }; |