| Index: tools/grit/grit/format/html_inline_unittest.py
|
| diff --git a/tools/grit/grit/format/html_inline_unittest.py b/tools/grit/grit/format/html_inline_unittest.py
|
| index ea76d3732e9f6f14d1ddc5099d59498074aa63fe..16674cfe237432ee3b8db55066381fdbe2da174b 100755
|
| --- a/tools/grit/grit/format/html_inline_unittest.py
|
| +++ b/tools/grit/grit/format/html_inline_unittest.py
|
| @@ -179,6 +179,95 @@ class HtmlInlineUnittest(unittest.TestCase):
|
|
|
| tmp_dir.CleanUp()
|
|
|
| + def testInlineCSSWithIncludeDirective(self):
|
| + '''Tests that include directive in external css files also inlined'''
|
| +
|
| + files = {
|
| + 'index.html': '''
|
| + <html>
|
| + <head>
|
| + <link rel="stylesheet" href="foo.css">
|
| + </head>
|
| + </html>
|
| + ''',
|
| +
|
| + 'foo.css': '''<include src="style.css">''',
|
| +
|
| + 'style.css': '''
|
| + <include src="style2.css">
|
| + blink {
|
| + display: none;
|
| + }
|
| + ''',
|
| + 'style2.css': '''h1 {}''',
|
| + }
|
| +
|
| + expected_inlined = '''
|
| + <html>
|
| + <head>
|
| + <style>
|
| + h1 {}
|
| + blink {
|
| + display: none;
|
| + }
|
| + </style>
|
| + </head>
|
| + </html>
|
| + '''
|
| +
|
| + source_resources = set()
|
| + tmp_dir = util.TempDir(files)
|
| + for filename in files:
|
| + source_resources.add(tmp_dir.GetPath(filename))
|
| +
|
| + result = html_inline.DoInline(tmp_dir.GetPath('index.html'), None)
|
| + resources = result.inlined_files
|
| + resources.add(tmp_dir.GetPath('index.html'))
|
| + self.failUnlessEqual(resources, source_resources)
|
| + self.failUnlessEqual(expected_inlined,
|
| + util.FixLineEnd(result.inlined_data, '\n'))
|
| +
|
| + def testCssIncludedFileNames(self):
|
| + '''Tests that all included files from css are returned'''
|
| +
|
| + files = {
|
| + 'index.html': '''
|
| + <!DOCTYPE HTML>
|
| + <html>
|
| + <head>
|
| + <link rel="stylesheet" href="test.css">
|
| + </head>
|
| + <body>
|
| + </body>
|
| + </html>
|
| + ''',
|
| +
|
| + 'test.css': '''
|
| + <include src="test2.css">
|
| + ''',
|
| +
|
| + 'test2.css': '''
|
| + <include src="test3.css">
|
| + .image {
|
| + background: url('test.png');
|
| + }
|
| + ''',
|
| +
|
| + 'test3.css': '''h1 {}''',
|
| +
|
| + 'test.png': 'PNG DATA'
|
| + }
|
| +
|
| + source_resources = set()
|
| + tmp_dir = util.TempDir(files)
|
| + for filename in files:
|
| + source_resources.add(tmp_dir.GetPath(filename))
|
| +
|
| + resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html'))
|
| + resources.add(tmp_dir.GetPath('index.html'))
|
| + self.failUnlessEqual(resources, source_resources)
|
| + tmp_dir.CleanUp()
|
| +
|
| def testInlineCSSLinks(self):
|
| '''Tests that only CSS files referenced via relative URLs are inlined.'''
|
|
|
|
|