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; |