19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_MOCK_URL_FETCHER_H_ 
   20 #define NET_INSTAWEB_HTTP_PUBLIC_MOCK_URL_FETCHER_H_ 
   32 namespace net_instaweb {
 
   46   void SetResponse(
const StringPiece& url,
 
   48                    const StringPiece& response_body);
 
   53                      const StringPiece& name,
 
   54                      const StringPiece& value);
 
   60                               int64 last_modified_date,
 
   63                               const StringPiece& response_body);
 
   72     return supports_https_;
 
   75   void set_fetcher_supports_https(
bool supports_https) {
 
   77     supports_https_ = supports_https;
 
  115     fail_on_unexpected_ = x;
 
  122     update_date_headers_ = x;
 
  129     omit_empty_writes_ = x;
 
  137     fail_after_headers_ = x;
 
  144     verify_host_header_ = x;
 
  147   void set_verify_pagespeed_header_off(
bool x) {
 
  149     verify_pagespeed_header_off_ = x;
 
  152   void set_timer(Timer* timer) {
 
  168     error_message_ = msg;
 
  171   void set_strip_query_params(
bool strip_query_params) {
 
  173     strip_query_params_ = strip_query_params;
 
  179     HttpResponse(int64 last_modified_time, 
const GoogleString& etag,
 
  180                  const ResponseHeaders& in_header, 
const StringPiece& in_body)
 
  181         : last_modified_time_(last_modified_time),
 
  183           body_(in_body.data(), in_body.size()),
 
  185       header_.CopyFrom(in_header);
 
  188     const int64 last_modified_time()
 const { 
return last_modified_time_; }
 
  190     const ResponseHeaders& header()
 const { 
return header_; }
 
  191     ResponseHeaders* mutable_header() { 
return &header_; }
 
  193     void set_success(
bool success) { success_ = success; }
 
  194     bool success()
 const { 
return success_; }
 
  197     int64 last_modified_time_;
 
  199     ResponseHeaders header_;
 
  205   typedef std::map<const GoogleString, HttpResponse*> ResponseMap;
 
  209   ResponseMap response_map_;
 
  212   bool fail_on_unexpected_; 
 
  213   bool update_date_headers_; 
 
  214   bool omit_empty_writes_; 
 
  215   bool fail_after_headers_; 
 
  216   bool verify_host_header_; 
 
  217   bool verify_pagespeed_header_off_; 
 
  219   bool supports_https_; 
 
  220   bool strip_query_params_; 
 
  225   scoped_ptr<ThreadSystem> thread_system_; 
 
  226   scoped_ptr<AbstractMutex> mutex_; 
 
void set_split_writes(bool val)
Definition: mock_url_fetcher.h:160
virtual bool SupportsHttps() const 
Definition: mock_url_fetcher.h:70
void AddToResponse(const StringPiece &url, const StringPiece &name, const StringPiece &value)
void set_fail_on_unexpected(bool x)
Definition: mock_url_fetcher.h:113
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_. 
Definition: string.h:24
#define ScopedMutex(x)
Definition: abstract_mutex.h:69
const GoogleString & last_referer()
Return the referer of this fetching request. 
Definition: mock_url_fetcher.h:81
Helper class for lexically scoped mutexing. 
Definition: abstract_mutex.h:46
Definition: async_fetch.h:53
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
Fetching unset URLs will cause EXPECT failures as well as Done(false). 
void set_omit_empty_writes(bool x)
Definition: mock_url_fetcher.h:127
void Disable()
Definition: mock_url_fetcher.h:102
Definition: mock_url_fetcher.h:41
void set_update_date_headers(bool x)
Definition: mock_url_fetcher.h:120
void Clear()
Clear all set responses. 
void set_error_message(const GoogleString &msg)
If this is non-empty, we will write this out any time we report an error. 
Definition: mock_url_fetcher.h:166
void SetConditionalResponse(const StringPiece &url, int64 last_modified_date, const GoogleString &etag, const ResponseHeaders &response_header, const StringPiece &response_body)
Definition: message_handler.h:39
void SetResponseFailure(const StringPiece &url)
void RemoveResponse(const StringPiece &url)
Remove a single response. Will be a no-op if no response was set for url. 
void set_fail_after_headers(bool x)
Definition: mock_url_fetcher.h:135
Definition: url_async_fetcher.h:33
void set_verify_host_header(bool x)
Definition: mock_url_fetcher.h:142