| 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) { | |
| 99 EXPECT_EQ(document_cookie_, cookie); | 98 EXPECT_EQ(document_cookie_, cookie); |
| 100 | 99 |
| 101 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); | 100 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); |
| 102 params->pages = pages; | |
| 103 SetPrintParams(&(params->params)); | 101 SetPrintParams(&(params->params)); |
| 104 printer_status_ = PRINTER_PRINTING; | 102 printer_status_ = PRINTER_PRINTING; |
| 105 } | 103 } |
| 106 | 104 |
| 107 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { | 105 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { |
| 108 // Verify the input parameter and update the printer status so that the | 106 // Verify the input parameter and update the printer status so that the |
| 109 // RenderViewTest class can verify the this function finishes without errors. | 107 // RenderViewTest class can verify the this function finishes without errors. |
| 110 EXPECT_EQ(document_cookie_, cookie); | 108 EXPECT_EQ(document_cookie_, cookie); |
| 111 EXPECT_EQ(PRINTER_PRINTING, printer_status_); | 109 EXPECT_EQ(PRINTER_PRINTING, printer_status_); |
| 112 EXPECT_EQ(0, number_pages_); | 110 EXPECT_EQ(0, number_pages_); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 params->max_shrink = max_shrink_; | 224 params->max_shrink = max_shrink_; |
| 227 params->min_shrink = min_shrink_; | 225 params->min_shrink = min_shrink_; |
| 228 params->desired_dpi = desired_dpi_; | 226 params->desired_dpi = desired_dpi_; |
| 229 params->selection_only = selection_only_; | 227 params->selection_only = selection_only_; |
| 230 params->document_cookie = document_cookie_; | 228 params->document_cookie = document_cookie_; |
| 231 params->page_size = page_size_; | 229 params->page_size = page_size_; |
| 232 params->printable_size = printable_size_; | 230 params->printable_size = printable_size_; |
| 233 params->margin_left = margin_left_; | 231 params->margin_left = margin_left_; |
| 234 params->margin_top = margin_top_; | 232 params->margin_top = margin_top_; |
| 235 } | 233 } |
| OLD | NEW |