| 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/file_util.h" | 7 #include "base/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/test_launcher.h" | 10 #include "base/test/test_launcher.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 fprintf(output_file_, " </testsuite>\n"); | 86 fprintf(output_file_, " </testsuite>\n"); |
| 87 fflush(output_file_); | 87 fflush(output_file_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ProcessGTestOutput(const base::FilePath& output_file, | 90 bool ProcessGTestOutput(const base::FilePath& output_file, |
| 91 std::vector<TestResult>* results, | 91 std::vector<TestResult>* results, |
| 92 bool* crashed) { | 92 bool* crashed) { |
| 93 DCHECK(results); | 93 DCHECK(results); |
| 94 | 94 |
| 95 std::string xml_contents; | 95 std::string xml_contents; |
| 96 if (!file_util::ReadFileToString(output_file, &xml_contents)) | 96 if (!ReadFileToString(output_file, &xml_contents)) |
| 97 return false; | 97 return false; |
| 98 | 98 |
| 99 // Silence XML errors - otherwise they go to stderr. | 99 // Silence XML errors - otherwise they go to stderr. |
| 100 std::string xml_errors; | 100 std::string xml_errors; |
| 101 ScopedXmlErrorFunc error_func(&xml_errors, &XmlErrorFunc); | 101 ScopedXmlErrorFunc error_func(&xml_errors, &XmlErrorFunc); |
| 102 | 102 |
| 103 XmlReader xml_reader; | 103 XmlReader xml_reader; |
| 104 if (!xml_reader.Load(xml_contents)) | 104 if (!xml_reader.Load(xml_contents)) |
| 105 return false; | 105 return false; |
| 106 | 106 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // format. | 213 // format. |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 *crashed = (state != STATE_END); | 218 *crashed = (state != STATE_END); |
| 219 return true; | 219 return true; |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace base | 222 } // namespace base |
| OLD | NEW |