Commit 6d24770c authored by Gavin Williams's avatar Gavin Williams Committed by Chromium LUCI CQ

printing: Check printer status severity for print jobs

Only recognize printer reasons with ERROR and WARNING severity as print
job errors.

Do not treat "low on supplies" reasons as print job errors as the print
job can still succeed.

Bug: 1027400
Change-Id: Iac0a00dd76be17219c10d0605218beb4970c9028
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640925Reviewed-by: default avatarSean Kau <skau@chromium.org>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846339}
parent 1cb19180
......@@ -58,21 +58,21 @@ using PrinterReason = ::printing::PrinterStatus::PrinterReason;
PrinterErrorCode PrinterErrorCodeFromPrinterStatusReasons(
const ::printing::PrinterStatus& printer_status) {
for (const auto& reason : printer_status.reasons) {
if (reason.severity != PrinterReason::Severity::kError &&
reason.severity != PrinterReason::Severity::kWarning) {
continue;
}
switch (reason.reason) {
case PrinterReason::Reason::kMediaEmpty:
case PrinterReason::Reason::kMediaNeeded:
case PrinterReason::Reason::kMediaLow:
return PrinterErrorCode::OUT_OF_PAPER;
case PrinterReason::Reason::kMediaJam:
return PrinterErrorCode::PAPER_JAM;
case PrinterReason::Reason::kTonerEmpty:
case PrinterReason::Reason::kTonerLow:
case PrinterReason::Reason::kDeveloperEmpty:
case PrinterReason::Reason::kDeveloperLow:
case PrinterReason::Reason::kMarkerSupplyEmpty:
case PrinterReason::Reason::kMarkerSupplyLow:
case PrinterReason::Reason::kMarkerWasteFull:
case PrinterReason::Reason::kMarkerWasteAlmostFull:
return PrinterErrorCode::OUT_OF_INK;
case PrinterReason::Reason::kTimedOut:
case PrinterReason::Reason::kShutdown:
......@@ -92,6 +92,11 @@ PrinterErrorCode PrinterErrorCodeFromPrinterStatusReasons(
case PrinterReason::Reason::kPaused:
case PrinterReason::Reason::kMovingToPaused:
return PrinterErrorCode::STOPPED;
case PrinterReason::Reason::kMediaLow:
case PrinterReason::Reason::kTonerLow:
case PrinterReason::Reason::kDeveloperLow:
case PrinterReason::Reason::kMarkerSupplyLow:
case PrinterReason::Reason::kMarkerWasteAlmostFull:
default:
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment