Index: grit/format/html_inline_unittest.py |
diff --git a/grit/format/html_inline_unittest.py b/grit/format/html_inline_unittest.py |
index 45840f2e75ce234398a7dcbecf9307f4aeb7fde4..96d87502768736a98760d784da97fc7537fc6e47 100755 |
--- a/grit/format/html_inline_unittest.py |
+++ b/grit/format/html_inline_unittest.py |
@@ -262,6 +262,67 @@ class HtmlInlineUnittest(unittest.TestCase): |
resources.add(tmp_dir.GetPath('index.html')) |
self.failUnlessEqual(resources, source_resources) |
+ def testWithCloseTags(self): |
+ '''Tests that close tags are removed.''' |
+ |
+ files = { |
+ 'index.html': ''' |
+ <html> |
+ <head> |
+ <link rel="stylesheet" href="style1.css"></link> |
+ <link rel="stylesheet" href="style2.css"> |
+ </link> |
+ <link rel="stylesheet" href="style2.css" |
+ > |
+ </link> |
+ <script src="script1.js"></script> |
+ </head> |
+ <include src="tmpl1.html"></include> |
+ <include src="tmpl2.html"> |
+ </include> |
+ <include src="tmpl2.html" |
+ > |
+ </include> |
+ <img src="img1.png"> |
+ </html> |
+ ''', |
+ 'style1.css': '''h1 {}''', |
+ 'style2.css': '''h2 {}''', |
+ 'tmpl1.html': '''<h1></h1>''', |
+ 'tmpl2.html': '''<h2></h2>''', |
+ 'script1.js': '''console.log('hello');''', |
+ 'img1.png': '''abc''', |
+ } |
+ |
+ expected_inlined = ''' |
+ <html> |
+ <head> |
+ <style>h1 {}</style> |
+ <style>h2 {}</style> |
+ <style>h2 {}</style> |
+ <script>console.log('hello');</script> |
+ </head> |
+ <h1></h1> |
+ <h2></h2> |
+ <h2></h2> |
+ <img src="data:image/png;base64,YWJj"> |
+ </html> |
+ ''' |
+ |
+ source_resources = set() |
+ tmp_dir = util.TempDir(files) |
+ for filename in files: |
+ source_resources.add(tmp_dir.GetPath(filename)) |
+ |
+ # Test normal inlining. |
+ 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')) |
if __name__ == '__main__': |
unittest.main() |