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

Side by Side Diff: components/printing/test/mock_printer.cc

Issue 2802093006: printing::Metafile: Simplify OS_MACOSX-specific code path (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | printing/image_mac.cc » ('j') | printing/pdf_metafile_cg_mac.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
205 EXPECT_EQ(page_number_, params.page_number); 205 EXPECT_EQ(page_number_, params.page_number);
206 EXPECT_LE(params.page_number, number_pages_); 206 EXPECT_LE(params.page_number, number_pages_);
207 207
208 #if defined(OS_WIN) || defined(OS_MACOSX) 208 #if defined(OS_WIN) || defined(OS_MACOSX)
209 // Load the data sent from a RenderView object and create a PageData object. 209 // Load the data sent from a RenderView object and create a PageData object.
210 // We duplicate the given file handle when creating a base::SharedMemory 210 // We duplicate the given file handle when creating a base::SharedMemory
211 // instance so that its destructor closes the copy. 211 // instance so that its destructor closes the copy.
212 EXPECT_GT(params.data_size, 0U); 212 EXPECT_GT(params.data_size, 0U);
213 base::SharedMemory metafile_data(params.metafile_data_handle, true); 213 base::SharedMemory metafile_data(params.metafile_data_handle, true);
214 metafile_data.Map(params.data_size); 214 metafile_data.Map(params.data_size);
215 #if defined(OS_MACOSX)
216 printing::PdfMetafileCg metafile;
217 #else
218 printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE); 215 printing::PdfMetafileSkia metafile(printing::PDF_SKIA_DOCUMENT_TYPE);
219 #endif
220 metafile.InitFromData(metafile_data.memory(), params.data_size); 216 metafile.InitFromData(metafile_data.memory(), params.data_size);
221 printing::Image image(metafile); 217 printing::Image image(metafile);
222 MockPrinterPage* page_data = 218 MockPrinterPage* page_data =
223 new MockPrinterPage(metafile_data.memory(), params.data_size, image); 219 new MockPrinterPage(metafile_data.memory(), params.data_size, image);
224 scoped_refptr<MockPrinterPage> page(page_data); 220 scoped_refptr<MockPrinterPage> page(page_data);
225 pages_.push_back(page); 221 pages_.push_back(page);
226 #endif 222 #endif
227 223
228 // We finish printing a printing job. 224 // We finish printing a printing job.
229 // Reset the job status and the printer status. 225 // Reset the job status and the printer status.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 params->margin_left = margin_left_; 296 params->margin_left = margin_left_;
301 params->margin_top = margin_top_; 297 params->margin_top = margin_top_;
302 params->is_first_request = is_first_request_; 298 params->is_first_request = is_first_request_;
303 params->print_scaling_option = print_scaling_option_; 299 params->print_scaling_option = print_scaling_option_;
304 params->print_to_pdf = print_to_pdf_; 300 params->print_to_pdf = print_to_pdf_;
305 params->preview_request_id = preview_request_id_; 301 params->preview_request_id = preview_request_id_;
306 params->display_header_footer = display_header_footer_; 302 params->display_header_footer = display_header_footer_;
307 params->title = title_; 303 params->title = title_;
308 params->url = url_; 304 params->url = url_;
309 } 305 }
OLDNEW
« no previous file with comments | « no previous file | printing/image_mac.cc » ('j') | printing/pdf_metafile_cg_mac.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698