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

Unified Diff: LayoutTests/svg/dom/resources/viewspec-parser.js

Issue 17143003: Rewrite SVG viewspec tests to not be fuzzer tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for landing Created 7 years, 6 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
Index: LayoutTests/svg/dom/resources/viewspec-parser.js
diff --git a/LayoutTests/svg/dom/resources/viewspec-parser.js b/LayoutTests/svg/dom/resources/viewspec-parser.js
deleted file mode 100644
index c4b4c306ce86f9b059f70402f96af059c1b627f0..0000000000000000000000000000000000000000
--- a/LayoutTests/svg/dom/resources/viewspec-parser.js
+++ /dev/null
@@ -1,121 +0,0 @@
-description("This test fuzzes the transform parser with semi-random attribute values and dumps the results of any values that parse successfully.");
-
-var testsToRun;
-
-var preserveAspectRatioValues = [ "Min", "Max", "Mid" ];
-
-var characters = [
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- ".",
- "e",
- "+",
- "-",
- "e",
- "(",
- ")",
- " ", // not a valid fragment char
- "\t", // not a valid fragment char
- ","
-];
-
-function zoomAndPanToString(zoomAndPan)
-{
- if (zoomAndPan == SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY)
- return "magnify";
- if (zoomAndPan == SVGZoomAndPan.SVG_ZOOMANDPAN_DISABLE)
- return "disable";
- return "unknown";
-}
-
-function viewSpecToString(viewSpec)
-{
- if (!viewSpec)
- return undefined;
-
- var attributes = [];
- if (viewSpec.transformString)
- attributes.push("transform(" + viewSpec.transformString + ")");
- if (viewSpec.viewBoxString && viewSpec.viewBoxString != "0 0 0 0")
- attributes.push("viewBox(" + viewSpec.viewBoxString + ")");
- if (viewSpec.preserveAspectRatioString && viewSpec.preserveAspectRatioString != "xMidYMid meet")
- attributes.push("preserveAspectRatio(" + viewSpec.preserveAspectRatioString + ")");
- if (viewSpec.zoomAndPan && viewSpec.zoomAndPan != SVGZoomAndPan.SVG_ZOOMANDPAN_MAGNIFY)
- attributes.push("zoomAndPan(" + zoomAndPanToString(viewSpec.zoomAndPan) + ")");
- if (viewSpec.viewTargetString)
- attributes.push("viewTarget(" + viewSpec.viewTargetString + ")");
- if (!attributes.length)
- return "[initial view]";
- return "svgView(" + attributes.join(";") + ")";
-}
-
-var testNumber = 0;
-var testString = "[initial view]"
-
-function makeURLRelative(url)
-{
- return url.slice(url.indexOf("resources"));
-}
-
-function testFragment(string)
-{
- var oldEmbed = document.getElementById("object");
- if (oldEmbed)
- oldEmbed.parentNode.removeChild(oldEmbed);
- var embedElement = document.createElement("iframe");
- embedElement.setAttribute("id", "object");
- embedElement.setAttribute("width", "100");
- embedElement.setAttribute("height", "100");
- embedElement.setAttribute("onload", "setTimeout('continueFuzzing(event)', 0)");
- var newURL = "resources/viewspec-target.svg#" + string;
- embedElement.src = newURL;
- document.body.appendChild(embedElement);
-}
-
-function startNextTest()
-{
- testFragment(testString);
-}
-
-function continueFuzzing(event)
-{
- var embedElement = document.getElementById("object");
- if (embedElement.contentDocument) {
- debug("Loaded: " + makeURLRelative(embedElement.contentDocument.URL));
- debug("Parsed: " + viewSpecToString(embedElement.contentDocument.documentElement.currentView) + " from: " + testString + "\n");
- } else
- debug("no svgdocument");
-
- if (testNumber < testsToRun.length)
- testString = testsToRun[testNumber];
- else {
- var script = document.createElement("script");
-
- script.onload = function() {
- if (window.testRunner)
- testRunner.notifyDone();
- };
-
- script.src = "../../fast/js/resources/js-test-post.js";
- document.body.appendChild(script);
- return;
- }
- testNumber++;
-
- // this lets us out of the onload handler so we don't overrun the stack
- window.setTimeout(startNextTest, 0);
-}
-
-function startViewspecTests(tests)
-{
- testsToRun = tests;
- testFragment("");
-}
« no previous file with comments | « LayoutTests/svg/dom/resources/viewspec-aspectparams.svg ('k') | LayoutTests/svg/dom/resources/viewspec-transformparams.svg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698