Page Speed Optimization Libraries
1.4.26.1
|
Classes | |
class | Callback |
Protected Member Functions | |
virtual Callback * | NewCallback () |
virtual CacheInterface * | Cache ()=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) |
Callback * | AddCallback () |
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) |
Callback * | InitiateGet (const GoogleString &key) |
Callback * | InitiateGet (CacheInterface *cache, const GoogleString &key) |
void | set_mutex (AbstractMutex *mutex) |
Sets the mutex used to protect outstanding_fetches_. | |
int | outstanding_fetches () |
Callback* net_instaweb::CacheTestBase::AddCallback | ( | ) | [inline, protected] |
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 | ||
) | [inline, protected] |
Performs a cache Get, waits for callback completion, and checks the result is as expected.
Callback* net_instaweb::CacheTestBase::InitiateGet | ( | const GoogleString & | key | ) | [inline, protected] |
Initiate a cache Get, and return the Callback* which can be passed to WaitAndCheck or WaitAndCheckNotFound.
virtual Callback* net_instaweb::CacheTestBase::NewCallback | ( | ) | [inline, protected, virtual] |
Allocates a callback structure. The default Callback structure has an empty implementation of Wait().
int net_instaweb::CacheTestBase::outstanding_fetches | ( | ) | [inline, protected] |
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 | ) | [inline, protected] |
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 | ( | ) | [inline, protected, virtual] |
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 | ||
) | [inline, protected] |
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());