| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/common/ipc_test_sink.h" | 11 #include "chrome/common/ipc_test_sink.h" |
| 12 #include "chrome/renderer/mock_printer.h" | 12 #include "chrome/renderer/mock_printer.h" |
| 13 #include "chrome/renderer/render_thread.h" | 13 #include "chrome/renderer/render_thread.h" |
| 14 | 14 |
| 15 struct ViewMsg_Print_Params; | 15 struct ViewMsg_Print_Params; |
| 16 struct ViewMsg_PrintPages_Params; | 16 struct ViewMsg_PrintPages_Params; |
| 17 struct ViewHostMsg_ScriptedPrint_Params; |
| 17 | 18 |
| 18 // This class is very simple mock of RenderThread. It simulates an IPC channel | 19 // This class is very simple mock of RenderThread. It simulates an IPC channel |
| 19 // which supports only two messages: | 20 // which supports only two messages: |
| 20 // ViewHostMsg_CreateWidget : sync message sent by the Widget. | 21 // ViewHostMsg_CreateWidget : sync message sent by the Widget. |
| 21 // ViewMsg_Close : async, send to the Widget. | 22 // ViewMsg_Close : async, send to the Widget. |
| 22 class MockRenderThread : public RenderThreadBase { | 23 class MockRenderThread : public RenderThreadBase { |
| 23 public: | 24 public: |
| 24 MockRenderThread(); | 25 MockRenderThread(); |
| 25 virtual ~MockRenderThread(); | 26 virtual ~MockRenderThread(); |
| 26 | 27 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const std::string& extension_id, | 83 const std::string& extension_id, |
| 83 int* channel_id); | 84 int* channel_id); |
| 84 | 85 |
| 85 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, | 86 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, |
| 86 base::SharedMemoryHandle* browser_handle); | 87 base::SharedMemoryHandle* browser_handle); |
| 87 | 88 |
| 88 // The RenderView expects default print settings. | 89 // The RenderView expects default print settings. |
| 89 void OnGetDefaultPrintSettings(ViewMsg_Print_Params* setting); | 90 void OnGetDefaultPrintSettings(ViewMsg_Print_Params* setting); |
| 90 | 91 |
| 91 // The RenderView expects final print settings from the user. | 92 // The RenderView expects final print settings from the user. |
| 92 void OnScriptedPrint(gfx::NativeViewId host_window, | 93 void OnScriptedPrint(const ViewHostMsg_ScriptedPrint_Params& params, |
| 93 int cookie, | |
| 94 int expected_pages_count, | |
| 95 bool has_selection, | |
| 96 ViewMsg_PrintPages_Params* settings); | 94 ViewMsg_PrintPages_Params* settings); |
| 97 | 95 |
| 98 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 96 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
| 99 void OnDidPrintPage(const ViewHostMsg_DidPrintPage_Params& params); | 97 void OnDidPrintPage(const ViewHostMsg_DidPrintPage_Params& params); |
| 100 | 98 |
| 101 IPC::TestSink sink_; | 99 IPC::TestSink sink_; |
| 102 | 100 |
| 103 // Routing id what will be assigned to the Widget. | 101 // Routing id what will be assigned to the Widget. |
| 104 int32 routing_id_; | 102 int32 routing_id_; |
| 105 | 103 |
| 106 // Opener id reported by the Widget. | 104 // Opener id reported by the Widget. |
| 107 int32 opener_id_; | 105 int32 opener_id_; |
| 108 | 106 |
| 109 // We only keep track of one Widget, we learn its pointer when it | 107 // We only keep track of one Widget, we learn its pointer when it |
| 110 // adds a new route. | 108 // adds a new route. |
| 111 IPC::Channel::Listener* widget_; | 109 IPC::Channel::Listener* widget_; |
| 112 | 110 |
| 113 // The last known good deserializer for sync messages. | 111 // The last known good deserializer for sync messages. |
| 114 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 112 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
| 115 | 113 |
| 116 // A mock printer device used for printing tests. | 114 // A mock printer device used for printing tests. |
| 117 scoped_ptr<MockPrinter> printer_; | 115 scoped_ptr<MockPrinter> printer_; |
| 118 }; | 116 }; |
| 119 | 117 |
| 120 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 118 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |