| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer/extensions/extension_renderer_info.h" |
| 11 #include "chrome/renderer/mock_printer.h" | 12 #include "chrome/renderer/mock_printer.h" |
| 12 #include "chrome/renderer/render_thread.h" | 13 #include "chrome/renderer/render_thread.h" |
| 13 #include "ipc/ipc_test_sink.h" | 14 #include "ipc/ipc_test_sink.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
| 15 | 16 |
| 16 namespace IPC { | 17 namespace IPC { |
| 17 class MessageReplyDeserializer; | 18 class MessageReplyDeserializer; |
| 18 } | 19 } |
| 19 | 20 |
| 20 struct ViewMsg_Print_Params; | 21 struct ViewMsg_Print_Params; |
| 21 struct ViewMsg_PrintPages_Params; | 22 struct ViewMsg_PrintPages_Params; |
| 22 struct ViewHostMsg_ScriptedPrint_Params; | 23 struct ViewHostMsg_ScriptedPrint_Params; |
| 23 | 24 |
| 24 // This class is very simple mock of RenderThread. It simulates an IPC channel | 25 // This class is very simple mock of RenderThread. It simulates an IPC channel |
| 25 // which supports only two messages: | 26 // which supports only two messages: |
| 26 // ViewHostMsg_CreateWidget : sync message sent by the Widget. | 27 // ViewHostMsg_CreateWidget : sync message sent by the Widget. |
| 27 // ViewMsg_Close : async, send to the Widget. | 28 // ViewMsg_Close : async, send to the Widget. |
| 28 class MockRenderThread : public RenderThreadBase { | 29 class MockRenderThread : public RenderThreadBase { |
| 29 public: | 30 public: |
| 30 MockRenderThread(); | 31 MockRenderThread(); |
| 31 virtual ~MockRenderThread(); | 32 virtual ~MockRenderThread(); |
| 32 | 33 |
| 34 virtual const ExtensionRendererInfo* GetExtensions() const; |
| 35 |
| 33 // Provides access to the messages that have been received by this thread. | 36 // Provides access to the messages that have been received by this thread. |
| 34 IPC::TestSink& sink() { return sink_; } | 37 IPC::TestSink& sink() { return sink_; } |
| 35 | 38 |
| 36 // Called by the Widget. The routing_id must match the routing id assigned | 39 // Called by the Widget. The routing_id must match the routing id assigned |
| 37 // to the Widget in reply to ViewHostMsg_CreateWidget message. | 40 // to the Widget in reply to ViewHostMsg_CreateWidget message. |
| 38 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 41 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 39 | 42 |
| 40 // Called by the Widget. The routing id must match the routing id of AddRoute. | 43 // Called by the Widget. The routing id must match the routing id of AddRoute. |
| 41 virtual void RemoveRoute(int32 routing_id); | 44 virtual void RemoveRoute(int32 routing_id); |
| 42 | 45 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // We only keep track of one Widget, we learn its pointer when it | 135 // We only keep track of one Widget, we learn its pointer when it |
| 133 // adds a new route. | 136 // adds a new route. |
| 134 IPC::Channel::Listener* widget_; | 137 IPC::Channel::Listener* widget_; |
| 135 | 138 |
| 136 // The last known good deserializer for sync messages. | 139 // The last known good deserializer for sync messages. |
| 137 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 140 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
| 138 | 141 |
| 139 // A mock printer device used for printing tests. | 142 // A mock printer device used for printing tests. |
| 140 scoped_ptr<MockPrinter> printer_; | 143 scoped_ptr<MockPrinter> printer_; |
| 141 | 144 |
| 145 // Contains extensions currently loaded by browser. This is usually empty |
| 146 // for MockRenderThread. |
| 147 ExtensionRendererInfo extensions_; |
| 148 |
| 142 bool is_extension_process_; | 149 bool is_extension_process_; |
| 143 }; | 150 }; |
| 144 | 151 |
| 145 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 152 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |