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

Side by Side Diff: base/test/gtest_util.cc

Issue 2439423003: test launcher: make --gtest_filter=A.B + --gtest_also_run_disabled_tests also run A.DISABLED_B or D… (Closed)
Patch Set: Just rebase. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « base/test/gtest_util.h ('k') | base/test/launcher/test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 TestNameWithoutDisabledPrefix(const std::string& full_test_name) {
30 std::string test_name_no_disabled(full_test_name);
31 ReplaceSubstringsAfterOffset(&test_name_no_disabled, 0, "DISABLED_", "");
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
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
OLDNEW
« no previous file with comments | « base/test/gtest_util.h ('k') | base/test/launcher/test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698