Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(992)

Unified Diff: net/http/http_pipelined_connection_impl_unittest.cc

Issue 11795003: Http Pipelinining: Make unit tests more friendly to greedily reading from sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698