diff options
Diffstat (limited to 'net/http/http_transaction_unittest.h')
-rw-r--r-- | net/http/http_transaction_unittest.h | 12 |
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) |