Index: third_party/WebKit/LayoutTests/svg/dom/fuzz-path-parser.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/fuzz-path-parser.html b/third_party/WebKit/LayoutTests/svg/dom/fuzz-path-parser.html |
deleted file mode 100644 |
index a36841617310762f7b952b6123c883f35031fac8..0000000000000000000000000000000000000000 |
--- a/third_party/WebKit/LayoutTests/svg/dom/fuzz-path-parser.html |
+++ /dev/null |
@@ -1,91 +0,0 @@ |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
-<script src="resources/scripted-random.js"></script> |
-</head> |
-<body> |
-<p id="description"></p> |
-<div id="console"></div> |
-<script> |
- description("This test fuzzes the path parser with semi-random attribute values and dumps the results."); |
- |
- var characters = [ |
- [ "m", 2 ], // maps a character to the number of arguments it requires |
- [ "M", 2 ], |
- [ "l", 2 ], |
- [ "L", 2 ], |
- [ "h", 1 ], |
- [ "H", 1 ], |
- [ "v", 1 ], |
- [ "V", 1 ], |
- [ "z", 0 ], |
- [ "Z", 0 ], |
- [ "c", 6 ], |
- [ "C", 6 ], |
- [ "s", 4 ], |
- [ "S", 4 ], |
- [ "q", 4 ], |
- [ "Q", 4 ], |
- [ "t", 2 ], |
- [ "T", 2 ], |
- [ "a", 7 ], |
- [ "A", 7 ] |
- ]; |
- |
- var separators = [ |
- " ", |
- "," |
- ]; |
- |
- var pathElement = document.createElementNS("http://www.w3.org/2000/svg", "path"); |
- function parsePath(string) |
- { |
- pathElement.setAttributeNS(null, "d", string); |
- |
- var pathSegList = pathElement.pathSegList; |
- var numberOfItems = pathSegList.numberOfItems; |
- |
- if (!numberOfItems) { |
- debug("Could not parse: " + string); |
- return; |
- } |
- |
- var pathCommands = ""; |
- for (var i = 0; i < numberOfItems; i++) { //> |
- pathCommands += pathSegList.getItem(i).pathSegTypeAsLetter; |
- } |
- debug("Parsed as " + numberOfItems + " command(s) [" + pathCommands + "]: " + string); |
- } |
- |
- function fuzz() |
- { |
- // Random assortments of valid characters with semi-valid argument counts |
- for (var i = 0; i < 250; i++) { //> |
- var pathString = "M1,1"; // path must start with moveto |
- |
- var numPathCommands = Math.scriptedRandomInt(20); |
- for (var j = 0; j < numPathCommands; j++) { //> |
- var characterIndex = Math.scriptedRandomInt(characters.length); |
- pathString += characters[characterIndex][0]; |
- |
- var numArguments; |
- var argumentRandomizer = Math.scriptedRandomInt(10); |
- if (argumentRandomizer < 8) //> |
- numArguments = characters[characterIndex][1]; |
- else if (argumentRandomizer < 9) //> |
- numArguments = characters[characterIndex][1] + 1; |
- else |
- numArguments = Math.max(characters[characterIndex][1] - 1, 0); |
- |
- for (var k = 0; k < numArguments; k++) { //> |
- pathString += String(Math.scriptedRandomInt(10)); |
- pathString += separators[Math.scriptedRandomInt(separators.length)]; |
- } |
- } |
- parsePath(pathString); |
- } |
- } |
- fuzz(); |
- |
-</script> |
-</html> |