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

Unified Diff: net/http/http_transaction_test_util.cc

Issue 1327763003: Added and implemented URLRequest::GetTotalSentBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spdy_sent_bytes_impl
Patch Set: Addressed nits Created 5 years, 3 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_test_util.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « net/http/http_transaction_test_util.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698