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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 93 base::ProcessId GetPeerPID() const override; |
94 base::ProcessId GetSelfPID() const override; | |
95 | |
96 #if defined(OS_POSIX) && !defined(OS_NACL) | |
97 int GetClientFileDescriptor() const override; | |
98 base::ScopedFD TakeClientFileDescriptor() override; | |
99 #endif // defined(OS_POSIX) && !defined(OS_NACL) | |
100 | 94 |
101 // Used by the source of the messages to send the message to the sink. This | 95 // Used by the source of the messages to send the message to the sink. This |
102 // will make a copy of the message and store it in the list. | 96 // will make a copy of the message and store it in the list. |
103 bool OnMessageReceived(const Message& msg); | 97 bool OnMessageReceived(const Message& msg); |
104 | 98 |
105 // Returns the number of messages in the queue. | 99 // Returns the number of messages in the queue. |
106 size_t message_count() const { return messages_.size(); } | 100 size_t message_count() const { return messages_.size(); } |
107 | 101 |
108 // Clears the message queue of saved messages. | 102 // Clears the message queue of saved messages. |
109 void ClearMessages(); | 103 void ClearMessages(); |
(...skipping 29 matching lines...) Expand all Loading... |
139 // The actual list of received messages. | 133 // The actual list of received messages. |
140 std::vector<Message> messages_; | 134 std::vector<Message> messages_; |
141 base::ObserverList<Listener> filter_list_; | 135 base::ObserverList<Listener> filter_list_; |
142 | 136 |
143 DISALLOW_COPY_AND_ASSIGN(TestSink); | 137 DISALLOW_COPY_AND_ASSIGN(TestSink); |
144 }; | 138 }; |
145 | 139 |
146 } // namespace IPC | 140 } // namespace IPC |
147 | 141 |
148 #endif // IPC_IPC_TEST_SINK_H_ | 142 #endif // IPC_IPC_TEST_SINK_H_ |
OLD | NEW |