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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/computedstyle/background-image.html

Issue 2872103003: [Typed CSSOM] Add computed background-image test (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698