| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 #if defined(OS_WIN) || defined(OS_MACOSX) | 197 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 198 // Load the data sent from a RenderView object and create a PageData object. | 198 // Load the data sent from a RenderView object and create a PageData object. |
| 199 // We duplicate the given file handle when creating a base::SharedMemory | 199 // We duplicate the given file handle when creating a base::SharedMemory |
| 200 // instance so that its destructor closes the copy. | 200 // instance so that its destructor closes the copy. |
| 201 EXPECT_GT(params.data_size, 0U); | 201 EXPECT_GT(params.data_size, 0U); |
| 202 base::SharedMemory metafile_data(params.metafile_data_handle, true); | 202 base::SharedMemory metafile_data(params.metafile_data_handle, true); |
| 203 metafile_data.Map(params.data_size); | 203 metafile_data.Map(params.data_size); |
| 204 #if defined(OS_MACOSX) | 204 #if defined(OS_MACOSX) |
| 205 printing::PdfMetafileCg metafile; | 205 printing::PdfMetafileCg metafile; |
| 206 #else | 206 #else |
| 207 printing::PdfMetafileSkia metafile; | 207 printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); |
| 208 #endif | 208 #endif |
| 209 metafile.InitFromData(metafile_data.memory(), params.data_size); | 209 metafile.InitFromData(metafile_data.memory(), params.data_size); |
| 210 printing::Image image(metafile); | 210 printing::Image image(metafile); |
| 211 MockPrinterPage* page_data = | 211 MockPrinterPage* page_data = |
| 212 new MockPrinterPage(metafile_data.memory(), params.data_size, image); | 212 new MockPrinterPage(metafile_data.memory(), params.data_size, image); |
| 213 scoped_refptr<MockPrinterPage> page(page_data); | 213 scoped_refptr<MockPrinterPage> page(page_data); |
| 214 pages_.push_back(page); | 214 pages_.push_back(page); |
| 215 #endif | 215 #endif |
| 216 | 216 |
| 217 // We finish printing a printing job. | 217 // We finish printing a printing job. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 params->margin_left = margin_left_; | 289 params->margin_left = margin_left_; |
| 290 params->margin_top = margin_top_; | 290 params->margin_top = margin_top_; |
| 291 params->is_first_request = is_first_request_; | 291 params->is_first_request = is_first_request_; |
| 292 params->print_scaling_option = print_scaling_option_; | 292 params->print_scaling_option = print_scaling_option_; |
| 293 params->print_to_pdf = print_to_pdf_; | 293 params->print_to_pdf = print_to_pdf_; |
| 294 params->preview_request_id = preview_request_id_; | 294 params->preview_request_id = preview_request_id_; |
| 295 params->display_header_footer = display_header_footer_; | 295 params->display_header_footer = display_header_footer_; |
| 296 params->title = title_; | 296 params->title = title_; |
| 297 params->url = url_; | 297 params->url = url_; |
| 298 } | 298 } |
| OLD | NEW |