Bug 1328509 - Check failure patterns in assertSnapshots. r=xidorn
Several mochitests call `assertSnapshots`, which prints a reftest-like output
for use with the reftest analyzer. Update these lines to check failure patterns
before printing, like the regular assertion methods do.
MozReview-Commit-ID: CfChoar7bp8
--- a/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
+++ b/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
@@ -57,20 +57,24 @@ function compareSnapshots(s1, s2, expect
}
function assertSnapshots(s1, s2, expectEqual, fuzz, s1name, s2name) {
var [passed, s1DataURI, s2DataURI, numDifferentPixels, maxDifference] =
compareSnapshots(s1, s2, expectEqual, fuzz);
var sym = expectEqual ? "==" : "!=";
ok(passed, "reftest comparison: " + sym + " " + s1name + " " + s2name);
if (!passed) {
+ let status = "TEST-UNEXPECTED-FAIL";
+ if (usesFailurePatterns() && recordIfMatchesFailurePattern(s1name)) {
+ status = "TEST-KNOWN-FAIL";
+ }
// The language / format in this message should match the failure messages
// displayed by reftest.js's "RecordResult()" method so that log output
// can be parsed by reftest-analyzer.xhtml
- var report = "REFTEST TEST-UNEXPECTED-FAIL | " + s1name +
+ var report = "REFTEST " + status + " | " + s1name +
" | image comparison (" + sym + "), max difference: " +
maxDifference + ", number of differing pixels: " +
numDifferentPixels + "\n";
if (expectEqual) {
report += "REFTEST IMAGE 1 (TEST): " + s1DataURI + "\n";
report += "REFTEST IMAGE 2 (REFERENCE): " + s2DataURI + "\n";
} else {
report += "REFTEST IMAGE: " + s1DataURI + "\n";