| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/test/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 size_t colon_pos = flag.find(':'); | 168 size_t colon_pos = flag.find(':'); |
| 169 base::FilePath path; | 169 base::FilePath path; |
| 170 if (colon_pos != std::string::npos) { | 170 if (colon_pos != std::string::npos) { |
| 171 base::FilePath flag_path = | 171 base::FilePath flag_path = |
| 172 command_line.GetSwitchValuePath(kGTestOutputFlag); | 172 command_line.GetSwitchValuePath(kGTestOutputFlag); |
| 173 base::FilePath::StringType path_string = flag_path.value(); | 173 base::FilePath::StringType path_string = flag_path.value(); |
| 174 path = base::FilePath(path_string.substr(colon_pos + 1)); | 174 path = base::FilePath(path_string.substr(colon_pos + 1)); |
| 175 // If the given path ends with '/', consider it is a directory. | 175 // If the given path ends with '/', consider it is a directory. |
| 176 // Note: This does NOT check that a directory (or file) actually exists | 176 // Note: This does NOT check that a directory (or file) actually exists |
| 177 // (the behavior is same as what gtest does). | 177 // (the behavior is same as what gtest does). |
| 178 if (file_util::EndsWithSeparator(path)) { | 178 if (path.EndsWithSeparator()) { |
| 179 base::FilePath executable = command_line.GetProgram().BaseName(); | 179 base::FilePath executable = command_line.GetProgram().BaseName(); |
| 180 path = path.Append(executable.ReplaceExtension( | 180 path = path.Append(executable.ReplaceExtension( |
| 181 base::FilePath::StringType(FILE_PATH_LITERAL("xml")))); | 181 base::FilePath::StringType(FILE_PATH_LITERAL("xml")))); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 if (path.value().empty()) | 184 if (path.value().empty()) |
| 185 path = base::FilePath(kDefaultOutputFile); | 185 path = base::FilePath(kDefaultOutputFile); |
| 186 base::FilePath dir_name = path.DirName(); | 186 base::FilePath dir_name = path.DirName(); |
| 187 if (!file_util::DirectoryExists(dir_name)) { | 187 if (!file_util::DirectoryExists(dir_name)) { |
| 188 LOG(WARNING) << "The output directory does not exist. " | 188 LOG(WARNING) << "The output directory does not exist. " |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 cycles--; | 744 cycles--; |
| 745 } | 745 } |
| 746 return exit_code; | 746 return exit_code; |
| 747 } | 747 } |
| 748 | 748 |
| 749 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { | 749 TestLauncherDelegate* GetCurrentTestLauncherDelegate() { |
| 750 return g_launcher_delegate; | 750 return g_launcher_delegate; |
| 751 } | 751 } |
| 752 | 752 |
| 753 } // namespace content | 753 } // namespace content |
| OLD | NEW |