OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/test/launcher/test_id.h" |
| 6 |
| 7 #include "base/strings/string_util.h" |
| 8 |
| 9 namespace base { |
| 10 |
| 11 TestID::TestID(const std::string& original_name) |
| 12 : original_name_(original_name) { |
| 13 } |
| 14 |
| 15 std::string TestID::GetDisplayName() const { |
| 16 std::string display_name = original_name_; |
| 17 ReplaceFirstSubstringAfterOffset(&display_name, 0, ".DISABLED_", "."); |
| 18 ReplaceFirstSubstringAfterOffset(&display_name, 0, ".SERIALIZE_", "."); |
| 19 return display_name; |
| 20 } |
| 21 |
| 22 std::string TestID::GetTestName() const { |
| 23 std::string display_name = GetDisplayName(); |
| 24 size_t dot_index = display_name.find('.'); |
| 25 return display_name.substr(dot_index + 1); |
| 26 } |
| 27 |
| 28 std::string GetTestCaseName() const { |
| 29 size_t dot_index = original_name_.find('.'); |
| 30 return original_name_.substr(0, dot_index); |
| 31 } |
| 32 |
| 33 bool TestID::IsDisabled() const { |
| 34 return original_name_.find(".DISABLED_") != std::string::npos; |
| 35 } |
| 36 |
| 37 bool TestID::IsSerialized() const { |
| 38 return original_name_.find(".SERIALIZE_") != std::string::npos; |
| 39 } |
| 40 |
| 41 } // namespace base |
| 42 |
| 43 #endif // BASE_TEST_LAUNCHER_TEST_RESULT_H_ |
OLD | NEW |