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

Unified Diff: net/http/http_transaction_test_util.cc

Issue 1467603002: URLRequestJob: change ReadRawData contract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add done_reading_called_ to MockNetworkTransaction Created 5 years, 1 month 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/test/url_request/url_request_failed_job.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 6bd8230c46363c106a347badef77bfe6a7f8c7e1..0bee91f836e8b77549a7612de693cdcffed42781 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -244,6 +244,7 @@ MockNetworkTransaction::MockNetworkTransaction(RequestPriority priority,
received_bytes_(0),
sent_bytes_(0),
socket_log_id_(NetLog::Source::kInvalidId),
+ done_reading_called_(false),
weak_factory_(this) {}
MockNetworkTransaction::~MockNetworkTransaction() {}
@@ -301,6 +302,7 @@ bool MockNetworkTransaction::IsReadyToRestartForAuth() {
int MockNetworkTransaction::Read(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) {
+ CHECK(!done_reading_called_);
int data_len = static_cast<int>(data_.size());
int num = std::min(buf_len, data_len - data_cursor_);
if (test_mode_ & TEST_MODE_SLOW_READ)
@@ -335,6 +337,8 @@ int64_t MockNetworkTransaction::GetTotalSentBytes() const {
}
void MockNetworkTransaction::DoneReading() {
+ CHECK(!done_reading_called_);
+ done_reading_called_ = true;
if (transaction_factory_.get())
transaction_factory_->TransactionDoneReading();
}
@@ -506,6 +510,7 @@ MockNetworkLayer::MockNetworkLayer()
MockNetworkLayer::~MockNetworkLayer() {}
void MockNetworkLayer::TransactionDoneReading() {
+ CHECK(!done_reading_called_);
done_reading_called_ = true;
}
« no previous file with comments | « net/http/http_transaction_test_util.h ('k') | net/test/url_request/url_request_failed_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698