Chromium Code Reviews| Index: net/http/http_transaction_test_util.cc |
| diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc |
| index 1b2960bb250e12fff7d9f10cc8fd4705b0bc6606..f1dae8650b08f875d51053cc46e1dc0fa9023d97 100644 |
| --- a/net/http/http_transaction_test_util.cc |
| +++ b/net/http/http_transaction_test_util.cc |
| @@ -242,9 +242,9 @@ MockNetworkTransaction::MockNetworkTransaction(RequestPriority priority, |
| websocket_handshake_stream_create_helper_(NULL), |
| transaction_factory_(factory->AsWeakPtr()), |
| received_bytes_(0), |
| + sent_bytes_(0), |
| socket_log_id_(NetLog::Source::kInvalidId), |
| - weak_factory_(this) { |
| -} |
| + weak_factory_(this) {} |
| MockNetworkTransaction::~MockNetworkTransaction() {} |
| @@ -329,6 +329,10 @@ int64 MockNetworkTransaction::GetTotalReceivedBytes() const { |
| return received_bytes_; |
| } |
| +int64_t MockNetworkTransaction::GetTotalSentBytes() const { |
| + return sent_bytes_; |
| +} |
| + |
| void MockNetworkTransaction::DoneReading() { |
| if (transaction_factory_.get()) |
| transaction_factory_->TransactionDoneReading(); |
| @@ -400,6 +404,13 @@ int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request, |
| return ERR_IO_PENDING; |
| } |
| + std::string request_line = |
| + base::StringPrintf("%s %s HTTP/1.1\r\n", request->method.c_str(), |
| + request->url.PathForRequest().c_str()); |
| + sent_bytes_ = request_line.size(); |
| + if (t->request_headers) |
| + sent_bytes_ += strlen(t->request_headers); |
|
mmenke
2015/09/04 15:21:49
This logic seems ugly and pointless, given that we
sclittle
2015/09/04 22:03:10
Done.
|
| + |
| std::string resp_status = t->status; |
| std::string resp_headers = t->response_headers; |
| std::string resp_data = t->data; |