summaryrefslogtreecommitdiffstats
path: root/net/http/http_transaction_unittest.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 00:30:47 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 00:30:47 +0000
commit9dea9e1fea04be579e34c634cb3be1b6654ef506 (patch)
tree6615f05d4b92199300d63cb5f2203ca7345e2cff /net/http/http_transaction_unittest.h
parentd615ad7ae65beddc26c9833b7bfd1d7bdb6f3d7b (diff)
downloadchromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.zip
chromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.tar.gz
chromium_src-9dea9e1fea04be579e34c634cb3be1b6654ef506.tar.bz2
Change URLRequest to use a ref-counted buffer for actual IO.
This will re-land http://codereview.chromium.org/18390 BUG=5325 Review URL: http://codereview.chromium.org/19004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_transaction_unittest.h')
-rw-r--r--net/http/http_transaction_unittest.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h
index ccdb954..0c26178 100644
--- a/net/http/http_transaction_unittest.h
+++ b/net/http/http_transaction_unittest.h
@@ -149,7 +149,7 @@ class TestTransactionConsumer : public CallbackRunner< Tuple1<int> > {
if (result <= 0) {
DidFinish(result);
} else {
- content_.append(read_buf_, result);
+ content_.append(read_buf_->data(), result);
Read();
}
}
@@ -163,7 +163,8 @@ class TestTransactionConsumer : public CallbackRunner< Tuple1<int> > {
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 @@ class TestTransactionConsumer : public CallbackRunner< Tuple1<int> > {
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 @@ class MockNetworkTransaction : public net::HttpTransaction {
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)