Test HandleResetPrintPreviewModeMessage when printing PDFs.
Make sure a proper HandleResetPrintPreviewMode message for PDF printing works as expected. Bug: 752903 Change-Id: If7228577f0cae6a9f692d90caf531ff64909658a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3967814 Reviewed-by: K. Moon <kmoon@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1066048}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9d54fa14e0
commit
0aa39f7bb0
@ -2213,6 +2213,33 @@ TEST_F(PdfViewWebPluginPrintPreviewTest, HandleResetPrintPreviewModeMessage) {
|
||||
})"));
|
||||
}
|
||||
|
||||
TEST_F(PdfViewWebPluginPrintPreviewTest,
|
||||
HandleResetPrintPreviewModeMessageForPdf) {
|
||||
EXPECT_CALL(*client_ptr_, CreateEngine)
|
||||
.WillOnce([](PDFEngine::Client* client,
|
||||
PDFiumFormFiller::ScriptOption script_option) {
|
||||
EXPECT_EQ(PDFiumFormFiller::ScriptOption::kNoJavaScript, script_option);
|
||||
|
||||
return std::make_unique<NiceMock<TestPDFiumEngine>>(client);
|
||||
});
|
||||
|
||||
// The UI ID of 1 in the URL is arbitrary.
|
||||
// The page index value of -1, AKA `kCompletePDFIndex`, is required for PDFs.
|
||||
plugin_->OnMessage(ParseMessage(R"({
|
||||
"type": "resetPrintPreviewMode",
|
||||
"url": "chrome-untrusted://print/1/-1/print.pdf",
|
||||
"grayscale": false,
|
||||
"pageCount": 0,
|
||||
})"));
|
||||
|
||||
EXPECT_CALL(*client_ptr_, PostMessage).Times(AnyNumber());
|
||||
EXPECT_CALL(*client_ptr_, PostMessage(base::test::IsJson(R"({
|
||||
"type": "printPreviewLoaded",
|
||||
})")));
|
||||
plugin_->DocumentLoadComplete();
|
||||
pdf_receiver_.FlushForTesting();
|
||||
}
|
||||
|
||||
TEST_F(PdfViewWebPluginPrintPreviewTest,
|
||||
HandleResetPrintPreviewModeMessageSetGrayscale) {
|
||||
EXPECT_CALL(*client_ptr_, CreateEngine)
|
||||
|
Reference in New Issue
Block a user