OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/browser_watcher/exit_code_watcher_win.h" | 5 #include "components/browser_watcher/exit_code_watcher_win.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 EXPECT_TRUE(process_.WaitForExit(nullptr)); | 46 EXPECT_TRUE(process_.WaitForExit(nullptr)); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void Launch() { | 50 void Launch() { |
51 ASSERT_FALSE(process_.IsValid()); | 51 ASSERT_FALSE(process_.IsValid()); |
52 | 52 |
53 base::CommandLine cmd_line(base::GetMultiProcessTestChildBaseCommandLine()); | 53 base::CommandLine cmd_line(base::GetMultiProcessTestChildBaseCommandLine()); |
54 base::LaunchOptions options; | 54 base::LaunchOptions options; |
55 options.start_hidden = true; | 55 options.start_hidden = true; |
56 process_ = base::SpawnMultiProcessTestChild("Sleeper", cmd_line, options); | 56 base::SpawnChildResult spawn_result = |
| 57 base::SpawnMultiProcessTestChild("Sleeper", cmd_line, options); |
| 58 process_ = std::move(spawn_result.process); |
57 ASSERT_TRUE(process_.IsValid()); | 59 ASSERT_TRUE(process_.IsValid()); |
58 } | 60 } |
59 | 61 |
60 void Kill(int exit_code, bool wait) { | 62 void Kill(int exit_code, bool wait) { |
61 ASSERT_TRUE(process_.IsValid()); | 63 ASSERT_TRUE(process_.IsValid()); |
62 ASSERT_FALSE(is_killed_); | 64 ASSERT_FALSE(is_killed_); |
63 process_.Terminate(exit_code, false); | 65 process_.Terminate(exit_code, false); |
64 int seen_exit_code = 0; | 66 int seen_exit_code = 0; |
65 EXPECT_TRUE(process_.WaitForExit(&seen_exit_code)); | 67 EXPECT_TRUE(process_.WaitForExit(&seen_exit_code)); |
66 EXPECT_EQ(exit_code, seen_exit_code); | 68 EXPECT_EQ(exit_code, seen_exit_code); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Kill the sleeper, and make sure it's exited before we continue. | 168 // Kill the sleeper, and make sure it's exited before we continue. |
167 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true)); | 169 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true)); |
168 | 170 |
169 watcher.WaitForExit(); | 171 watcher.WaitForExit(); |
170 EXPECT_EQ(kExitCode, watcher.exit_code()); | 172 EXPECT_EQ(kExitCode, watcher.exit_code()); |
171 | 173 |
172 VerifyWroteExitCode(sleeper.process().Pid(), kExitCode); | 174 VerifyWroteExitCode(sleeper.process().Pid(), kExitCode); |
173 } | 175 } |
174 | 176 |
175 } // namespace browser_watcher | 177 } // namespace browser_watcher |
OLD | NEW |