Page Speed Optimization Libraries  1.7.30.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
net_instaweb::TestRewriteDriverFactory Class Reference

#include "test_rewrite_driver_factory.h"

Inheritance diagram for net_instaweb::TestRewriteDriverFactory:
net_instaweb::RewriteDriverFactory net_instaweb::CustomRewriteTestBase< OptionsClass >::CustomTestRewriteDriverFactory

List of all members.

Classes

class  CreateFilterCallback
class  CreateRewriterCallback
class  PlatformSpecificConfigurationCallback

Public Member Functions

 TestRewriteDriverFactory (const StringPiece &temp_dir, MockUrlFetcher *mock_fetcher, TestDistributedFetcher *test_distributed_fetcher)
DelayCache * delay_cache ()
LRUCache * lru_cache ()
MockTimer * mock_timer ()
MockHasher * mock_hasher ()
MemFileSystem * mem_file_system ()
MockUrlFetchermock_url_async_fetcher ()
WaitUrlAsyncFetcherwait_url_async_fetcher ()
CountingUrlAsyncFetchercounting_url_async_fetcher ()
CountingUrlAsyncFetchercounting_distributed_async_fetcher ()
MockTimeCache * mock_time_cache ()
void SetupWaitFetcher ()
void CallFetcherCallbacksForDriver (RewriteDriver *driver)
MockMessageHandler * mock_message_handler ()
MockScheduler * mock_scheduler ()
bool use_test_url_namer () const
void SetUseTestUrlNamer (bool x)
void AddCreateFilterCallback (CreateFilterCallback *callback)
 Does NOT take ownership of the callback.
void ClearFilterCallbackVector ()
void AddCreateRewriterCallback (CreateRewriterCallback *callback)
 Does NOT take ownership of the callback.
void ClearRewriterCallbackVector ()
virtual bool UseBeaconResultsInFilters () const
 By default this is false, but can be reset.
void set_use_beacon_results_in_filters (bool b)
void AddPlatformSpecificConfigurationCallback (PlatformSpecificConfigurationCallback *callback)
 Does NOT take ownership of the callback.
void ClearPlatformSpecificConfigurationCallback ()
virtual RewriteOptionsNewRewriteOptions ()
 Note that this disables ajax rewriting by default.
virtual ServerContextNewServerContext ()
 Note that this enables html proxying.
virtual bool IsDebugClient (const GoogleString &ip) const
 Base method that returns true if the given ip is a debug ip.
void set_add_platform_specific_decoding_passes (bool value)
bool add_platform_specific_decoding_passes () const
void AdvanceTimeMs (int64 delta_ms)
 Advances the mock scheduler by delta_ms.
const PropertyCache::CohortSetupCohort (PropertyCache *cache, const GoogleString &cohort_name)
 Sets up the cohort in the PropertyCache provided.
CachePropertyStorecache_property_store ()

Static Public Member Functions

static void InitStats (Statistics *statistics)

Static Public Attributes

static const int64 kStartTimeMs
 Arbitrary time to start MockTimer.
static const char kUrlNamerScheme []
 Env.var URL_NAMER_SCHEME.
static const int kMaxFetchGlobalQueueSize = 500
static const int kFetchesPerHostOutgoingRequestThreshold = 100
static const int kFetchesPerHostQueuedRequestThreshold = 500

Protected Member Functions

virtual Hasher * NewHasher ()
virtual MessageHandler * DefaultHtmlParseMessageHandler ()
virtual MessageHandler * DefaultMessageHandler ()
virtual UrlAsyncFetcherDefaultAsyncUrlFetcher ()
virtual UrlAsyncFetcherDefaultDistributedUrlFetcher ()
virtual FileSystem * DefaultFileSystem ()
virtual NonceGenerator * DefaultNonceGenerator ()
virtual Timer * DefaultTimer ()
virtual void SetupCaches (ServerContext *server_context)
virtual UrlNamerDefaultUrlNamer ()
virtual Scheduler * CreateScheduler ()
virtual void AddPlatformSpecificDecodingPasses (RewriteDriver *driver)
virtual void AddPlatformSpecificRewritePasses (RewriteDriver *driver)
virtual void ApplyPlatformSpecificConfiguration (RewriteDriver *driver)

Detailed Description

RewriteDriverFactory implementation for use in tests, using mock time, mock fetchers, and a memory-based file system.


Member Function Documentation

Provides an optional hook for adding rewriters to the .pagespeed. resource decoding chain. This should be used for rewriters that are specific to a particular RewriteDriverFactory implementation. The caller should only use the resulting driver for reconstructing a .pagespeed. resource, not for transforming HTML. Therefore, implementations should add any platform-specific rewriter whose id might appear in a .pagespeed. URL.

Reimplemented from net_instaweb::RewriteDriverFactory.

Provides an optional hook for adding rewrite passes to the HTML filter chain. This should be used for filters that are specific to a particular RewriteDriverFactory implementation.

Reimplemented from net_instaweb::RewriteDriverFactory.

Provides an optional hook for customizing the RewriteDriver object using the options set on it. This is called before RewriteDriver::AddFilters() and AddPlatformSpecificRewritePasses().

Reimplemented from net_instaweb::RewriteDriverFactory.

virtual Scheduler* net_instaweb::TestRewriteDriverFactory::CreateScheduler ( ) [protected, virtual]

Subclasses can override this to create an appropriate Scheduler subclass if the default isn't acceptable.

Reimplemented from net_instaweb::RewriteDriverFactory.

Implementors of RewriteDriverFactory must supply default definitions for each of these methods, although they may be overridden via set_ methods above. These methods all instantiate objects and transfer ownership to the caller.

Implements net_instaweb::RewriteDriverFactory.

They may also supply a custom Url namer. The default implementation performs sharding and appends '.pagespeed.<filter>.<hash>.<extension>'.

Reimplemented from net_instaweb::RewriteDriverFactory.

static void net_instaweb::TestRewriteDriverFactory::InitStats ( Statistics *  statistics) [static]

Initializes statistics variables. This must be done at process startup to enable shared memory segments in Apache to be set up.

Reimplemented from net_instaweb::RewriteDriverFactory.

Enable or disable adding the contents of rewriter_callback_vector_ within AddPlatformSpecificRewritePasses.

virtual void net_instaweb::TestRewriteDriverFactory::SetupCaches ( ServerContext server_context) [protected, virtual]

Called from InitServerContext, but virtualized separately as it is platform-specific. This method must call on the server context: set_http_cache, set_metadata_cache, set_filesystem_metadata_cache, and MakePropertyCaches.

Implements net_instaweb::RewriteDriverFactory.


Member Data Documentation

These constants are used to initialize the rate-controlling fetcher, which is instantiated unconditionally, with limits high enough that no tests will hit this unless they are trying to.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines