net_instaweb::HtmlParseTestBaseNoAlloc Class Reference

Inheritance diagram for net_instaweb::HtmlParseTestBaseNoAlloc:
net_instaweb::HtmlParseTestBase net_instaweb::ResourceManagerTestBase net_instaweb::CssRewriteTestBase

List of all members.

Protected Member Functions

virtual bool AddBody () const =0
virtual bool AddHtmlTags () const
void SetDoctype (const StringPiece &directive)
virtual GoogleString AddHtmlBody (const StringPiece &html)
void ValidateNoChanges (const StringPiece &case_id, const GoogleString &html_input)
void ValidateNoChangesFail (const StringPiece &case_id, const GoogleString &html_input)
 Fail to ValidateNoChanges.
void SetupWriter ()
void Parse (const StringPiece &case_id, const GoogleString &html_input)
 Parse html_input, the result is stored in output_buffer_.
virtual void ParseUrl (const StringPiece &url, const StringPiece &html_input)
 Parse given an explicit URL rather than an id to build URL around.
void ValidateExpected (const StringPiece &case_id, const GoogleString &html_input, const GoogleString &expected)
void ValidateExpectedUrl (const StringPiece &url, const GoogleString &html_input, const GoogleString &expected)
 Same as ValidateExpected, but with an explicit URL rather than an id.
void ValidateExpectedFail (const StringPiece &case_id, const GoogleString &html_input, const GoogleString &expected)
 Fail to ValidateExpected.
virtual HtmlParsehtml_parse ()=0

Protected Attributes

MockMessageHandler message_handler_
StringWriter write_to_string_
GoogleString output_buffer_
bool added_filter_
scoped_ptr< HtmlWriterFilterhtml_writer_filter_
GoogleString doctype_string_

Static Protected Attributes

static const char kTestDomain []
static const char kXhtmlDtd []
 DOCTYPE string for claiming XHTML.

Member Function Documentation

virtual bool net_instaweb::HtmlParseTestBaseNoAlloc::AddBody (  )  const [protected, pure virtual]

To make the tests more concise, we generally omit the <html>...</html> tags bracketing the input. The libxml parser will add those in if we don't have them. To avoid having that make the test data more verbose, we automatically add them in the test infrastructure, both for stimulus and expected response.

This flag controls whether we also add <body>...</body> tags. In the case html_parse_test, we go ahead and add them in. In the case of the rewriter tests, we want to explicitly control/observe the head and the body so we don't add the body tags in automatically. So classes that derive from HtmlParseTestBase must override this variable to indicate which they prefer.

Implemented in net_instaweb::ResourceManagerTestBase.

virtual bool net_instaweb::HtmlParseTestBaseNoAlloc::AddHtmlTags (  )  const [inline, protected, virtual]

If true, prepends "<html>\n" and appends "\n</html>" to input text prior to parsing it. This was originally done for consistency with libxml2 but that's long since been made irrelevant and we should probably just stop doing it. Adding the virtual function here should help us incrementally update tests & their gold results.

void net_instaweb::HtmlParseTestBaseNoAlloc::Parse ( const StringPiece &  case_id,
const GoogleString html_input 
) [inline, protected]

Parse html_input, the result is stored in output_buffer_.

HtmlParser needs a valid HTTP URL to evaluate relative paths, so we create a dummy URL.

void net_instaweb::HtmlParseTestBaseNoAlloc::SetDoctype ( const StringPiece &  directive  )  [inline, protected]

Set a doctype string (e.g. "<!doctype html>") to be inserted before the rest of the document (for the current test only). If none is set, it defaults to the empty string.

void net_instaweb::HtmlParseTestBaseNoAlloc::ValidateExpected ( const StringPiece &  case_id,
const GoogleString html_input,
const GoogleString expected 
) [protected]

Validate that the output HTML serializes as specified in 'expected', which might not be identical to the input.

void net_instaweb::HtmlParseTestBaseNoAlloc::ValidateNoChanges ( const StringPiece &  case_id,
const GoogleString html_input 
) [inline, protected]

Check that the output HTML is serialized to string-compare precisely with the input.


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:51 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3