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

Side by Side Diff: components/browser_watcher/exit_code_watcher_win_unittest.cc

Issue 1086363003: Handled nullptr argument in WaitForExit() and WaitForExitWithTimeout() methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments incorporated. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/process_singleton_win_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 } 32 }
33 33
34 class ScopedSleeperProcess { 34 class ScopedSleeperProcess {
35 public: 35 public:
36 ScopedSleeperProcess() : is_killed_(false) { 36 ScopedSleeperProcess() : is_killed_(false) {
37 } 37 }
38 38
39 ~ScopedSleeperProcess() { 39 ~ScopedSleeperProcess() {
40 if (process_.IsValid()) { 40 if (process_.IsValid()) {
41 process_.Terminate(-1, false); 41 process_.Terminate(-1, false);
42 int exit_code = 0; 42 EXPECT_TRUE(process_.WaitForExit(nullptr));
43 EXPECT_TRUE(process_.WaitForExit(&exit_code));
44 } 43 }
45 } 44 }
46 45
47 void Launch() { 46 void Launch() {
48 ASSERT_FALSE(process_.IsValid()); 47 ASSERT_FALSE(process_.IsValid());
49 48
50 base::CommandLine cmd_line(base::GetMultiProcessTestChildBaseCommandLine()); 49 base::CommandLine cmd_line(base::GetMultiProcessTestChildBaseCommandLine());
51 base::LaunchOptions options; 50 base::LaunchOptions options;
52 options.start_hidden = true; 51 options.start_hidden = true;
53 process_ = base::SpawnMultiProcessTestChild("Sleeper", cmd_line, options); 52 process_ = base::SpawnMultiProcessTestChild("Sleeper", cmd_line, options);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Kill the sleeper, and make sure it's exited before we continue. 160 // Kill the sleeper, and make sure it's exited before we continue.
162 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true)); 161 ASSERT_NO_FATAL_FAILURE(sleeper.Kill(kExitCode, true));
163 162
164 watcher.WaitForExit(); 163 watcher.WaitForExit();
165 EXPECT_EQ(kExitCode, watcher.exit_code()); 164 EXPECT_EQ(kExitCode, watcher.exit_code());
166 165
167 VerifyWroteExitCode(sleeper.process().Pid(), kExitCode); 166 VerifyWroteExitCode(sleeper.process().Pid(), kExitCode);
168 } 167 }
169 168
170 } // namespace browser_watcher 169 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698