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

Unified Diff: base/test/unit_test_launcher.cc

Issue 23757033: GTTF: Support running browser tests in parallel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: base/test/unit_test_launcher.cc
diff --git a/base/test/unit_test_launcher.cc b/base/test/unit_test_launcher.cc
index cc7f5b9a83ea2700e0ee6a9ebf7bf06a1654044f..aeddde149ce7d290a2b2addddc822a1fa386bc32 100644
--- a/base/test/unit_test_launcher.cc
+++ b/base/test/unit_test_launcher.cc
@@ -99,6 +99,14 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
TestResultCallback callback;
};
+ virtual std::string GetTestNameForFiltering(
+ const testing::TestCase* test_case,
+ const testing::TestInfo* test_info) OVERRIDE {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ return std::string(test_case->name()) + "." + test_info->name();
+ }
+
virtual bool ShouldRunTest(const testing::TestCase* test_case,
const testing::TestInfo* test_info) OVERRIDE {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -167,6 +175,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
void GTestCallback(const std::vector<TestLaunchInfo>& tests,
const FilePath& output_file,
int exit_code,
+ const TimeDelta& elapsed_time,
bool was_timeout,
const std::string& output) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -190,35 +199,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
DeleteFile(output_file.DirName(), true);
}
- static void MaybePrintTestOutputSnippet(const TestResult& result,
- const std::string& full_output) {
- if (result.status == TestResult::TEST_SUCCESS)
- return;
-
- size_t run_pos = full_output.find(std::string("[ RUN ] ") +
- result.GetFullName());
- if (run_pos == std::string::npos)
- return;
-
- size_t end_pos = full_output.find(std::string("[ FAILED ] ") +
- result.GetFullName(),
- run_pos);
- if (end_pos != std::string::npos) {
- size_t newline_pos = full_output.find("\n", end_pos);
- if (newline_pos != std::string::npos)
- end_pos = newline_pos + 1;
- }
-
- std::string snippet(full_output.substr(run_pos));
- if (end_pos != std::string::npos)
- snippet = full_output.substr(run_pos, end_pos - run_pos);
-
- // TODO(phajdan.jr): Indent each line of the snippet so it's more
- // noticeable.
- fprintf(stdout, "%s", snippet.c_str());
- fflush(stdout);
- }
-
static bool ProcessTestResults(
const std::vector<TestLaunchInfo>& tests,
const base::FilePath& output_file,
@@ -255,7 +235,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
test_result.status = TestResult::TEST_TIMEOUT;
}
}
- MaybePrintTestOutputSnippet(test_result, output);
+ PrintTestOutputSnippetOnFailure(test_result, output);
tests[i].callback.Run(test_result);
called_any_callback = true;
} else if (had_interrupted_test) {
@@ -268,7 +248,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
test_result.test_case_name = tests[i].test_case_name;
test_result.test_name = tests[i].test_name;
test_result.status = TestResult::TEST_UNKNOWN;
- MaybePrintTestOutputSnippet(test_result, output);
+ PrintTestOutputSnippetOnFailure(test_result, output);
tests[i].callback.Run(test_result);
called_any_callback = true;
}

Powered by Google App Engine
This is Rietveld 408576698