| 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 |
| 11 #include "chrome/common/extensions/extension_set.h" | 11 #include "chrome/common/extensions/extension_set.h" |
| 12 #include "chrome/renderer/mock_printer.h" | 12 #include "chrome/renderer/mock_printer.h" |
| 13 #include "content/renderer/render_thread.h" | 13 #include "content/renderer/render_thread.h" |
| 14 #include "ipc/ipc_test_sink.h" | 14 #include "ipc/ipc_test_sink.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
| 16 | 16 |
| 17 namespace IPC { | 17 namespace IPC { |
| 18 class MessageReplyDeserializer; | 18 class MessageReplyDeserializer; |
| 19 } | 19 } |
| 20 | 20 |
| 21 struct PrintMsg_Print_Params; | 21 struct PrintHostMsg_DidGetPreviewPageCount_Params; |
| 22 struct PrintMsg_PrintPages_Params; | |
| 23 struct PrintHostMsg_DidPreviewPage_Params; | 22 struct PrintHostMsg_DidPreviewPage_Params; |
| 24 struct PrintHostMsg_ScriptedPrint_Params; | 23 struct PrintHostMsg_ScriptedPrint_Params; |
| 24 struct PrintMsg_PrintPages_Params; |
| 25 struct PrintMsg_Print_Params; |
| 25 | 26 |
| 26 // This class is very simple mock of RenderThread. It simulates an IPC channel | 27 // This class is very simple mock of RenderThread. It simulates an IPC channel |
| 27 // which supports only two messages: | 28 // which supports only two messages: |
| 28 // ViewHostMsg_CreateWidget : sync message sent by the Widget. | 29 // ViewHostMsg_CreateWidget : sync message sent by the Widget. |
| 29 // ViewMsg_Close : async, send to the Widget. | 30 // ViewMsg_Close : async, send to the Widget. |
| 30 class MockRenderThread : public RenderThreadBase { | 31 class MockRenderThread : public RenderThreadBase { |
| 31 public: | 32 public: |
| 32 MockRenderThread(); | 33 MockRenderThread(); |
| 33 virtual ~MockRenderThread(); | 34 virtual ~MockRenderThread(); |
| 34 | 35 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // PrintWebViewHelper expects default print settings. | 120 // PrintWebViewHelper expects default print settings. |
| 120 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); | 121 void OnGetDefaultPrintSettings(PrintMsg_Print_Params* setting); |
| 121 | 122 |
| 122 // PrintWebViewHelper expects final print settings from the user. | 123 // PrintWebViewHelper expects final print settings from the user. |
| 123 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, | 124 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, |
| 124 PrintMsg_PrintPages_Params* settings); | 125 PrintMsg_PrintPages_Params* settings); |
| 125 | 126 |
| 126 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 127 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
| 127 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 128 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
| 128 void OnDidGetPreviewPageCount(int document_cookie, int number_pages, | 129 void OnDidGetPreviewPageCount( |
| 129 bool is_modifiable); | 130 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 130 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); | 131 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); |
| 131 | 132 |
| 132 // For print preview, PrintWebViewHelper will update settings. | 133 // For print preview, PrintWebViewHelper will update settings. |
| 133 void OnUpdatePrintSettings(int document_cookie, | 134 void OnUpdatePrintSettings(int document_cookie, |
| 134 const DictionaryValue& job_settings, | 135 const DictionaryValue& job_settings, |
| 135 PrintMsg_PrintPages_Params* params); | 136 PrintMsg_PrintPages_Params* params); |
| 136 | 137 |
| 137 IPC::TestSink sink_; | 138 IPC::TestSink sink_; |
| 138 | 139 |
| 139 // Routing id what will be assigned to the Widget. | 140 // Routing id what will be assigned to the Widget. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 153 scoped_ptr<MockPrinter> printer_; | 154 scoped_ptr<MockPrinter> printer_; |
| 154 | 155 |
| 155 // True to simulate user clicking print. False to cancel. | 156 // True to simulate user clicking print. False to cancel. |
| 156 bool print_dialog_user_response_; | 157 bool print_dialog_user_response_; |
| 157 | 158 |
| 158 // Number of pages to generate for print preview. | 159 // Number of pages to generate for print preview. |
| 159 int print_preview_pages_remaining_; | 160 int print_preview_pages_remaining_; |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 163 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |