Chromium Code Reviews| Index: components/printing/test/print_mock_render_thread.cc |
| diff --git a/components/printing/test/print_mock_render_thread.cc b/components/printing/test/print_mock_render_thread.cc |
| index cc8205aeafaf7574903d7439168e1563cecbd1a3..27bfefbb896cac320c41f3cdf0b300e7549f600e 100644 |
| --- a/components/printing/test/print_mock_render_thread.cc |
| +++ b/components/printing/test/print_mock_render_thread.cc |
| @@ -15,6 +15,7 @@ |
| #include "printing/features/features.h" |
| #include "printing/page_range.h" |
| #include "printing/print_job_constants.h" |
| +#include "printing/units.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #if BUILDFLAG(ENABLE_PRINTING) |
| @@ -162,9 +163,32 @@ void PrintMockRenderThread::OnUpdatePrintSettings( |
| new_ranges.push_back(range); |
| } |
| } |
| - std::vector<int> pages(printing::PageRange::GetPages(new_ranges)); |
| - printer_->UpdateSettings(document_cookie, params, pages, margins_type); |
| + // Get media size |
| + const base::DictionaryValue* media_size_value = NULL; |
|
Lei Zhang
2017/02/22 21:21:38
nullptr
rbpotter
2017/02/23 22:27:11
Done.
|
| + gfx::Size page_size = gfx::Size(0, 0); |
|
Lei Zhang
2017/02/22 21:21:38
The default constructor already sets the size of (
rbpotter
2017/02/23 22:27:11
Done.
|
| + if (job_settings.GetDictionary(printing::kSettingMediaSize, |
| + &media_size_value)) { |
| + int width_microns = 0; |
| + int height_microns = 0; |
| + if (media_size_value->GetInteger(printing::kSettingMediaSizeWidthMicrons, |
| + &width_microns) && |
| + media_size_value->GetInteger(printing::kSettingMediaSizeHeightMicrons, |
| + &height_microns)) { |
| + float deviceMicronsPerUnit = |
|
Lei Zhang
2017/02/22 21:21:38
device_microns_per_unit
rbpotter
2017/02/23 22:27:11
Done.
|
| + (printing::kHundrethsMMPerInch * 10.0f) / printing::kDefaultPdfDpi; |
| + page_size = gfx::Size(width_microns / deviceMicronsPerUnit, |
| + height_microns / deviceMicronsPerUnit); |
| + } |
| + } |
| + |
| + // Get scaling |
| + int scale_factor = 100; |
| + job_settings.GetInteger(printing::kSettingScaleFactor, &scale_factor); |
| + |
| + std::vector<int> pages(printing::PageRange::GetPages(new_ranges)); |
| + printer_->UpdateSettings(document_cookie, params, pages, margins_type, |
| + page_size, scale_factor); |
| job_settings.GetBoolean(printing::kSettingShouldPrintSelectionOnly, |
| ¶ms->params.selection_only); |
| job_settings.GetBoolean(printing::kSettingShouldPrintBackgrounds, |