Page Speed Optimization Libraries
1.3.25.1
|
#include "fetcher_test.h"
Public Member Functions | |
MockAsyncFetcher (UrlFetcher *url_fetcher) | |
virtual void | Fetch (const GoogleString &url, MessageHandler *handler, AsyncFetch *fetch) |
void | CallCallbacks () |
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.
virtual void net_instaweb::FetcherTest::MockAsyncFetcher::Fetch | ( | const GoogleString & | url, |
MessageHandler * | message_handler, | ||
AsyncFetch * | fetch | ||
) | [virtual] |
Asynchronously fetch a URL, set the response headers and stream the contents to fetch and call fetch->Done() when the fetch finishes.
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).
TODO(sligocki): GoogleString -> GoogleUrl or at least StringPiece.
TODO(sligocki): Include the URL in the fetch, like the request headers.
Implements net_instaweb::UrlAsyncFetcher.