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

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

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Fix merge again (?) 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
Index: content/browser/loader/mock_resource_loader.h
diff --git a/content/browser/loader/mock_resource_loader.h b/content/browser/loader/mock_resource_loader.h
index 958f8c71a02c7ccd631992085831c34a26e48624..7c2b685650111180b2a2a63b6133d0af33f60bf2 100644
--- a/content/browser/loader/mock_resource_loader.h
+++ b/content/browser/loader/mock_resource_loader.h
@@ -9,7 +9,8 @@
#include <string>
#include "base/macros.h"
-#include "content/browser/loader/resource_controller.h"
+#include "base/memory/weak_ptr.h"
+#include "content/browser/loader/resource_handler.h"
#include "net/base/net_errors.h"
class GURL;
@@ -20,13 +21,12 @@ class URLRequestStatus;
}
namespace content {
-class ResourceHandler;
struct ResourceResponse;
// Class that takes the place of the ResourceLoader for tests. It simplifies
// testing ResourceHandlers by managing callbacks and performing basic sanity
// checks. The test fixture is responsible for advancing states.
-class MockResourceLoader : public ResourceController {
+class MockResourceLoader : public ResourceHandler::Delegate {
public:
explicit MockResourceLoader(ResourceHandler* resource_handler);
~MockResourceLoader() override;
@@ -65,16 +65,21 @@ class MockResourceLoader : public ResourceController {
int error_code() const { return error_code_; }
private:
- // ResourceController implementation.
- void Cancel() override;
- void CancelAndIgnore() override;
- void CancelWithError(int error_code) override;
- void Resume() override;
+ class TestResourceController;
+
+ // ResourceHandler::Delegate implementation:
+ void OutOfBandCancel(int error_code, bool tell_renderer) override;
+
+ void OnCancel(int error_code);
+ void OnResume();
ResourceHandler* const resource_handler_;
Status status_ = Status::IDLE;
int error_code_ = net::OK;
+ bool canceled_out_of_band_ = false;
+
+ base::WeakPtrFactory<MockResourceLoader> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MockResourceLoader);
};

Powered by Google App Engine
This is Rietveld 408576698