Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: content/public/test/test_launcher.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698