Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: components/printing/test/mock_printer.cc

Issue 2719443003: Reland of Add automated testing to check for page size with scaling (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/printing/test/mock_printer.h ('k') | components/printing/test/print_mock_render_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/printing/test/mock_printer.cc
diff --git a/components/printing/test/mock_printer.cc b/components/printing/test/mock_printer.cc
index 4197dc603b584709e98e3d2d92c279e943983473..1a38b7a08aa8033e1ae3bd0a71d87c07e8cb3d4e 100644
--- a/components/printing/test/mock_printer.cc
+++ b/components/printing/test/mock_printer.cc
@@ -38,6 +38,13 @@
params->margin_left = static_cast<int>(0.30 * dpi);
params->margin_top = static_cast<int>(0.30 * dpi);
}
+}
+
+void UpdatePageSizeAndScaling(const gfx::Size& page_size,
+ int scale_factor,
+ PrintMsg_Print_Params* params) {
+ params->page_size = page_size;
+ params->scale_factor = static_cast<double>(scale_factor) / 100.0;
}
} // namespace
@@ -161,7 +168,9 @@
void MockPrinter::UpdateSettings(int cookie,
PrintMsg_PrintPages_Params* params,
const std::vector<int>& pages,
- int margins_type) {
+ int margins_type,
+ const gfx::Size& page_size,
+ int scale_factor) {
if (document_cookie_ == -1) {
document_cookie_ = CreateDocumentCookie();
}
@@ -169,6 +178,8 @@
params->pages = pages;
SetPrintParams(&(params->params));
UpdateMargins(margins_type, dpi_, &(params->params));
+ if (!page_size.IsEmpty())
+ UpdatePageSizeAndScaling(page_size, scale_factor, &params->params);
printer_status_ = PRINTER_PRINTING;
}
« no previous file with comments | « components/printing/test/mock_printer.h ('k') | components/printing/test/print_mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698