| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "cc/test/test_shared_bitmap_manager.h" | 11 #include "cc/test/test_shared_bitmap_manager.h" |
| 12 #include "content/public/renderer/render_thread.h" | 12 #include "content/public/renderer/render_thread.h" |
| 13 #include "ipc/ipc_test_sink.h" | 13 #include "ipc/ipc_test_sink.h" |
| 14 #include "ipc/message_filter.h" | 14 #include "ipc/message_filter.h" |
| 15 #include "third_party/WebKit/public/web/WebPopupType.h" | 15 #include "third_party/WebKit/public/web/WebPopupType.h" |
| 16 | 16 |
| 17 struct ViewHostMsg_CreateWindow_Params; | 17 struct ViewHostMsg_CreateWindow_Params; |
| 18 struct ViewHostMsg_CreateWindow_Reply; | 18 struct ViewHostMsg_CreateWindow_Reply; |
| 19 | 19 |
| 20 namespace IPC { | 20 namespace IPC { |
| 21 class MessageFilter; | 21 class MessageFilter; |
| 22 class MessageReplyDeserializer; | 22 class MessageReplyDeserializer; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace blink { | 25 namespace blink { |
| 26 enum class WebSandboxFlags; | 26 enum class WebSandboxFlags; |
| 27 enum class WebTreeScopeType; | 27 enum class WebTreeScopeType; |
| 28 struct WebFrameOwnerProperties; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 // This class is a very simple mock of RenderThread. It simulates an IPC channel | 33 // This class is a very simple mock of RenderThread. It simulates an IPC channel |
| 33 // which supports only three messages: | 34 // which supports only three messages: |
| 34 // ViewHostMsg_CreateWidget : sync message sent by the Widget. | 35 // ViewHostMsg_CreateWidget : sync message sent by the Widget. |
| 35 // ViewHostMsg_CreateWindow : sync message sent by the Widget. | 36 // ViewHostMsg_CreateWindow : sync message sent by the Widget. |
| 36 // ViewMsg_Close : async, send to the Widget. | 37 // ViewMsg_Close : async, send to the Widget. |
| 37 class MockRenderThread : public RenderThread { | 38 class MockRenderThread : public RenderThread { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 blink::WebPopupType popup_type, | 123 blink::WebPopupType popup_type, |
| 123 int* route_id); | 124 int* route_id); |
| 124 | 125 |
| 125 // The View expects to be returned a valid |reply.route_id| different from its | 126 // The View expects to be returned a valid |reply.route_id| different from its |
| 126 // own. We do not keep track of the newly created widget in MockRenderThread, | 127 // own. We do not keep track of the newly created widget in MockRenderThread, |
| 127 // so it must be cleaned up on its own. | 128 // so it must be cleaned up on its own. |
| 128 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params, | 129 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params, |
| 129 ViewHostMsg_CreateWindow_Reply* reply); | 130 ViewHostMsg_CreateWindow_Reply* reply); |
| 130 | 131 |
| 131 // The Frame expects to be returned a valid route_id different from its own. | 132 // The Frame expects to be returned a valid route_id different from its own. |
| 132 void OnCreateChildFrame(int new_frame_routing_id, | 133 void OnCreateChildFrame( |
| 133 blink::WebTreeScopeType scope, | 134 int new_frame_routing_id, |
| 134 const std::string& frame_name, | 135 blink::WebTreeScopeType scope, |
| 135 blink::WebSandboxFlags sandbox_flags, | 136 const std::string& frame_name, |
| 136 int* new_render_frame_id); | 137 blink::WebSandboxFlags sandbox_flags, |
| 138 const blink::WebFrameOwnerProperties& frame_owner_properties, |
| 139 int* new_render_frame_id); |
| 137 | 140 |
| 138 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 139 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, | 142 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, |
| 140 base::SharedMemoryHandle* browser_handle); | 143 base::SharedMemoryHandle* browser_handle); |
| 141 #endif | 144 #endif |
| 142 | 145 |
| 143 IPC::TestSink sink_; | 146 IPC::TestSink sink_; |
| 144 | 147 |
| 145 // Routing id what will be assigned to the Widget. | 148 // Routing id what will be assigned to the Widget. |
| 146 int32 routing_id_; | 149 int32 routing_id_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 162 | 165 |
| 163 // Observers to notify. | 166 // Observers to notify. |
| 164 base::ObserverList<RenderProcessObserver> observers_; | 167 base::ObserverList<RenderProcessObserver> observers_; |
| 165 | 168 |
| 166 cc::TestSharedBitmapManager shared_bitmap_manager_; | 169 cc::TestSharedBitmapManager shared_bitmap_manager_; |
| 167 }; | 170 }; |
| 168 | 171 |
| 169 } // namespace content | 172 } // namespace content |
| 170 | 173 |
| 171 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ | 174 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |