19 #ifndef PAGESPEED_AUTOMATIC_PROXY_INTERFACE_TEST_BASE_H_
20 #define PAGESPEED_AUTOMATIC_PROXY_INTERFACE_TEST_BASE_H_
45 namespace net_instaweb {
47 class MockCriticalImagesFinder;
49 const char kPageUrl[] =
"page.html";
50 const char kBackgroundFetchHeader[] =
"X-Background-Fetch";
56 static const char kProxyHost[];
70 void set_authorized(
bool authorized) { authorized_ = authorized; }
88 num_elements_property_(NULL) {
97 virtual const char*
Name()
const {
return "MockFilter"; }
128 async_fetch_(base_fetch) {}
132 SharedAsyncFetch::HandleHeadersComplete();
139 virtual void HandleDone(
bool success) {
140 SharedAsyncFetch::HandleDone(success);
145 AsyncFetch* async_fetch_;
154 : base_fetcher_(fetcher),
155 num_background_fetches_(0) {}
162 num_background_fetches_++;
166 base_fetcher_->
Fetch(url, message_handler, new_fetch);
169 int num_background_fetches() {
return num_background_fetches_; }
170 void clear_num_background_fetches() { num_background_fetches_ = 0; }
174 int num_background_fetches_;
180 void TestHeadersSetupRace();
183 static const int kHtmlCacheTimeSec = 5000;
186 virtual void SetUp();
187 virtual void TearDown();
190 const StringPiece& url,
195 bool proxy_fetch_property_callback_collector_created);
197 void FetchFromProxy(
const StringPiece& url,
203 void FetchFromProxy(
const StringPiece& url,
208 void FetchFromProxyLoggingFlushes(
const StringPiece& url,
212 void FetchFromProxyNoWait(
const StringPiece& url,
218 void WaitForFetch(
bool proxy_fetch_property_callback_collector_created);
220 void TestPropertyCache(
const StringPiece& url,
221 bool delay_pcache,
bool thread_pcache,
222 bool expect_success);
224 void TestPropertyCacheWithHeadersAndOutput(
225 const StringPiece& url,
bool delay_pcache,
bool thread_pcache,
226 bool expect_success,
bool check_stats,
bool add_create_filter_callback,
227 bool expect_detach_before_pcache,
const RequestHeaders& request_headers,
230 void SetCriticalImagesInFinder(StringSet* critical_images);
231 void SetCssCriticalImagesInFinder(StringSet* css_critical_images);
243 header_latency_ms_ = header_latency_ms;
251 bool callback_done_value_;
252 int64 header_latency_ms_;
255 friend class FilterCallback;
Definition: url_namer.h:38
class GoogleUrl
Definition: google_url.h:58
virtual const char * Name() const
The name of this filter – used for logging and debugging.
Definition: proxy_interface_test_base.h:97
Definition: html_filter.h:35
Definition: proxy_interface_test_base.h:54
virtual RequestContextPtr request_context()
Holds the value & stability-metadata for a property.
Definition: property_cache.h:122
virtual bool IsAuthorized(const GoogleUrl &gurl, const RewriteOptions &options) const
Definition: proxy_interface_test_base.h:65
void SetHeaderLatencyMs(int64 header_latency_ms)
Definition: proxy_interface_test_base.h:242
Definition: empty_html_filter.h:37
Definition: test_rewrite_driver_factory.h:79
virtual void EndDocument()
Definition: rewrite_test_base.h:90
ResponseHeaders * response_headers()
See doc for request_headers and set_request_headers.
Definition: html_element.h:42
Definition: scoped_ptr.h:30
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool Decode(const GoogleUrl &gurl, const RewriteOptions *rewrite_options, GoogleString *decoded) const override
Given the request_url, generate the original url.
Definition: async_fetch.h:278
Definition: async_fetch.h:53
Definition: proxy_interface_test_base.h:178
Definition: proxy_interface_test_base.h:83
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)=0
Definition: rewrite_driver.h:100
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
Definition: proxy_interface_test_base.h:158
virtual bool IsBackgroundFetch() const
Definition: async_fetch.h:125
Definition: message_handler.h:39
virtual void HandleHeadersComplete()
Definition: proxy_interface_test_base.h:131
Definition: proxy_interface_test_base.h:151
UrlAsyncFetcher()
Definition: url_async_fetcher.h:78
Definition: rewrite_options.h:84
virtual void StartElement(HtmlElement *element)
virtual void StartDocument()
Definition: proxy_interface_test_base.h:124
Definition: url_async_fetcher.h:33
Definition: mock_critical_images_finder.h:36
Definition: proxy_interface_test_base.h:108