Index: third_party/WebKit/LayoutTests/typedcssom/computedstyle/background-image.html |
diff --git a/third_party/WebKit/LayoutTests/typedcssom/computedstyle/background-image.html b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/background-image.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a21b5a069ad89ef95f33f396cd2422083524c9cb |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/background-image.html |
@@ -0,0 +1,52 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src='../../resources/testharness.js'></script> |
+<script src='../../resources/testharnessreport.js'></script> |
+</head> |
+<body> |
+<div id='testElement'></div> |
+<style> |
+#testElement { |
+ background-image: url("resources/1x1-green.png"); |
+} |
+</style> |
+<script> |
+var locationPath = location.href.substring(0, location.href.lastIndexOf('/')); |
+var imagePath = locationPath + '/resources/1x1-green.png'; |
+ |
+var computedStyleMap = getComputedStyleMap(testElement); |
+ |
+function checks() { |
+ var result = computedStyleMap.get('background-image'); |
+ assert_true(result instanceof CSSURLImageValue); |
+ assert_equals(result.cssText, 'url(\"' + imagePath + '\")'); |
+ assert_equals(result.state, 'loaded'); |
+ assert_equals(result.intrinsicWidth, 1); |
+ assert_equals(result.intrinsicHeight, 1); |
+ assert_equals(result.intrinsicRatio, 1); |
+} |
+ |
+var t1 = async_test('Getting a background-image with a relative URL image value returns a CSSURLImageValue'); |
+function t1Callback() { |
+ t1.step(checks); |
+ t1.done(); |
+} |
+ |
+var t2 = async_test('Getting a background-image with a URL image value returns a CSSURLImageValue'); |
+function t2Callback() { |
+ testElement.style.backgroundImage = 'url(\"' + imagePath + '\")'; |
+ t2.step(checks); |
+ t2.done(); |
+} |
+ |
+document.onreadystatechange = function() { |
+ if(document.readyState == 'complete') { |
+ t1Callback(); |
+ t2Callback(); |
+ } |
+}; |
+ |
+</script> |
+</body> |
+</html> |