| Index: grit/format/html_inline_unittest.py
|
| diff --git a/grit/format/html_inline_unittest.py b/grit/format/html_inline_unittest.py
|
| index 57efc4e21574dec8ae0955dcfa8f44b09bd70bd7..493ffc103651bc80fd6b3b79776a285859aab7cb 100755
|
| --- a/grit/format/html_inline_unittest.py
|
| +++ b/grit/format/html_inline_unittest.py
|
| @@ -91,25 +91,25 @@ class HtmlInlineUnittest(unittest.TestCase):
|
| 'index.html': '''
|
| <html>
|
| <head>
|
| - <link rel="stylesheet" href="test.css">
|
| + <link rel="stylesheet" href="css/test.css">
|
| </head>
|
| </html>
|
| ''',
|
|
|
| - 'test.css': '''
|
| - @import url('test2.css')
|
| + 'css/test.css': '''
|
| + @import url('test2.css');
|
| blink {
|
| display: none;
|
| }
|
| ''',
|
|
|
| - 'test2.css': '''
|
| + 'css/test2.css': '''
|
| .image {
|
| - background: url('test.png');
|
| + background: url('../images/test.png');
|
| }
|
| '''.strip(),
|
|
|
| - 'test.png': 'PNG DATA'
|
| + 'images/test.png': 'PNG DATA'
|
| }
|
|
|
| expected_inlined = '''
|
| @@ -140,6 +140,52 @@ class HtmlInlineUnittest(unittest.TestCase):
|
|
|
| tmp_dir.CleanUp()
|
|
|
| + def testInlineCSSLinks(self):
|
| + '''Tests that only CSS files referenced via relative URLs are inlined.'''
|
| +
|
| + files = {
|
| + 'index.html': '''
|
| + <html>
|
| + <head>
|
| + <link rel="stylesheet" href="foo.css">
|
| + <link rel="stylesheet" href="chrome://resources/bar.css">
|
| + </head>
|
| + </html>
|
| + ''',
|
| +
|
| + 'foo.css': '''
|
| + @import url(chrome://resources/blurp.css);
|
| + blink {
|
| + display: none;
|
| + }
|
| + ''',
|
| + }
|
| +
|
| + expected_inlined = '''
|
| + <html>
|
| + <head>
|
| + <style>
|
| + @import url(chrome://resources/blurp.css);
|
| + blink {
|
| + display: none;
|
| + }
|
| + </style>
|
| + <link rel="stylesheet" href="chrome://resources/bar.css">
|
| + </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, result.inlined_data)
|
| +
|
|
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|