Index: third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.html b/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.html |
index 53982d360d880456fab12843b024c4e97af49254..bd3db63c4f3c67d81db0d2528ea844fdf5b6806d 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGLengthList-insertItemBefore.html |
@@ -2,6 +2,7 @@ |
<title>SVGLengthList, insertItemBefore()</title> |
<script src="../../resources/testharness.js"></script> |
<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/SVGLengthList-helper.js"></script> |
<svg width="200" height="200"> |
<text x="500 1000 1500" y="50"> ABC </text> |
</svg> |
@@ -41,12 +42,7 @@ test(function() { |
// Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list. |
// Insert item 'newLength1' at the end of the list, by using a large index. |
assert_equals(list.insertItemBefore(newLength1, 1000).value, newLength1.value); |
- assert_equals(list.numberOfItems, 4); |
- assert_equals(list.getItem(0).value, 500); |
- assert_equals(list.getItem(1).value, 1000); |
- assert_equals(list.getItem(2).value, 1500); |
- assert_equals(list.getItem(3).value, 50); |
- assert_throws("IndexSizeError", function() { list.getItem(4); }); |
+ assert_list(list, [500, 1000, 1500, 50]); |
// Storing getItem(0/1/2/3) in local variables. |
var item0 = list.getItem(0); |
@@ -57,13 +53,7 @@ test(function() { |
// Spec: If the index is equal to 0, then the new item is inserted at the front of the list. |
// Insert item 'newLength2' at the front of the list, by using index=0". |
assert_equals(list.insertItemBefore(newLength2, 0).value, newLength2.value); |
- assert_equals(list.numberOfItems, 5); |
- assert_equals(list.getItem(0).value, 100); |
- assert_equals(list.getItem(1).value, 500); |
- assert_equals(list.getItem(2).value, 1000); |
- assert_equals(list.getItem(3).value, 1500); |
- assert_equals(list.getItem(4).value, 50); |
- assert_throws("IndexSizeError", function() { list.getItem(5); }); |
+ assert_list(list, [100, 500, 1000, 1500, 50]); |
// Assure that previously saved wrappers still show the old values. |
assert_equals(item0.value, 500); |
@@ -75,14 +65,7 @@ test(function() { |
// Insert item 'newLength3' at position=2, between '500' and '1000'. |
assert_equals(list.insertItemBefore(newLength3, 2).value, newLength3.value); |
- assert_equals(list.numberOfItems, 6); |
- assert_equals(list.getItem(0).value, 100); |
- assert_equals(list.getItem(1).value, 500); |
- assert_equals(list.getItem(2).value, 150); |
- assert_equals(list.getItem(3).value, 1000); |
- assert_equals(list.getItem(4).value, 1500); |
- assert_equals(list.getItem(5).value, 50); |
- assert_throws("IndexSizeError", function() { list.getItem(6); }); |
+ assert_list(list, [100, 500, 150, 1000, 1500, 50]); |
// Spec: If newItem is already in a list, then a new object is created with the same values as newItem and this item is inserted into the list. |
// Otherwise, newItem itself is inserted into the list. |
@@ -90,26 +73,10 @@ test(function() { |
// Insert item 'newLength3' at position=1, between '100' and '500', should not remove it from the old position=2 afterwards."); |
assert_equals(list.insertItemBefore(newLength3, 1).value, newLength3.value); |
assert_equals(list.numberOfItems, 7); |
- assert_equals(list.getItem(0).value, 100); |
- assert_equals(list.getItem(1).value, 150); |
- assert_equals(list.getItem(2).value, 500); |
- assert_equals(list.getItem(3).value, 150); |
- assert_equals(list.getItem(4).value, 1000); |
- assert_equals(list.getItem(5).value, 1500); |
- assert_equals(list.getItem(6).value, 50); |
- assert_throws("IndexSizeError", function() { list.getItem(7); }); |
+ assert_list(list, [100, 150, 500, 150, 1000, 1500, 50]); |
// Insert item 'newLength1' at position=0, before '100', should not remove it from the old position=6 afterwards. |
assert_equals(list.insertItemBefore(newLength1, 0).value, newLength1.value); |
- assert_equals(list.numberOfItems, 8); |
- assert_equals(list.getItem(0).value, 50); |
- assert_equals(list.getItem(1).value, 100); |
- assert_equals(list.getItem(2).value, 150); |
- assert_equals(list.getItem(3).value, 500); |
- assert_equals(list.getItem(4).value, 150); |
- assert_equals(list.getItem(5).value, 1000); |
- assert_equals(list.getItem(6).value, 1500); |
- assert_equals(list.getItem(7).value, 50); |
- assert_throws("IndexSizeError", function() { list.getItem(8); }); |
+ assert_list(list, [50, 100, 150, 500, 150, 1000, 1500, 50]); |
}); |
</script> |