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

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

Issue 2313693002: Use modified URLRequest::Read() and delegate methods in /appcache/ (Closed)
Patch Set: michaeln's comments 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..f8465303a5a12e0cbf07d263266f15b6be3a7130 100644
--- a/content/browser/appcache/appcache_request_handler_unittest.cc
+++ b/content/browser/appcache/appcache_request_handler_unittest.cc
@@ -79,8 +79,26 @@ 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);
+ 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() const { return request_status_; }
+
+ private:
+ int request_status_;
};
class MockURLRequestJob : public net::URLRequestJob {
@@ -385,7 +403,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