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.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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 </head> | 258 </head> |
259 <body> | 259 <body> |
260 <!-- Don't need a body. --> | 260 <!-- Don't need a body. --> |
261 </body> | 261 </body> |
262 </html> | 262 </html> |
263 ''', | 263 ''', |
264 | 264 |
265 'test.css': ''' | 265 'test.css': ''' |
266 .image { | 266 .image { |
267 background: url('chrome://theme/IDR_RESOURCE_NAME'); | 267 background: url('chrome://theme/IDR_RESOURCE_NAME'); |
| 268 content: url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q?$1'); |
268 } | 269 } |
269 ''', | 270 ''', |
270 }) | 271 }) |
271 | 272 |
272 html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html')) | 273 html = chrome_html.ChromeHtml(tmp_dir.GetPath('index.html')) |
273 html.SetDefines({'scale_factors': '2x'}) | 274 html.SetDefines({'scale_factors': '2x'}) |
274 html.SetAttributes({'flattenhtml': 'true'}) | 275 html.SetAttributes({'flattenhtml': 'true'}) |
275 html.Parse() | 276 html.Parse() |
276 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), | 277 self.failUnlessEqual(StandardizeHtml(html.GetData('en', 'utf-8')), |
277 StandardizeHtml(''' | 278 StandardizeHtml(''' |
278 <!DOCTYPE HTML> | 279 <!DOCTYPE HTML> |
279 <html> | 280 <html> |
280 <head> | 281 <head> |
281 <style> | 282 <style> |
282 .image { | 283 .image { |
283 background: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME') 1x
, url('chrome://theme/IDR_RESOURCE_NAME@2x') 2x); | 284 background: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME') 1x
, url('chrome://theme/IDR_RESOURCE_NAME@2x') 2x); |
| 285 content: -webkit-image-set(url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q?
$1') 1x, url('chrome://theme/IDR_RESOURCE_NAME_WITH_Q@2x?$1') 2x); |
284 } | 286 } |
285 </style> | 287 </style> |
286 </head> | 288 </head> |
287 <body> | 289 <body> |
288 <!-- Don't need a body. --> | 290 <!-- Don't need a body. --> |
289 </body> | 291 </body> |
290 </html> | 292 </html> |
291 ''')) | 293 ''')) |
292 tmp_dir.CleanUp() | 294 tmp_dir.CleanUp() |
293 | 295 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 <body> | 399 <body> |
398 <!-- Don't need a body. --> | 400 <!-- Don't need a body. --> |
399 </body> | 401 </body> |
400 </html> | 402 </html> |
401 ''')) | 403 ''')) |
402 tmp_dir.CleanUp() | 404 tmp_dir.CleanUp() |
403 | 405 |
404 | 406 |
405 if __name__ == '__main__': | 407 if __name__ == '__main__': |
406 unittest.main() | 408 unittest.main() |
OLD | NEW |