net_instaweb::FetcherTest::MockAsyncFetcher Class Reference

#include "fetcher_test.h"

Inheritance diagram for net_instaweb::FetcherTest::MockAsyncFetcher:
net_instaweb::UrlAsyncFetcher

List of all members.

Public Member Functions

 MockAsyncFetcher (UrlFetcher *url_fetcher)
virtual bool StreamingFetch (const GoogleString &url, const RequestHeaders &request_headers, ResponseHeaders *response_headers, Writer *response_writer, MessageHandler *handler, Callback *callback)
void CallCallbacks ()

Detailed Description

This is a pseudo-asynchronous interface to MockFetcher. It performs fetches instantly, but defers calling the callback until the user calls CallCallbacks(). Then it will execute the deferred callbacks.


Member Function Documentation

virtual bool net_instaweb::FetcherTest::MockAsyncFetcher::StreamingFetch ( const GoogleString url,
const RequestHeaders request_headers,
ResponseHeaders response_headers,
Writer response_writer,
MessageHandler message_handler,
Callback callback 
) [virtual]

Fetch a URL, set response_headers and stream the output to response_writer. response_headers and response_writer must be valid until callback->Done().

There is an unchecked contract that response_headers are set before the response_writer or callback are used. Caution, several implementations do not satisfy this contract (but should).

This function returns true if the request was immediately satisfied. In either case, the callback will be called with the completion status, so it's safe to ignore the return value.

Todo:
TODO(sligocki): GoogleString -> GoogleUrl

Default implementation uses Fetch. So derivative classes only need to define one of these functions.

Reimplemented from net_instaweb::UrlAsyncFetcher.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:33:53 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3