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

Unified Diff: base/test/launcher/test_launcher.cc

Issue 202113004: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/launch_posix.cc ('k') | chrome/browser/chromeos/system/automatic_reboot_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index c25b00a3c5e157bebce14c317b5242c2a65a599d..889244d92662021b20f79694528edd70170ef7b0 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -14,6 +14,7 @@
#include "base/environment.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/scoped_file.h"
#include "base/format_macros.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -244,16 +245,14 @@ void DoLaunchChildTestProcess(
options.new_process_group = true;
base::FileHandleMappingVector fds_mapping;
- file_util::ScopedFD output_file_fd_closer;
+ base::ScopedFD output_file_fd;
if (redirect_stdio) {
- int output_file_fd = open(output_file.value().c_str(), O_RDWR);
- CHECK_GE(output_file_fd, 0);
+ output_file_fd.reset(open(output_file.value().c_str(), O_RDWR));
+ CHECK(output_file_fd.is_valid());
- output_file_fd_closer.reset(&output_file_fd);
-
- fds_mapping.push_back(std::make_pair(output_file_fd, STDOUT_FILENO));
- fds_mapping.push_back(std::make_pair(output_file_fd, STDERR_FILENO));
+ fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDOUT_FILENO));
+ fds_mapping.push_back(std::make_pair(output_file_fd.get(), STDERR_FILENO));
options.fds_to_remap = &fds_mapping;
}
#endif
@@ -264,10 +263,10 @@ void DoLaunchChildTestProcess(
if (redirect_stdio) {
#if defined(OS_WIN)
- FlushFileBuffers(handle.Get());
- handle.Close();
+ FlushFileBuffers(handle.Get());
+ handle.Close();
#elif defined(OS_POSIX)
- output_file_fd_closer.reset();
+ output_file_fd.reset();
#endif
}
« no previous file with comments | « base/process/launch_posix.cc ('k') | chrome/browser/chromeos/system/automatic_reboot_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698