| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/print_mock_render_thread.h" | 5 #include "components/printing/test/print_mock_render_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include <vector> | 9 #include <vector> |
| 8 | 10 |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "build/build_config.h" |
| 10 #include "components/printing/test/mock_printer.h" | 13 #include "components/printing/test/mock_printer.h" |
| 11 #include "ipc/ipc_sync_message.h" | 14 #include "ipc/ipc_sync_message.h" |
| 12 #include "printing/page_range.h" | 15 #include "printing/page_range.h" |
| 13 #include "printing/print_job_constants.h" | 16 #include "printing/print_job_constants.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 18 |
| 16 #if defined(ENABLE_PRINTING) | 19 #if defined(ENABLE_PRINTING) |
| 17 #include "components/printing/common/print_messages.h" | 20 #include "components/printing/common/print_messages.h" |
| 18 #endif | 21 #endif |
| 19 | 22 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 101 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
| 99 print_preview_pages_remaining_ = params.page_count; | 102 print_preview_pages_remaining_ = params.page_count; |
| 100 } | 103 } |
| 101 | 104 |
| 102 void PrintMockRenderThread::OnDidPreviewPage( | 105 void PrintMockRenderThread::OnDidPreviewPage( |
| 103 const PrintHostMsg_DidPreviewPage_Params& params) { | 106 const PrintHostMsg_DidPreviewPage_Params& params) { |
| 104 DCHECK_GE(params.page_number, printing::FIRST_PAGE_INDEX); | 107 DCHECK_GE(params.page_number, printing::FIRST_PAGE_INDEX); |
| 105 print_preview_pages_remaining_--; | 108 print_preview_pages_remaining_--; |
| 106 } | 109 } |
| 107 | 110 |
| 108 void PrintMockRenderThread::OnCheckForCancel(int32 preview_ui_id, | 111 void PrintMockRenderThread::OnCheckForCancel(int32_t preview_ui_id, |
| 109 int preview_request_id, | 112 int preview_request_id, |
| 110 bool* cancel) { | 113 bool* cancel) { |
| 111 *cancel = | 114 *cancel = |
| 112 (print_preview_pages_remaining_ == print_preview_cancel_page_number_); | 115 (print_preview_pages_remaining_ == print_preview_cancel_page_number_); |
| 113 } | 116 } |
| 114 | 117 |
| 115 void PrintMockRenderThread::OnUpdatePrintSettings( | 118 void PrintMockRenderThread::OnUpdatePrintSettings( |
| 116 int document_cookie, | 119 int document_cookie, |
| 117 const base::DictionaryValue& job_settings, | 120 const base::DictionaryValue& job_settings, |
| 118 PrintMsg_PrintPages_Params* params, | 121 PrintMsg_PrintPages_Params* params, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 178 } |
| 176 | 179 |
| 177 void PrintMockRenderThread::set_print_preview_cancel_page_number(int page) { | 180 void PrintMockRenderThread::set_print_preview_cancel_page_number(int page) { |
| 178 print_preview_cancel_page_number_ = page; | 181 print_preview_cancel_page_number_ = page; |
| 179 } | 182 } |
| 180 | 183 |
| 181 int PrintMockRenderThread::print_preview_pages_remaining() const { | 184 int PrintMockRenderThread::print_preview_pages_remaining() const { |
| 182 return print_preview_pages_remaining_; | 185 return print_preview_pages_remaining_; |
| 183 } | 186 } |
| 184 #endif // defined(ENABLE_PRINTING) | 187 #endif // defined(ENABLE_PRINTING) |
| OLD | NEW |