Allow empty papers
Some Windows printer drivers respond to the query of supported capabilities with no paper sizes specified. This was found to occur with the Epson PX660 series driver. Note that the Print Preview UI is capable of dealing with no papers being provided, in that case it just doesn't show the "Paper size" setting to the user. Drop the mojom validation check for empty papers in light of this discovery. Bug: 809738, 1214139, 12141391 Change-Id: Ic31ae7532120745e296c8eb187d6fd0f81a98a9d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3035965 Reviewed-by: Alex Gough <ajgo@chromium.org> Commit-Queue: Alan Screen <awscreen@chromium.org> Cr-Commit-Position: refs/heads/master@{#902715}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4414e04e46
commit
98a96e9da6
printing/backend/mojom
@ -63,7 +63,7 @@ struct PrinterSemanticCapsAndDefaults {
|
||||
bool color_default = false;
|
||||
ColorModel color_model = kUnknownColorModel;
|
||||
ColorModel bw_model = kUnknownColorModel;
|
||||
array<Paper> papers; // Duplicates allowed.
|
||||
array<Paper> papers; // Empty and duplicates allowed.
|
||||
array<Paper> user_defined_papers;
|
||||
Paper default_paper;
|
||||
array<gfx.mojom.Size> dpis; // Duplicates allowed.
|
||||
|
@ -215,12 +215,6 @@ bool StructTraits<printing::mojom::PrinterSemanticCapsAndDefaultsDataView,
|
||||
return false;
|
||||
}
|
||||
|
||||
// There should be at least one item in `papers`.
|
||||
if (out->papers.empty()) {
|
||||
DLOG(ERROR) << "The available papers must not be empty.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// There should not be duplicates in certain arrays.
|
||||
DuplicateChecker<printing::mojom::DuplexMode> duplex_modes_dup_checker;
|
||||
if (duplex_modes_dup_checker.HasDuplicates(out->duplex_modes)) {
|
||||
|
@ -275,11 +275,15 @@ TEST(PrintBackendMojomTraitsTest,
|
||||
GenerateSamplePrinterSemanticCapsAndDefaults();
|
||||
PrinterSemanticCapsAndDefaults output;
|
||||
|
||||
// Override sample with empty `papers`, which is not allowed.
|
||||
// Override sample with empty `papers`. This is known to be possible, seen
|
||||
// with Epson PX660 series driver.
|
||||
const PrinterSemanticCapsAndDefaults::Papers kEmptyPapers;
|
||||
input.papers.clear();
|
||||
|
||||
EXPECT_FALSE(mojo::test::SerializeAndDeserialize<
|
||||
mojom::PrinterSemanticCapsAndDefaults>(input, output));
|
||||
EXPECT_TRUE(mojo::test::SerializeAndDeserialize<
|
||||
mojom::PrinterSemanticCapsAndDefaults>(input, output));
|
||||
|
||||
EXPECT_EQ(kEmptyPapers, output.papers);
|
||||
}
|
||||
|
||||
TEST(
|
||||
|
Reference in New Issue
Block a user