OLD | NEW |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 const int kDummyExitCode = 42; | 118 const int kDummyExitCode = 42; |
119 int exit_code = kDummyExitCode; | 119 int exit_code = kDummyExitCode; |
120 EXPECT_EQ(TERMINATION_STATUS_STILL_RUNNING, | 120 EXPECT_EQ(TERMINATION_STATUS_STILL_RUNNING, |
121 GetTerminationStatus(process.Handle(), &exit_code)); | 121 GetTerminationStatus(process.Handle(), &exit_code)); |
122 EXPECT_EQ(kExpectedStillRunningExitCode, exit_code); | 122 EXPECT_EQ(kExpectedStillRunningExitCode, exit_code); |
123 | 123 |
124 exit_code = kDummyExitCode; | 124 exit_code = kDummyExitCode; |
125 int kExpectedExitCode = 250; | 125 int kExpectedExitCode = 250; |
126 process.Terminate(kExpectedExitCode); | 126 process.Terminate(kExpectedExitCode); |
127 WaitForSingleProcess(process.Handle(), TestTimeouts::action_max_timeout()); | 127 process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(), |
| 128 &exit_code); |
128 | 129 |
129 EXPECT_NE(TERMINATION_STATUS_STILL_RUNNING, | 130 EXPECT_NE(TERMINATION_STATUS_STILL_RUNNING, |
130 GetTerminationStatus(process.Handle(), &exit_code)); | 131 GetTerminationStatus(process.Handle(), &exit_code)); |
131 #if !defined(OS_POSIX) | 132 #if !defined(OS_POSIX) |
132 // The POSIX implementation actually ignores the exit_code. | 133 // The POSIX implementation actually ignores the exit_code. |
133 EXPECT_EQ(kExpectedExitCode, exit_code); | 134 EXPECT_EQ(kExpectedExitCode, exit_code); |
134 #endif | 135 #endif |
135 } | 136 } |
136 | 137 |
137 MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) { | 138 MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 EXPECT_FALSE(process.IsProcessBackgrounded()); | 195 EXPECT_FALSE(process.IsProcessBackgrounded()); |
195 #else | 196 #else |
196 process.SetProcessBackgrounded(true); | 197 process.SetProcessBackgrounded(true); |
197 process.SetProcessBackgrounded(false); | 198 process.SetProcessBackgrounded(false); |
198 #endif | 199 #endif |
199 int new_priority = process.GetPriority(); | 200 int new_priority = process.GetPriority(); |
200 EXPECT_EQ(old_priority, new_priority); | 201 EXPECT_EQ(old_priority, new_priority); |
201 } | 202 } |
202 | 203 |
203 } // namespace base | 204 } // namespace base |
OLD | NEW |