Bug 1563358 - Report pixel differences as part of message in wpt reftests, r=maja_zf

Instead of reporting the pixel differences in a logger info message,
put it in the text that's returned to the harness. This has a notable
advantage on android where this will cause it to be logged as part of
the harness logs rather than ending up in the logcat from the
device. It also makes these messages more accessible in other
consumers of the logs e.g. wpt.fyi.

Differential Revision: https://phabricator.services.mozilla.com/D40064

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Graham 2019-08-01 09:26:37 +00:00
Родитель 31f729e8c4
Коммит a445961de2
1 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -324,11 +324,20 @@ max-width: ${width}px; max-height: ${height}px`;
extras
);
} catch (e) {
comparison = { lhs: null, rhs: null, passed: false, error: e };
comparison = {
lhs: null,
rhs: null,
passed: false,
error: e,
msg: null,
};
}
if (comparison.msg) {
result.message += `${comparison.msg}\n`;
}
if (comparison.error !== null) {
result.status = STATUS.ERROR;
result.message = String(comparison.error);
result.message += String(comparison.error);
result.stack = comparison.error.stack;
}
@ -412,6 +421,7 @@ max-width: ${width}px; max-height: ${height}px`;
let error = null;
let pixelsDifferent = null;
let maxDifferences = {};
let msg = null;
try {
pixelsDifferent = this.windowUtils.compareCanvases(
@ -433,10 +443,9 @@ max-width: ${width}px; max-height: ${height}px`;
switch (relation) {
case "==":
if (!passed) {
logger.info(
msg =
`Found ${pixelsDifferent} pixels different, ` +
`maximum difference per channel ${maxDifferences.value}`
);
`maximum difference per channel ${maxDifferences.value}`;
}
break;
case "!=":
@ -448,7 +457,7 @@ max-width: ${width}px; max-height: ${height}px`;
);
}
}
return { lhs, rhs, passed, error };
return { lhs, rhs, passed, error, msg };
}
isAcceptableDifference(maxDifference, pixelsDifferent, allowed) {