OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/printing/test/mock_printer.h" | 5 #include "components/printing/test/mock_printer.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 #if defined(OS_WIN) || defined(OS_MACOSX) | 205 #if defined(OS_WIN) || defined(OS_MACOSX) |
206 // Load the data sent from a RenderView object and create a PageData object. | 206 // Load the data sent from a RenderView object and create a PageData object. |
207 // We duplicate the given file handle when creating a base::SharedMemory | 207 // We duplicate the given file handle when creating a base::SharedMemory |
208 // instance so that its destructor closes the copy. | 208 // instance so that its destructor closes the copy. |
209 EXPECT_GT(params.data_size, 0U); | 209 EXPECT_GT(params.data_size, 0U); |
210 base::SharedMemory metafile_data(params.metafile_data_handle, true); | 210 base::SharedMemory metafile_data(params.metafile_data_handle, true); |
211 metafile_data.Map(params.data_size); | 211 metafile_data.Map(params.data_size); |
212 #if defined(OS_MACOSX) | 212 #if defined(OS_MACOSX) |
213 printing::PdfMetafileCg metafile; | 213 printing::PdfMetafileCg metafile; |
214 #else | 214 #else |
215 printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); | 215 printing::PdfMetafileSkia metafile(printing::SkiaDocumentType::PDF); |
216 #endif | 216 #endif |
217 metafile.InitFromData(metafile_data.memory(), params.data_size); | 217 metafile.InitFromData(metafile_data.memory(), params.data_size); |
218 printing::Image image(metafile); | 218 printing::Image image(metafile); |
219 MockPrinterPage* page_data = | 219 MockPrinterPage* page_data = |
220 new MockPrinterPage(metafile_data.memory(), params.data_size, image); | 220 new MockPrinterPage(metafile_data.memory(), params.data_size, image); |
221 scoped_refptr<MockPrinterPage> page(page_data); | 221 scoped_refptr<MockPrinterPage> page(page_data); |
222 pages_.push_back(page); | 222 pages_.push_back(page); |
223 #endif | 223 #endif |
224 | 224 |
225 // We finish printing a printing job. | 225 // We finish printing a printing job. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 params->margin_left = margin_left_; | 296 params->margin_left = margin_left_; |
297 params->margin_top = margin_top_; | 297 params->margin_top = margin_top_; |
298 params->is_first_request = is_first_request_; | 298 params->is_first_request = is_first_request_; |
299 params->print_scaling_option = print_scaling_option_; | 299 params->print_scaling_option = print_scaling_option_; |
300 params->print_to_pdf = print_to_pdf_; | 300 params->print_to_pdf = print_to_pdf_; |
301 params->preview_request_id = preview_request_id_; | 301 params->preview_request_id = preview_request_id_; |
302 params->display_header_footer = display_header_footer_; | 302 params->display_header_footer = display_header_footer_; |
303 params->title = title_; | 303 params->title = title_; |
304 params->url = url_; | 304 params->url = url_; |
305 } | 305 } |
OLD | NEW |