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

Side by Side Diff: base/test/test_launcher.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « base/prefs/json_pref_store_unittest.cc ('k') | chrome/app/app_mode_loader_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/prefs/json_pref_store_unittest.cc ('k') | chrome/app/app_mode_loader_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698