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/launcher/test_launcher.h" | 10 #include "base/test/launcher/test_launcher.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 XmlUnitTestResultPrinter::XmlUnitTestResultPrinter() : output_file_(NULL) { | 29 XmlUnitTestResultPrinter::XmlUnitTestResultPrinter() : output_file_(NULL) { |
30 } | 30 } |
31 | 31 |
32 XmlUnitTestResultPrinter::~XmlUnitTestResultPrinter() { | 32 XmlUnitTestResultPrinter::~XmlUnitTestResultPrinter() { |
33 if (output_file_) { | 33 if (output_file_) { |
34 fprintf(output_file_, "</testsuites>\n"); | 34 fprintf(output_file_, "</testsuites>\n"); |
35 fflush(output_file_); | 35 fflush(output_file_); |
36 file_util::CloseFile(output_file_); | 36 base::CloseFile(output_file_); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 bool XmlUnitTestResultPrinter::Initialize(const FilePath& output_file_path) { | 40 bool XmlUnitTestResultPrinter::Initialize(const FilePath& output_file_path) { |
41 DCHECK(!output_file_); | 41 DCHECK(!output_file_); |
42 output_file_ = file_util::OpenFile(output_file_path, "w"); | 42 output_file_ = OpenFile(output_file_path, "w"); |
43 if (!output_file_) | 43 if (!output_file_) |
44 return false; | 44 return false; |
45 | 45 |
46 fprintf(output_file_, | 46 fprintf(output_file_, |
47 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites>\n"); | 47 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<testsuites>\n"); |
48 fflush(output_file_); | 48 fflush(output_file_); |
49 | 49 |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // format. | 219 // format. |
220 return false; | 220 return false; |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 *crashed = (state != STATE_END); | 224 *crashed = (state != STATE_END); |
225 return true; | 225 return true; |
226 } | 226 } |
227 | 227 |
228 } // namespace base | 228 } // namespace base |
OLD | NEW |