OLD | NEW |
1 // Copyright (c) 2010 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 CHROME_COMMON_IPC_TEST_SINK_H_ | 5 #ifndef IPC_IPC_TEST_SINK_H_ |
6 #define CHROME_COMMON_IPC_TEST_SINK_H_ | 6 #define IPC_IPC_TEST_SINK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
14 | 14 |
15 namespace IPC { | 15 namespace IPC { |
16 | 16 |
(...skipping 19 matching lines...) Expand all Loading... |
36 // ASSERT_TRUE(msg); | 36 // ASSERT_TRUE(msg); |
37 // bool first_param; | 37 // bool first_param; |
38 // int second_param; | 38 // int second_param; |
39 // ViewMsg_Foo::Read(msg, &first_param, &second_param); | 39 // ViewMsg_Foo::Read(msg, &first_param, &second_param); |
40 // | 40 // |
41 // // Go on to the next phase of the test. | 41 // // Go on to the next phase of the test. |
42 // test_sink.ClearMessages(); | 42 // test_sink.ClearMessages(); |
43 // | 43 // |
44 // To hook up the sink, all you need to do is call OnMessageReceived when a | 44 // To hook up the sink, all you need to do is call OnMessageReceived when a |
45 // message is received. | 45 // message is received. |
46 class TestSink : public IPC::Channel { | 46 class TestSink : public Channel { |
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. |
(...skipping 24 matching lines...) Expand all Loading... |
81 | 81 |
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 // IPC_IPC_TEST_SINK_H_ |
OLD | NEW |