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_MOCK_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
6 #define CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // state. | 76 // state. |
77 void SendCloseMessage(); | 77 void SendCloseMessage(); |
78 | 78 |
79 // Returns the pseudo-printer instance. | 79 // Returns the pseudo-printer instance. |
80 MockPrinter* printer() const { return printer_.get(); } | 80 MockPrinter* printer() const { return printer_.get(); } |
81 | 81 |
82 // Call with |response| set to true if the user wants to print. | 82 // Call with |response| set to true if the user wants to print. |
83 // False if the user decides to cancel. | 83 // False if the user decides to cancel. |
84 void set_print_dialog_user_response(bool response); | 84 void set_print_dialog_user_response(bool response); |
85 | 85 |
86 // Set to true to simulate canceling of a print preview. | 86 // Get the number of pages to generate for print preview. |
87 void set_cancel_print_preview(bool cancel); | 87 int print_preview_pages_remaining(); |
88 | 88 |
89 private: | 89 private: |
90 // This function operates as a regular IPC listener. | 90 // This function operates as a regular IPC listener. |
91 bool OnMessageReceived(const IPC::Message& msg); | 91 bool OnMessageReceived(const IPC::Message& msg); |
92 | 92 |
93 // The Widget expects to be returned valid route_id. | 93 // The Widget expects to be returned valid route_id. |
94 void OnMsgCreateWidget(int opener_id, | 94 void OnMsgCreateWidget(int opener_id, |
95 WebKit::WebPopupType popup_type, | 95 WebKit::WebPopupType popup_type, |
96 int* route_id); | 96 int* route_id); |
97 | 97 |
(...skipping 19 matching lines...) Expand all Loading... |
117 | 117 |
118 // PrintWebViewHelper expects default print settings. | 118 // PrintWebViewHelper expects default print settings. |
119 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); | 119 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); |
120 | 120 |
121 // PrintWebViewHelper expects final print settings from the user. | 121 // PrintWebViewHelper expects final print settings from the user. |
122 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, | 122 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, |
123 PrintMsg_PrintPages_Params* settings); | 123 PrintMsg_PrintPages_Params* settings); |
124 | 124 |
125 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 125 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
126 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 126 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
127 void OnDidPreviewPage(int page_number, bool* cancel); | 127 void OnDidGetPreviewPageCount(int document_cookie, int number_pages); |
| 128 void OnDidPreviewPage(int page_number); |
128 | 129 |
129 // For print preview, PrintWebViewHelper will update settings. | 130 // For print preview, PrintWebViewHelper will update settings. |
130 void OnUpdatePrintSettings(int document_cookie, | 131 void OnUpdatePrintSettings(int document_cookie, |
131 const DictionaryValue& job_settings, | 132 const DictionaryValue& job_settings, |
132 PrintMsg_PrintPages_Params* params); | 133 PrintMsg_PrintPages_Params* params); |
133 | 134 |
134 IPC::TestSink sink_; | 135 IPC::TestSink sink_; |
135 | 136 |
136 // Routing id what will be assigned to the Widget. | 137 // Routing id what will be assigned to the Widget. |
137 int32 routing_id_; | 138 int32 routing_id_; |
138 | 139 |
139 // Opener id reported by the Widget. | 140 // Opener id reported by the Widget. |
140 int32 opener_id_; | 141 int32 opener_id_; |
141 | 142 |
142 // We only keep track of one Widget, we learn its pointer when it | 143 // We only keep track of one Widget, we learn its pointer when it |
143 // adds a new route. | 144 // adds a new route. |
144 IPC::Channel::Listener* widget_; | 145 IPC::Channel::Listener* widget_; |
145 | 146 |
146 // The last known good deserializer for sync messages. | 147 // The last known good deserializer for sync messages. |
147 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 148 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
148 | 149 |
149 // A mock printer device used for printing tests. | 150 // A mock printer device used for printing tests. |
150 scoped_ptr<MockPrinter> printer_; | 151 scoped_ptr<MockPrinter> printer_; |
151 | 152 |
152 // True to simulate user clicking print. False to cancel. | 153 // True to simulate user clicking print. False to cancel. |
153 bool print_dialog_user_response_; | 154 bool print_dialog_user_response_; |
154 | 155 |
155 // True to simulate cancelling a print preview. | 156 // Number of pages to generate for print preview. |
156 bool cancel_print_preview_; | 157 int print_preview_pages_remaining_; |
157 }; | 158 }; |
158 | 159 |
159 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 160 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
OLD | NEW |