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_ |