Page Speed Optimization Libraries  1.7.30.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
net_instaweb::CssRewriteTestBase Class Reference
Inheritance diagram for net_instaweb::CssRewriteTestBase:
net_instaweb::RewriteTestBase net_instaweb::RewriteOptionsTestBase< OptionsClass >

List of all members.

Protected Types

enum  ValidationFlags {
  kNoFlags = 0, kExpectSuccess = 1<<0, kExpectCached = 1<<1, kExpectNoChange = 1<<2,
  kExpectFallback = 1<<3, kExpectFailure = 1<<4, kNoStatCheck = 1<<5, kNoClearFetcher = 1<<6,
  kNoOtherContexts = 1<<7, kLinkCharsetIsUTF8 = 1<<8, kLinkScreenMedia = 1<<9, kLinkPrintMedia = 1<<10,
  kMetaCharsetUTF8 = 1<<11, kMetaCharsetISO88591 = 1<<12, kMetaHttpEquiv = 1<<13, kMetaHttpEquivUnquoted = 1<<14,
  kFlattenImportsCharsetMismatch = 1<<15, kFlattenImportsInvalidUrl = 1<<16, kFlattenImportsLimitExceeded = 1<<17, kFlattenImportsMinifyFailed = 1<<18,
  kFlattenImportsRecursion = 1<<19, kFlattenImportsComplexQueries = 1<<20, kInputHtml = 1<<21, kOutputHtml = 1<<22
}

Protected Member Functions

virtual void SetUp ()
bool FlagSet (int flags, ValidationFlags f) const
void CheckFlags (int flags)
 Sanity check on flags passed in.
bool ValidateRewriteInlineCss (const StringPiece &id, const StringPiece &css_input, const StringPiece &expected_css_output, int flags)
 Check that inline CSS gets rewritten correctly.
void GetNamerForCss (const StringPiece &id, const GoogleString &expected_css_output, ResourceNamer *namer)
GoogleString ExpectedUrlForNamer (const ResourceNamer &namer)
GoogleString ExpectedUrlForCss (const StringPiece &id, const GoogleString &expected_css_output)
void ValidateRewriteExternalCss (const StringPiece &id, const GoogleString &css_input, const GoogleString &expected_css_output, int flags)
 Check that external CSS gets rewritten correctly.
void ValidateRewriteExternalCssUrl (const StringPiece &id, const StringPiece &css_url, const GoogleString &css_input, const GoogleString &expected_css_output, int flags)
GoogleString MakeHtmlWithExternalCssLink (const StringPiece &css_url, int flags)
 Makes an HTML document with an external CSS link.
GoogleString MakeIndentedCssWithImage (StringPiece image_url)
 Makes a CSS body with an external image link, with nice indentation.
GoogleString MakeMinifiedCssWithImage (StringPiece image_url)
 Makes a minified CSS body with an external image link.
GoogleString ExtractCssBackgroundImage (const GoogleString &in_css)
 Extract the background image from the css text.
virtual GoogleString CssDebugMessage (int flags) const
 Return any debug message to be inserted into the expected output CSS.
void ValidateRewrite (const StringPiece &id, const GoogleString &css_input, const GoogleString &gold_output, int flags)
void ValidateFailParse (const StringPiece &id, const GoogleString &css_input)
void ResetStats ()
 Reset all Variables.
bool ValidateWithStats (const StringPiece &id, const GoogleString &html_input, const GoogleString &expected_html_output, const StringPiece &css_input, const StringPiece &expected_css_output, int flags)
 Validate HTML rewrite as well as checking statistics.
void TestCorruptUrl (const char *junk)
 Helper to test for how we handle trailing junk.

Static Protected Member Functions

static bool ExactlyOneTrue (bool a, bool b)
static bool ExactlyOneTrue (bool a, bool b, bool c)
static bool ExactlyOneTrue (bool a, bool b, bool c, bool d)
static bool ExactlyOneTrue (bool a, bool b, bool c, bool d, bool e)

Protected Attributes

Variable * num_blocks_rewritten_
Variable * num_fallback_rewrites_
Variable * num_parse_failures_
Variable * num_rewrites_dropped_
Variable * total_bytes_saved_
Variable * total_original_bytes_
Variable * num_uses_
Variable * num_flatten_imports_charset_mismatch_
Variable * num_flatten_imports_invalid_url_
Variable * num_flatten_imports_limit_exceeded_
Variable * num_flatten_imports_minify_failed_
Variable * num_flatten_imports_recursion_
Variable * num_flatten_imports_complex_queries_

Member Enumeration Documentation

Enumerator:
kExpectSuccess 

CSS parser succeeds and URL should be rewritten.

kExpectCached 

CSS parser succeeds and URL should be rewritten, but everything is from the cache so zero stats.

kExpectNoChange 

CSS parser succeeds but the URL is not rewritten because we increased the size of contents.

kExpectFallback 

CSS parser fails, fallback succeeds.

kExpectFailure 

CSS parser fails, fallback failed or disabled.

kNoStatCheck 
Todo:
TODO(sligocki): Explain why we turn off stats check at each use-site.
kNoClearFetcher 
Todo:
TODO(sligocki): Why would we ever want to clear fetcher?
kNoOtherContexts 
Todo:
TODO(sligocki): Explain why we turn off other contexts.
kFlattenImportsCharsetMismatch 

Flags to the check various import flattening failure statistics.

kInputHtml 

Flags to allow methods to know if the HTML is the test input or output.


Member Function Documentation

void net_instaweb::CssRewriteTestBase::ValidateRewrite ( const StringPiece &  id,
const GoogleString &  css_input,
const GoogleString &  gold_output,
int  flags 
) [inline, protected]

Don't run for external CSS unless inline succeeds.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines