Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Protected Member Functions | List of all members
net_instaweb::CacheTestBase Class Referenceabstract
Inheritance diagram for net_instaweb::CacheTestBase:
net_instaweb::SharedMemCacheTestBase net_instaweb::SharedMemCacheTestTemplate< ConcreteTestEnv >

Classes

class  Callback
 

Protected Member Functions

virtual CallbackNewCallback ()
 
virtual CacheInterfaceCache ()=0
 
virtual void PostOpCleanup ()
 
void CheckGet (const GoogleString &key, const GoogleString &expected_value)
 
void CheckGet (CacheInterface *cache, const GoogleString &key, const GoogleString &expected_value)
 As above, but specifies which cache to use.
 
void CheckPut (const GoogleString &key, const GoogleString &value)
 Writes a value into the cache.
 
void CheckPut (CacheInterface *cache, const GoogleString &key, const GoogleString &value)
 
void CheckDelete (const GoogleString &key)
 
void CheckNotFound (const char *key)
 Performs a Get and verifies that the key is not found.
 
void CheckNotFound (CacheInterface *cache, const char *key)
 
CallbackAddCallback ()
 
void WaitAndCheck (Callback *callback, const GoogleString &expected_value)
 
void WaitAndCheckNotFound (Callback *callback)
 
void IssueMultiGet (Callback *c0, const GoogleString &key0, Callback *c1, const GoogleString &key1, Callback *c2, const GoogleString &key2)
 
void TestMultiGet ()
 
void PopulateCache (int num)
 
void set_invalid_value (const char *v)
 
void set_invalid_key (const char *k)
 
CallbackInitiateGet (const GoogleString &key)
 
CallbackInitiateGet (CacheInterface *cache, const GoogleString &key)
 
void set_mutex (AbstractMutex *mutex)
 Sets the mutex used to protect outstanding_fetches_.
 
int outstanding_fetches ()
 

Member Function Documentation

Callback* net_instaweb::CacheTestBase::AddCallback ( )
inlineprotected

Adds a new callback to the callback-array, returning a Callback* that can then be passed to WaitAndCheck and WaitAndCheckNotFound.

void net_instaweb::CacheTestBase::CheckGet ( const GoogleString key,
const GoogleString expected_value 
)
inlineprotected

Performs a cache Get, waits for callback completion, and checks the result is as expected.

Callback* net_instaweb::CacheTestBase::InitiateGet ( const GoogleString key)
inlineprotected

Initiate a cache Get, and return the Callback* which can be passed to WaitAndCheck or WaitAndCheckNotFound.

virtual Callback* net_instaweb::CacheTestBase::NewCallback ( )
inlineprotectedvirtual

Allocates a callback structure. The default Callback structure has an empty implementation of Wait().

int net_instaweb::CacheTestBase::outstanding_fetches ( )
inlineprotected

Returns the number of outstanding Get requests. The return value makes sense only if the cache system is quiescent.

void net_instaweb::CacheTestBase::PopulateCache ( int  num)
inlineprotected

Populates the cache with keys in pattern n0 n1 n2 n3... and values in pattern v0 v1 v2 v3...

virtual void net_instaweb::CacheTestBase::PostOpCleanup ( )
inlineprotectedvirtual

Optional method that can be specified by a test subclass to specify an operation that should be performed after Get or Put.

void net_instaweb::CacheTestBase::WaitAndCheck ( Callback callback,
const GoogleString expected_value 
)
inlineprotected

noop_wait_called_ means the callback hasn't overridden Wait() so Callback's do-nothing method was called; if that's the case, then we expect the cache to be blocking, and we expect the Get() call to have invoked Done() before the do-nothing Wait(). Since we can't know which version of Wait() was called before calling it, we use the value of called() as noted by the do-nothing Wait().

We'd like to test this but it's valid for a CacheInterface to report that it is not blocking even though it actually is (or can be). DelayCache is an example. EXPECT_TRUE(Cache()->IsBlocking());


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