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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 settings->params.selection_only = selection_only_; | 91 settings->params.selection_only = selection_only_; |
92 settings->params.document_cookie = document_cookie_; | 92 settings->params.document_cookie = document_cookie_; |
93 settings->params.page_size = page_size_; | 93 settings->params.page_size = page_size_; |
94 settings->params.printable_size = printable_size_; | 94 settings->params.printable_size = printable_size_; |
95 settings->params.is_first_request = is_first_request_; | 95 settings->params.is_first_request = is_first_request_; |
96 settings->params.preview_request_id = preview_request_id_; | 96 settings->params.preview_request_id = preview_request_id_; |
97 printer_status_ = PRINTER_PRINTING; | 97 printer_status_ = PRINTER_PRINTING; |
98 } | 98 } |
99 | 99 |
100 void MockPrinter::UpdateSettings(int cookie, | 100 void MockPrinter::UpdateSettings(int cookie, |
101 PrintMsg_PrintPages_Params* params) { | 101 PrintMsg_PrintPages_Params* params, |
102 const std::vector<int>& pages) { | |
102 EXPECT_EQ(document_cookie_, cookie); | 103 EXPECT_EQ(document_cookie_, cookie); |
103 | 104 |
104 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); | 105 memset(params, 0, sizeof(PrintMsg_PrintPages_Params)); |
Chris Guillory
2011/08/16 20:08:53
Looking at this further I think line is your issue
kmadhusu
2011/08/16 20:53:21
hmm.. interesting.. I tested without the memset li
| |
106 // On Release version, MSVS crashes the application if we try to assign an | |
107 // empty vector to an empty vector. Always check for empty vector before | |
108 // assigning it to another vector. | |
109 if (pages.size() != 0) | |
110 params->pages = pages; | |
111 | |
105 SetPrintParams(&(params->params)); | 112 SetPrintParams(&(params->params)); |
106 printer_status_ = PRINTER_PRINTING; | 113 printer_status_ = PRINTER_PRINTING; |
107 } | 114 } |
108 | 115 |
109 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { | 116 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { |
110 // Verify the input parameter and update the printer status so that the | 117 // Verify the input parameter and update the printer status so that the |
111 // RenderViewTest class can verify the this function finishes without errors. | 118 // RenderViewTest class can verify the this function finishes without errors. |
112 EXPECT_EQ(document_cookie_, cookie); | 119 EXPECT_EQ(document_cookie_, cookie); |
113 EXPECT_EQ(PRINTER_PRINTING, printer_status_); | 120 EXPECT_EQ(PRINTER_PRINTING, printer_status_); |
114 EXPECT_EQ(0, number_pages_); | 121 EXPECT_EQ(0, number_pages_); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 params->desired_dpi = desired_dpi_; | 237 params->desired_dpi = desired_dpi_; |
231 params->selection_only = selection_only_; | 238 params->selection_only = selection_only_; |
232 params->document_cookie = document_cookie_; | 239 params->document_cookie = document_cookie_; |
233 params->page_size = page_size_; | 240 params->page_size = page_size_; |
234 params->printable_size = printable_size_; | 241 params->printable_size = printable_size_; |
235 params->margin_left = margin_left_; | 242 params->margin_left = margin_left_; |
236 params->margin_top = margin_top_; | 243 params->margin_top = margin_top_; |
237 params->is_first_request = is_first_request_; | 244 params->is_first_request = is_first_request_; |
238 params->preview_request_id = preview_request_id_; | 245 params->preview_request_id = preview_request_id_; |
239 } | 246 } |
OLD | NEW |