Index: ipc/ipc_test_sink.cc |
diff --git a/ipc/ipc_test_sink.cc b/ipc/ipc_test_sink.cc |
index 95900b6ca5074a164b45491431ffc7e86e5e9b66..44042390727c75455a5758e16cb55c1be521610a 100644 |
--- a/ipc/ipc_test_sink.cc |
+++ b/ipc/ipc_test_sink.cc |
@@ -21,6 +21,14 @@ bool TestSink::Send(Message* message) { |
} |
bool TestSink::OnMessageReceived(const Message& msg) { |
+ ObserverListBase<Channel::Listener>::Iterator it(filter_list_); |
+ Channel::Listener* observer; |
+ while ((observer = it.GetNext()) != NULL) { |
+ if (observer->OnMessageReceived(msg)) |
+ return true; |
+ } |
+ |
+ // No filter handled the message, so store it. |
messages_.push_back(Message(msg)); |
return true; |
} |
@@ -57,4 +65,12 @@ const Message* TestSink::GetUniqueMessageMatching(uint32 id) const { |
return &messages_[found_index]; |
} |
+void TestSink::AddFilter(Channel::Listener* filter) { |
+ filter_list_.AddObserver(filter); |
+} |
+ |
+void TestSink::RemoveFilter(Channel::Listener* filter) { |
+ filter_list_.RemoveObserver(filter); |
+} |
+ |
} // namespace IPC |