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 #include "content/public/test/mock_render_thread.h" | 5 #include "content/public/test/mock_render_thread.h" |
6 | 6 |
7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 // Called by the Widget. Used to send messages to the browser. | 34 // Called by the Widget. Used to send messages to the browser. |
35 // We short-circuit the mechanism and handle the messages right here on this | 35 // We short-circuit the mechanism and handle the messages right here on this |
36 // class. | 36 // class. |
37 bool MockRenderThread::Send(IPC::Message* msg) { | 37 bool MockRenderThread::Send(IPC::Message* msg) { |
38 // We need to simulate a synchronous channel, thus we are going to receive | 38 // We need to simulate a synchronous channel, thus we are going to receive |
39 // through this function messages, messages with reply and reply messages. | 39 // through this function messages, messages with reply and reply messages. |
40 // We can only handle one synchronous message at a time. | 40 // We can only handle one synchronous message at a time. |
41 if (msg->is_reply()) { | 41 if (msg->is_reply()) { |
42 if (reply_deserializer_.get()) { | 42 if (reply_deserializer_) { |
43 reply_deserializer_->SerializeOutputParameters(*msg); | 43 reply_deserializer_->SerializeOutputParameters(*msg); |
44 reply_deserializer_.reset(); | 44 reply_deserializer_.reset(); |
45 } | 45 } |
46 } else { | 46 } else { |
47 if (msg->is_sync()) { | 47 if (msg->is_sync()) { |
48 // We actually need to handle deleting the reply deserializer for sync | 48 // We actually need to handle deleting the reply deserializer for sync |
49 // messages. | 49 // messages. |
50 reply_deserializer_.reset( | 50 reply_deserializer_.reset( |
51 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer()); | 51 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer()); |
52 } | 52 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void MockRenderThread::OnDuplicateSection( | 233 void MockRenderThread::OnDuplicateSection( |
234 base::SharedMemoryHandle renderer_handle, | 234 base::SharedMemoryHandle renderer_handle, |
235 base::SharedMemoryHandle* browser_handle) { | 235 base::SharedMemoryHandle* browser_handle) { |
236 // We don't have to duplicate the input handles since RenderViewTest does not | 236 // We don't have to duplicate the input handles since RenderViewTest does not |
237 // separate a browser process from a renderer process. | 237 // separate a browser process from a renderer process. |
238 *browser_handle = renderer_handle; | 238 *browser_handle = renderer_handle; |
239 } | 239 } |
240 #endif // defined(OS_WIN) | 240 #endif // defined(OS_WIN) |
241 | 241 |
242 } // namespace content | 242 } // namespace content |
OLD | NEW |