Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (window.testRunner) | 1 if (window.testRunner) |
| 2 testRunner.dumpAsText(); | 2 testRunner.dumpAsText(); |
| 3 | 3 |
| 4 (function() { | 4 (function() { |
| 5 | 5 |
| 6 function insertAfter(nodeToAdd, referenceNode) | 6 function insertAfter(nodeToAdd, referenceNode) |
| 7 { | 7 { |
| 8 if (referenceNode == document.body) { | 8 if (referenceNode == document.body) { |
| 9 document.body.appendChild(nodeToAdd); | 9 document.body.appendChild(nodeToAdd); |
| 10 return; | 10 return; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 var result = node.getAttribute && node.getAttribute(attribute); | 30 var result = node.getAttribute && node.getAttribute(attribute); |
| 31 output.checked |= !!result; | 31 output.checked |= !!result; |
| 32 return result; | 32 return result; |
| 33 } | 33 } |
| 34 | 34 |
| 35 function checkExpectedValues(node, failures) | 35 function checkExpectedValues(node, failures) |
| 36 { | 36 { |
| 37 var output = { checked: false }; | 37 var output = { checked: false }; |
| 38 var expectedWidth = checkAttribute(output, node, "data-expected-width"); | 38 var expectedWidth = checkAttribute(output, node, "data-expected-width"); |
| 39 if (expectedWidth) { | 39 if (expectedWidth) { |
| 40 if (Math.abs(node.offsetWidth - expectedWidth) >= 1) | 40 if (isNaN(expectedWidth) || Math.abs(node.offsetWidth - expectedWidth) > = 1) |
| 41 failures.push("Expected " + expectedWidth + " for width, but got " + node.offsetWidth + ". "); | 41 failures.push("Expected " + expectedWidth + " for width, but got " + node.offsetWidth + ". "); |
| 42 } | 42 } |
| 43 | 43 |
| 44 var expectedHeight = checkAttribute(output, node, "data-expected-height"); | 44 var expectedHeight = checkAttribute(output, node, "data-expected-height"); |
| 45 if (expectedHeight) { | 45 if (expectedHeight) { |
| 46 if (Math.abs(node.offsetHeight - expectedHeight) >= 1) | 46 if (isNaN(expectedHeight) || Math.abs(node.offsetHeight - expectedHeight ) >= 1) |
| 47 failures.push("Expected " + expectedHeight + " for height, but got " + node.offsetHeight + ". "); | 47 failures.push("Expected " + expectedHeight + " for height, but got " + node.offsetHeight + ". "); |
| 48 } | 48 } |
| 49 | 49 |
| 50 var expectedOffset = checkAttribute(output, node, "data-offset-x"); | 50 var expectedOffset = checkAttribute(output, node, "data-offset-x"); |
| 51 if (expectedOffset) { | 51 if (expectedOffset) { |
| 52 if (Math.abs(node.offsetLeft - expectedOffset) >= 1) | 52 if (isNaN(expectedOffset) || Math.abs(node.offsetLeft - expectedOffset) >= 1) |
| 53 failures.push("Expected " + expectedOffset + " for offsetLeft, but g ot " + node.offsetLeft + ". "); | 53 failures.push("Expected " + expectedOffset + " for offsetLeft, but g ot " + node.offsetLeft + ". "); |
| 54 } | 54 } |
| 55 | 55 |
| 56 var expectedOffset = checkAttribute(output, node, "data-offset-y"); | 56 var expectedOffset = checkAttribute(output, node, "data-offset-y"); |
| 57 if (expectedOffset) { | 57 if (expectedOffset) { |
| 58 if (Math.abs(node.offsetTop - expectedOffset) >= 1) | 58 if (isNaN(expectedOffset) || Math.abs(node.offsetTop - expectedOffset) > = 1) |
| 59 failures.push("Expected " + expectedOffset + " for offsetTop, but go t " + node.offsetTop + ". "); | 59 failures.push("Expected " + expectedOffset + " for offsetTop, but go t " + node.offsetTop + ". "); |
| 60 } | 60 } |
| 61 | 61 |
| 62 var expectedWidth = checkAttribute(output, node, "data-expected-client-width "); | 62 var expectedWidth = checkAttribute(output, node, "data-expected-client-width "); |
| 63 if (expectedWidth) { | 63 if (expectedWidth) { |
| 64 if (Math.abs(node.clientWidth - expectedWidth) >= 1) | 64 if (isNaN(expectedWidth) || Math.abs(node.clientWidth - expectedWidth) > = 1) |
| 65 failures.push("Expected " + expectedWidth + " for clientWidth, but g ot " + node.clientWidth + ". "); | 65 failures.push("Expected " + expectedWidth + " for clientWidth, but g ot " + node.clientWidth + ". "); |
| 66 } | 66 } |
| 67 | 67 |
| 68 var expectedHeight = checkAttribute(output, node, "data-expected-client-heig ht"); | 68 var expectedHeight = checkAttribute(output, node, "data-expected-client-heig ht"); |
| 69 if (expectedHeight) { | 69 if (expectedHeight) { |
| 70 if (Math.abs(node.clientHeight - expectedHeight) >= 1) | 70 if (isNaN(expectedHeight) || Math.abs(node.clientHeight - expectedHeight ) >= 1) |
| 71 failures.push("Expected " + expectedHeight + " for clientHeight, but got " + node.clientHeight + ". "); | 71 failures.push("Expected " + expectedHeight + " for clientHeight, but got " + node.clientHeight + ". "); |
| 72 } | 72 } |
| 73 | 73 |
| 74 var expectedWidth = checkAttribute(output, node, "data-expected-scroll-width "); | 74 var expectedWidth = checkAttribute(output, node, "data-expected-scroll-width "); |
| 75 if (expectedWidth) { | 75 if (expectedWidth) { |
| 76 if (Math.abs(node.scrollWidth - expectedWidth) >= 1) | 76 if (isNaN(expectedWidth) || Math.abs(node.scrollWidth - expectedWidth) > = 1) |
| 77 failures.push("Expected " + expectedWidth + " for scrollWidth, but g ot " + node.scrollWidth + ". "); | 77 failures.push("Expected " + expectedWidth + " for scrollWidth, but g ot " + node.scrollWidth + ". "); |
| 78 } | 78 } |
| 79 | 79 |
| 80 var expectedHeight = checkAttribute(output, node, "data-expected-scroll-heig ht"); | 80 var expectedHeight = checkAttribute(output, node, "data-expected-scroll-heig ht"); |
| 81 if (expectedHeight) { | 81 if (expectedHeight) { |
| 82 if (Math.abs(node.scrollHeight - expectedHeight) >= 1) | 82 if (isNaN(expectedHeight) || Math.abs(node.scrollHeight - expectedHeight ) >= 1) |
| 83 failures.push("Expected " + expectedHeight + " for scrollHeight, but got " + node.scrollHeight + ". "); | 83 failures.push("Expected " + expectedHeight + " for scrollHeight, but got " + node.scrollHeight + ". "); |
| 84 } | 84 } |
| 85 | 85 |
| 86 var expectedOffset = checkAttribute(output, node, "data-total-x"); | 86 var expectedOffset = checkAttribute(output, node, "data-total-x"); |
| 87 if (expectedOffset) { | 87 if (expectedOffset) { |
| 88 var totalLeft = node.clientLeft + node.offsetLeft; | 88 var totalLeft = node.clientLeft + node.offsetLeft; |
| 89 if (Math.abs(totalLeft - expectedOffset) >= 1) | 89 if (isNaN(expectedOffset) || Math.abs(totalLeft - expectedOffset) >= 1) |
| 90 failures.push("Expected " + expectedOffset + " for clientLeft+offset Left, but got " + totalLeft + ", clientLeft: " + node.clientLeft + ", offsetLeft : " + node.offsetLeft + ". "); | 90 failures.push("Expected " + expectedOffset + " for clientLeft+offset Left, but got " + totalLeft + ", clientLeft: " + node.clientLeft + ", offsetLeft : " + node.offsetLeft + ". "); |
| 91 } | 91 } |
| 92 | 92 |
| 93 var expectedOffset = checkAttribute(output, node, "data-total-y"); | 93 var expectedOffset = checkAttribute(output, node, "data-total-y"); |
| 94 if (expectedOffset) { | 94 if (expectedOffset) { |
| 95 var totalTop = node.clientTop + node.offsetTop; | 95 var totalTop = node.clientTop + node.offsetTop; |
| 96 if (Math.abs(totalTop - expectedOffset) >= 1) | 96 if (isNaN(expectedOffset) || Math.abs(totalTop - expectedOffset) >= 1) |
| 97 failures.push("Expected " + expectedOffset + " for clientTop+offsetT op, but got " + totalTop + ", clientTop: " + node.clientTop + ", + offsetTop: " + node.offsetTop + ". "); | 97 failures.push("Expected " + expectedOffset + " for clientTop+offsetT op, but got " + totalTop + ", clientTop: " + node.clientTop + ", + offsetTop: " + node.offsetTop + ". "); |
| 98 } | 98 } |
|
Julien - ping for review
2015/02/03 02:42:53
Should we have testing for that in the harness? (I
| |
| 99 | 99 |
| 100 var expectedDisplay = checkAttribute(output, node, "data-expected-display"); | 100 var expectedDisplay = checkAttribute(output, node, "data-expected-display"); |
| 101 if (expectedDisplay) { | 101 if (expectedDisplay) { |
| 102 var actualDisplay = getComputedStyle(node).display; | 102 var actualDisplay = getComputedStyle(node).display; |
| 103 if (actualDisplay != expectedDisplay) | 103 if (actualDisplay != expectedDisplay) |
| 104 failures.push("Expected " + expectedDisplay + " for display, but got " + actualDisplay + ". "); | 104 failures.push("Expected " + expectedDisplay + " for display, but got " + actualDisplay + ". "); |
| 105 } | 105 } |
| 106 | 106 |
| 107 var expectedPaddingTop = checkAttribute(output, node, "data-expected-padding -top"); | 107 var expectedPaddingTop = checkAttribute(output, node, "data-expected-padding -top"); |
| 108 if (expectedPaddingTop) { | 108 if (expectedPaddingTop) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 var pre = document.querySelector('.FAIL'); | 223 var pre = document.querySelector('.FAIL'); |
| 224 if (pre) | 224 if (pre) |
| 225 setTimeout(function() { pre.previousSibling.scrollIntoView(); }, 0); | 225 setTimeout(function() { pre.previousSibling.scrollIntoView(); }, 0); |
| 226 return result; | 226 return result; |
| 227 } | 227 } |
| 228 | 228 |
| 229 })(); | 229 })(); |
| OLD | NEW |