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/test_launcher.h" | 5 #include "base/test/test_launcher.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // (the behavior is same as what gtest does). | 155 // (the behavior is same as what gtest does). |
156 if (path.EndsWithSeparator()) { | 156 if (path.EndsWithSeparator()) { |
157 FilePath executable = command_line.GetProgram().BaseName(); | 157 FilePath executable = command_line.GetProgram().BaseName(); |
158 path = path.Append(executable.ReplaceExtension( | 158 path = path.Append(executable.ReplaceExtension( |
159 FilePath::StringType(FILE_PATH_LITERAL("xml")))); | 159 FilePath::StringType(FILE_PATH_LITERAL("xml")))); |
160 } | 160 } |
161 } | 161 } |
162 if (path.value().empty()) | 162 if (path.value().empty()) |
163 path = FilePath(kDefaultOutputFile); | 163 path = FilePath(kDefaultOutputFile); |
164 FilePath dir_name = path.DirName(); | 164 FilePath dir_name = path.DirName(); |
165 if (!file_util::DirectoryExists(dir_name)) { | 165 if (!DirectoryExists(dir_name)) { |
166 LOG(WARNING) << "The output directory does not exist. " | 166 LOG(WARNING) << "The output directory does not exist. " |
167 << "Creating the directory: " << dir_name.value(); | 167 << "Creating the directory: " << dir_name.value(); |
168 // Create the directory if necessary (because the gtest does the same). | 168 // Create the directory if necessary (because the gtest does the same). |
169 file_util::CreateDirectory(dir_name); | 169 file_util::CreateDirectory(dir_name); |
170 } | 170 } |
171 out_ = file_util::OpenFile(path, "w"); | 171 out_ = file_util::OpenFile(path, "w"); |
172 if (!out_) { | 172 if (!out_) { |
173 LOG(ERROR) << "Cannot open output file: " | 173 LOG(ERROR) << "Cannot open output file: " |
174 << path.value() << "."; | 174 << path.value() << "."; |
175 return; | 175 return; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 // Special value "-1" means "repeat indefinitely". | 442 // Special value "-1" means "repeat indefinitely". |
443 if (cycles != -1) | 443 if (cycles != -1) |
444 cycles--; | 444 cycles--; |
445 } | 445 } |
446 | 446 |
447 return exit_code; | 447 return exit_code; |
448 } | 448 } |
449 | 449 |
450 } // namespace base | 450 } // namespace base |
OLD | NEW |