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

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

Issue 1701703003: Reland of Cleanup: Remove unused PrintSettings shrink factors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « components/printing/test/mock_printer.h ('k') | printing/print_settings.h » ('j') | no next file with comments »
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 source_data_.reset(new uint8_t[source_size]); 50 source_data_.reset(new uint8_t[source_size]);
51 if (source_data_.get()) 51 if (source_data_.get())
52 memcpy(source_data_.get(), source_data, source_size); 52 memcpy(source_data_.get(), source_data, source_size);
53 } 53 }
54 54
55 MockPrinterPage::~MockPrinterPage() { 55 MockPrinterPage::~MockPrinterPage() {
56 } 56 }
57 57
58 MockPrinter::MockPrinter() 58 MockPrinter::MockPrinter()
59 : dpi_(printing::kPointsPerInch), 59 : dpi_(printing::kPointsPerInch),
60 max_shrink_(2.0),
61 min_shrink_(1.25),
62 desired_dpi_(printing::kPointsPerInch), 60 desired_dpi_(printing::kPointsPerInch),
63 selection_only_(false), 61 selection_only_(false),
64 should_print_backgrounds_(false), 62 should_print_backgrounds_(false),
65 document_cookie_(-1), 63 document_cookie_(-1),
66 current_document_cookie_(0), 64 current_document_cookie_(0),
67 printer_status_(PRINTER_READY), 65 printer_status_(PRINTER_READY),
68 number_pages_(0), 66 number_pages_(0),
69 page_number_(0), 67 page_number_(0),
70 is_first_request_(true), 68 is_first_request_(true),
71 print_to_pdf_(false), 69 print_to_pdf_(false),
(...skipping 27 matching lines...) Expand all
99 EXPECT_EQ(-1, document_cookie_); 97 EXPECT_EQ(-1, document_cookie_);
100 98
101 // Assign a unit document cookie and set the print settings. 99 // Assign a unit document cookie and set the print settings.
102 document_cookie_ = CreateDocumentCookie(); 100 document_cookie_ = CreateDocumentCookie();
103 params->Reset(); 101 params->Reset();
104 SetPrintParams(params); 102 SetPrintParams(params);
105 } 103 }
106 104
107 void MockPrinter::SetDefaultPrintSettings(const PrintMsg_Print_Params& params) { 105 void MockPrinter::SetDefaultPrintSettings(const PrintMsg_Print_Params& params) {
108 dpi_ = params.dpi; 106 dpi_ = params.dpi;
109 max_shrink_ = params.max_shrink;
110 min_shrink_ = params.min_shrink;
111 desired_dpi_ = params.desired_dpi; 107 desired_dpi_ = params.desired_dpi;
112 selection_only_ = params.selection_only; 108 selection_only_ = params.selection_only;
113 should_print_backgrounds_ = params.should_print_backgrounds; 109 should_print_backgrounds_ = params.should_print_backgrounds;
114 page_size_ = params.page_size; 110 page_size_ = params.page_size;
115 content_size_ = params.content_size; 111 content_size_ = params.content_size;
116 printable_area_ = params.printable_area; 112 printable_area_ = params.printable_area;
117 margin_left_ = params.margin_left; 113 margin_left_ = params.margin_left;
118 margin_top_ = params.margin_top; 114 margin_top_ = params.margin_top;
119 display_header_footer_ = params.display_header_footer; 115 display_header_footer_ = params.display_header_footer;
120 title_ = params.title; 116 title_ = params.title;
(...skipping 17 matching lines...) Expand all
138 void MockPrinter::ScriptedPrint(int cookie, 134 void MockPrinter::ScriptedPrint(int cookie,
139 int expected_pages_count, 135 int expected_pages_count,
140 bool has_selection, 136 bool has_selection,
141 PrintMsg_PrintPages_Params* settings) { 137 PrintMsg_PrintPages_Params* settings) {
142 // Verify the input parameters. 138 // Verify the input parameters.
143 EXPECT_EQ(document_cookie_, cookie); 139 EXPECT_EQ(document_cookie_, cookie);
144 140
145 settings->Reset(); 141 settings->Reset();
146 142
147 settings->params.dpi = dpi_; 143 settings->params.dpi = dpi_;
148 settings->params.max_shrink = max_shrink_;
149 settings->params.min_shrink = min_shrink_;
150 settings->params.desired_dpi = desired_dpi_; 144 settings->params.desired_dpi = desired_dpi_;
151 settings->params.selection_only = selection_only_; 145 settings->params.selection_only = selection_only_;
152 settings->params.should_print_backgrounds = should_print_backgrounds_; 146 settings->params.should_print_backgrounds = should_print_backgrounds_;
153 settings->params.document_cookie = document_cookie_; 147 settings->params.document_cookie = document_cookie_;
154 settings->params.page_size = page_size_; 148 settings->params.page_size = page_size_;
155 settings->params.content_size = content_size_; 149 settings->params.content_size = content_size_;
156 settings->params.printable_area = printable_area_; 150 settings->params.printable_area = printable_area_;
157 settings->params.is_first_request = is_first_request_; 151 settings->params.is_first_request = is_first_request_;
158 settings->params.print_scaling_option = print_scaling_option_; 152 settings->params.print_scaling_option = print_scaling_option_;
159 settings->params.print_to_pdf = print_to_pdf_; 153 settings->params.print_to_pdf = print_to_pdf_;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 pages_[page]->image().SaveToPng(filepath); 273 pages_[page]->image().SaveToPng(filepath);
280 return true; 274 return true;
281 } 275 }
282 276
283 int MockPrinter::CreateDocumentCookie() { 277 int MockPrinter::CreateDocumentCookie() {
284 return use_invalid_settings_ ? 0 : ++current_document_cookie_; 278 return use_invalid_settings_ ? 0 : ++current_document_cookie_;
285 } 279 }
286 280
287 void MockPrinter::SetPrintParams(PrintMsg_Print_Params* params) { 281 void MockPrinter::SetPrintParams(PrintMsg_Print_Params* params) {
288 params->dpi = dpi_; 282 params->dpi = dpi_;
289 params->max_shrink = max_shrink_;
290 params->min_shrink = min_shrink_;
291 params->desired_dpi = desired_dpi_; 283 params->desired_dpi = desired_dpi_;
292 params->selection_only = selection_only_; 284 params->selection_only = selection_only_;
293 params->should_print_backgrounds = should_print_backgrounds_; 285 params->should_print_backgrounds = should_print_backgrounds_;
294 params->document_cookie = document_cookie_; 286 params->document_cookie = document_cookie_;
295 params->page_size = page_size_; 287 params->page_size = page_size_;
296 params->content_size = content_size_; 288 params->content_size = content_size_;
297 params->printable_area = printable_area_; 289 params->printable_area = printable_area_;
298 params->margin_left = margin_left_; 290 params->margin_left = margin_left_;
299 params->margin_top = margin_top_; 291 params->margin_top = margin_top_;
300 params->is_first_request = is_first_request_; 292 params->is_first_request = is_first_request_;
301 params->print_scaling_option = print_scaling_option_; 293 params->print_scaling_option = print_scaling_option_;
302 params->print_to_pdf = print_to_pdf_; 294 params->print_to_pdf = print_to_pdf_;
303 params->preview_request_id = preview_request_id_; 295 params->preview_request_id = preview_request_id_;
304 params->display_header_footer = display_header_footer_; 296 params->display_header_footer = display_header_footer_;
305 params->title = title_; 297 params->title = title_;
306 params->url = url_; 298 params->url = url_;
307 } 299 }
OLDNEW
« no previous file with comments | « components/printing/test/mock_printer.h ('k') | printing/print_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698