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

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

Issue 1027993002: Allow unit tests to force serial execution in the test launcher. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TestID experiment Created 5 years, 9 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_id.h ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_id.cc
diff --git a/base/test/launcher/test_id.cc b/base/test/launcher/test_id.cc
new file mode 100644
index 0000000000000000000000000000000000000000..72f9a5c31391d5bae8cf44597792597a89c3bbb4
--- /dev/null
+++ b/base/test/launcher/test_id.cc
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/test/launcher/test_id.h"
+
+#include "base/strings/string_util.h"
+
+namespace base {
+
+TestID::TestID(const std::string& original_name)
+ : original_name_(original_name) {
+}
+
+std::string TestID::GetDisplayName() const {
+ std::string display_name = original_name_;
+ ReplaceFirstSubstringAfterOffset(&display_name, 0, ".DISABLED_", ".");
+ ReplaceFirstSubstringAfterOffset(&display_name, 0, ".SERIALIZE_", ".");
+ return display_name;
+}
+
+std::string TestID::GetTestName() const {
+ std::string display_name = GetDisplayName();
+ size_t dot_index = display_name.find('.');
+ return display_name.substr(dot_index + 1);
+}
+
+std::string GetTestCaseName() const {
+ size_t dot_index = original_name_.find('.');
+ return original_name_.substr(0, dot_index);
+}
+
+bool TestID::IsDisabled() const {
+ return original_name_.find(".DISABLED_") != std::string::npos;
+}
+
+bool TestID::IsSerialized() const {
+ return original_name_.find(".SERIALIZE_") != std::string::npos;
+}
+
+} // namespace base
+
+#endif // BASE_TEST_LAUNCHER_TEST_RESULT_H_
« no previous file with comments | « base/test/launcher/test_id.h ('k') | base/test/launcher/unit_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698