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 15 matching lines...) Expand all Loading... |
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 virtual ~ChromeMockRenderThread(); |
32 | 32 |
33 ////////////////////////////////////////////////////////////////////////// | 33 ////////////////////////////////////////////////////////////////////////// |
34 // The following functions are called by the test itself. | 34 // The following functions are called by the test itself. |
35 | 35 |
| 36 #if defined(ENABLE_PRINTING) |
36 // Returns the pseudo-printer instance. | 37 // Returns the pseudo-printer instance. |
37 MockPrinter* printer(); | 38 MockPrinter* printer(); |
38 | 39 |
39 // Call with |response| set to true if the user wants to print. | 40 // Call with |response| set to true if the user wants to print. |
40 // False if the user decides to cancel. | 41 // False if the user decides to cancel. |
41 void set_print_dialog_user_response(bool response); | 42 void set_print_dialog_user_response(bool response); |
42 | 43 |
43 // Cancel print preview when print preview has |page| remaining pages. | 44 // Cancel print preview when print preview has |page| remaining pages. |
44 void set_print_preview_cancel_page_number(int page); | 45 void set_print_preview_cancel_page_number(int page); |
45 | 46 |
46 // Get the number of pages to generate for print preview. | 47 // Get the number of pages to generate for print preview. |
47 int print_preview_pages_remaining() const; | 48 int print_preview_pages_remaining() const; |
| 49 #endif |
48 | 50 |
49 private: | 51 private: |
50 // Overrides base class implementation to add custom handling for | 52 // Overrides base class implementation to add custom handling for |
51 // print and extensions. | 53 // print and extensions. |
52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 54 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
53 | 55 |
54 // The callee expects to be returned a valid channel_id. | 56 // The callee expects to be returned a valid channel_id. |
55 void OnOpenChannelToExtension(int routing_id, | 57 void OnOpenChannelToExtension(int routing_id, |
56 const ExtensionMsg_ExternalConnectionInfo& info, | 58 const ExtensionMsg_ExternalConnectionInfo& info, |
57 const std::string& channel_name, | 59 const std::string& channel_name, |
58 int* port_id); | 60 int* port_id); |
59 | 61 |
| 62 #if defined(ENABLE_PRINTING) |
60 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
61 void OnAllocateTempFileForPrinting(base::FileDescriptor* renderer_fd, | 64 void OnAllocateTempFileForPrinting(base::FileDescriptor* renderer_fd, |
62 int* browser_fd); | 65 int* browser_fd); |
63 void OnTempFileForPrintingWritten(int render_view_id, int browser_fd); | 66 void OnTempFileForPrintingWritten(int render_view_id, int browser_fd); |
64 #endif | 67 #endif |
65 | 68 |
66 // PrintWebViewHelper expects default print settings. | 69 // PrintWebViewHelper expects default print settings. |
67 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); | 70 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); |
68 | 71 |
69 // PrintWebViewHelper expects final print settings from the user. | 72 // PrintWebViewHelper expects final print settings from the user. |
(...skipping 20 matching lines...) Expand all Loading... |
90 | 93 |
91 // True to simulate user clicking print. False to cancel. | 94 // True to simulate user clicking print. False to cancel. |
92 bool print_dialog_user_response_; | 95 bool print_dialog_user_response_; |
93 | 96 |
94 // Simulates cancelling print preview if |print_preview_pages_remaining_| | 97 // Simulates cancelling print preview if |print_preview_pages_remaining_| |
95 // equals this. | 98 // equals this. |
96 int print_preview_cancel_page_number_; | 99 int print_preview_cancel_page_number_; |
97 | 100 |
98 // Number of pages to generate for print preview. | 101 // Number of pages to generate for print preview. |
99 int print_preview_pages_remaining_; | 102 int print_preview_pages_remaining_; |
| 103 #endif |
| 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(ChromeMockRenderThread); |
100 }; | 106 }; |
101 | 107 |
102 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ | 108 #endif // CHROME_RENDERER_CHROME_MOCK_RENDER_THREAD_H_ |
OLD | NEW |