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

Unified Diff: base/process/process_util_unittest.cc

Issue 645133002: Prefix CommandLine usege with base namespace (Part 1: base/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated #3 Created 6 years, 2 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/logging.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_util_unittest.cc
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
index d846d1acfae2634c4aff68f1498b21eaac1b45f8..bd7eed76b3e6a8f8e49c9bea765913605671296f 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -325,7 +325,7 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
expected += "\r\n";
FilePath cmd(L"cmd.exe");
- CommandLine cmd_line(cmd);
+ base::CommandLine cmd_line(cmd);
cmd_line.AppendArg("/c");
cmd_line.AppendArg("echo " + message + "");
std::string output;
@@ -333,7 +333,7 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
EXPECT_EQ(expected, output);
// Let's make sure stderr is ignored.
- CommandLine other_cmd_line(cmd);
+ base::CommandLine other_cmd_line(cmd);
other_cmd_line.AppendArg("/c");
// http://msdn.microsoft.com/library/cc772622.aspx
cmd_line.AppendArg("echo " + message + " >&2");
@@ -356,7 +356,7 @@ static const char kEventToTriggerHandleSwitch[] = "event-to-trigger-handle";
MULTIPROCESS_TEST_MAIN(TriggerEventChildProcess) {
std::string handle_value_string =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
kEventToTriggerHandleSwitch);
CHECK(!handle_value_string.empty());
@@ -385,7 +385,7 @@ TEST_F(ProcessUtilTest, InheritSpecifiedHandles) {
base::LaunchOptions options;
options.handles_to_inherit = &handles_to_inherit;
- CommandLine cmd_line = MakeCmdLine("TriggerEventChildProcess");
+ base::CommandLine cmd_line = MakeCmdLine("TriggerEventChildProcess");
cmd_line.AppendSwitchASCII(kEventToTriggerHandleSwitch,
base::Uint64ToString(reinterpret_cast<uint64>(event.handle())));
@@ -710,27 +710,29 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
argv.push_back("-c");
argv.push_back("exit 0");
- EXPECT_TRUE(base::GetAppOutput(CommandLine(argv), &output));
+ EXPECT_TRUE(base::GetAppOutput(base::CommandLine(argv), &output));
EXPECT_STREQ("", output.c_str());
argv[2] = "exit 1";
- EXPECT_FALSE(base::GetAppOutput(CommandLine(argv), &output));
+ EXPECT_FALSE(base::GetAppOutput(base::CommandLine(argv), &output));
EXPECT_STREQ("", output.c_str());
argv[2] = "echo foobar42";
- EXPECT_TRUE(base::GetAppOutput(CommandLine(argv), &output));
+ EXPECT_TRUE(base::GetAppOutput(base::CommandLine(argv), &output));
EXPECT_STREQ("foobar42\n", output.c_str());
#else
- EXPECT_TRUE(base::GetAppOutput(CommandLine(FilePath("true")), &output));
+ EXPECT_TRUE(base::GetAppOutput(base::CommandLine(FilePath("true")),
+ &output));
EXPECT_STREQ("", output.c_str());
- EXPECT_FALSE(base::GetAppOutput(CommandLine(FilePath("false")), &output));
+ EXPECT_FALSE(base::GetAppOutput(base::CommandLine(FilePath("false")),
+ &output));
std::vector<std::string> argv;
argv.push_back("/bin/echo");
argv.push_back("-n");
argv.push_back("foobar42");
- EXPECT_TRUE(base::GetAppOutput(CommandLine(argv), &output));
+ EXPECT_TRUE(base::GetAppOutput(base::CommandLine(argv), &output));
EXPECT_STREQ("foobar42", output.c_str());
#endif // defined(OS_ANDROID)
}
@@ -754,34 +756,39 @@ TEST_F(ProcessUtilTest, MAYBE_GetAppOutputRestricted) {
// need absolute paths).
argv.push_back("exit 0"); // argv[2]; equivalent to "true"
std::string output = "abc";
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 100));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 100));
EXPECT_STREQ("", output.c_str());
argv[2] = "exit 1"; // equivalent to "false"
output = "before";
- EXPECT_FALSE(base::GetAppOutputRestricted(CommandLine(argv),
- &output, 100));
+ EXPECT_FALSE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 100));
EXPECT_STREQ("", output.c_str());
// Amount of output exactly equal to space allowed.
argv[2] = "echo 123456789"; // (the sh built-in doesn't take "-n")
output.clear();
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 10));
EXPECT_STREQ("123456789\n", output.c_str());
// Amount of output greater than space allowed.
output.clear();
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 5));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 5));
EXPECT_STREQ("12345", output.c_str());
// Amount of output less than space allowed.
output.clear();
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 15));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 15));
EXPECT_STREQ("123456789\n", output.c_str());
// Zero space allowed.
output = "abc";
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 0));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 0));
EXPECT_STREQ("", output.c_str());
}
@@ -796,11 +803,13 @@ TEST_F(ProcessUtilTest, GetAppOutputRestrictedSIGPIPE) {
argv.push_back("-c");
#if defined(OS_ANDROID)
argv.push_back("while echo 12345678901234567890; do :; done");
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 10));
EXPECT_STREQ("1234567890", output.c_str());
#else
argv.push_back("yes");
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 10));
EXPECT_STREQ("y\ny\ny\ny\ny\n", output.c_str());
#endif
}
@@ -826,14 +835,16 @@ TEST_F(ProcessUtilTest, MAYBE_GetAppOutputRestrictedNoZombies) {
// 10.5) times with an output buffer big enough to capture all output.
for (int i = 0; i < 300; i++) {
std::string output;
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 100));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 100));
EXPECT_STREQ("123456789012345678901234567890\n", output.c_str());
}
// Ditto, but with an output buffer too small to capture all output.
for (int i = 0; i < 300; i++) {
std::string output;
- EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10));
+ EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
+ 10));
EXPECT_STREQ("1234567890", output.c_str());
}
}
@@ -846,7 +857,7 @@ TEST_F(ProcessUtilTest, GetAppOutputWithExitCode) {
argv.push_back(std::string(kShellPath)); // argv[0]
argv.push_back("-c"); // argv[1]
argv.push_back("echo foo"); // argv[2];
- EXPECT_TRUE(base::GetAppOutputWithExitCode(CommandLine(argv), &output,
+ EXPECT_TRUE(base::GetAppOutputWithExitCode(base::CommandLine(argv), &output,
&exit_code));
EXPECT_STREQ("foo\n", output.c_str());
EXPECT_EQ(exit_code, 0);
@@ -855,7 +866,7 @@ TEST_F(ProcessUtilTest, GetAppOutputWithExitCode) {
// code.
output.clear();
argv[2] = "echo foo; exit 2";
- EXPECT_TRUE(base::GetAppOutputWithExitCode(CommandLine(argv), &output,
+ EXPECT_TRUE(base::GetAppOutputWithExitCode(base::CommandLine(argv), &output,
&exit_code));
EXPECT_STREQ("foo\n", output.c_str());
EXPECT_EQ(exit_code, 2);
« no previous file with comments | « base/logging.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698