summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorsergiyb@chromium.org <sergiyb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-05 22:56:43 +0000
committersergiyb@chromium.org <sergiyb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-05 22:56:43 +0000
commit4983b81b070f83257e5bc198eeee91c5760075da (patch)
treea0f2d16dae8179c5749af7c4a374f6053feef438 /base
parent35f5421c0ebda7ab13426c9453bd7be40b262d2c (diff)
downloadchromium_src-4983b81b070f83257e5bc198eeee91c5760075da.zip
chromium_src-4983b81b070f83257e5bc198eeee91c5760075da.tar.gz
chromium_src-4983b81b070f83257e5bc198eeee91c5760075da.tar.bz2
Factored out duplicate code for formatting full test name
R=phajdan.jr@chromium.org Review URL: https://codereview.chromium.org/418093004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/test/gtest_xml_util.cc3
-rw-r--r--base/test/launcher/test_launcher.cc11
-rw-r--r--base/test/launcher/test_launcher.h4
3 files changed, 14 insertions, 4 deletions
diff --git a/base/test/gtest_xml_util.cc b/base/test/gtest_xml_util.cc
index 75d023a..f52c2f6 100644
--- a/base/test/gtest_xml_util.cc
+++ b/base/test/gtest_xml_util.cc
@@ -146,7 +146,8 @@ bool ProcessGTestOutput(const base::FilePath& output_file,
std::string test_name;
if (!xml_reader.NodeAttribute("name", &test_name))
return false;
- result.full_name = test_case_name + "." + test_name;
+ result.full_name = TestLauncher::FormatFullTestName(test_case_name,
+ test_name);
result.elapsed_time = TimeDelta();
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 56ed4a2..ca60cba 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -576,6 +576,12 @@ void TestLauncher::OnTestFinished(const TestResult& result) {
test_started_count_ += retry_started_count;
}
+// static
+std::string TestLauncher::FormatFullTestName(const std::string& test_case_name,
+ const std::string& test_name) {
+ return test_case_name + "." + test_name;
+}
+
bool TestLauncher::Init() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -785,9 +791,8 @@ void TestLauncher::RunTests() {
const testing::TestCase* test_case = unit_test->GetTestCase(i);
for (int j = 0; j < test_case->total_test_count(); ++j) {
const testing::TestInfo* test_info = test_case->GetTestInfo(j);
- std::string test_name = test_info->test_case_name();
- test_name.append(".");
- test_name.append(test_info->name());
+ std::string test_name = FormatFullTestName(
+ test_info->test_case_name(), test_info->name());
results_tracker_.AddTest(test_name);
diff --git a/base/test/launcher/test_launcher.h b/base/test/launcher/test_launcher.h
index 600c4dec..d50bf2f 100644
--- a/base/test/launcher/test_launcher.h
+++ b/base/test/launcher/test_launcher.h
@@ -99,6 +99,10 @@ class TestLauncher {
// Called when a test has finished running.
void OnTestFinished(const TestResult& result);
+ // Constructs a full test name given a test case name and a test name.
+ static std::string FormatFullTestName(const std::string& test_case_name,
+ const std::string& test_name);
+
private:
bool Init() WARN_UNUSED_RESULT;