OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_xml_util.h" | 5 #include "base/test/gtest_xml_util.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/test/gtest_util.h" |
10 #include "base/test/launcher/test_launcher.h" | 11 #include "base/test/launcher/test_launcher.h" |
11 #include "third_party/libxml/chromium/libxml_utils.h" | 12 #include "third_party/libxml/chromium/libxml_utils.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 // This is used for the xml parser to report errors. This assumes the context | 18 // This is used for the xml parser to report errors. This assumes the context |
18 // is a pointer to a std::string where the error message should be appended. | 19 // is a pointer to a std::string where the error message should be appended. |
19 static void XmlErrorFunc(void *context, const char *message, ...) { | 20 static void XmlErrorFunc(void *context, const char *message, ...) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // This is our custom extension that helps recognize which test was | 140 // This is our custom extension that helps recognize which test was |
140 // running when the test binary crashed. | 141 // running when the test binary crashed. |
141 TestResult result; | 142 TestResult result; |
142 | 143 |
143 std::string test_case_name; | 144 std::string test_case_name; |
144 if (!xml_reader.NodeAttribute("classname", &test_case_name)) | 145 if (!xml_reader.NodeAttribute("classname", &test_case_name)) |
145 return false; | 146 return false; |
146 std::string test_name; | 147 std::string test_name; |
147 if (!xml_reader.NodeAttribute("name", &test_name)) | 148 if (!xml_reader.NodeAttribute("name", &test_name)) |
148 return false; | 149 return false; |
149 result.full_name = TestLauncher::FormatFullTestName(test_case_name, | 150 result.full_name = FormatFullTestName(test_case_name, test_name); |
150 test_name); | |
151 | 151 |
152 result.elapsed_time = TimeDelta(); | 152 result.elapsed_time = TimeDelta(); |
153 | 153 |
154 // Assume the test crashed - we can correct that later. | 154 // Assume the test crashed - we can correct that later. |
155 result.status = TestResult::TEST_CRASH; | 155 result.status = TestResult::TEST_CRASH; |
156 | 156 |
157 results->push_back(result); | 157 results->push_back(result); |
158 } else if (node_name == "testcase" && !xml_reader.IsClosingElement()) { | 158 } else if (node_name == "testcase" && !xml_reader.IsClosingElement()) { |
159 std::string test_status; | 159 std::string test_status; |
160 if (!xml_reader.NodeAttribute("status", &test_status)) | 160 if (!xml_reader.NodeAttribute("status", &test_status)) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // format. | 220 // format. |
221 return false; | 221 return false; |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 *crashed = (state != STATE_END); | 225 *crashed = (state != STATE_END); |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
229 } // namespace base | 229 } // namespace base |
OLD | NEW |