Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: base/memory/shared_memory_unittest.cc

Issue 843113003: MultiProcessTest: Update SpawnChild* to return a Process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/debug/stack_trace_unittest.cc ('k') | base/metrics/stats_table_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « base/debug/stack_trace_unittest.cc ('k') | base/metrics/stats_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698