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

Side by Side Diff: base/process/process_unittest.cc

Issue 725353003: Don't pass ProcessHandle through ChildProcessHostDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 1 month 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/process/process_posix.cc ('k') | base/process/process_win.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include "base/process/kill.h" 7 #include "base/process/kill.h"
8 #include "base/test/multiprocess_test.h" 8 #include "base/test/multiprocess_test.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ASSERT_TRUE(process1.IsValid()); 85 ASSERT_TRUE(process1.IsValid());
86 ASSERT_TRUE(process2.IsValid()); 86 ASSERT_TRUE(process2.IsValid());
87 EXPECT_EQ(process1.pid(), process2.pid()); 87 EXPECT_EQ(process1.pid(), process2.pid());
88 EXPECT_TRUE(process1.is_current()); 88 EXPECT_TRUE(process1.is_current());
89 EXPECT_TRUE(process2.is_current()); 89 EXPECT_TRUE(process2.is_current());
90 90
91 process1.Close(); 91 process1.Close();
92 ASSERT_TRUE(process2.IsValid()); 92 ASSERT_TRUE(process2.IsValid());
93 } 93 }
94 94
95 TEST_F(ProcessTest, DeprecatedGetProcessFromHandle) {
96 Process process1(SpawnChild("SimpleChildProcess"));
97 ASSERT_TRUE(process1.IsValid());
98
99 Process process2 = Process::DeprecatedGetProcessFromHandle(process1.Handle());
100 ASSERT_TRUE(process1.IsValid());
101 ASSERT_TRUE(process2.IsValid());
102 EXPECT_EQ(process1.pid(), process2.pid());
103 EXPECT_FALSE(process1.is_current());
104 EXPECT_FALSE(process2.is_current());
105
106 process1.Close();
107 ASSERT_TRUE(process2.IsValid());
108 }
109
95 MULTIPROCESS_TEST_MAIN(SleepyChildProcess) { 110 MULTIPROCESS_TEST_MAIN(SleepyChildProcess) {
96 PlatformThread::Sleep(TestTimeouts::action_max_timeout()); 111 PlatformThread::Sleep(TestTimeouts::action_max_timeout());
97 return 0; 112 return 0;
98 } 113 }
99 114
100 TEST_F(ProcessTest, Terminate) { 115 TEST_F(ProcessTest, Terminate) {
101 Process process(SpawnChild("SleepyChildProcess")); 116 Process process(SpawnChild("SleepyChildProcess"));
102 ASSERT_TRUE(process.IsValid()); 117 ASSERT_TRUE(process.IsValid());
103 118
104 const int kDummyExitCode = 42; 119 const int kDummyExitCode = 42;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 EXPECT_FALSE(process.IsProcessBackgrounded()); 167 EXPECT_FALSE(process.IsProcessBackgrounded());
153 #else 168 #else
154 process.SetProcessBackgrounded(true); 169 process.SetProcessBackgrounded(true);
155 process.SetProcessBackgrounded(false); 170 process.SetProcessBackgrounded(false);
156 #endif 171 #endif
157 int new_priority = process.GetPriority(); 172 int new_priority = process.GetPriority();
158 EXPECT_EQ(old_priority, new_priority); 173 EXPECT_EQ(old_priority, new_priority);
159 } 174 }
160 175
161 } // namespace base 176 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_posix.cc ('k') | base/process/process_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698