| OLD | NEW |
| 1 // Copyright (c) 2008 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 <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "chrome/common/ipc_test_sink.h" | 11 #include "chrome/common/ipc_test_sink.h" |
| 11 #include "chrome/renderer/render_thread.h" | 12 #include "chrome/renderer/render_thread.h" |
| 12 | 13 |
| 14 struct ViewMsg_Print_Params; |
| 15 struct ViewMsg_PrintPages_Params; |
| 16 |
| 13 // This class is very simple mock of RenderThread. It simulates an IPC channel | 17 // This class is very simple mock of RenderThread. It simulates an IPC channel |
| 14 // which supports only two messages: | 18 // which supports only two messages: |
| 15 // ViewHostMsg_CreateWidget : sync message sent by the Widget. | 19 // ViewHostMsg_CreateWidget : sync message sent by the Widget. |
| 16 // ViewMsg_Close : async, send to the Widget. | 20 // ViewMsg_Close : async, send to the Widget. |
| 17 class MockRenderThread : public RenderThreadBase { | 21 class MockRenderThread : public RenderThreadBase { |
| 18 public: | 22 public: |
| 19 MockRenderThread(); | 23 MockRenderThread(); |
| 20 virtual ~MockRenderThread(); | 24 virtual ~MockRenderThread(); |
| 21 | 25 |
| 22 // Provides access to the messages that have been received by this thread. | 26 // Provides access to the messages that have been received by this thread. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 70 |
| 67 // The Widget expects to be returned valid route_id. | 71 // The Widget expects to be returned valid route_id. |
| 68 void OnMsgCreateWidget(int opener_id, | 72 void OnMsgCreateWidget(int opener_id, |
| 69 bool activatable, | 73 bool activatable, |
| 70 int* route_id); | 74 int* route_id); |
| 71 | 75 |
| 72 // The callee expects to be returned a valid channel_id. | 76 // The callee expects to be returned a valid channel_id. |
| 73 void OnMsgOpenChannelToExtension(const std::string& extension_id, | 77 void OnMsgOpenChannelToExtension(const std::string& extension_id, |
| 74 int* channel_id); | 78 int* channel_id); |
| 75 | 79 |
| 80 // The RenderView expects default print settings. |
| 81 void OnGetDefaultPrintSettings(ViewMsg_Print_Params* setting); |
| 82 |
| 83 // The RenderView expects final print settings from the user. |
| 84 void OnScriptedPrint(gfx::NativeViewId host_window, |
| 85 int cookie, |
| 86 int expected_pages_count, |
| 87 ViewMsg_PrintPages_Params* settings); |
| 88 |
| 76 IPC::TestSink sink_; | 89 IPC::TestSink sink_; |
| 77 | 90 |
| 78 // Routing id what will be assigned to the Widget. | 91 // Routing id what will be assigned to the Widget. |
| 79 int32 routing_id_; | 92 int32 routing_id_; |
| 80 | 93 |
| 81 // Opener id reported by the Widget. | 94 // Opener id reported by the Widget. |
| 82 int32 opener_id_; | 95 int32 opener_id_; |
| 83 | 96 |
| 84 // We only keep track of one Widget, we learn its pointer when it | 97 // We only keep track of one Widget, we learn its pointer when it |
| 85 // adds a new route. | 98 // adds a new route. |
| 86 IPC::Channel::Listener* widget_; | 99 IPC::Channel::Listener* widget_; |
| 87 | 100 |
| 88 // The last known good deserializer for sync messages. | 101 // The last known good deserializer for sync messages. |
| 89 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 102 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
| 90 }; | 103 }; |
| 91 | 104 |
| 92 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 105 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |