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 "ppapi/proxy/resource_message_test_sink.h" | 5 #include "ppapi/proxy/resource_message_test_sink.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <tuple> | 9 #include <tuple> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 ResourceMessageTestSink::ResourceMessageTestSink() { | 43 ResourceMessageTestSink::ResourceMessageTestSink() { |
44 } | 44 } |
45 | 45 |
46 ResourceMessageTestSink::~ResourceMessageTestSink() { | 46 ResourceMessageTestSink::~ResourceMessageTestSink() { |
47 } | 47 } |
48 | 48 |
49 bool ResourceMessageTestSink::Send(IPC::Message* msg) { | 49 bool ResourceMessageTestSink::Send(IPC::Message* msg) { |
50 int message_id = 0; | 50 int message_id = 0; |
51 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer; | 51 std::unique_ptr<IPC::MessageReplyDeserializer> reply_deserializer; |
52 if (msg->is_sync()) { | 52 if (msg->is_sync()) { |
53 reply_deserializer.reset( | 53 reply_deserializer.reset( |
54 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer()); | 54 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer()); |
55 message_id = IPC::SyncMessage::GetMessageId(*msg); | 55 message_id = IPC::SyncMessage::GetMessageId(*msg); |
56 } | 56 } |
57 bool result = IPC::TestSink::Send(msg); // Deletes |msg|. | 57 bool result = IPC::TestSink::Send(msg); // Deletes |msg|. |
58 if (sync_reply_msg_.get()) { | 58 if (sync_reply_msg_.get()) { |
59 // |sync_reply_msg_| should always be a reply to the pending sync message. | 59 // |sync_reply_msg_| should always be a reply to the pending sync message. |
60 DCHECK(IPC::SyncMessage::IsMessageReplyTo(*sync_reply_msg_.get(), | 60 DCHECK(IPC::SyncMessage::IsMessageReplyTo(*sync_reply_msg_.get(), |
61 message_id)); | 61 message_id)); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 wrapper_reply_msg, reply_params, reply_msg_); | 147 wrapper_reply_msg, reply_params, reply_msg_); |
148 test_sink_->SetSyncReplyMessage(wrapper_reply_msg); | 148 test_sink_->SetSyncReplyMessage(wrapper_reply_msg); |
149 | 149 |
150 // Stash a copy of the message for inspection later. | 150 // Stash a copy of the message for inspection later. |
151 last_handled_msg_ = call_msg; | 151 last_handled_msg_ = call_msg; |
152 return true; | 152 return true; |
153 } | 153 } |
154 | 154 |
155 } // namespace proxy | 155 } // namespace proxy |
156 } // namespace ppapi | 156 } // namespace ppapi |
OLD | NEW |