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/renderer/browser_plugin/mock_browser_plugin_manager.h" | 5 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "content/common/browser_plugin/browser_plugin_messages.h" | 8 #include "content/common/browser_plugin/browser_plugin_messages.h" |
9 #include "content/renderer/browser_plugin/mock_browser_plugin.h" | 9 #include "content/renderer/browser_plugin/mock_browser_plugin.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 FROM_HERE, | 34 FROM_HERE, |
35 base::Bind(&MockBrowserPluginManager::AllocateInstanceIDACK, | 35 base::Bind(&MockBrowserPluginManager::AllocateInstanceIDACK, |
36 this, | 36 this, |
37 browser_plugin.get(), | 37 browser_plugin.get(), |
38 guest_instance_id)); | 38 guest_instance_id)); |
39 } | 39 } |
40 | 40 |
41 void MockBrowserPluginManager::AllocateInstanceIDACK( | 41 void MockBrowserPluginManager::AllocateInstanceIDACK( |
42 BrowserPlugin* browser_plugin, | 42 BrowserPlugin* browser_plugin, |
43 int guest_instance_id) { | 43 int guest_instance_id) { |
44 browser_plugin->OnInstanceIDAllocated(guest_instance_id); | |
45 scoped_ptr<base::DictionaryValue> extra_params(new base::DictionaryValue()); | 44 scoped_ptr<base::DictionaryValue> extra_params(new base::DictionaryValue()); |
46 browser_plugin->Attach(extra_params.Pass()); | 45 browser_plugin->Attach(guest_instance_id, extra_params.Pass()); |
47 } | 46 } |
48 | 47 |
49 bool MockBrowserPluginManager::Send(IPC::Message* msg) { | 48 bool MockBrowserPluginManager::Send(IPC::Message* msg) { |
50 // This is a copy-and-paste from MockRenderThread::Send. | 49 // This is a copy-and-paste from MockRenderThread::Send. |
51 // We need to simulate a synchronous channel, thus we are going to receive | 50 // We need to simulate a synchronous channel, thus we are going to receive |
52 // through this function messages, messages with reply and reply messages. | 51 // through this function messages, messages with reply and reply messages. |
53 // We can only handle one synchronous message at a time. | 52 // We can only handle one synchronous message at a time. |
54 if (msg->is_reply()) { | 53 if (msg->is_reply()) { |
55 if (reply_deserializer_) { | 54 if (reply_deserializer_) { |
56 reply_deserializer_->SerializeOutputParameters(*msg); | 55 reply_deserializer_->SerializeOutputParameters(*msg); |
(...skipping 13 matching lines...) Expand all Loading... |
70 } | 69 } |
71 | 70 |
72 bool MockBrowserPluginManager::OnMessageReceived( | 71 bool MockBrowserPluginManager::OnMessageReceived( |
73 const IPC::Message& message) { | 72 const IPC::Message& message) { |
74 // Save the message in the sink. | 73 // Save the message in the sink. |
75 sink_.OnMessageReceived(message); | 74 sink_.OnMessageReceived(message); |
76 return false; | 75 return false; |
77 } | 76 } |
78 | 77 |
79 } // namespace content | 78 } // namespace content |
OLD | NEW |