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

Unified Diff: base/test/launcher/test_results_tracker.cc

Issue 93603008: GTTF: Include info about disabled tests and platforms in JSON test summary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 11 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
« no previous file with comments | « base/test/launcher/test_results_tracker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_results_tracker.cc
diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc
index 3e680939b79541bb147a7db31e03d420414a328f..9841e5c9f06569bfc497028ca2684d215277d0d1 100644
--- a/base/test/launcher/test_results_tracker.cc
+++ b/base/test/launcher/test_results_tracker.cc
@@ -12,6 +12,7 @@
#include "base/json/json_file_value_serializer.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/launcher/test_launcher.h"
#include "base/values.h"
@@ -47,6 +48,12 @@ void PrintTests(InputIterator first,
fflush(stdout);
}
+std::string TestNameWithoutDisabledPrefix(const std::string& test_name) {
+ std::string test_name_no_disabled(test_name);
+ ReplaceSubstringsAfterOffset(&test_name_no_disabled, 0, "DISABLED_", "");
+ return test_name_no_disabled;
+}
+
} // namespace
TestResultsTracker::TestResultsTracker() : iteration_(-1), out_(NULL) {
@@ -155,6 +162,18 @@ void TestResultsTracker::OnTestIterationStarting() {
per_iteration_data_.push_back(PerIterationData());
}
+void TestResultsTracker::AddTest(const std::string& test_name) {
+ // Record disabled test names without DISABLED_ prefix so that they are easy
+ // to compare with regular test names, e.g. before or after disabling.
+ all_tests_.insert(TestNameWithoutDisabledPrefix(test_name));
+}
+
+void TestResultsTracker::AddDisabledTest(const std::string& test_name) {
+ // Record disabled test names without DISABLED_ prefix so that they are easy
+ // to compare with regular test names, e.g. before or after disabling.
+ disabled_tests_.insert(TestNameWithoutDisabledPrefix(test_name));
+}
+
void TestResultsTracker::AddTestResult(const TestResult& result) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -252,6 +271,24 @@ bool TestResultsTracker::SaveSummaryAsJSON(const FilePath& path) const {
global_tags->AppendString(*i);
}
+ ListValue* all_tests = new ListValue;
+ summary_root->Set("all_tests", all_tests);
+
+ for (std::set<std::string>::const_iterator i = all_tests_.begin();
+ i != all_tests_.end();
+ ++i) {
+ all_tests->AppendString(*i);
+ }
+
+ ListValue* disabled_tests = new ListValue;
+ summary_root->Set("disabled_tests", disabled_tests);
+
+ for (std::set<std::string>::const_iterator i = disabled_tests_.begin();
+ i != disabled_tests_.end();
+ ++i) {
+ disabled_tests->AppendString(*i);
+ }
+
ListValue* per_iteration_data = new ListValue;
summary_root->Set("per_iteration_data", per_iteration_data);
« no previous file with comments | « base/test/launcher/test_results_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698