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

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

Issue 1154313003: Non-SFI mode: Implement test launcher for nacl_helper_nonsfi_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « base/test/launcher/test_launcher_nacl_nonsfi.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/launcher/unit_test_launcher.h"
6
7 #include "base/command_line.h"
8 #include "base/files/file_util.h"
9 #include "base/test/gtest_util.h"
10 #include "base/test/gtest_xml_unittest_result_printer.h"
11 #include "base/test/test_switches.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace base {
15
16 int LaunchUnitTests(int argc,
17 char** argv,
18 const RunTestSuiteCallback& run_test_suite) {
19 CHECK(CommandLine::InitializedForCurrentProcess() ||
20 CommandLine::Init(argc, argv));
21 const CommandLine* command_line = CommandLine::ForCurrentProcess();
22 if (command_line->HasSwitch(switches::kTestLauncherListTests)) {
23 // Dump all test list into a file.
24 FilePath list_path(
25 command_line->GetSwitchValuePath(switches::kTestLauncherListTests));
26 if (!WriteCompiledInTestsToFile(list_path)) {
27 LOG(ERROR) << "Failed to write list of tests.";
28 return 1;
29 }
30
31 // Successfully done.
32 return 0;
33 }
34
35 // Register XML output printer, if --test-launcher-output flag is set.
36 if (command_line->HasSwitch(switches::kTestLauncherOutput)) {
37 FilePath output_path = command_line->GetSwitchValuePath(
38 switches::kTestLauncherOutput);
39 if (PathExists(output_path)) {
40 LOG(WARNING) << "Test launcher output path exists. Do not override";
41 } else {
42 XmlUnitTestResultPrinter* printer = new XmlUnitTestResultPrinter;
43 CHECK(printer->Initialize(output_path));
44 testing::UnitTest::GetInstance()->listeners().Append(printer);
45 }
46 }
47
48 return run_test_suite.Run();
49 }
50
51 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher_nacl_nonsfi.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698