OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/mock_printer.h" | 5 #include "chrome/renderer/mock_printer.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "chrome/common/print_messages.h" | 9 #include "chrome/common/print_messages.h" |
10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 settings->params.min_shrink = min_shrink_; | 87 settings->params.min_shrink = min_shrink_; |
88 settings->params.desired_dpi = desired_dpi_; | 88 settings->params.desired_dpi = desired_dpi_; |
89 settings->params.selection_only = selection_only_; | 89 settings->params.selection_only = selection_only_; |
90 settings->params.document_cookie = document_cookie_; | 90 settings->params.document_cookie = document_cookie_; |
91 settings->params.page_size = page_size_; | 91 settings->params.page_size = page_size_; |
92 settings->params.printable_size = printable_size_; | 92 settings->params.printable_size = printable_size_; |
93 printer_status_ = PRINTER_PRINTING; | 93 printer_status_ = PRINTER_PRINTING; |
94 } | 94 } |
95 | 95 |
96 void MockPrinter::UpdateSettings(int cookie, | 96 void MockPrinter::UpdateSettings(int cookie, |
97 PrintMsg_PrintPages_Params* params) { | 97 PrintMsg_PrintPages_Params* params, |
| 98 const std::vector<int>& pages) { |
98 EXPECT_EQ(document_cookie_, cookie); | 99 EXPECT_EQ(document_cookie_, cookie); |
99 | 100 |
100 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); | 101 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); |
| 102 params->pages = pages; |
101 SetPrintParams(&(params->params)); | 103 SetPrintParams(&(params->params)); |
102 printer_status_ = PRINTER_PRINTING; | 104 printer_status_ = PRINTER_PRINTING; |
103 } | 105 } |
104 | 106 |
105 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { | 107 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { |
106 // Verify the input parameter and update the printer status so that the | 108 // Verify the input parameter and update the printer status so that the |
107 // RenderViewTest class can verify the this function finishes without errors. | 109 // RenderViewTest class can verify the this function finishes without errors. |
108 EXPECT_EQ(document_cookie_, cookie); | 110 EXPECT_EQ(document_cookie_, cookie); |
109 EXPECT_EQ(PRINTER_PRINTING, printer_status_); | 111 EXPECT_EQ(PRINTER_PRINTING, printer_status_); |
110 EXPECT_EQ(0, number_pages_); | 112 EXPECT_EQ(0, number_pages_); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 params->max_shrink = max_shrink_; | 226 params->max_shrink = max_shrink_; |
225 params->min_shrink = min_shrink_; | 227 params->min_shrink = min_shrink_; |
226 params->desired_dpi = desired_dpi_; | 228 params->desired_dpi = desired_dpi_; |
227 params->selection_only = selection_only_; | 229 params->selection_only = selection_only_; |
228 params->document_cookie = document_cookie_; | 230 params->document_cookie = document_cookie_; |
229 params->page_size = page_size_; | 231 params->page_size = page_size_; |
230 params->printable_size = printable_size_; | 232 params->printable_size = printable_size_; |
231 params->margin_left = margin_left_; | 233 params->margin_left = margin_left_; |
232 params->margin_top = margin_top_; | 234 params->margin_top = margin_top_; |
233 } | 235 } |
OLD | NEW |