| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 Send(&chan, "hello from parent"); | 224 Send(&chan, "hello from parent"); |
| 225 | 225 |
| 226 // Run message loop. | 226 // Run message loop. |
| 227 MessageLoop::current()->Run(); | 227 MessageLoop::current()->Run(); |
| 228 | 228 |
| 229 // Close Channel so client gets its OnChannelError() callback fired. | 229 // Close Channel so client gets its OnChannelError() callback fired. |
| 230 chan.Close(); | 230 chan.Close(); |
| 231 | 231 |
| 232 // Cleanup child process. | 232 // Cleanup child process. |
| 233 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); | 233 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); |
| 234 base::CloseProcessHandle(process_handle); |
| 234 } | 235 } |
| 235 | 236 |
| 236 #if defined(OS_POSIX) | 237 #if defined(OS_POSIX) |
| 237 | 238 |
| 238 class MyChannelDescriptorListener : public IPC::Channel::Listener { | 239 class MyChannelDescriptorListener : public IPC::Channel::Listener { |
| 239 public: | 240 public: |
| 240 virtual void OnMessageReceived(const IPC::Message& message) { | 241 virtual void OnMessageReceived(const IPC::Message& message) { |
| 241 void* iter = NULL; | 242 void* iter = NULL; |
| 242 | 243 |
| 243 FileDescriptor descriptor; | 244 FileDescriptor descriptor; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 351 |
| 351 ASSERT_TRUE(process_handle); | 352 ASSERT_TRUE(process_handle); |
| 352 | 353 |
| 353 Send(&chan, "hello from parent"); | 354 Send(&chan, "hello from parent"); |
| 354 | 355 |
| 355 // run message loop | 356 // run message loop |
| 356 MessageLoop::current()->Run(); | 357 MessageLoop::current()->Run(); |
| 357 | 358 |
| 358 // cleanup child process | 359 // cleanup child process |
| 359 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); | 360 EXPECT_TRUE(base::WaitForSingleProcess(process_handle, 5000)); |
| 361 base::CloseProcessHandle(process_handle); |
| 360 } | 362 } |
| 361 thread.Stop(); | 363 thread.Stop(); |
| 362 } | 364 } |
| 363 | 365 |
| 364 MULTIPROCESS_TEST_MAIN(RunTestClient) { | 366 MULTIPROCESS_TEST_MAIN(RunTestClient) { |
| 365 MessageLoopForIO main_message_loop; | 367 MessageLoopForIO main_message_loop; |
| 366 | 368 |
| 367 // setup IPC channel | 369 // setup IPC channel |
| 368 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_CLIENT, | 370 IPC::Channel chan(kTestClientChannel, IPC::Channel::MODE_CLIENT, |
| 369 &channel_listener); | 371 &channel_listener); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 #endif // PERFORMANCE_TEST | 543 #endif // PERFORMANCE_TEST |
| 542 | 544 |
| 543 int main(int argc, char** argv) { | 545 int main(int argc, char** argv) { |
| 544 #ifdef PERFORMANCE_TEST | 546 #ifdef PERFORMANCE_TEST |
| 545 int retval = PerfTestSuite(argc, argv).Run(); | 547 int retval = PerfTestSuite(argc, argv).Run(); |
| 546 #else | 548 #else |
| 547 int retval = TestSuite(argc, argv).Run(); | 549 int retval = TestSuite(argc, argv).Run(); |
| 548 #endif | 550 #endif |
| 549 return retval; | 551 return retval; |
| 550 } | 552 } |
| OLD | NEW |