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

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

Issue 2733323002: Changing multiprocess test SpawnChild to return a struct. (Closed)
Patch Set: Fixed bots. Created 3 years, 9 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
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 <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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698