Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: grit/format/html_inline_unittest.py

Issue 12036024: Fix the regex flatting html to prevent misdetection (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/format/html_inline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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()
OLDNEW
« no previous file with comments | « grit/format/html_inline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698