| 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..f316d0c8f49e7e225bc2d93f589438378cf84312 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,16 +21,15 @@ 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;
|
| + ~MockResourceLoader();
|
|
|
| // Idle means the ResourceHandler is waiting for the next call from the
|
| // TestFixture/ResourceLoader, CALLBACK_PENDING means that the ResourceHandler
|
| @@ -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);
|
| };
|
|
|