| 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 #ifndef COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ | 5 #ifndef COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ |
| 6 #define COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ | 6 #define COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" |
| 11 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "build/build_config.h" |
| 12 #include "content/public/test/mock_render_thread.h" | 16 #include "content/public/test/mock_render_thread.h" |
| 13 | 17 |
| 14 namespace base { | 18 namespace base { |
| 15 class DictionaryValue; | 19 class DictionaryValue; |
| 16 } | 20 } |
| 17 | 21 |
| 18 class MockPrinter; | 22 class MockPrinter; |
| 19 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 23 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 20 struct PrintHostMsg_DidPreviewPage_Params; | 24 struct PrintHostMsg_DidPreviewPage_Params; |
| 21 struct PrintHostMsg_DidPrintPage_Params; | 25 struct PrintHostMsg_DidPrintPage_Params; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 75 |
| 72 // PrintWebViewHelper expects final print settings from the user. | 76 // PrintWebViewHelper expects final print settings from the user. |
| 73 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, | 77 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, |
| 74 PrintMsg_PrintPages_Params* settings); | 78 PrintMsg_PrintPages_Params* settings); |
| 75 | 79 |
| 76 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 80 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
| 77 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 81 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
| 78 void OnDidGetPreviewPageCount( | 82 void OnDidGetPreviewPageCount( |
| 79 const PrintHostMsg_DidGetPreviewPageCount_Params& params); | 83 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 80 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); | 84 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); |
| 81 void OnCheckForCancel(int32 preview_ui_id, | 85 void OnCheckForCancel(int32_t preview_ui_id, |
| 82 int preview_request_id, | 86 int preview_request_id, |
| 83 bool* cancel); | 87 bool* cancel); |
| 84 | 88 |
| 85 // For print preview, PrintWebViewHelper will update settings. | 89 // For print preview, PrintWebViewHelper will update settings. |
| 86 void OnUpdatePrintSettings(int document_cookie, | 90 void OnUpdatePrintSettings(int document_cookie, |
| 87 const base::DictionaryValue& job_settings, | 91 const base::DictionaryValue& job_settings, |
| 88 PrintMsg_PrintPages_Params* params, | 92 PrintMsg_PrintPages_Params* params, |
| 89 bool* canceled); | 93 bool* canceled); |
| 90 | 94 |
| 91 // A mock printer device used for printing tests. | 95 // A mock printer device used for printing tests. |
| 92 scoped_ptr<MockPrinter> printer_; | 96 scoped_ptr<MockPrinter> printer_; |
| 93 | 97 |
| 94 // True to simulate user clicking print. False to cancel. | 98 // True to simulate user clicking print. False to cancel. |
| 95 bool print_dialog_user_response_; | 99 bool print_dialog_user_response_; |
| 96 | 100 |
| 97 // Simulates cancelling print preview if |print_preview_pages_remaining_| | 101 // Simulates cancelling print preview if |print_preview_pages_remaining_| |
| 98 // equals this. | 102 // equals this. |
| 99 int print_preview_cancel_page_number_; | 103 int print_preview_cancel_page_number_; |
| 100 | 104 |
| 101 // Number of pages to generate for print preview. | 105 // Number of pages to generate for print preview. |
| 102 int print_preview_pages_remaining_; | 106 int print_preview_pages_remaining_; |
| 103 #endif | 107 #endif |
| 104 | 108 |
| 105 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 109 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 106 | 110 |
| 107 DISALLOW_COPY_AND_ASSIGN(PrintMockRenderThread); | 111 DISALLOW_COPY_AND_ASSIGN(PrintMockRenderThread); |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 #endif // COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ | 114 #endif // COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |