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

Unified Diff: content/browser/loader/test_resource_handler.h

Issue 2552463002: Add more ResourceLoaderTests (Closed)
Patch Set: Fix Created 4 years 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/browser/loader/resource_loader_unittest.cc ('k') | content/browser/loader/test_resource_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/test_resource_handler.h
diff --git a/content/browser/loader/test_resource_handler.h b/content/browser/loader/test_resource_handler.h
index 08b172eb1e41d35cc99e562abe56ddf38a7feeb8..6269f403b7b45c567eeaab7fc03c5cd2fc83e26d 100644
--- a/content/browser/loader/test_resource_handler.h
+++ b/content/browser/loader/test_resource_handler.h
@@ -83,8 +83,8 @@ class TestResourceHandler : public ResourceHandler {
void set_on_read_completed_result(bool on_read_completed_result) {
on_read_completed_result_ = on_read_completed_result;
}
- void set_on_on_read_eof_result(bool on_on_read_eof_result) {
- on_on_read_eof_result_ = on_on_read_eof_result;
+ void set_on_read_eof_result(bool on_read_eof_result) {
+ on_read_eof_result_ = on_read_eof_result;
}
// Cause |defer| to be set to true when the specified method is invoked. The
@@ -146,6 +146,9 @@ class TestResourceHandler : public ResourceHandler {
const std::string& body() const { return body_; }
net::URLRequestStatus final_status() const { return final_status_; }
+ // Returns the current number of |this|'s methods on the callstack.
+ int call_depth() const { return call_depth_; }
+
// Spins the message loop until the request is deferred. Using this is
// optional, but if used, must use it exclusively to wait for the request. If
// the request was deferred and then resumed/canceled without calling this
@@ -169,7 +172,7 @@ class TestResourceHandler : public ResourceHandler {
bool on_response_started_result_ = true;
bool on_will_read_result_ = true;
bool on_read_completed_result_ = true;
- bool on_on_read_eof_result_ = true;
+ bool on_read_eof_result_ = true;
bool defer_on_will_start_ = false;
bool defer_on_request_redirected_ = false;
@@ -198,6 +201,9 @@ class TestResourceHandler : public ResourceHandler {
net::URLRequestStatus::FromError(net::ERR_UNEXPECTED);
bool canceled_ = false;
+ // Tracks recursive calls, which aren't allowed.
+ int call_depth_ = 0;
+
std::unique_ptr<base::RunLoop> deferred_run_loop_;
base::RunLoop response_complete_run_loop_;
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/loader/test_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698