| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_COMMON_IPC_TEST_SINK_H_ | 5 #ifndef CHROME_COMMON_IPC_TEST_SINK_H_ |
| 6 #define CHROME_COMMON_IPC_TEST_SINK_H_ | 6 #define CHROME_COMMON_IPC_TEST_SINK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 public: | 47 public: |
| 48 TestSink(); | 48 TestSink(); |
| 49 ~TestSink(); | 49 ~TestSink(); |
| 50 | 50 |
| 51 // Interface in IPC::Channel. This copies the message to the sink and then | 51 // Interface in IPC::Channel. This copies the message to the sink and then |
| 52 // deletes it. | 52 // deletes it. |
| 53 virtual bool Send(IPC::Message* message); | 53 virtual bool Send(IPC::Message* message); |
| 54 | 54 |
| 55 // Used by the source of the messages to send the message to the sink. This | 55 // Used by the source of the messages to send the message to the sink. This |
| 56 // will make a copy of the message and store it in the list. | 56 // will make a copy of the message and store it in the list. |
| 57 void OnMessageReceived(const Message& msg); | 57 bool OnMessageReceived(const Message& msg); |
| 58 | 58 |
| 59 // Returns the number of messages in the queue. | 59 // Returns the number of messages in the queue. |
| 60 size_t message_count() const { return messages_.size(); } | 60 size_t message_count() const { return messages_.size(); } |
| 61 | 61 |
| 62 // Clears the message queue of saved messages. | 62 // Clears the message queue of saved messages. |
| 63 void ClearMessages(); | 63 void ClearMessages(); |
| 64 | 64 |
| 65 // Returns the message at the given index in the queue. The index may be out | 65 // Returns the message at the given index in the queue. The index may be out |
| 66 // of range, in which case the return value is NULL. The returned pointer will | 66 // of range, in which case the return value is NULL. The returned pointer will |
| 67 // only be valid until another message is received or the list is cleared. | 67 // only be valid until another message is received or the list is cleared. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 82 private: | 82 private: |
| 83 // The actual list of received messages. | 83 // The actual list of received messages. |
| 84 std::vector<Message> messages_; | 84 std::vector<Message> messages_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(TestSink); | 86 DISALLOW_COPY_AND_ASSIGN(TestSink); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace IPC | 89 } // namespace IPC |
| 90 | 90 |
| 91 #endif // CHROME_COMMON_IPC_TEST_SINK_H_ | 91 #endif // CHROME_COMMON_IPC_TEST_SINK_H_ |
| OLD | NEW |