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

Unified Diff: net/http/http_transaction_unittest.h

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « net/http/http_transaction.h ('k') | net/http/http_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_transaction_unittest.h
===================================================================
--- net/http/http_transaction_unittest.h (revision 8565)
+++ net/http/http_transaction_unittest.h (working copy)
@@ -149,7 +149,7 @@
if (result <= 0) {
DidFinish(result);
} else {
- content_.append(read_buf_, result);
+ content_.append(read_buf_->data(), result);
Read();
}
}
@@ -163,7 +163,8 @@
void Read() {
state_ = READING;
- int result = trans_->Read(read_buf_, sizeof(read_buf_), this);
+ read_buf_ = new net::IOBuffer(1024);
+ int result = trans_->Read(read_buf_, 1024, this);
if (result != net::ERR_IO_PENDING)
DidRead(result);
}
@@ -177,7 +178,7 @@
scoped_ptr<net::HttpTransaction> trans_;
std::string content_;
- char read_buf_[1024];
+ scoped_refptr<net::IOBuffer> read_buf_;
int error_;
static int quit_counter_;
@@ -237,11 +238,12 @@
return net::ERR_FAILED;
}
- virtual int Read(char* buf, int buf_len, net::CompletionCallback* callback) {
+ virtual int Read(net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
int data_len = static_cast<int>(data_.size());
int num = std::min(buf_len, data_len - data_cursor_);
if (num) {
- memcpy(buf, data_.data() + data_cursor_, num);
+ memcpy(buf->data(), data_.data() + data_cursor_, num);
data_cursor_ += num;
}
if (test_mode_ & TEST_MODE_SYNC_NET_READ)
« no previous file with comments | « net/http/http_transaction.h ('k') | net/http/http_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698