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

Side by Side Diff: grit/gather/chrome_html_unittest.py

Issue 10795081: Use ' instead of " when rewriting -webkit-image-set. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 5 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/gather/chrome_html.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.gather.chrome_html''' 6 '''Unit tests for grit.gather.chrome_html'''
7 7
8 8
9 import os 9 import os
10 import re 10 import re
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 html.SetDefines({'scale_factors': '1.4x,1.8x'}) 64 html.SetDefines({'scale_factors': '1.4x,1.8x'})
65 html.SetAttributes({'flattenhtml': 'true'}) 65 html.SetAttributes({'flattenhtml': 'true'})
66 html.Parse() 66 html.Parse()
67 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), 67 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
68 StandardizeHtml(''' 68 StandardizeHtml('''
69 <!DOCTYPE HTML> 69 <!DOCTYPE HTML>
70 <html> 70 <html>
71 <head> 71 <head>
72 <style> 72 <style>
73 .image { 73 .image {
74 background: -webkit-image-set(url("data:image/png;base64,UE5HIERBVEE=") 1x, url("data:image/png;base64,MS40eCBQTkcgREFUQQ==") 1.4x, url("data:image/png; base64,MS44eCBQTkcgREFUQQ==") 1.8x); 74 background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x, url('data:image/png;base64,MS40eCBQTkcgREFUQQ==') 1.4x, url('data:image/png; base64,MS44eCBQTkcgREFUQQ==') 1.8x);
75 } 75 }
76 </style> 76 </style>
77 </head> 77 </head>
78 <body> 78 <body>
79 <!-- Don't need a body. --> 79 <!-- Don't need a body. -->
80 </body> 80 </body>
81 </html> 81 </html>
82 ''')) 82 '''))
83 tmp_dir.CleanUp() 83 tmp_dir.CleanUp()
84 84
(...skipping 14 matching lines...) Expand all
99 '1.8x/test.png': '1.8x PNG DATA', 99 '1.8x/test.png': '1.8x PNG DATA',
100 }) 100 })
101 101
102 html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css')) 102 html = chrome_html.ChromeHtml(tmp_dir.GetPath('test.css'))
103 html.SetDefines({'scale_factors': '1.4x,1.8x'}) 103 html.SetDefines({'scale_factors': '1.4x,1.8x'})
104 html.SetAttributes({'flattenhtml': 'false'}) 104 html.SetAttributes({'flattenhtml': 'false'})
105 html.Parse() 105 html.Parse()
106 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), 106 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
107 StandardizeHtml(''' 107 StandardizeHtml('''
108 .image { 108 .image {
109 background: -webkit-image-set(url("test.png") 1x, url("1.4x/test.png") 1 .4x, url("1.8x/test.png") 1.8x); 109 background: -webkit-image-set(url('test.png') 1x, url('1.4x/test.png') 1 .4x, url('1.8x/test.png') 1.8x);
110 } 110 }
111 ''')) 111 '''))
112 tmp_dir.CleanUp() 112 tmp_dir.CleanUp()
113 113
114 def testFileResourcesNoFile(self): 114 def testFileResourcesNoFile(self):
115 '''Tests inlined image file resources without available high DPI assets.''' 115 '''Tests inlined image file resources without available high DPI assets.'''
116 116
117 tmp_dir = util.TempDir({ 117 tmp_dir = util.TempDir({
118 'index.html': ''' 118 'index.html': '''
119 <!DOCTYPE HTML> 119 <!DOCTYPE HTML>
(...skipping 20 matching lines...) Expand all
140 html.SetDefines({'scale_factors': '2x'}) 140 html.SetDefines({'scale_factors': '2x'})
141 html.SetAttributes({'flattenhtml': 'true'}) 141 html.SetAttributes({'flattenhtml': 'true'})
142 html.Parse() 142 html.Parse()
143 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), 143 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
144 StandardizeHtml(''' 144 StandardizeHtml('''
145 <!DOCTYPE HTML> 145 <!DOCTYPE HTML>
146 <html> 146 <html>
147 <head> 147 <head>
148 <style> 148 <style>
149 .image { 149 .image {
150 background: -webkit-image-set(url("data:image/png;base64,UE5HIERBVEE=") 1x); 150 background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x);
151 } 151 }
152 </style> 152 </style>
153 </head> 153 </head>
154 <body> 154 <body>
155 <!-- Don't need a body. --> 155 <!-- Don't need a body. -->
156 </body> 156 </body>
157 </html> 157 </html>
158 ''')) 158 '''))
159 tmp_dir.CleanUp() 159 tmp_dir.CleanUp()
160 160
(...skipping 24 matching lines...) Expand all
185 html.SetDefines({'scale_factors': '2x'}) 185 html.SetDefines({'scale_factors': '2x'})
186 html.SetAttributes({'flattenhtml': 'true'}) 186 html.SetAttributes({'flattenhtml': 'true'})
187 html.Parse() 187 html.Parse()
188 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), 188 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
189 StandardizeHtml(''' 189 StandardizeHtml('''
190 <!DOCTYPE HTML> 190 <!DOCTYPE HTML>
191 <html> 191 <html>
192 <head> 192 <head>
193 <style> 193 <style>
194 .image { 194 .image {
195 background: -webkit-image-set(url("chrome://theme/IDR_RESOURCE_NAME") 1x , url("chrome://theme/IDR_RESOURCE_NAME@2x") 2x); 195 background: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME') 1x , url('chrome://theme/IDR_RESOURCE_NAME@2x') 2x);
196 } 196 }
197 </style> 197 </style>
198 </head> 198 </head>
199 <body> 199 <body>
200 <!-- Don't need a body. --> 200 <!-- Don't need a body. -->
201 </body> 201 </body>
202 </html> 202 </html>
203 ''')) 203 '''))
204 tmp_dir.CleanUp() 204 tmp_dir.CleanUp()
205 205
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 html.SetDefines({'scale_factors': '1.8x'}) 238 html.SetDefines({'scale_factors': '1.8x'})
239 html.SetAttributes({'flattenhtml': 'true'}) 239 html.SetAttributes({'flattenhtml': 'true'})
240 html.Parse() 240 html.Parse()
241 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), 241 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')),
242 StandardizeHtml(''' 242 StandardizeHtml('''
243 <!DOCTYPE HTML> 243 <!DOCTYPE HTML>
244 <html> 244 <html>
245 <head> 245 <head>
246 <style> 246 <style>
247 .image { 247 .image {
248 background: -webkit-image-set(url("data:image/png;base64,UE5HIERBVEE=") 1x, 248 background: -webkit-image-set(url('data:image/png;base64,UE5HIERBVEE=') 1x,
249 url("data:image/png;base64,MS44eCBQTkcgREF UQQ==") 1.8x); 249 url('data:image/png;base64,MS44eCBQTkcgREF UQQ==') 1.8x);
250 } 250 }
251 </style> 251 </style>
252 </head> 252 </head>
253 <body> 253 <body>
254 <!-- Don't need a body. --> 254 <!-- Don't need a body. -->
255 </body> 255 </body>
256 </html> 256 </html>
257 ''')) 257 '''))
258 tmp_dir.CleanUp() 258 tmp_dir.CleanUp()
259 259
260 if __name__ == '__main__': 260 if __name__ == '__main__':
261 unittest.main() 261 unittest.main()
OLDNEW
« no previous file with comments | « grit/gather/chrome_html.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698