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 #ifndef IPC_IPC_TEST_SINK_H_ | 5 #ifndef IPC_IPC_TEST_SINK_H_ |
6 #define IPC_IPC_TEST_SINK_H_ | 6 #define IPC_IPC_TEST_SINK_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 class TestSink : public Channel { | 83 class TestSink : public Channel { |
84 public: | 84 public: |
85 TestSink(); | 85 TestSink(); |
86 ~TestSink() override; | 86 ~TestSink() override; |
87 | 87 |
88 // Interface in IPC::Channel. This copies the message to the sink and then | 88 // Interface in IPC::Channel. This copies the message to the sink and then |
89 // deletes it. | 89 // deletes it. |
90 bool Send(IPC::Message* message) override; | 90 bool Send(IPC::Message* message) override; |
91 bool Connect() override WARN_UNUSED_RESULT; | 91 bool Connect() override WARN_UNUSED_RESULT; |
92 void Close() override; | 92 void Close() override; |
93 base::ProcessId GetPeerPID() const override; | |
94 | 93 |
95 // Used by the source of the messages to send the message to the sink. This | 94 // Used by the source of the messages to send the message to the sink. This |
96 // will make a copy of the message and store it in the list. | 95 // will make a copy of the message and store it in the list. |
97 bool OnMessageReceived(const Message& msg); | 96 bool OnMessageReceived(const Message& msg); |
98 | 97 |
99 // Returns the number of messages in the queue. | 98 // Returns the number of messages in the queue. |
100 size_t message_count() const { return messages_.size(); } | 99 size_t message_count() const { return messages_.size(); } |
101 | 100 |
102 // Clears the message queue of saved messages. | 101 // Clears the message queue of saved messages. |
103 void ClearMessages(); | 102 void ClearMessages(); |
(...skipping 29 matching lines...) Expand all Loading... |
133 // The actual list of received messages. | 132 // The actual list of received messages. |
134 std::vector<Message> messages_; | 133 std::vector<Message> messages_; |
135 base::ObserverList<Listener> filter_list_; | 134 base::ObserverList<Listener> filter_list_; |
136 | 135 |
137 DISALLOW_COPY_AND_ASSIGN(TestSink); | 136 DISALLOW_COPY_AND_ASSIGN(TestSink); |
138 }; | 137 }; |
139 | 138 |
140 } // namespace IPC | 139 } // namespace IPC |
141 | 140 |
142 #endif // IPC_IPC_TEST_SINK_H_ | 141 #endif // IPC_IPC_TEST_SINK_H_ |
OLD | NEW |