19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_FAKE_FILTER_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_FAKE_FILTER_H_
32 namespace net_instaweb {
35 class ResourceContext;
49 ResourceContext* resource_context)
57 virtual void DoRewriteSingle(
60 const ResourceContext* resource_context)
const;
62 virtual const char*
id()
const {
return filter_->id(); }
72 semantic_type::Category category)
75 exceed_deadline_(false),
78 output_content_type_(NULL),
79 num_calls_to_encode_user_agent_(0),
80 category_(category) {}
82 virtual ~FakeFilter();
85 virtual void EndElementImpl(
HtmlElement* element) {}
86 virtual void StartElementImpl(HtmlElement* element);
95 ResourceContext* resource_context) {
98 int num_rewrites()
const {
return num_rewrites_; }
99 int num_encode_user_agent()
const {
return num_calls_to_encode_user_agent_; }
101 void set_enabled(
bool x) { enabled_ = x; }
102 bool enabled() {
return enabled_; }
103 bool exceed_deadline() {
return exceed_deadline_; }
104 void set_exceed_deadline(
bool x) { exceed_deadline_ = x; }
105 void IncRewrites() { ++num_rewrites_; }
106 void set_output_content_type(
const ContentType* type) {
107 output_content_type_ = type;
109 const ContentType* output_content_type() {
return output_content_type_; }
111 ResourceContext* context)
const;
114 virtual const char* id()
const {
return id_; }
116 virtual const char*
Name()
const {
return "MockFilter"; }
121 bool exceed_deadline_;
125 mutable int num_calls_to_encode_user_agent_;
126 semantic_type::Category category_;
RewriteContext * parent()
Allows a nested rewriter to walk up its parent hierarchy.
Definition: rewrite_context.h:280
virtual void EncodeUserAgentIntoResourceContext(ResourceContext *context) const
bool PolicyPermitsRendering() const override
Definition: fake_filter.h:64
SingleRewriteContext(RewriteDriver *driver, RewriteContext *parent, ResourceContext *resource_context)
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: fake_filter.h:116
virtual const char * id() const
Returns the filter ID.
Definition: fake_filter.h:62
virtual bool ComputeOnTheFly() const
Definition: fake_filter.h:117
Definition: html_element.h:42
virtual void StartDocumentImpl()
Definition: fake_filter.h:84
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual RewriteContext * MakeFakeContext(RewriteDriver *driver, RewriteContext *parent, ResourceContext *resource_context)
Factory for context so a subclass can override FakeFilter::Context.
Definition: fake_filter.h:93
Definition: fake_filter.h:44
Definition: rewrite_filter.h:35
Definition: rewrite_driver.h:100
void RewriteSingle(const ResourcePtr &input, const OutputResourcePtr &output)
Subclasses of SingleRewriteContext must override this:
Definition: content_type.h:31
virtual OutputResourceKind kind() const
Definition: fake_filter.h:63
Definition: rewrite_context.h:155
Derived from some input resource URL or URLs.
Definition: output_resource_kind.h:27
Definition: single_rewrite_context.h:36
Definition: fake_filter.h:46
GoogleString UserAgentCacheKey(const ResourceContext *resource_context) const
virtual RewriteContext * MakeNestedRewriteContext(RewriteContext *parent, const ResourceSlotPtr &slot)
virtual RewriteContext * MakeRewriteContext()
Definition: fake_filter.h:87
OutputResourceKind
Definition: output_resource_kind.h:26