Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
net_instaweb::CriticalImagesFinderTestBase Class Referenceabstract
Inheritance diagram for net_instaweb::CriticalImagesFinderTestBase:
net_instaweb::RewriteTestBase net_instaweb::RewriteOptionsTestBase< OptionsClass > net_instaweb::HtmlParseTestBaseNoAlloc

Public Member Functions

virtual CriticalImagesFinderfinder ()=0
virtual bool UpdateCriticalImagesCacheEntry (const StringSet *critical_images_set, const StringSet *css_critical_images_set)
void CheckCriticalImageFinderStats (int hits, int expiries, int not_found)
bool IsHtmlCriticalImage (StringPiece url)
bool IsCssCriticalImage (StringPiece url)
- Public Member Functions inherited from net_instaweb::RewriteTestBase
 RewriteTestBase (std::pair< TestRewriteDriverFactory *, TestRewriteDriverFactory * > factories)
virtual void SetUp ()
virtual void TearDown ()
virtual bool AddBody () const
virtual TestRewriteDriverFactoryMakeTestFactory ()
void AddRecompressImageFilters ()
void AddFilter (RewriteOptions::Filter filter)
 Add a single rewrite filter to rewrite_driver_.
void AddOtherFilter (RewriteOptions::Filter filter)
 Add a single rewrite filter to other_rewrite_driver_.
void AddRewriteFilter (RewriteFilter *filter)
void AddFetchOnlyRewriteFilter (RewriteFilter *filter)
void AddOtherRewriteFilter (RewriteFilter *filter)
void SetBaseUrlForFetch (const StringPiece &url)
void SetDriverRequestHeaders ()
void SetDownstreamCacheDirectives (StringPiece downstream_cache_purge_method, StringPiece downstream_cache_purge_location_prefix, StringPiece rebeaconing_key)
void SetShouldBeaconHeader (StringPiece rebeaconing_key)
 Set ShouldBeacon request header to the specified value.
ResourcePtr CreateResource (const StringPiece &base, const StringPiece &url)
Timertimer ()
void AppendDefaultHeaders (const ContentType &content_type, GoogleString *text)
 Append default headers to the given string.
void AppendDefaultHeadersWithCanonical (const ContentType &content_type, StringPiece canonical_url, GoogleString *text)
 Like above, but also include a Link: <..>; rel="canonical" header.
void ServeResourceFromManyContexts (const GoogleString &resource_url, const StringPiece &expected_content)
void ServeResourceFromManyContextsWithUA (const GoogleString &resource_url, const StringPiece &expected_content, const StringPiece &user_agent)
void ServeResourceFromNewContext (const GoogleString &resource_url, const StringPiece &expected_content)
virtual RewriteDriverhtml_parse ()
void DefaultResponseHeaders (const ContentType &content_type, int64 ttl_sec, ResponseHeaders *response_headers)
 Set default headers for a resource with content_type and Cache ttl_sec.
bool FetchResource (const StringPiece &path, const StringPiece &filter_id, const StringPiece &name, const StringPiece &ext, GoogleString *content)
bool FetchResource (const StringPiece &path, const StringPiece &filter_id, const StringPiece &name, const StringPiece &ext, GoogleString *content, ResponseHeaders *response)
bool FetchResourceUrl (const StringPiece &url, GoogleString *content, ResponseHeaders *response)
bool FetchResourceUrl (const StringPiece &url, RequestHeaders *request_headers, GoogleString *content, ResponseHeaders *response_headers)
bool FetchResourceUrl (const StringPiece &url, GoogleString *content)
bool TryFetchResource (const StringPiece &url)
 Just check if we can fetch a resource successfully, ignore response.
void SetUseManagedRewriteDrivers (bool use_managed_rewrite_drivers)
GoogleString CssLinkHref (const StringPiece &url)
void CollectCssLinks (const StringPiece &id, const StringPiece &html, StringVector *css_links)
 Collects the hrefs for all CSS <link>s on the page.
void CollectCssLinks (const StringPiece &id, const StringPiece &html, CssLink::Vector *css_links)
 Collects all information about CSS links into a CssLink::Vector.
void EncodePathAndLeaf (const StringPiece &filter_id, const StringPiece &hash, const StringVector &name_vector, const StringPiece &ext, ResourceNamer *namer)
 Encode the given name (path + leaf) using the given pagespeed attributes.
StringVector MultiUrl (const StringPiece &url1)
StringVector MultiUrl (const StringPiece &url1, const StringPiece &url2)
StringVector MultiUrl (const StringPiece &url1, const StringPiece &url2, const StringPiece &url3)
StringVector MultiUrl (const StringPiece &url1, const StringPiece &url2, const StringPiece &url3, const StringPiece &url4)
GoogleString Encode (const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringPiece &name, const StringPiece &ext)
GoogleString Encode (const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringVector &name_vector, const StringPiece &ext)
GoogleString EncodeNormal (const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringPiece &name, const StringPiece &ext)
 Same as Encode but specifically using UrlNamer not TestUrlNamer.
GoogleString EncodeNormal (const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringVector &name_vector, const StringPiece &ext)
GoogleString EncodeWithBase (const StringPiece &base, const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringPiece &name, const StringPiece &ext)
GoogleString EncodeWithBase (const StringPiece &base, const StringPiece &path, const StringPiece &filter_id, const StringPiece &hash, const StringVector &name_vector, const StringPiece &ext)
GoogleString EncodeImage (int width, int height, StringPiece filename, StringPiece hash, StringPiece rewritten_ext)
GoogleString AddOptionsToEncodedUrl (const StringPiece &url, const StringPiece &options)
 Takes an already-encoded URL and adds options to to it.
void SetupWaitFetcher ()
void CallFetcherCallbacks ()
void OtherCallFetcherCallbacks ()
RewriteOptionsoptions () const
RewriteOptionsother_options () const
void SetRewriteOptions (RewriteOptions *opts)
 Set the RewriteOptions to be returned by the RewriteOptionsManager.
bool AddDomain (StringPiece domain)
bool AddOriginDomainMapping (StringPiece to_domain, StringPiece from_domain)
bool AddRewriteDomainMapping (StringPiece to_domain, StringPiece from_domain)
bool AddShard (StringPiece domain, StringPiece shards)
void TestServeFiles (const ContentType *content_type, const StringPiece &filter_id, const StringPiece &rewritten_ext, const StringPiece &orig_name, const StringPiece &orig_content, const StringPiece &rewritten_name, const StringPiece &rewritten_content)
 Helper method to test all manner of resource serving from a filter.
void ValidateFallbackHeaderSanitization (StringPiece filter_id)
TestRewriteDriverFactoryfactory ()
TestRewriteDriverFactoryother_factory ()
void UseMd5Hasher ()
void SetDefaultLongCacheHeaders (const ContentType *content_type, ResponseHeaders *header)
void SetFetchResponse (const StringPiece &url, const ResponseHeaders &response_header, const StringPiece &response_body)
void SetResponseWithDefaultHeaders (const StringPiece &relative_url, const ContentType &content_type, const StringPiece &content, int64 ttl_sec)
 Add content to mock fetcher (with default headers).
bool LoadFile (const StringPiece &filename, GoogleString *contents)
void AddFileToMockFetcher (const StringPiece &url, const StringPiece &filename, const ContentType &content_type, int64 ttl_sec)
 Add the contents of a file to mock fetcher (with default headers).
void AddToResponse (const StringPiece &url, const StringPiece &name, const StringPiece &value)
void SetFetchResponse404 (const StringPiece &url)
void SetFetchFailOnUnexpected (bool fail)
void FetcherUpdateDateHeaders ()
void ClearFetcherResponses ()
virtual void ClearStats ()
void ClearRewriteDriver ()
MockUrlFetchermock_url_fetcher ()
Hasherhasher ()
DelayCachedelay_cache ()
LRUCachelru_cache ()
Statisticsstatistics ()
MemFileSystemfile_system ()
HTTPCachehttp_cache ()
PropertyCachepage_property_cache ()
MockMessageHandlermessage_handler ()
RewriteDriverrewrite_driver ()
RewriteDriverother_rewrite_driver ()
MockSchedulermock_scheduler ()
 The scheduler used by rewrite_driver.
int64 start_time_ms () const
bool ReadFile (const char *filename, GoogleString *contents)
bool WriteFile (const char *filename, const StringPiece &contents)
ServerContextserver_context ()
ServerContextother_server_context ()
CountingUrlAsyncFetchercounting_url_async_fetcher ()
void SetMockHashValue (const GoogleString &value)
void SetCacheDelayUs (int64 delay_us)
void SetupWriter () override
RewriteDriverMakeDriver (ServerContext *server_context, RewriteOptions *options)
GoogleString AbsolutifyUrl (const StringPiece &in)
 Converts a potentially relative URL off kTestDomain to absolute if needed.
void TestRetainExtraHeaders (const StringPiece &name, const StringPiece &filter_id, const StringPiece &ext)
const UrlSegmentEncoderFindEncoder (const StringPiece &id) const
void SetUseTestUrlNamer (bool use_test_url_namer)
 Switch url namers as specified.
GoogleString EncodeCssName (const StringPiece &name, bool supports_webp, bool can_inline)
bool ReadIfCached (const ResourcePtr &resource)
void InitiateResourceRead (const ResourcePtr &resource)
HTTPCache::FindResult HttpBlockingFind (const GoogleString &key, HTTPCache *http_cache, HTTPValue *value_out, ResponseHeaders *headers)
HTTPCache::FindResult HttpBlockingFindStatus (const GoogleString &key, HTTPCache *http_cache)
HTTPCache::FindResult HttpBlockingFindWithOptions (const RewriteOptions *options, const GoogleString &key, HTTPCache *http_cache, HTTPValue *value_out, ResponseHeaders *headers)
 Same as above, but with options (for invalidation checks)
void SetXhtmlMimetype ()
 Sets the response-headers Content-Type to "application/xhtml+xml".
void SetHtmlMimetype ()
 Sets the response-headers Content-Type to "text/html".
void SetMimetype (const StringPiece &mimetype)
 Sets the response-headers Content-Type as specified.
void CheckFetchFromHttpCache (StringPiece url, StringPiece expected_contents, int64 expected_expiration_ms)
const PropertyCache::CohortSetupCohort (PropertyCache *cache, const GoogleString &cohort)
 Setup statistics for the given cohort and add it to the give PropertyCache.
void SetupSharedCache ()
MockPropertyPageNewMockPage (const StringPiece &url, const StringPiece &options_signature_hash, UserAgentMatcher::DeviceType device_type)
 Returns a new mock property page for the page property cache.
MockPropertyPageNewMockPage (const StringPiece &url)
void SetMockLogRecord ()
 Sets MockLogRecord in the driver's request_context.
MockLogRecordmock_log_record ()
 Returns the MockLogRecord in the driver.
GoogleString GetLazyloadScriptHtml ()
 Helper methods to return js/html snippets related to lazyload images.
GoogleString GetLazyloadPostscriptHtml ()
void SetCacheInvalidationTimestamp ()
void SetCacheInvalidationTimestampForUrl (StringPiece url, bool ignores_metadata_and_pcache)
void EnableCachePurge ()
void EnableDebug ()
 Enables the debug flag, which is often done on a test-by-test basis.
void DebugWithMessage (StringPiece expected_debug_message)
GoogleString DebugMessage (StringPiece url)
void DisableGzip ()
bool WasGzipped (const ResponseHeaders &response_headers)
 Determines whether a response was originally gzipped.
- Public Member Functions inherited from net_instaweb::RewriteOptionsTestBase< OptionsClass >
ThreadSystemthread_system ()
OptionsClass * NewOptions ()

Protected Member Functions

void ResetDriver ()
 Resets the state of the driver.
const PropertyValueGetCriticalImagesUpdatedValue ()
- Protected Member Functions inherited from net_instaweb::RewriteTestBase
void Init ()
virtual RequestContextPtr CreateRequestContext ()
void CallFetcherCallbacksForDriver (WaitUrlAsyncFetcher *fetcher, RewriteDriver *driver)
void PopulateDefaultHeaders (const ContentType &content_type, int64 original_content_length, ResponseHeaders *headers)
void SetActiveServer (ActiveServerFlag server_to_use)
void AdvanceTimeUs (int64 delay_ms)
void AdvanceTimeMs (int64 delay_ms)
void SetTimeUs (int64 time_us)
void SetTimeMs (int64 time_ms)
void AdjustTimeUsWithoutWakingAlarms (int64 time_us)
 Adjusts time ignoring any scheduler callbacks. Use with caution.
const RequestTimingInfotiming_info ()
 Accessor for TimingInfo.
RequestTimingInfomutable_timing_info ()
virtual RequestContextPtr request_context ()
LoggingInfo * logging_info ()
const MetadataCacheInfo & metadata_cache_info ()
 Convenience method to extract read-only metadata_cache_info.
GoogleString AppliedRewriterStringFromLog ()
void VerifyRewriterInfoEntry (AbstractLogRecord *log_record, const GoogleString &id, int url_index, int rewriter_info_index, int rewriter_info_size, int url_list_size, const GoogleString &url)
void SetCurrentUserAgent (const StringPiece &user_agent)
 Sets current_user_agent_.
void SetupForWebp ()
 Sets up user-agent and request-header to allow webp processing.
void SetupForWebpLossless ()
void SetupForWebpAnimated ()
void AddRequestAttribute (StringPiece name, StringPiece value)
void PopulateRequestHeaders (RequestHeaders *request_headers)
 Populates a RequestHeaders* object with al.
virtual void ParseUrl (StringPiece url, StringPiece html_input)
GoogleString ExpectedNonce ()
GoogleString HttpCacheKey (StringPiece url)
int TimedValue (StringPiece name)
 Returns the value of a TimedVariable, specified by name.
- Protected Member Functions inherited from net_instaweb::HtmlParseTestBaseNoAlloc
virtual bool AddHtmlTags () const
void SetDoctype (StringPiece directive)
virtual GoogleString AddHtmlBody (StringPiece html)
void ValidateNoChanges (StringPiece case_id, StringPiece html_input)
void ValidateNoChangesFail (StringPiece case_id, StringPiece html_input)
 Fail to ValidateNoChanges.
void SetupWriter (scoped_ptr< HtmlWriterFilter > *html_writer_filter)
void Parse (StringPiece case_id, StringPiece html_input)
 Parse html_input, the result is stored in output_buffer_. More...
bool ValidateExpected (StringPiece case_id, StringPiece html_input, StringPiece expected)
bool ValidateExpectedUrl (StringPiece url, StringPiece html_input, StringPiece expected)
 Same as ValidateExpected, but with an explicit URL rather than an id.
void ValidateExpectedFail (StringPiece case_id, StringPiece html_input, StringPiece expected)
 Fail to ValidateExpected.
const GoogleUrlhtml_gurl ()

Protected Attributes

NullStatistics stats_
- Protected Attributes inherited from net_instaweb::RewriteTestBase
const HTTPCache::FindResult kFoundResult
 Common values for HttpBlockingFind* result.
const HTTPCache::FindResult kNotFoundResult
MockUrlFetcher mock_url_fetcher_
scoped_ptr< Statisticsstatistics_
< TestRewriteDriverFactory
< TestRewriteDriverFactory
scoped_ptr< HtmlWriterFilterother_html_writer_filter_
ActiveServerFlag active_server_
bool use_managed_rewrite_drivers_
StringPiece current_user_agent_
StringVector request_attribute_names_
StringVector request_attribute_values_
MD5Hasher md5_hasher_
 owned by rewrite_driver_.
 owned by other_rewrite_driver_.
UrlSegmentEncoder default_encoder_
ResponseHeaders response_headers_
const GoogleString kEtag0
 Etag with a 0 hash.
uint64 expected_nonce_
GoogleString debug_message_
 Message used by DebugMessage.
- Protected Attributes inherited from net_instaweb::HtmlParseTestBaseNoAlloc
MockMessageHandler message_handler_
StringWriter write_to_string_
GoogleString output_buffer_
bool added_filter_
scoped_ptr< HtmlWriterFilterhtml_writer_filter_
GoogleString doctype_string_

Additional Inherited Members

- Public Types inherited from net_instaweb::RewriteTestBase
enum  ActiveServerFlag { kPrimary, kSecondary }
- Static Public Member Functions inherited from net_instaweb::RewriteTestBase
static GoogleString ChangeSuffix (StringPiece old_url, bool append_new_suffix, StringPiece old_suffix, StringPiece new_suffix)
static const ProcessContextprocess_context ()
- Public Attributes inherited from net_instaweb::RewriteOptionsTestBase< OptionsClass >
scoped_ptr< ThreadSystemthread_system_
- Static Public Attributes inherited from net_instaweb::RewriteTestBase
static const char kTestData []
 Testdata directory.
static const char kConfiguredBeaconingKey []
 Beaconing key values used when downstream caching is enabled.
static const char kWrongBeaconingKey []
- Static Protected Attributes inherited from net_instaweb::HtmlParseTestBaseNoAlloc
static const char kTestDomain []
static const char kXhtmlDtd []
 DOCTYPE string for claiming XHTML.

The documentation for this class was generated from the following file: