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 // Unit test for SyncChannel. | 5 // Unit test for SyncChannel. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/platform_thread.h" | 13 #include "base/platform_thread.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 17 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
18 #include "base/thread.h" | 18 #include "base/thread.h" |
19 #include "base/waitable_event.h" | 19 #include "base/waitable_event.h" |
20 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
21 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
22 #include "ipc/ipc_sync_message_filter.h" | 22 #include "ipc/ipc_sync_message_filter.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 | 25 |
26 #define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" | 26 #define MESSAGES_INTERNAL_FILE "ipc/ipc_sync_message_unittest.h" |
27 #include "ipc/ipc_message_macros.h" | 27 #include "ipc/ipc_message_macros.h" |
28 | 28 |
| 29 // Definition of IPC Messages used for this test. |
| 30 #define MESSAGES_INTERNAL_IMPL_FILE "ipc/ipc_sync_message_unittest.h" |
| 31 #include "ipc/ipc_message_impl_macros.h" |
| 32 |
29 using namespace IPC; | 33 using namespace IPC; |
30 using base::WaitableEvent; | 34 using base::WaitableEvent; |
31 | 35 |
32 namespace { | 36 namespace { |
33 | 37 |
34 // Base class for a "process" with listener and IPC threads. | 38 // Base class for a "process" with listener and IPC threads. |
35 class Worker : public Channel::Listener, public Message::Sender { | 39 class Worker : public Channel::Listener, public Message::Sender { |
36 public: | 40 public: |
37 // Will create a channel without a name. | 41 // Will create a channel without a name. |
38 Worker(Channel::Mode mode, const std::string& thread_name) | 42 Worker(Channel::Mode mode, const std::string& thread_name) |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 | 1113 |
1110 } // namespace | 1114 } // namespace |
1111 | 1115 |
1112 // Tests basic synchronous call | 1116 // Tests basic synchronous call |
1113 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { | 1117 TEST_F(IPCSyncChannelTest, SyncMessageFilter) { |
1114 std::vector<Worker*> workers; | 1118 std::vector<Worker*> workers; |
1115 workers.push_back(new SyncMessageFilterServer()); | 1119 workers.push_back(new SyncMessageFilterServer()); |
1116 workers.push_back(new SimpleClient()); | 1120 workers.push_back(new SimpleClient()); |
1117 RunTest(workers); | 1121 RunTest(workers); |
1118 } | 1122 } |
OLD | NEW |