#ifndef CONTENT_TEST_WEBURL_LOADER_MOCK_H_
#define CONTENT_TEST_WEBURL_LOADER_MOCK_H_
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/WebKit/public/platform/WebURLLoader.h"
namespace blink {
class WebData;
struct WebURLError;
class WebURLLoaderClient;
class WebURLRequest;
class WebURLResponse;
}
class WebURLLoaderMockFactory;
class WebURLLoaderMock : public blink::WebURLLoader {
public:
WebURLLoaderMock(WebURLLoaderMockFactory* factory,
blink::WebURLLoader* default_loader);
virtual ~WebURLLoaderMock();
void ServeAsynchronousRequest(const blink::WebURLResponse& response,
const blink::WebData& data,
const blink::WebURLError& error);
blink::WebURLRequest ServeRedirect(
const blink::WebURLResponse& redirectResponse);
virtual void loadSynchronously(const blink::WebURLRequest& request,
blink::WebURLResponse& response,
blink::WebURLError& error,
blink::WebData& data);
virtual void loadAsynchronously(const blink::WebURLRequest& request,
blink::WebURLLoaderClient* client);
virtual void cancel();
virtual void setDefersLoading(bool defer);
bool isDeferred() { return is_deferred_; }
private:
WebURLLoaderMockFactory* factory_;
blink::WebURLLoaderClient* client_;
scoped_ptr<blink::WebURLLoader> default_loader_;
bool using_default_loader_;
bool is_deferred_;
DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock);
};
#endif