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

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
« no previous file with comments | « base/process/process_posix.cc ('k') | base/process/process_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_unittest.cc
diff --git a/base/process/process_unittest.cc b/base/process/process_unittest.cc
index 90bb95a0fe9b04964cedb716629bb42e3058741f..0a59b0a525d52f8f83f7ca1112ef09afd51c2e34 100644
--- a/base/process/process_unittest.cc
+++ b/base/process/process_unittest.cc
@@ -148,6 +148,35 @@ TEST_F(ProcessTest, Terminate) {
#endif
}
+MULTIPROCESS_TEST_MAIN(TerminateCurrentProcessImmediately) {
+ // PlatformThread::Sleep(TestTimeouts::action_max_timeout());
+ int kExpectedExitCode = 250;
+ Process::TerminateCurrentProcessImmediately(kExpectedExitCode);
+ return 0;
+}
+
+TEST_F(ProcessTest, TerminateCurrentProcessImmediately) {
+ Process process(SpawnChild("TerminateCurrentProcessImmediately"));
+ 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;
+ process.WaitForExitWithTimeout(TestTimeouts::action_max_timeout(),
+ &exit_code);
+
+ EXPECT_NE(TERMINATION_STATUS_STILL_RUNNING,
+ GetTerminationStatus(process.Handle(), &exit_code));
+#if !defined(OS_POSIX)
haraken 2017/01/17 09:40:27 It looks like this guard is needed. In Linux, exit
Primiano Tucci (use gerrit) 2017/01/17 12:08:21 I insist, on linux the exit code works really fine
+ // The POSIX implementation actually ignores the exit_code.
+ EXPECT_EQ(kExpectedExitCode, exit_code);
+#endif
+}
+
MULTIPROCESS_TEST_MAIN(FastSleepyChildProcess) {
PlatformThread::Sleep(TestTimeouts::tiny_timeout() * 10);
return 0;
« 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