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

Unified Diff: base/process_util_unittest.cc

Issue 9625022: Use cmd.exe instead of python.exe for unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | 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 771a587633295f1c045f44e2532c4fda3283441b..15a3a321609691b299323ded3821c3c7bfab019a 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -414,24 +414,23 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
// boundary.
message += "Hello!";
}
-
- FilePath python_runtime;
- ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &python_runtime));
- python_runtime = python_runtime.Append(FILE_PATH_LITERAL("third_party"))
- .Append(FILE_PATH_LITERAL("python_26"))
- .Append(FILE_PATH_LITERAL("python.exe"));
-
- CommandLine cmd_line(python_runtime);
- cmd_line.AppendArg("-c");
- cmd_line.AppendArg("import sys; sys.stdout.write('" + message + "');");
+ // cmd.exe's echo always adds a \r\n to its output.
+ std::string expected(message);
+ expected += "\r\n";
+
+ FilePath cmd(L"cmd.exe");
+ CommandLine cmd_line(cmd);
+ cmd_line.AppendArg("/c");
+ cmd_line.AppendArg("echo " + message + "");
std::string output;
ASSERT_TRUE(base::GetAppOutput(cmd_line, &output));
- EXPECT_EQ(message, output);
+ EXPECT_EQ(expected, output);
// Let's make sure stderr is ignored.
- CommandLine other_cmd_line(python_runtime);
- other_cmd_line.AppendArg("-c");
- other_cmd_line.AppendArg("import sys; sys.stderr.write('Hello!');");
+ CommandLine other_cmd_line(cmd);
+ other_cmd_line.AppendArg("/c");
+ // http://msdn.microsoft.com/library/cc772622.aspx
+ cmd_line.AppendArg("echo " + message + " >&2");
jar (doing other things) 2012/03/07 22:05:35 Although a shell in cygwin or linux can handle thi
output.clear();
ASSERT_TRUE(base::GetAppOutput(other_cmd_line, &output));
EXPECT_EQ("", output);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698