Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/test/gtest_util.h" | 5 #include "base/test/gtest_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/json/json_file_value_serializer.h" | 12 #include "base/json/json_file_value_serializer.h" |
| 13 #include "base/strings/string_util.h" | |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 | 18 |
| 18 TestIdentifier::TestIdentifier() { | 19 TestIdentifier::TestIdentifier() { |
| 19 } | 20 } |
| 20 | 21 |
| 21 TestIdentifier::TestIdentifier(const TestIdentifier& other) = default; | 22 TestIdentifier::TestIdentifier(const TestIdentifier& other) = default; |
| 22 | 23 |
| 23 std::string FormatFullTestName(const std::string& test_case_name, | 24 std::string FormatFullTestName(const std::string& test_case_name, |
| 24 const std::string& test_name) { | 25 const std::string& test_name) { |
| 25 return test_case_name + "." + test_name; | 26 return test_case_name + "." + test_name; |
| 26 } | 27 } |
| 27 | 28 |
| 29 std::string NormalizeTestName(const std::string& full_test_name) { | |
| 30 std::string test_name_no_disabled(full_test_name); | |
| 31 ReplaceSubstringsAfterOffset(&test_name_no_disabled, 0, "DISABLED_", ""); | |
|
stgao
2016/10/24 21:48:23
For test A.B, if A or B matches either "DISABLED_*
Paweł Hajdan Jr.
2016/10/25 18:16:59
The code is fine. It matches existing implementati
stgao
2016/10/25 19:16:49
Acknowledged.
| |
| 32 return test_name_no_disabled; | |
| 33 } | |
| 34 | |
| 28 std::vector<TestIdentifier> GetCompiledInTests() { | 35 std::vector<TestIdentifier> GetCompiledInTests() { |
| 29 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); | 36 testing::UnitTest* const unit_test = testing::UnitTest::GetInstance(); |
| 30 | 37 |
| 31 std::vector<TestIdentifier> tests; | 38 std::vector<TestIdentifier> tests; |
| 32 for (int i = 0; i < unit_test->total_test_case_count(); ++i) { | 39 for (int i = 0; i < unit_test->total_test_case_count(); ++i) { |
| 33 const testing::TestCase* test_case = unit_test->GetTestCase(i); | 40 const testing::TestCase* test_case = unit_test->GetTestCase(i); |
| 34 for (int j = 0; j < test_case->total_test_count(); ++j) { | 41 for (int j = 0; j < test_case->total_test_count(); ++j) { |
| 35 const testing::TestInfo* test_info = test_case->GetTestInfo(j); | 42 const testing::TestInfo* test_info = test_case->GetTestInfo(j); |
| 36 TestIdentifier test_data; | 43 TestIdentifier test_data; |
| 37 test_data.test_case_name = test_case->name(); | 44 test_data.test_case_name = test_case->name(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 return false; | 103 return false; |
| 97 | 104 |
| 98 result.push_back(test_data); | 105 result.push_back(test_data); |
| 99 } | 106 } |
| 100 | 107 |
| 101 output->swap(result); | 108 output->swap(result); |
| 102 return true; | 109 return true; |
| 103 } | 110 } |
| 104 | 111 |
| 105 } // namespace base | 112 } // namespace base |
| OLD | NEW |