Chromium Code Reviews| Index: LayoutTests/fast/css/css-imagevalue-url.html |
| diff --git a/LayoutTests/fast/css/css-imagevalue-url.html b/LayoutTests/fast/css/css-imagevalue-url.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f55788508834d44c4e284dc15b4136be1df4def8 |
| --- /dev/null |
| +++ b/LayoutTests/fast/css/css-imagevalue-url.html |
| @@ -0,0 +1,39 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| + |
| +<style> |
| +div { background-image: url(images.jpg); } |
| +</style> |
| + |
| +<body> |
| +</body> |
| + |
| +<script> |
| + var rulesForCssText = function (styleContent) { |
|
alancutter (OOO until 2018)
2015/09/18 02:55:09
No space after function.
nainar
2015/09/18 03:47:24
Done.
|
| + var doc = document.implementation.createHTMLDocument(""), |
| + styleElement = document.createElement("style"); |
|
alancutter (OOO until 2018)
2015/09/18 02:55:09
Use separate var statements.
nainar
2015/09/18 03:47:25
Done.
|
| + |
| + styleElement.textContent = styleContent; |
| + // the style will only parsed once it is added to a document |
|
alancutter (OOO until 2018)
2015/09/18 02:55:09
No need for comment.
nainar
2015/09/18 03:47:24
Done.
|
| + doc.body.appendChild(styleElement); |
| + |
| + return styleElement.sheet.cssRules; |
| + }; |
| + |
| + var cssRulesToText = function (cssRules) { |
| + var cssText = ""; |
| + Array.prototype.slice.call(cssRules).forEach(function (rule) { |
| + cssText += rule.cssText; |
| + }); |
| + return cssText; |
| + }; |
| + |
| + addEventListener("load", function() { |
| + test(function() { |
| + var styles = document.getElementsByTagName("style"), |
| + cssText = styles[styles.length-1].textContent.trim(); |
| + assert_equals(cssRulesToText(rulesForCssText(cssText)), cssText); |
|
alancutter (OOO until 2018)
2015/09/18 02:55:09
No need for the helper functions if they're only d
nainar
2015/09/18 03:47:24
Done.
Done.
|
| + }, 'Testing URLs in CSS'); |
|
alancutter (OOO until 2018)
2015/09/18 02:55:09
This is very vague, you're actually testing serial
nainar
2015/09/18 03:47:24
Done.
|
| + }, false); |
| +</script> |