OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 '''Unit tests for grit.format.html_inline''' | 6 '''Unit tests for grit.format.html_inline''' |
7 | 7 |
8 | 8 |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 source_resources = set() | 57 source_resources = set() |
58 tmp_dir = util.TempDir(files) | 58 tmp_dir = util.TempDir(files) |
59 for filename in files: | 59 for filename in files: |
60 source_resources.add(tmp_dir.GetPath(filename)) | 60 source_resources.add(tmp_dir.GetPath(filename)) |
61 | 61 |
62 resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html')) | 62 resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.html')) |
63 resources.add(tmp_dir.GetPath('index.html')) | 63 resources.add(tmp_dir.GetPath('index.html')) |
64 self.failUnlessEqual(resources, source_resources) | 64 self.failUnlessEqual(resources, source_resources) |
65 tmp_dir.CleanUp() | 65 tmp_dir.CleanUp() |
66 | 66 |
| 67 def testCompressedJavaScript(self): |
| 68 '''Tests that ".src=" doesn't treat as a tag.''' |
| 69 |
| 70 files = { |
| 71 'index.js': ''' |
| 72 if(i<j)a.src="hoge.png"; |
| 73 ''', |
| 74 } |
| 75 |
| 76 source_resources = set() |
| 77 tmp_dir = util.TempDir(files) |
| 78 for filename in files: |
| 79 source_resources.add(tmp_dir.GetPath(filename)) |
| 80 |
| 81 resources = html_inline.GetResourceFilenames(tmp_dir.GetPath('index.js')) |
| 82 resources.add(tmp_dir.GetPath('index.js')) |
| 83 self.failUnlessEqual(resources, source_resources) |
| 84 tmp_dir.CleanUp() |
| 85 |
| 86 |
67 if __name__ == '__main__': | 87 if __name__ == '__main__': |
68 unittest.main() | 88 unittest.main() |
OLD | NEW |