Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
net_instaweb::FetcherTest Class Reference
Inheritance diagram for net_instaweb::FetcherTest:

Classes

class  CheckCallback
 

Protected Member Functions

WaitUrlAsyncFetcherwait_fetcher ()
 Helpful classes for testing. More...
 
CountingUrlAsyncFetchercounting_fetcher ()
 
int CountFetchesAsync (const StringPiece &url, bool expect_success, bool *callback_called)
 
int CountFetchesAsync (const StringPiece &url, UrlAsyncFetcher *fetcher, bool expect_success, bool check_error_message, bool *callback_called)
 
virtual UrlAsyncFetcherasync_fetcher ()
 
GoogleString TestFilename ()
 
void ValidateOutput (const GoogleString &content, const ResponseHeaders &response_headers)
 

Static Protected Member Functions

static void ValidateMockFetcherResponse (bool success, bool check_error_message, const GoogleString &content, const ResponseHeaders &response_headers)
 This checks that response matches the mock response we setup.
 

Protected Attributes

GoogleMessageHandler message_handler_
 
MockUrlFetcher mock_fetcher_
 
WaitUrlAsyncFetcher wait_url_async_fetcher_
 
CountingUrlAsyncFetcher counting_fetcher_
 
scoped_ptr< ThreadSystemthread_system_
 
SimpleStats statistics_
 

Static Protected Attributes

static const char kStartDate []
 
static const char kHtmlContent []
 
static const char kGoodUrl []
 
static const char kNotCachedUrl []
 
static const char kBadUrl []
 
static const char kHeaderName []
 
static const char kHeaderValue []
 
static const char kErrorMessage []
 

Member Function Documentation

virtual UrlAsyncFetcher* net_instaweb::FetcherTest::async_fetcher ( )
inlineprotectedvirtual

Override this to allow CountFetchesAsync w/o fetcher argument. It is not abstract (= 0) because they only need to be overridden by classes which want to use CountFetchersAsync.

int net_instaweb::FetcherTest::CountFetchesAsync ( const StringPiece &  url,
bool  expect_success,
bool *  callback_called 
)
protected

Initiate an async URL fetch, and return the number of times the counting fetcher had to be run to perform the fetch. Note: You must override async_fetcher() to return the correct fetcher.

int net_instaweb::FetcherTest::CountFetchesAsync ( const StringPiece &  url,
UrlAsyncFetcher fetcher,
bool  expect_success,
bool  check_error_message,
bool *  callback_called 
)
protected

Like above, but doesn't use async_fetcher(), and lets you opt-out of checking of error messages

void net_instaweb::FetcherTest::ValidateOutput ( const GoogleString content,
const ResponseHeaders response_headers 
)
protected

This validation code is hard-coded to the http request capture in testdata/google.http.

WaitUrlAsyncFetcher* net_instaweb::FetcherTest::wait_fetcher ( )
inlineprotected

Helpful classes for testing.

We set up a chain of fetchers: Counting -> Wait -> Mock, where the mock will only fetch kGoodUrl and kNotCachedUrl, returning kHtmlContent.


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