Commit a7daa5bc authored by timloh@chromium.org's avatar timloh@chromium.org

Don't require getPropertyCSSValue in fast/css tests

As getPropertyCSSValue is no longer web-exposed we shouldn't require it
in tests so we can delete the interface.

BUG=428595

Review URL: https://codereview.chromium.org/714693002

git-svn-id: svn://svn.chromium.org/blink/trunk@185111 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 696d8206
...@@ -42,8 +42,7 @@ if (window.testRunner) ...@@ -42,8 +42,7 @@ if (window.testRunner)
function test() function test()
{ {
var totalHeight = document.defaultView.getComputedStyle(document.getElementById("test"), null).getPropertyCSSValue("height"); var totalHeight = parseFloat(getComputedStyle(document.getElementById("test")).height);
totalHeight = totalHeight.getFloatValue(CSSPrimitiveValue.CSS_PX);
if (totalHeight > 150 && totalHeight < 300) if (totalHeight > 150 && totalHeight < 300)
document.getElementById("result").innerHTML = "PASS"; document.getElementById("result").innerHTML = "PASS";
else else
......
...@@ -4,89 +4,32 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,89 +4,32 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Single value for background-image : url('#a') 1x Single value for background-image : url(#a) 1x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 2
PASS subRule is 'a'
PASS subRule.cssText is '1'
Multiple values for background-image : url('#a') 1x, url('#b') 2x Multiple values for background-image : url(#a) 1x, url(#b) 2x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x, url(#b) 2x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 4
PASS subRule is 'a'
PASS subRule.cssText is '1'
PASS subRule is 'b'
PASS subRule.cssText is '2'
Multiple values for background-image, out of order : url('#c') 3x, url('#b') 2x, url('#a') 1x Multiple values for background-image, out of order : url(#c) 3x, url(#b) 2x, url(#a) 1x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#c) 3x, url(#b) 2x, url(#a) 1x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 6
PASS subRule is 'c'
PASS subRule.cssText is '3'
PASS subRule is 'b'
PASS subRule.cssText is '2'
PASS subRule is 'a'
PASS subRule.cssText is '1'
Single value for content : url('#a') 1x Single value for content : url(#a) 1x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 2
PASS subRule is 'a'
PASS subRule.cssText is '1'
Multiple values for content : url('#a') 1x, url('#b') 2x Multiple values for content : url(#a) 1x, url(#b) 2x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x, url(#b) 2x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 4
PASS subRule is 'a'
PASS subRule.cssText is '1'
PASS subRule is 'b'
PASS subRule.cssText is '2'
Single value for border-image : url('#a') 1x Single value for border-image : url(#a) 1x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 2
PASS subRule is 'a'
PASS subRule.cssText is '1'
Multiple values for border-image : url('#a') 1x, url('#b') 2x Multiple values for border-image : url(#a) 1x, url(#b) 2x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x, url(#b) 2x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 4
PASS subRule is 'a'
PASS subRule.cssText is '1'
PASS subRule is 'b'
PASS subRule.cssText is '2'
Single value for -webkit-mask-box-image-source : url('#a') 1x Single value for -webkit-mask-box-image-source : url(#a) 1x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 2
PASS subRule is 'a'
PASS subRule.cssText is '1'
Multiple values for -webkit-mask-box-image-source : url('#a') 1x, url('#b') 2x Multiple values for -webkit-mask-box-image-source : url(#a) 1x, url(#b) 2x
PASS jsWrapperClass(imageSetRule) is 'CSSValueList' PASS result is "-webkit-image-set(url(#a) 1x, url(#b) 2x)"
FAIL jsWrapperClass(imageSetRule.__proto__) should be CSSValueListPrototype. Was Object.
FAIL jsWrapperClass(imageSetRule.constructor) should be CSSValueListConstructor. Was Function.
PASS imageSetRule.length is 4
PASS subRule is 'a'
PASS subRule.cssText is '1'
PASS subRule is 'b'
PASS subRule.cssText is '2'
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -5,22 +5,22 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -5,22 +5,22 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Too many url parameters : url(#a #b) Too many url parameters : url(#a #b)
PASS cssRule is null PASS cssRule is ""
No x : url('#a') 1 No x : url('#a') 1
PASS cssRule is null PASS cssRule is ""
No comma : url('#a') 1x url('#b') 2x No comma : url('#a') 1x url('#b') 2x
PASS cssRule is null PASS cssRule is ""
Too many scale factor parameters : url('#a') 1x 2x Too many scale factor parameters : url('#a') 1x 2x
PASS cssRule is null PASS cssRule is ""
Scale factor is 0 : url('#a') 0x Scale factor is 0 : url('#a') 0x
PASS cssRule is null PASS cssRule is ""
No url function : '#a' 1x No url function : '#a' 1x
PASS cssRule is null PASS cssRule is ""
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -3,26 +3,26 @@ description("Test the parsing of the -webkit-image-set function."); ...@@ -3,26 +3,26 @@ description("Test the parsing of the -webkit-image-set function.");
// These have to be global for the test helpers to see them. // These have to be global for the test helpers to see them.
var cssRule; var cssRule;
function testInvalidImageSet(description, property, rule) function testInvalidImageSet(description, rule)
{ {
debug(""); debug("");
debug(description + " : " + rule); debug(description + " : " + rule);
var div = document.createElement("div"); var div = document.createElement("div");
div.setAttribute("style", property + ": -webkit-image-set(" + rule + ")"); div.style.backgroundImage = "-webkit-image-set(" + rule + ")";
document.body.appendChild(div); document.body.appendChild(div);
cssRule = div.style.getPropertyCSSValue(property); cssRule = div.style.backgroundImage;
shouldBe("cssRule", "null"); shouldBeEmptyString("cssRule");
document.body.removeChild(div); document.body.removeChild(div);
} }
testInvalidImageSet("Too many url parameters", "background-image", "url(#a #b)"); testInvalidImageSet("Too many url parameters", "url(#a #b)");
testInvalidImageSet("No x", "background-image", "url('#a') 1"); testInvalidImageSet("No x", "url('#a') 1");
testInvalidImageSet("No comma", "background-image", "url('#a') 1x url('#b') 2x"); testInvalidImageSet("No comma", "url('#a') 1x url('#b') 2x");
testInvalidImageSet("Too many scale factor parameters", "background-image", "url('#a') 1x 2x"); testInvalidImageSet("Too many scale factor parameters", "url('#a') 1x 2x");
testInvalidImageSet("Scale factor is 0", "background-image", "url('#a') 0x"); testInvalidImageSet("Scale factor is 0", "url('#a') 0x");
testInvalidImageSet("No url function", "background-image", "'#a' 1x"); testInvalidImageSet("No url function", "'#a' 1x");
successfullyParsed = true; successfullyParsed = true;
description("Test the parsing of the -webkit-image-set function."); description("Test the parsing of the -webkit-image-set function.");
function jsWrapperClass(node) var result;
{
if (!node)
return "[null]";
var string = Object.prototype.toString.apply(node);
return string.substr(8, string.length - 9);
}
function shouldBeType(expression, className, prototypeName, constructorName)
{
if (!prototypeName)
prototypeName = className + "Prototype";
if (!constructorName)
constructorName = className + "Constructor";
shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'");
shouldBe("jsWrapperClass(" + expression + ".__proto__)", "'" + prototypeName + "'");
shouldBe("jsWrapperClass(" + expression + ".constructor)", "'" + constructorName + "'");
}
// These have to be global for the test helpers to see them.
var imageSetRule, subRule;
function testImageSetRule(description, property, rule, expectedLength, expectedTexts) function testImageSetRule(description, property, rule, expectedTexts)
{ {
debug(""); debug("");
debug(description + " : " + rule); debug(description + " : " + rule);
var div = document.createElement("div"); var div = document.createElement("div");
div.setAttribute("style", property + ": -webkit-image-set(" + rule + ")"); rule = "-webkit-image-set(" + rule + ")";
div.style[property] = rule;
document.body.appendChild(div); document.body.appendChild(div);
result = div.style[property].replace(/url\([^#]*#/g, "url(#");
imageSetRule = div.style.getPropertyCSSValue(property); shouldBeEqualToString("result", rule);
shouldBeType("imageSetRule", "CSSValueList");
if (imageSetRule) {
if (jsWrapperClass(imageSetRule[0]) == "CSSValueList") {
// The content property returns a CSSValueList anyway, so to get to the
// imageSet CSS value list, we have to look at the first entry in the
// content value list.
imageSetRule = imageSetRule[0];
}
}
shouldBe("imageSetRule.length", "" + expectedLength); // shouldBe expects string arguments
if (imageSetRule) {
for (var i = 0; i < expectedLength; i++) {
string = imageSetRule[i];
if (i % 2 == 0) {
subRule = string.cssText.split('#')[1];
subRule = subRule.split(')')[0];
shouldBe("subRule", "'" + expectedTexts[i] + "'");
} else {
subRule = string;
shouldBe("subRule.cssText", "'" + expectedTexts[i] + "'");
}
}
}
document.body.removeChild(div); document.body.removeChild(div);
} }
testImageSetRule("Single value for background-image", testImageSetRule("Single value for background-image",
"background-image", "background-image",
"url('#a') 1x", 2, "url(#a) 1x");
["a", "1"]);
testImageSetRule("Multiple values for background-image", testImageSetRule("Multiple values for background-image",
"background-image", "background-image",
"url('#a') 1x, url('#b') 2x", 4, "url(#a) 1x, url(#b) 2x");
["a", "1", "b", "2"]);
testImageSetRule("Multiple values for background-image, out of order", testImageSetRule("Multiple values for background-image, out of order",
"background-image", "background-image",
"url('#c') 3x, url('#b') 2x, url('#a') 1x", 6, "url(#c) 3x, url(#b) 2x, url(#a) 1x");
["c", "3", "b", "2", "a", "1"]);
testImageSetRule("Single value for content", testImageSetRule("Single value for content",
"content", "content",
"url('#a') 1x", 2, "url(#a) 1x");
["a", "1"]);
testImageSetRule("Multiple values for content", testImageSetRule("Multiple values for content",
"content", "content",
"url('#a') 1x, url('#b') 2x", 4, "url(#a) 1x, url(#b) 2x");
["a", "1", "b", "2"]);
testImageSetRule("Single value for border-image", testImageSetRule("Single value for border-image",
"-webkit-border-image", "-webkit-border-image",
"url('#a') 1x", 2, "url(#a) 1x");
["a", "1"]);
testImageSetRule("Multiple values for border-image", testImageSetRule("Multiple values for border-image",
"-webkit-border-image", "-webkit-border-image",
"url('#a') 1x, url('#b') 2x", 4, "url(#a) 1x, url(#b) 2x");
["a", "1", "b", "2"]);
testImageSetRule("Single value for -webkit-mask-box-image-source", testImageSetRule("Single value for -webkit-mask-box-image-source",
"-webkit-mask-box-image-source", "-webkit-mask-box-image-source",
"url('#a') 1x", 2, "url(#a) 1x");
["a", "1"]);
testImageSetRule("Multiple values for -webkit-mask-box-image-source", testImageSetRule("Multiple values for -webkit-mask-box-image-source",
"-webkit-mask-box-image-source", "-webkit-mask-box-image-source",
"url('#a') 1x, url('#b') 2x", 4, "url(#a) 1x, url(#b) 2x");
["a", "1", "b", "2"]);
successfullyParsed = true; successfullyParsed = true;
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
for (i = 0; i < sheets.length; i++) { for (i = 0; i < sheets.length; i++) {
if (sheets[i].cssRules.length != 1 if (sheets[i].cssRules.length != 1
|| sheets[i].cssRules[0].type != CSSRule.STYLE_RULE || sheets[i].cssRules[0].type != CSSRule.STYLE_RULE
|| sheets[i].cssRules[0].style.getPropertyCSSValue("background-image") == null) { || sheets[i].cssRules[0].style.backgroundImage === "") {
return; return;
} }
} }
......
...@@ -13,7 +13,6 @@ PASS 'webkitTransform' in document.body.style is true ...@@ -13,7 +13,6 @@ PASS 'webkitTransform' in document.body.style is true
PASS 'WebkitTransform' in document.body.style is true PASS 'WebkitTransform' in document.body.style is true
PASS 'bogus-random-String' in document.body.style is false PASS 'bogus-random-String' in document.body.style is false
PASS 'cssText' in document.body.style is true PASS 'cssText' in document.body.style is true
PASS 'getPropertyCSSValue' in document.body.style is true
PASS The CSS property order is correct PASS The CSS property order is correct
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
shouldBeTrue("'WebkitTransform' in document.body.style"); shouldBeTrue("'WebkitTransform' in document.body.style");
shouldBeFalse("'bogus-random-String' in document.body.style"); shouldBeFalse("'bogus-random-String' in document.body.style");
shouldBeTrue("'cssText' in document.body.style"); shouldBeTrue("'cssText' in document.body.style");
shouldBeTrue("'getPropertyCSSValue' in document.body.style");
// Test CSS property order. // Test CSS property order.
var started; var started;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment