OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/test/test_launcher/test_runner.h" | 5 #include "chrome/test/test_launcher/test_runner.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/linked_ptr.h" | 11 #include "base/linked_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 FilePath executable = command_line.GetProgram().BaseName(); | 67 FilePath executable = command_line.GetProgram().BaseName(); |
68 path = path.Append(executable.ReplaceExtension( | 68 path = path.Append(executable.ReplaceExtension( |
69 FilePath::StringType(FILE_PATH_LITERAL("xml")))); | 69 FilePath::StringType(FILE_PATH_LITERAL("xml")))); |
70 } | 70 } |
71 } | 71 } |
72 if (path.value().empty()) | 72 if (path.value().empty()) |
73 path = FilePath(kDefaultOutputFile); | 73 path = FilePath(kDefaultOutputFile); |
74 FilePath dir_name = path.DirName(); | 74 FilePath dir_name = path.DirName(); |
75 if (!file_util::DirectoryExists(dir_name)) { | 75 if (!file_util::DirectoryExists(dir_name)) { |
76 LOG(WARNING) << "The output directory does not exist. " | 76 LOG(WARNING) << "The output directory does not exist. " |
77 << "Creating the directory: " << dir_name.value() << std::endl; | 77 << "Creating the directory: " << dir_name.value(); |
78 // Create the directory if necessary (because the gtest does the same). | 78 // Create the directory if necessary (because the gtest does the same). |
79 file_util::CreateDirectory(dir_name); | 79 file_util::CreateDirectory(dir_name); |
80 } | 80 } |
81 out_ = file_util::OpenFile(path, "w"); | 81 out_ = file_util::OpenFile(path, "w"); |
82 if (!out_) { | 82 if (!out_) { |
83 LOG(ERROR) << "Cannot open output file: " | 83 LOG(ERROR) << "Cannot open output file: " << path.value() << "."; |
84 << path.value() << "." << std::endl; | |
85 return; | 84 return; |
86 } | 85 } |
87 fprintf(out_, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); | 86 fprintf(out_, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); |
88 fprintf(out_, "<testsuites name=\"AllTests\" tests=\"\" failures=\"\"" | 87 fprintf(out_, "<testsuites name=\"AllTests\" tests=\"\" failures=\"\"" |
89 " disabled=\"\" errors=\"\" time=\"\">\n"); | 88 " disabled=\"\" errors=\"\" time=\"\">\n"); |
90 } | 89 } |
91 | 90 |
92 ResultsPrinter::~ResultsPrinter() { | 91 ResultsPrinter::~ResultsPrinter() { |
93 if (!out_) | 92 if (!out_) |
94 return; | 93 return; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 printf("Failing tests:\n"); | 260 printf("Failing tests:\n"); |
262 for (std::vector<std::string>::const_iterator iter = failed_tests.begin(); | 261 for (std::vector<std::string>::const_iterator iter = failed_tests.begin(); |
263 iter != failed_tests.end(); ++iter) { | 262 iter != failed_tests.end(); ++iter) { |
264 printf("%s\n", iter->c_str()); | 263 printf("%s\n", iter->c_str()); |
265 } | 264 } |
266 | 265 |
267 return false; | 266 return false; |
268 } | 267 } |
269 | 268 |
270 } // namespace | 269 } // namespace |
OLD | NEW |