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

Unified Diff: base/process_util_unittest.cc

Issue 67226: Add GetAppOutput function, a better replacement for popen. (Closed)
Patch Set: fixes Created 11 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 side-by-side diff with in-line comments
Download patch
« base/process_util_posix.cc ('K') | « base/process_util_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_unittest.cc
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index acb60e046e7ab98dabe99b973a3262156c4d820a..fba7b2b4fa7bac5a8c4ef085748632bb7998231f 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -4,6 +4,7 @@
#define _CRT_SECURE_NO_WARNINGS
+#include "base/command_line.h"
#include "base/multiprocess_test.h"
#include "base/platform_thread.h"
#include "base/process_util.h"
@@ -218,6 +219,21 @@ TEST_F(ProcessUtilTest, FDRemapping) {
close(dev_null);
}
+TEST_F(ProcessUtilTest, GetAppOutput) {
+ std::string output;
+ EXPECT_TRUE(GetAppOutput(CommandLine(L"true"), &output));
+ EXPECT_STREQ("", output.c_str());
+
+ EXPECT_FALSE(GetAppOutput(CommandLine(L"false"), &output));
+
+ std::vector<std::string> argv;
+ argv.push_back("/bin/echo");
+ argv.push_back("-n");
+ argv.push_back("foobar42");
+ EXPECT_TRUE(GetAppOutput(CommandLine(argv), &output));
+ EXPECT_STREQ("foobar42", output.c_str());
+}
+
#endif // defined(OS_POSIX)
} // namespace base
« base/process_util_posix.cc ('K') | « base/process_util_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698