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

List of all members.

Classes

class  CheckCallback

Protected Member Functions

WaitUrlAsyncFetcherwait_fetcher ()
 Helpful classes for testing.
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 SetUpTestCase ()
static void TearDownTestCase ()
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< ThreadSystem > thread_system_

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 []
static SimpleStats * statistics_

Member Function Documentation

virtual UrlAsyncFetcher* net_instaweb::FetcherTest::async_fetcher ( ) [inline, protected, virtual]

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.

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines