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

Unified Diff: content/test/net/url_request_abort_on_end_job.cc

Issue 1459333002: Revert "Reland: URLRequestJob: change ReadRawData contract" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « content/test/net/url_request_abort_on_end_job.h ('k') | ios/web/webui/url_data_manager_ios_backend.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/net/url_request_abort_on_end_job.cc
diff --git a/content/test/net/url_request_abort_on_end_job.cc b/content/test/net/url_request_abort_on_end_job.cc
index 6d237a8f9749ad7816d5888828f3cffc1dcddf8d..f7ff5a9dd84bf0f1e759e62211fddbbb74fb0035 100644
--- a/content/test/net/url_request_abort_on_end_job.cc
+++ b/content/test/net/url_request_abort_on_end_job.cc
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "base/location.h"
-#include "base/numerics/safe_conversions.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
@@ -112,16 +111,20 @@ void URLRequestAbortOnEndJob::Start() {
weak_factory_.GetWeakPtr()));
}
-int URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf, int max_bytes) {
+bool URLRequestAbortOnEndJob::ReadRawData(net::IOBuffer* buf,
+ const int max_bytes,
+ int* bytes_read) {
if (!sent_data_) {
- max_bytes =
- std::min(max_bytes, base::checked_cast<int>(sizeof(kPageContent)));
- std::memcpy(buf->data(), kPageContent, max_bytes);
+ *bytes_read = std::min(size_t(max_bytes), sizeof(kPageContent));
+ std::memcpy(buf->data(), kPageContent, *bytes_read);
sent_data_ = true;
- return max_bytes;
+ return true;
}
- return net::ERR_CONNECTION_ABORTED;
+ SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
+ net::ERR_CONNECTION_ABORTED));
+ *bytes_read = -1;
+ return false;
}
} // namespace content
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.h ('k') | ios/web/webui/url_data_manager_ios_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698