OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 #include "ipc/ipc_message_macros.h" | 11 #include "ipc/ipc_message_macros.h" |
12 #include "ipc/ipc_test_base.h" | 12 #include "ipc/ipc_test_base.h" |
| 13 #include "ipc/message_filter.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 #if defined(IPC_MESSAGE_START) | 17 #if defined(IPC_MESSAGE_START) |
17 #undef IPC_MESSAGE_START | 18 #undef IPC_MESSAGE_START |
18 #endif | 19 #endif |
19 | 20 |
20 enum Command { | 21 enum Command { |
21 SEND, | 22 SEND, |
22 QUIT | 23 QUIT |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 | 76 |
76 channel_->Send(new IPC::Message(message)); | 77 channel_->Send(new IPC::Message(message)); |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 IPC::Channel* channel_; | 82 IPC::Channel* channel_; |
82 }; | 83 }; |
83 | 84 |
84 class MessageCountFilter : public IPC::ChannelProxy::MessageFilter { | 85 class MessageCountFilter : public IPC::MessageFilter { |
85 public: | 86 public: |
86 enum FilterEvent { | 87 enum FilterEvent { |
87 NONE, | 88 NONE, |
88 FILTER_ADDED, | 89 FILTER_ADDED, |
89 CHANNEL_CONNECTED, | 90 CHANNEL_CONNECTED, |
90 CHANNEL_ERROR, | 91 CHANNEL_ERROR, |
91 CHANNEL_CLOSING, | 92 CHANNEL_CLOSING, |
92 FILTER_REMOVED | 93 FILTER_REMOVED |
93 }; | 94 }; |
94 MessageCountFilter() | 95 MessageCountFilter() |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 IPC::Channel::MODE_CLIENT, | 306 IPC::Channel::MODE_CLIENT, |
306 &listener); | 307 &listener); |
307 CHECK(channel.Connect()); | 308 CHECK(channel.Connect()); |
308 listener.Init(&channel); | 309 listener.Init(&channel); |
309 | 310 |
310 base::MessageLoop::current()->Run(); | 311 base::MessageLoop::current()->Run(); |
311 return 0; | 312 return 0; |
312 } | 313 } |
313 | 314 |
314 } // namespace | 315 } // namespace |
OLD | NEW |