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

Unified Diff: LayoutTests/fast/svg/whitespace-length-invalid.html

Issue 837393003: Attempt to slim the test down for dbg trybots. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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: LayoutTests/fast/svg/whitespace-length-invalid.html
diff --git a/LayoutTests/fast/svg/whitespace-length-invalid.html b/LayoutTests/fast/svg/whitespace-length-invalid.html
index 84bf03b2b1166dbfe34d2d49b033b945f26cf327..5c58f7a9e129ff3d23b87c329846f24e95d7b209 100644
--- a/LayoutTests/fast/svg/whitespace-length-invalid.html
+++ b/LayoutTests/fast/svg/whitespace-length-invalid.html
@@ -2,15 +2,7 @@
<title>Whitespace in attribute values tests</title>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
-<script src=resources/whitespace-helper.js></script>
<svg id="testcontainer">
- <defs>
- <marker/>
- <stop/>
- <filter>
- <feTurbulence></feTurbulence>
- </filter>
- </defs>
</svg>
<div id=log></div>
<script>
@@ -23,7 +15,45 @@ var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ];
// This test was split out from whitespace-length.html because the trybots were too slow.
-testType("<length>",
+/**
+ * Tests attribute parsing and handling of whitespace in attribute values.
+ *
+ * @param type Name of the type being tested (only for test output)
+ * @param target The element that should be tested
+ * @param attribute The name of the attribute that should be tested
+ * @param expected The fallback/default value that is the expectation for invalid values
+ * @param whitespace An array of strings that are valid whitespace characters
+ * @param valid An array of strings containing valid attribute values
+ * @param invalid An array of strings containing invalid attribute values
+ * @param garbage An array of strings containing values that would make a valid value invalid when concatenated
+ * @param assert_valid_custom A function for asserting validity of a valid value, arguments passed to this function: the element and the string from valid values array
+ * @param assert_invalid_custom A function for asserting that an invalid value results in the expected default value, arguments passed to this function: the element and the expected value
+ */
+function testTypeLocal(type, target, attribute, expected, whitespace, valid, invalid, validunits, garbage, assert_valid_custom, assert_invalid_custom) {
+ whitespace.forEach(function(leading) {
+ whitespace.forEach(function(trailing) {
+ // test invalid values
+ invalid.forEach(function(value) {
+ validunits.forEach(function(unit) {
+ var valueStr = leading + value + unit + trailing;
+ var escapedValueStr = valueStr.replace(/(\r)/g, '\\r').replace(/(\n)/g, '\\n').replace(/(\t)/g, '\\t').replace(/(\f)/g, '\\f');
+ test(function() {
+ try {
+ target.setAttribute(attribute, valueStr);
+ assert_equals(target.getAttribute(attribute), valueStr);
+ assert_invalid_custom(target, expected);
+ }
+ finally {
+ target.removeAttribute(attribute);
+ }
+ }, "Test " + type + " invalid value: " + escapedValueStr);
+ });
+ });
+ });
+ });
+}
+
+testTypeLocal("<length>",
svg,
"x",
0, // expected default value
« 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