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

Unified Diff: content/browser/appcache/appcache_request_handler_unittest.cc

Issue 2313693002: Use modified URLRequest::Read() and delegate methods in /appcache/ (Closed)
Patch Set: use net::ERR_IO_PENDING as initial value Created 4 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
Index: content/browser/appcache/appcache_request_handler_unittest.cc
diff --git a/content/browser/appcache/appcache_request_handler_unittest.cc b/content/browser/appcache/appcache_request_handler_unittest.cc
index 1252bf190611dd870804365f8c271dd6df07eb72..90bcefc16b88d708a97edec9231bee4e807e9042 100644
--- a/content/browser/appcache/appcache_request_handler_unittest.cc
+++ b/content/browser/appcache/appcache_request_handler_unittest.cc
@@ -79,8 +79,27 @@ class AppCacheRequestHandlerTest : public testing::Test {
// exercise fallback code paths.
class MockURLRequestDelegate : public net::URLRequest::Delegate {
- void OnResponseStarted(net::URLRequest* request) override {}
- void OnReadCompleted(net::URLRequest* request, int bytes_read) override {}
+ public:
+ MockURLRequestDelegate() : request_status_(1) {}
+
+ void OnResponseStarted(net::URLRequest* request, int net_error) override {
+ DCHECK_NE(net::ERR_IO_PENDING, net_error);
+
michaeln 2016/09/07 20:49:39 nit: you can delete the blank line and after the d
maksims (do not use this acc) 2016/09/12 12:45:58 Done.
+ request_status_ = net_error;
+ }
+ void OnReadCompleted(net::URLRequest* request, int bytes_read) override {
+ DCHECK_NE(net::ERR_IO_PENDING, bytes_read);
+
+ if (bytes_read >= 0)
+ request_status_ = net::OK;
+ else
+ request_status_ = bytes_read;
+ }
+
+ int request_status() { return request_status_; }
michaeln 2016/09/07 20:49:39 could be const
maksims (do not use this acc) 2016/09/12 12:45:58 Done.
+
+ private:
+ int request_status_;
};
class MockURLRequestJob : public net::URLRequestJob {
@@ -385,7 +404,7 @@ class AppCacheRequestHandlerTest : public testing::Test {
response_code));
request_->Start();
// All our simulation needs to satisfy are the following two DCHECKs
- DCHECK(request_->status().is_success());
+ DCHECK_EQ(net::OK, delegate_.request_status());
DCHECK_EQ(response_code, request_->GetResponseCode());
}
« no previous file with comments | « no previous file | content/browser/appcache/appcache_update_job.h » ('j') | content/browser/appcache/appcache_update_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698