summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authorxunjieli <xunjieli@chromium.org>2015-11-09 14:36:45 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-09 22:37:37 +0000
commit8f4440075845550559c09a787bf71de915d4cfc5 (patch)
treec079d73605d53c116b138f3544a0284f33e04438 /mojo
parent93f190df6d1e0435e535a4336e1fe9035a5c9eb7 (diff)
downloadchromium_src-8f4440075845550559c09a787bf71de915d4cfc5.zip
chromium_src-8f4440075845550559c09a787bf71de915d4cfc5.tar.gz
chromium_src-8f4440075845550559c09a787bf71de915d4cfc5.tar.bz2
Revert "URLRequestJob: change ReadRawData contract"
This reverts commit a505cbb45ec92d2617fe80490acf7d01ef4d3225. Revert "Disable http/tests/serviceworker/registration.html" This reverts commit e2bf349b84f10e940b5ebe5a8fcaf2cf8c8eb322. Revert "Remove incorrect DCHECK_NE in ServiceWorkerWriteToCacheJob::OnReadCompleted." This reverts commit 5b28d0b0efd8a75a9ad783bd849fa41eb9339a3b. Revert "Do not call NotifyDone in URLRequestJob::ReadRawDataComplete if ERR_IO_PENDING" This reverts commit 876da269322a66d5e2741de0892e01b24ab98065. TBR=michaeln@chromium.org,mnaganov@chromium.org,skyostil@chromium.org,eugenebut@chromium.org,davidben@chromium.org,falken@chromium.org,mtomasz@chromium.org, sky@chromium.org,jianli@chromium.org,zork@chromium.org BUG=553300 BUG=474859 Review URL: https://codereview.chromium.org/1437523002 Cr-Commit-Position: refs/heads/master@{#358686}
Diffstat (limited to 'mojo')
-rw-r--r--mojo/services/network/url_loader_impl_apptest.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/mojo/services/network/url_loader_impl_apptest.cc b/mojo/services/network/url_loader_impl_apptest.cc
index 5754e863..f21d684 100644
--- a/mojo/services/network/url_loader_impl_apptest.cc
+++ b/mojo/services/network/url_loader_impl_apptest.cc
@@ -49,23 +49,30 @@ class TestURLRequestJob : public net::URLRequestJob {
void Start() override { status_ = STARTED; }
- int ReadRawData(net::IOBuffer* buf, int buf_size) override {
+ bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read) override {
status_ = READING;
buf_size_ = buf_size;
- return net::ERR_IO_PENDING;
+ SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ return false;
}
void NotifyHeadersComplete() { net::URLRequestJob::NotifyHeadersComplete(); }
- void NotifyReadComplete(int result) {
- // Map errors to net::ERR_FAILED.
- if (result < 0)
- result = net::ERR_FAILED;
-
- ReadRawDataComplete(result);
- // Set this after calling ReadRawDataComplete since that ends up calling
- // ReadRawData.
- status_ = result <= 0 ? COMPLETED : STARTED;
+ void NotifyReadComplete(int bytes_read) {
+ if (bytes_read < 0) {
+ status_ = COMPLETED;
+ NotifyDone(net::URLRequestStatus(
+ net::URLRequestStatus::FromError(net::ERR_FAILED)));
+ net::URLRequestJob::NotifyReadComplete(0);
+ } else if (bytes_read == 0) {
+ status_ = COMPLETED;
+ NotifyDone(net::URLRequestStatus());
+ net::URLRequestJob::NotifyReadComplete(bytes_read);
+ } else {
+ status_ = STARTED;
+ SetStatus(net::URLRequestStatus());
+ net::URLRequestJob::NotifyReadComplete(bytes_read);
+ }
}
private: