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

Unified Diff: base/process/process_unittest.cc

Issue 2629623003: Win should call ::TerminateProcess to exit a renderer process (Closed)
Patch Set: temp Created 3 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 side-by-side diff with in-line comments
Download patch
Index: base/process/process_unittest.cc
diff --git a/base/process/process_unittest.cc b/base/process/process_unittest.cc
index 90bb95a0fe9b04964cedb716629bb42e3058741f..9558efce0d96530ae4ec8ce1289fba0107d8c1af 100644
--- a/base/process/process_unittest.cc
+++ b/base/process/process_unittest.cc
@@ -148,6 +148,30 @@ TEST_F(ProcessTest, Terminate) {
#endif
}
+TEST_F(ProcessTest, TerminateCurrentProcessImmediately) {
+ Process process(SpawnChild("SleepyChildProcess"));
+ ASSERT_TRUE(process.IsValid());
+
+ const int kDummyExitCode = 42;
+ int exit_code = kDummyExitCode;
+ EXPECT_EQ(TERMINATION_STATUS_STILL_RUNNING,
+ GetTerminationStatus(process.Handle(), &exit_code));
+ EXPECT_EQ(kExpectedStillRunningExitCode, exit_code);
+
+ exit_code = kDummyExitCode;
+ int kExpectedExitCode = 250;
+ process.TerminateCurrentProcessImmediately(kExpectedExitCode);
Primiano Tucci (use gerrit) 2017/01/16 14:37:34 well this is the problem. You don't want to termin
+ process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(),
+ &exit_code);
+
+ EXPECT_NE(TERMINATION_STATUS_STILL_RUNNING,
+ GetTerminationStatus(process.Handle(), &exit_code));
+#if !defined(OS_POSIX)
+ // The POSIX implementation actually ignores the exit_code.
Primiano Tucci (use gerrit) 2017/01/16 14:37:34 Where did this happen? I tried both on OSX and Lin
+ EXPECT_EQ(kExpectedExitCode, exit_code);
+#endif
+}
+
MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) {
PlatformThread::Sleep(TestTimeouts::tiny_timeout() * 10);
return 0;

Powered by Google App Engine
This is Rietveld 408576698