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..926d8c695d63357eb7f85cdfd5afcf58442fdf28 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(); |
@@ -383,6 +387,12 @@ void MockNetworkTransaction::SetWebSocketHandshakeStreamCreateHelper( |
websocket_handshake_stream_create_helper_ = create_helper; |
} |
+// static |
+const int64_t MockNetworkTransaction::kTotalReceivedBytes = 1000; |
+ |
+// static |
+const int64_t MockNetworkTransaction::kTotalSentBytes = 100; |
+ |
int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request, |
const CompletionCallback& callback, |
const BoundNetLog& net_log) { |
@@ -400,10 +410,12 @@ int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request, |
return ERR_IO_PENDING; |
} |
+ sent_bytes_ = kTotalSentBytes; |
+ received_bytes_ = kTotalReceivedBytes; |
+ |
std::string resp_status = t->status; |
std::string resp_headers = t->response_headers; |
std::string resp_data = t->data; |
- received_bytes_ = resp_status.size() + resp_headers.size() + resp_data.size(); |
if (t->handler) |
(t->handler)(request, &resp_status, &resp_headers, &resp_data); |