OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "ipc/ipc_message_utils.h" | 35 #include "ipc/ipc_message_utils.h" |
36 #include "ipc/ipc_switches.h" | 36 #include "ipc/ipc_switches.h" |
37 #include "testing/multiprocess_func_list.h" | 37 #include "testing/multiprocess_func_list.h" |
38 | 38 |
39 // Define to enable IPC performance testing instead of the regular unit tests | 39 // Define to enable IPC performance testing instead of the regular unit tests |
40 // #define PERFORMANCE_TEST | 40 // #define PERFORMANCE_TEST |
41 | 41 |
42 const char kTestClientChannel[] = "T1"; | 42 const char kTestClientChannel[] = "T1"; |
43 const char kReflectorChannel[] = "T2"; | 43 const char kReflectorChannel[] = "T2"; |
44 const char kFuzzerChannel[] = "F3"; | 44 const char kFuzzerChannel[] = "F3"; |
| 45 const char kSyncSocketChannel[] = "S4"; |
45 | 46 |
46 const size_t kLongMessageStringNumBytes = 50000; | 47 const size_t kLongMessageStringNumBytes = 50000; |
47 | 48 |
48 #ifndef PERFORMANCE_TEST | 49 #ifndef PERFORMANCE_TEST |
49 | 50 |
50 void IPCChannelTest::SetUp() { | 51 void IPCChannelTest::SetUp() { |
51 MultiProcessTest::SetUp(); | 52 MultiProcessTest::SetUp(); |
52 | 53 |
53 // Construct a fresh IO Message loop for the duration of each test. | 54 // Construct a fresh IO Message loop for the duration of each test. |
54 message_loop_ = new MessageLoopForIO(); | 55 message_loop_ = new MessageLoopForIO(); |
(...skipping 16 matching lines...) Expand all Loading... |
71 switch (child_type) { | 72 switch (child_type) { |
72 case TEST_CLIENT: | 73 case TEST_CLIENT: |
73 return MultiProcessTest::SpawnChild(L"RunTestClient", debug_on_start); | 74 return MultiProcessTest::SpawnChild(L"RunTestClient", debug_on_start); |
74 break; | 75 break; |
75 case TEST_REFLECTOR: | 76 case TEST_REFLECTOR: |
76 return MultiProcessTest::SpawnChild(L"RunReflector", debug_on_start); | 77 return MultiProcessTest::SpawnChild(L"RunReflector", debug_on_start); |
77 break; | 78 break; |
78 case FUZZER_SERVER: | 79 case FUZZER_SERVER: |
79 return MultiProcessTest::SpawnChild(L"RunFuzzServer", debug_on_start); | 80 return MultiProcessTest::SpawnChild(L"RunFuzzServer", debug_on_start); |
80 break; | 81 break; |
| 82 case SYNC_SOCKET_SERVER: |
| 83 return MultiProcessTest::SpawnChild(L"RunSyncSocketServer", debug_on_start); |
| 84 break; |
81 default: | 85 default: |
82 return NULL; | 86 return NULL; |
83 break; | 87 break; |
84 } | 88 } |
85 } | 89 } |
86 #elif defined(OS_POSIX) | 90 #elif defined(OS_POSIX) |
87 base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, | 91 base::ProcessHandle IPCChannelTest::SpawnChild(ChildType child_type, |
88 IPC::Channel *channel) { | 92 IPC::Channel *channel) { |
89 // kDebugChildren support. | 93 // kDebugChildren support. |
90 bool debug_on_start = | 94 bool debug_on_start = |
(...skipping 25 matching lines...) Expand all Loading... |
116 case TEST_REFLECTOR: | 120 case TEST_REFLECTOR: |
117 ret = MultiProcessTest::SpawnChild(L"RunReflector", | 121 ret = MultiProcessTest::SpawnChild(L"RunReflector", |
118 fds_to_map, | 122 fds_to_map, |
119 debug_on_start); | 123 debug_on_start); |
120 break; | 124 break; |
121 case FUZZER_SERVER: | 125 case FUZZER_SERVER: |
122 ret = MultiProcessTest::SpawnChild(L"RunFuzzServer", | 126 ret = MultiProcessTest::SpawnChild(L"RunFuzzServer", |
123 fds_to_map, | 127 fds_to_map, |
124 debug_on_start); | 128 debug_on_start); |
125 break; | 129 break; |
| 130 case SYNC_SOCKET_SERVER: |
| 131 ret = MultiProcessTest::SpawnChild(L"RunSyncSocketServer", |
| 132 fds_to_map, |
| 133 debug_on_start); |
| 134 break; |
126 default: | 135 default: |
127 return NULL; | 136 return NULL; |
128 break; | 137 break; |
129 } | 138 } |
130 return ret; | 139 return ret; |
131 } | 140 } |
132 #endif // defined(OS_POSIX) | 141 #endif // defined(OS_POSIX) |
133 | 142 |
134 TEST_F(IPCChannelTest, BasicMessageTest) { | 143 TEST_F(IPCChannelTest, BasicMessageTest) { |
135 int v1 = 10; | 144 int v1 = 10; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 #endif // PERFORMANCE_TEST | 543 #endif // PERFORMANCE_TEST |
535 | 544 |
536 int main(int argc, char** argv) { | 545 int main(int argc, char** argv) { |
537 #ifdef PERFORMANCE_TEST | 546 #ifdef PERFORMANCE_TEST |
538 int retval = PerfTestSuite(argc, argv).Run(); | 547 int retval = PerfTestSuite(argc, argv).Run(); |
539 #else | 548 #else |
540 int retval = TestSuite(argc, argv).Run(); | 549 int retval = TestSuite(argc, argv).Run(); |
541 #endif | 550 #endif |
542 return retval; | 551 return retval; |
543 } | 552 } |
OLD | NEW |