| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/process/process.h" | 8 #include "base/process/process.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 TEST_F(ExitCodeWatcherTest, ExitCodeWatcherOnExitedProcess) { | 163 TEST_F(ExitCodeWatcherTest, ExitCodeWatcherOnExitedProcess) { |
| 164 ScopedSleeperProcess sleeper; | 164 ScopedSleeperProcess sleeper; |
| 165 ASSERT_NO_FATAL_FAILURE(sleeper.Launch()); | 165 ASSERT_NO_FATAL_FAILURE(sleeper.Launch()); |
| 166 | 166 |
| 167 ExitCodeWatcher watcher(kRegistryPath); | 167 ExitCodeWatcher watcher(kRegistryPath); |
| 168 | 168 |
| 169 EXPECT_TRUE(watcher.Initialize(sleeper.process().Duplicate())); | 169 EXPECT_TRUE(watcher.Initialize(sleeper.process().Duplicate())); |
| 170 | 170 |
| 171 // Verify that the watcher wrote a sentinel for the process. | 171 // Verify that the watcher wrote a sentinel for the process. |
| 172 VerifyWroteExitCode(sleeper.process().pid(), STILL_ACTIVE); | 172 VerifyWroteExitCode(sleeper.process().Pid(), STILL_ACTIVE); |
| 173 | 173 |
| 174 // Kill the sleeper, and make sure it's exited before we continue. | 174 // Kill the sleeper, and make sure it's exited before we continue. |
| 175 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true)); | 175 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true)); |
| 176 | 176 |
| 177 watcher.WaitForExit(); | 177 watcher.WaitForExit(); |
| 178 EXPECT_EQ(kExitCode, watcher.exit_code()); | 178 EXPECT_EQ(kExitCode, watcher.exit_code()); |
| 179 | 179 |
| 180 VerifyWroteExitCode(sleeper.process().pid(), kExitCode); | 180 VerifyWroteExitCode(sleeper.process().Pid(), kExitCode); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace browser_watcher | 183 } // namespace browser_watcher |
| OLD | NEW |