Index: third_party/WebKit/LayoutTests/svg/dom/transform-parser.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/transform-parser.html b/third_party/WebKit/LayoutTests/svg/dom/transform-parser.html |
index fbc3ddfed4ea3bfa29500cab7c3ea6a01f275dbb..cc3541ae99cd4ac882f4de3a501c5a88c83bcc98 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/transform-parser.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/transform-parser.html |
@@ -1,97 +1,8 @@ |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
+<!DOCTYPE html> |
+<title>Transform parser fuzzer (matrix, rotate, scale)</title> |
<script src="resources/scripted-random.js"></script> |
-</head> |
-<body> |
-<p id="description"></p> |
-<div id="console"></div> |
+<script src="resources/transform-parser-fuzzer.js"></script> |
<script> |
- description("This test fuzzes the transform parser with semi-random attribute values and dumps the results of any values that parse successfully."); |
- |
- var transforms = { // maps a transform name to its minimum argument count |
- matrix: 6, |
- rotate: 1, |
- scale: 1, |
- skewX: 1, |
- skewY: 1, |
- translate: 1 |
- }; |
- |
- var characters = [ |
- "0", |
- "1", |
- "2", |
- "3", |
- "4", |
- "5", |
- "6", |
- "7", |
- "8", |
- "9", |
- ".", |
- "e", |
- "+", |
- "-", |
- "e", |
- "(", |
- ")", |
- " ", |
- "\t", |
- "," |
- ]; |
- |
- var gElement = document.createElementNS("http://www.w3.org/2000/svg", "g"); |
- function parseTransform(string) |
- { |
- gElement.setAttributeNS(null, "transform", string); |
- |
- var transformList = gElement.transform.baseVal; |
- if (!transformList.numberOfItems) |
- return; |
- |
- debug("Parsed as " + transformList.numberOfItems + " transform(s): " + string); |
- } |
- |
- function fuzz() |
- { |
- for (var transform in transforms) { |
- |
- // Too few / too many arguments |
- for (var i = 0; i < 50; i++) { //> |
- var transformString = transform + "("; |
- for (var j = 0; j < i; j++) { //> |
- transformString += "0"; |
- if (j < i - 1) //> |
- transformString += ","; |
- } |
- transformString += ")"; |
- parseTransform(transformString); |
- } |
- |
- // Random assortments of valid characters |
- for (var i = 0; i < 100; i++) { //> |
- var transformString = transform + "("; |
- var count = Math.scriptedRandomInt(20); |
- for (var j = 0; j < count; j++) { //> |
- transformString += characters[Math.scriptedRandomInt(characters.length)]; |
- } |
- parseTransform(transformString); |
- } |
- |
- // Transform names that are "off by one" |
- var extraChar = transform.charAt(transform.length - 1); |
- parseTransform(transform + extraChar + "(0, 0)"); |
- parseTransform(transform.substring(0, transform.length - 1) + "(0, 0)"); |
- |
- // Empty-ish transforms |
- parseTransform(transform); |
- parseTransform(transform + String.fromCharCode(0)); |
- parseTransform(transform + "(" + String.fromCharCode(0) + ")"); |
- } |
- } |
- |
- fuzz(); |
- |
+fuzzTransforms({ matrix: 6, rotate: 1, scale: 1 }); |
</script> |
-</html> |
+<p>DONE</p> |