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

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

Issue 2697683004: Add automated testing to check for page size with scaling (Closed)
Patch Set: Fix git cl format issue 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
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..f7442a30ed484150a4e2700fc2f558d8428ecca7 100644
--- a/components/printing/test/mock_printer.cc
+++ b/components/printing/test/mock_printer.cc
@@ -40,6 +40,13 @@ void UpdateMargins(int margins_type, int dpi, PrintMsg_Print_Params* params) {
}
}
+void UpdatePageSizeAndScaling(gfx::Size page_size,
Lei Zhang 2017/02/22 21:21:37 Pass by cosnt ref again.
rbpotter 2017/02/23 22:27:11 Done.
+ int scale_factor,
+ PrintMsg_Print_Params* params) {
+ params->page_size = page_size;
+ params->scale_factor = static_cast<double>(scale_factor) / 100.0;
+}
+
} // namespace
MockPrinterPage::MockPrinterPage(const void* source_data,
@@ -161,7 +168,9 @@ void MockPrinter::ScriptedPrint(int cookie,
void MockPrinter::UpdateSettings(int cookie,
PrintMsg_PrintPages_Params* params,
const std::vector<int>& pages,
- int margins_type) {
+ int margins_type,
+ gfx::Size page_size,
+ int scale_factor) {
if (document_cookie_ == -1) {
document_cookie_ = CreateDocumentCookie();
}
@@ -169,6 +178,8 @@ void MockPrinter::UpdateSettings(int cookie,
params->pages = pages;
SetPrintParams(&(params->params));
UpdateMargins(margins_type, dpi_, &(params->params));
+ if (page_size.width() > 0 && page_size.height() > 0)
Lei Zhang 2017/02/22 21:21:37 if (!page_size.IsEmpty())
rbpotter 2017/02/23 22:27:11 Done.
+ UpdatePageSizeAndScaling(page_size, scale_factor, &(params->params));
Lei Zhang 2017/02/22 21:21:37 You can probably omit the parenthesis around |para
rbpotter 2017/02/23 22:27:11 Done.
printer_status_ = PRINTER_PRINTING;
}

Powered by Google App Engine
This is Rietveld 408576698