OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ipc/ipc_test_sink.h" | 5 #include "ipc/ipc_test_sink.h" |
6 | 6 |
7 #include "ipc/ipc_listener.h" | 7 #include "ipc/ipc_listener.h" |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 | 9 |
10 namespace IPC { | 10 namespace IPC { |
11 | 11 |
12 TestSink::TestSink() { | 12 TestSink::TestSink() { |
13 } | 13 } |
14 | 14 |
15 TestSink::~TestSink() { | 15 TestSink::~TestSink() { |
16 } | 16 } |
17 | 17 |
18 bool TestSink::Send(Message* message) { | 18 bool TestSink::Send(Message* message) { |
19 OnMessageReceived(*message); | 19 OnMessageReceived(*message); |
20 delete message; | 20 delete message; |
21 return true; | 21 return true; |
22 } | 22 } |
23 | 23 |
| 24 bool TestSink::Connect() { |
| 25 NOTIMPLEMENTED(); |
| 26 return false; |
| 27 } |
| 28 |
| 29 void TestSink::Close() { |
| 30 NOTIMPLEMENTED(); |
| 31 } |
| 32 |
| 33 base::ProcessId TestSink::GetPeerPID() const { |
| 34 NOTIMPLEMENTED(); |
| 35 return base::ProcessId(); |
| 36 } |
| 37 |
| 38 |
24 bool TestSink::OnMessageReceived(const Message& msg) { | 39 bool TestSink::OnMessageReceived(const Message& msg) { |
25 ObserverListBase<Listener>::Iterator it(filter_list_); | 40 ObserverListBase<Listener>::Iterator it(filter_list_); |
26 Listener* observer; | 41 Listener* observer; |
27 while ((observer = it.GetNext()) != NULL) { | 42 while ((observer = it.GetNext()) != NULL) { |
28 if (observer->OnMessageReceived(msg)) | 43 if (observer->OnMessageReceived(msg)) |
29 return true; | 44 return true; |
30 } | 45 } |
31 | 46 |
32 // No filter handled the message, so store it. | 47 // No filter handled the message, so store it. |
33 messages_.push_back(Message(msg)); | 48 messages_.push_back(Message(msg)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 82 } |
68 | 83 |
69 void TestSink::AddFilter(Listener* filter) { | 84 void TestSink::AddFilter(Listener* filter) { |
70 filter_list_.AddObserver(filter); | 85 filter_list_.AddObserver(filter); |
71 } | 86 } |
72 | 87 |
73 void TestSink::RemoveFilter(Listener* filter) { | 88 void TestSink::RemoveFilter(Listener* filter) { |
74 filter_list_.RemoveObserver(filter); | 89 filter_list_.RemoveObserver(filter); |
75 } | 90 } |
76 | 91 |
| 92 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 93 |
| 94 int TestSink::GetClientFileDescriptor() const { |
| 95 NOTREACHED(); |
| 96 return -1; |
| 97 } |
| 98 |
| 99 int TestSink::TakeClientFileDescriptor() { |
| 100 NOTREACHED(); |
| 101 return -1; |
| 102 } |
| 103 |
| 104 bool TestSink::AcceptsConnections() const { |
| 105 NOTREACHED(); |
| 106 return false; |
| 107 } |
| 108 |
| 109 bool TestSink::HasAcceptedConnection() const { |
| 110 NOTREACHED(); |
| 111 return false; |
| 112 } |
| 113 |
| 114 bool TestSink::GetPeerEuid(uid_t* peer_euid) const { |
| 115 NOTREACHED(); |
| 116 return false; |
| 117 } |
| 118 |
| 119 void TestSink::ResetToAcceptingConnectionState() { |
| 120 NOTREACHED(); |
| 121 } |
| 122 |
| 123 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
| 124 |
77 } // namespace IPC | 125 } // namespace IPC |
OLD | NEW |