| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 11 #include "content/public/test/mock_render_thread.h" | 12 #include "content/public/test/mock_render_thread.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class DictionaryValue; | 15 class DictionaryValue; |
| 15 } | 16 } |
| 16 | 17 |
| 17 class MockPrinter; | 18 class MockPrinter; |
| 18 struct PrintHostMsg_DidGetPreviewPageCount_Params; | 19 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 19 struct PrintHostMsg_DidPreviewPage_Params; | 20 struct PrintHostMsg_DidPreviewPage_Params; |
| 20 struct PrintHostMsg_DidPrintPage_Params; | 21 struct PrintHostMsg_DidPrintPage_Params; |
| 21 struct PrintHostMsg_ScriptedPrint_Params; | 22 struct PrintHostMsg_ScriptedPrint_Params; |
| 22 struct PrintMsg_PrintPages_Params; | 23 struct PrintMsg_PrintPages_Params; |
| 23 struct PrintMsg_Print_Params; | 24 struct PrintMsg_Print_Params; |
| 24 | 25 |
| 25 // Extends content::MockRenderThread to know about printing | 26 // Extends content::MockRenderThread to know about printing |
| 26 class PrintMockRenderThread : public content::MockRenderThread { | 27 class PrintMockRenderThread : public content::MockRenderThread { |
| 27 public: | 28 public: |
| 28 PrintMockRenderThread(); | 29 PrintMockRenderThread(); |
| 29 ~PrintMockRenderThread() override; | 30 ~PrintMockRenderThread() override; |
| 30 | 31 |
| 31 // content::RenderThread overrides. | 32 // content::RenderThread overrides. |
| 32 scoped_refptr<base::SingleThreadTaskRunner> GetIOMessageLoopProxy() override; | 33 scoped_refptr<base::SingleThreadTaskRunner> GetIOMessageLoopProxy() override; |
| 33 | 34 |
| 34 ////////////////////////////////////////////////////////////////////////// | 35 ////////////////////////////////////////////////////////////////////////// |
| 35 // The following functions are called by the test itself. | 36 // The following functions are called by the test itself. |
| 36 | 37 |
| 37 // Set IO message loop proxy. | 38 // Set IO message loop proxy. |
| 38 void set_io_message_loop_proxy( | 39 void set_io_message_loop_proxy( |
| 39 const scoped_refptr<base::MessageLoopProxy>& proxy); | 40 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 40 | 41 |
| 41 #if defined(ENABLE_PRINTING) | 42 #if defined(ENABLE_PRINTING) |
| 42 // Returns the pseudo-printer instance. | 43 // Returns the pseudo-printer instance. |
| 43 MockPrinter* printer(); | 44 MockPrinter* printer(); |
| 44 | 45 |
| 45 // Call with |response| set to true if the user wants to print. | 46 // Call with |response| set to true if the user wants to print. |
| 46 // False if the user decides to cancel. | 47 // False if the user decides to cancel. |
| 47 void set_print_dialog_user_response(bool response); | 48 void set_print_dialog_user_response(bool response); |
| 48 | 49 |
| 49 // Cancel print preview when print preview has |page| remaining pages. | 50 // Cancel print preview when print preview has |page| remaining pages. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool print_dialog_user_response_; | 95 bool print_dialog_user_response_; |
| 95 | 96 |
| 96 // Simulates cancelling print preview if |print_preview_pages_remaining_| | 97 // Simulates cancelling print preview if |print_preview_pages_remaining_| |
| 97 // equals this. | 98 // equals this. |
| 98 int print_preview_cancel_page_number_; | 99 int print_preview_cancel_page_number_; |
| 99 | 100 |
| 100 // Number of pages to generate for print preview. | 101 // Number of pages to generate for print preview. |
| 101 int print_preview_pages_remaining_; | 102 int print_preview_pages_remaining_; |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 105 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 105 | 106 |
| 106 DISALLOW_COPY_AND_ASSIGN(PrintMockRenderThread); | 107 DISALLOW_COPY_AND_ASSIGN(PrintMockRenderThread); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 #endif // COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ | 110 #endif // COMPONENTS_PRINTING_TEST_PRINT_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |