| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 static const char* const s_test_name_; | 641 static const char* const s_test_name_; |
| 642 }; | 642 }; |
| 643 | 643 |
| 644 const char* const SharedMemoryProcessTest::s_test_name_ = "MPMem"; | 644 const char* const SharedMemoryProcessTest::s_test_name_ = "MPMem"; |
| 645 | 645 |
| 646 TEST_F(SharedMemoryProcessTest, Tasks) { | 646 TEST_F(SharedMemoryProcessTest, Tasks) { |
| 647 SharedMemoryProcessTest::CleanUp(); | 647 SharedMemoryProcessTest::CleanUp(); |
| 648 | 648 |
| 649 ProcessHandle handles[kNumTasks]; | 649 ProcessHandle handles[kNumTasks]; |
| 650 for (int index = 0; index < kNumTasks; ++index) { | 650 for (int index = 0; index < kNumTasks; ++index) { |
| 651 handles[index] = SpawnChild("SharedMemoryTestMain", false); | 651 handles[index] = SpawnChild("SharedMemoryTestMain"); |
| 652 ASSERT_TRUE(handles[index]); | 652 ASSERT_TRUE(handles[index]); |
| 653 } | 653 } |
| 654 | 654 |
| 655 int exit_code = 0; | 655 int exit_code = 0; |
| 656 for (int index = 0; index < kNumTasks; ++index) { | 656 for (int index = 0; index < kNumTasks; ++index) { |
| 657 EXPECT_TRUE(WaitForExitCode(handles[index], &exit_code)); | 657 EXPECT_TRUE(WaitForExitCode(handles[index], &exit_code)); |
| 658 EXPECT_EQ(0, exit_code); | 658 EXPECT_EQ(0, exit_code); |
| 659 } | 659 } |
| 660 | 660 |
| 661 SharedMemoryProcessTest::CleanUp(); | 661 SharedMemoryProcessTest::CleanUp(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { | 664 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { |
| 665 return SharedMemoryProcessTest::TaskTestMain(); | 665 return SharedMemoryProcessTest::TaskTestMain(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 #endif // !OS_IOS | 668 #endif // !OS_IOS |
| 669 | 669 |
| 670 } // namespace base | 670 } // namespace base |
| OLD | NEW |