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

Unified Diff: base/process/process_util_unittest.cc

Issue 2118583004: Remove unused function from base/process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix NULL Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/launch_posix.cc ('k') | build/android/pylib/gtest/filter/base_unittests_disabled » ('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 c162fb203663635eb9db72d283d192bebcb04875..783e09a1644e84161f6bd44a1bda1164803f9cd7 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -844,118 +844,6 @@ TEST_F(ProcessUtilTest, GetAppOutput) {
#endif // defined(OS_ANDROID)
}
-// Flakes on Android, crbug.com/375840
-#if defined(OS_ANDROID)
-#define MAYBE_GetAppOutputRestricted DISABLED_GetAppOutputRestricted
-#else
-#define MAYBE_GetAppOutputRestricted GetAppOutputRestricted
-#endif
-TEST_F(ProcessUtilTest, MAYBE_GetAppOutputRestricted) {
- // Unfortunately, since we can't rely on the path, we need to know where
- // everything is. So let's use /bin/sh, which is on every POSIX system, and
- // its built-ins.
- std::vector<std::string> argv;
- argv.push_back(std::string(kShellPath)); // argv[0]
- argv.push_back("-c"); // argv[1]
-
- // On success, should set |output|. We use |/bin/sh -c 'exit 0'| instead of
- // |true| since the location of the latter may be |/bin| or |/usr/bin| (and we
- // need absolute paths).
- argv.push_back("exit 0"); // argv[2]; equivalent to "true"
- std::string output = "abc";
- 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(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(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(base::CommandLine(argv), &output,
- 5));
- EXPECT_STREQ("12345", output.c_str());
-
- // Amount of output less than space allowed.
- output.clear();
- 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(base::CommandLine(argv), &output,
- 0));
- EXPECT_STREQ("", output.c_str());
-}
-
-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD)
-// TODO(benwells): GetAppOutputRestricted should terminate applications
-// with SIGPIPE when we have enough output. http://crbug.com/88502
-TEST_F(ProcessUtilTest, GetAppOutputRestrictedSIGPIPE) {
- std::vector<std::string> argv;
- std::string output;
-
- argv.push_back(std::string(kShellPath)); // argv[0]
- argv.push_back("-c");
-#if defined(OS_ANDROID)
- argv.push_back("while echo 12345678901234567890; do :; done");
- EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
- 10));
- EXPECT_STREQ("1234567890", output.c_str());
-#else // defined(OS_ANDROID)
- argv.push_back("yes");
- EXPECT_TRUE(base::GetAppOutputRestricted(base::CommandLine(argv), &output,
- 10));
- EXPECT_STREQ("y\ny\ny\ny\ny\n", output.c_str());
-#endif // !defined(OS_ANDROID)
-}
-#endif // !defined(OS_MACOSX) && !defined(OS_OPENBSD)
-
-#if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) && \
- defined(ARCH_CPU_64_BITS)
-// Times out under AddressSanitizer on 64-bit OS X, see
-// http://crbug.com/298197.
-#define MAYBE_GetAppOutputRestrictedNoZombies \
- DISABLED_GetAppOutputRestrictedNoZombies
-#else
-#define MAYBE_GetAppOutputRestrictedNoZombies GetAppOutputRestrictedNoZombies
-#endif
-TEST_F(ProcessUtilTest, MAYBE_GetAppOutputRestrictedNoZombies) {
- std::vector<std::string> argv;
-
- argv.push_back(std::string(kShellPath)); // argv[0]
- argv.push_back("-c"); // argv[1]
- argv.push_back("echo 123456789012345678901234567890"); // argv[2]
-
- // Run |GetAppOutputRestricted()| 300 (> default per-user processes on Mac OS
- // 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(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(base::CommandLine(argv), &output,
- 10));
- EXPECT_STREQ("1234567890", output.c_str());
- }
-}
-
TEST_F(ProcessUtilTest, GetAppOutputWithExitCode) {
// Test getting output from a successful application.
std::vector<std::string> argv;
« no previous file with comments | « base/process/launch_posix.cc ('k') | build/android/pylib/gtest/filter/base_unittests_disabled » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698