| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 settings->params.display_header_footer = display_header_footer_; | 116 settings->params.display_header_footer = display_header_footer_; |
| 117 settings->params.date = date_; | 117 settings->params.date = date_; |
| 118 settings->params.title = title_; | 118 settings->params.title = title_; |
| 119 settings->params.url = url_; | 119 settings->params.url = url_; |
| 120 printer_status_ = PRINTER_PRINTING; | 120 printer_status_ = PRINTER_PRINTING; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void MockPrinter::UpdateSettings(int cookie, | 123 void MockPrinter::UpdateSettings(int cookie, |
| 124 PrintMsg_PrintPages_Params* params, | 124 PrintMsg_PrintPages_Params* params, |
| 125 const std::vector<int>& pages) { | 125 const std::vector<int>& pages) { |
| 126 EXPECT_EQ(document_cookie_, cookie); | 126 if (document_cookie_ == -1) { |
| 127 | 127 document_cookie_ = CreateDocumentCookie(); |
| 128 } |
| 128 params->Reset(); | 129 params->Reset(); |
| 129 params->pages = pages; | 130 params->pages = pages; |
| 130 SetPrintParams(&(params->params)); | 131 SetPrintParams(&(params->params)); |
| 131 printer_status_ = PRINTER_PRINTING; | 132 printer_status_ = PRINTER_PRINTING; |
| 132 } | 133 } |
| 133 | 134 |
| 134 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { | 135 void MockPrinter::SetPrintedPagesCount(int cookie, int number_pages) { |
| 135 // Verify the input parameter and update the printer status so that the | 136 // Verify the input parameter and update the printer status so that the |
| 136 // RenderViewTest class can verify the this function finishes without errors. | 137 // RenderViewTest class can verify the this function finishes without errors. |
| 137 EXPECT_EQ(document_cookie_, cookie); | 138 EXPECT_EQ(document_cookie_, cookie); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 params->printable_size = printable_size_; | 260 params->printable_size = printable_size_; |
| 260 params->margin_left = margin_left_; | 261 params->margin_left = margin_left_; |
| 261 params->margin_top = margin_top_; | 262 params->margin_top = margin_top_; |
| 262 params->is_first_request = is_first_request_; | 263 params->is_first_request = is_first_request_; |
| 263 params->preview_request_id = preview_request_id_; | 264 params->preview_request_id = preview_request_id_; |
| 264 params->display_header_footer = display_header_footer_; | 265 params->display_header_footer = display_header_footer_; |
| 265 params->date = date_; | 266 params->date = date_; |
| 266 params->title = title_; | 267 params->title = title_; |
| 267 params->url = url_; | 268 params->url = url_; |
| 268 } | 269 } |
| OLD | NEW |