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 CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
6 #define CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_CHROME_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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 struct PrintHostMsg_DidPrintPage_Params; | 21 struct PrintHostMsg_DidPrintPage_Params; |
22 struct PrintHostMsg_ScriptedPrint_Params; | 22 struct PrintHostMsg_ScriptedPrint_Params; |
23 struct PrintMsg_PrintPages_Params; | 23 struct PrintMsg_PrintPages_Params; |
24 struct PrintMsg_Print_Params; | 24 struct PrintMsg_Print_Params; |
25 | 25 |
26 // Extends content::MockRenderThread to know about printing and | 26 // Extends content::MockRenderThread to know about printing and |
27 // extension messages. | 27 // extension messages. |
28 class ChromeMockRenderThread : public content::MockRenderThread { | 28 class ChromeMockRenderThread : public content::MockRenderThread { |
29 public: | 29 public: |
30 ChromeMockRenderThread(); | 30 ChromeMockRenderThread(); |
31 virtual ~ChromeMockRenderThread(); | 31 ~ChromeMockRenderThread() override; |
32 | 32 |
33 // content::RenderThread overrides. | 33 // content::RenderThread overrides. |
34 virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() | 34 scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() override; |
35 override; | |
36 | 35 |
37 ////////////////////////////////////////////////////////////////////////// | 36 ////////////////////////////////////////////////////////////////////////// |
38 // The following functions are called by the test itself. | 37 // The following functions are called by the test itself. |
39 | 38 |
40 // Set IO message loop proxy. | 39 // Set IO message loop proxy. |
41 void set_io_message_loop_proxy( | 40 void set_io_message_loop_proxy( |
42 const scoped_refptr<base::MessageLoopProxy>& proxy); | 41 const scoped_refptr<base::MessageLoopProxy>& proxy); |
43 | 42 |
44 #if defined(ENABLE_PRINTING) | 43 #if defined(ENABLE_PRINTING) |
45 // Returns the pseudo-printer instance. | 44 // Returns the pseudo-printer instance. |
46 MockPrinter* printer(); | 45 MockPrinter* printer(); |
47 | 46 |
48 // Call with |response| set to true if the user wants to print. | 47 // Call with |response| set to true if the user wants to print. |
49 // False if the user decides to cancel. | 48 // False if the user decides to cancel. |
50 void set_print_dialog_user_response(bool response); | 49 void set_print_dialog_user_response(bool response); |
51 | 50 |
52 // Cancel print preview when print preview has |page| remaining pages. | 51 // Cancel print preview when print preview has |page| remaining pages. |
53 void set_print_preview_cancel_page_number(int page); | 52 void set_print_preview_cancel_page_number(int page); |
54 | 53 |
55 // Get the number of pages to generate for print preview. | 54 // Get the number of pages to generate for print preview. |
56 int print_preview_pages_remaining() const; | 55 int print_preview_pages_remaining() const; |
57 #endif | 56 #endif |
58 | 57 |
59 private: | 58 private: |
60 // Overrides base class implementation to add custom handling for | 59 // Overrides base class implementation to add custom handling for |
61 // print and extensions. | 60 // print and extensions. |
62 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 61 bool OnMessageReceived(const IPC::Message& msg) override; |
63 | 62 |
64 #if defined(ENABLE_EXTENSIONS) | 63 #if defined(ENABLE_EXTENSIONS) |
65 // The callee expects to be returned a valid channel_id. | 64 // The callee expects to be returned a valid channel_id. |
66 void OnOpenChannelToExtension(int routing_id, | 65 void OnOpenChannelToExtension(int routing_id, |
67 const ExtensionMsg_ExternalConnectionInfo& info, | 66 const ExtensionMsg_ExternalConnectionInfo& info, |
68 const std::string& channel_name, | 67 const std::string& channel_name, |
69 bool include_tls_channel_id, | 68 bool include_tls_channel_id, |
70 int* port_id); | 69 int* port_id); |
71 #endif | 70 #endif |
72 | 71 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Number of pages to generate for print preview. | 113 // Number of pages to generate for print preview. |
115 int print_preview_pages_remaining_; | 114 int print_preview_pages_remaining_; |
116 #endif | 115 #endif |
117 | 116 |
118 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 117 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
119 | 118 |
120 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread); | 119 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread); |
121 }; | 120 }; |
122 | 121 |
123 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 122 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
OLD | NEW |