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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 692 |
693 private: | 693 private: |
694 static const char* const s_test_name_; | 694 static const char* const s_test_name_; |
695 }; | 695 }; |
696 | 696 |
697 const char* const SharedMemoryProcessTest::s_test_name_ = "MPMem"; | 697 const char* const SharedMemoryProcessTest::s_test_name_ = "MPMem"; |
698 | 698 |
699 TEST_F(SharedMemoryProcessTest, Tasks) { | 699 TEST_F(SharedMemoryProcessTest, Tasks) { |
700 SharedMemoryProcessTest::CleanUp(); | 700 SharedMemoryProcessTest::CleanUp(); |
701 | 701 |
702 ProcessHandle handles[kNumTasks]; | 702 Process processes[kNumTasks]; |
703 for (int index = 0; index < kNumTasks; ++index) { | 703 for (int index = 0; index < kNumTasks; ++index) { |
704 handles[index] = SpawnChild("SharedMemoryTestMain"); | 704 processes[index] = SpawnChild("SharedMemoryTestMain"); |
705 ASSERT_TRUE(handles[index]); | 705 ASSERT_TRUE(processes[index].IsValid()); |
706 } | 706 } |
707 | 707 |
708 int exit_code = 0; | 708 int exit_code = 0; |
709 for (int index = 0; index < kNumTasks; ++index) { | 709 for (int index = 0; index < kNumTasks; ++index) { |
710 EXPECT_TRUE(WaitForExitCode(handles[index], &exit_code)); | 710 EXPECT_TRUE(processes[index].WaitForExit(&exit_code)); |
711 EXPECT_EQ(0, exit_code); | 711 EXPECT_EQ(0, exit_code); |
712 } | 712 } |
713 | 713 |
714 SharedMemoryProcessTest::CleanUp(); | 714 SharedMemoryProcessTest::CleanUp(); |
715 } | 715 } |
716 | 716 |
717 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { | 717 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { |
718 return SharedMemoryProcessTest::TaskTestMain(); | 718 return SharedMemoryProcessTest::TaskTestMain(); |
719 } | 719 } |
720 | 720 |
721 #endif // !OS_IOS | 721 #endif // !OS_IOS |
722 | 722 |
723 } // namespace base | 723 } // namespace base |
OLD | NEW |