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

Side by Side Diff: base/test/launcher/unit_test_launcher.cc

Issue 441333002: Disallow breakaway from job for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/test/launcher/unit_test_launcher.h" 5 #include "base/test/launcher/unit_test_launcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 GTestCallbackState callback_state; 181 GTestCallbackState callback_state;
182 callback_state.test_launcher = test_launcher; 182 callback_state.test_launcher = test_launcher;
183 callback_state.test_names = current_test_names; 183 callback_state.test_names = current_test_names;
184 callback_state.output_file = output_file; 184 callback_state.output_file = output_file;
185 185
186 test_launcher->LaunchChildGTestProcess( 186 test_launcher->LaunchChildGTestProcess(
187 cmd_line, 187 cmd_line,
188 std::string(), 188 std::string(),
189 TestTimeouts::test_launcher_timeout(), 189 TestTimeouts::test_launcher_timeout(),
190 use_job_objects_, 190 use_job_objects_,
191 false,
191 Bind(&UnitTestLauncherDelegate::SerialGTestCallback, 192 Bind(&UnitTestLauncherDelegate::SerialGTestCallback,
192 Unretained(this), 193 Unretained(this),
193 callback_state, 194 callback_state,
194 new_test_names)); 195 new_test_names));
195 } 196 }
196 197
197 void RunBatch(TestLauncher* test_launcher, 198 void RunBatch(TestLauncher* test_launcher,
198 const std::vector<std::string>& test_names) { 199 const std::vector<std::string>& test_names) {
199 DCHECK(thread_checker_.CalledOnValidThread()); 200 DCHECK(thread_checker_.CalledOnValidThread());
200 201
(...skipping 22 matching lines...) Expand all
223 GTestCallbackState callback_state; 224 GTestCallbackState callback_state;
224 callback_state.test_launcher = test_launcher; 225 callback_state.test_launcher = test_launcher;
225 callback_state.test_names = test_names; 226 callback_state.test_names = test_names;
226 callback_state.output_file = output_file; 227 callback_state.output_file = output_file;
227 228
228 test_launcher->LaunchChildGTestProcess( 229 test_launcher->LaunchChildGTestProcess(
229 cmd_line, 230 cmd_line,
230 std::string(), 231 std::string(),
231 timeout, 232 timeout,
232 use_job_objects_, 233 use_job_objects_,
234 false,
233 Bind(&UnitTestLauncherDelegate::GTestCallback, 235 Bind(&UnitTestLauncherDelegate::GTestCallback,
234 Unretained(this), 236 Unretained(this),
235 callback_state)); 237 callback_state));
236 } 238 }
237 239
238 void GTestCallback(const GTestCallbackState& callback_state, 240 void GTestCallback(const GTestCallbackState& callback_state,
239 int exit_code, 241 int exit_code,
240 const TimeDelta& elapsed_time, 242 const TimeDelta& elapsed_time,
241 bool was_timeout, 243 bool was_timeout,
242 const std::string& output) { 244 const std::string& output) {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 CommandLine::Init(argc, NULL); 579 CommandLine::Init(argc, NULL);
578 return LaunchUnitTestsInternal( 580 return LaunchUnitTestsInternal(
579 run_test_suite, 581 run_test_suite,
580 SysInfo::NumberOfProcessors(), 582 SysInfo::NumberOfProcessors(),
581 use_job_objects, 583 use_job_objects,
582 Bind(&InitGoogleTestWChar, &argc, argv)); 584 Bind(&InitGoogleTestWChar, &argc, argv));
583 } 585 }
584 #endif // defined(OS_WIN) 586 #endif // defined(OS_WIN)
585 587
586 } // namespace base 588 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698