| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10)); | 762 EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10)); |
| 763 EXPECT_STREQ("1234567890", output.c_str()); | 763 EXPECT_STREQ("1234567890", output.c_str()); |
| 764 #else | 764 #else |
| 765 argv.push_back("yes"); | 765 argv.push_back("yes"); |
| 766 EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10)); | 766 EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 10)); |
| 767 EXPECT_STREQ("y\ny\ny\ny\ny\n", output.c_str()); | 767 EXPECT_STREQ("y\ny\ny\ny\ny\n", output.c_str()); |
| 768 #endif | 768 #endif |
| 769 } | 769 } |
| 770 #endif | 770 #endif |
| 771 | 771 |
| 772 TEST_F(ProcessUtilTest, GetAppOutputRestrictedNoZombies) { | 772 #if defined(ADDRESS_SANITIZER) && defined(OS_MACOSX) && \ |
| 773 defined(ARCH_CPU_64_BITS) |
| 774 // Times out under AddressSanitizer on 64-bit OS X, see |
| 775 // http://crbug.com/298197. |
| 776 #define MAYBE_GetAppOutputRestrictedNoZombies \ |
| 777 DISABLED_GetAppOutputRestrictedNoZombies |
| 778 #else |
| 779 #define MAYBE_GetAppOutputRestrictedNoZombies GetAppOutputRestrictedNoZombies |
| 780 #endif |
| 781 TEST_F(ProcessUtilTest, MAYBE_GetAppOutputRestrictedNoZombies) { |
| 773 std::vector<std::string> argv; | 782 std::vector<std::string> argv; |
| 774 | 783 |
| 775 argv.push_back(std::string(kShellPath)); // argv[0] | 784 argv.push_back(std::string(kShellPath)); // argv[0] |
| 776 argv.push_back("-c"); // argv[1] | 785 argv.push_back("-c"); // argv[1] |
| 777 argv.push_back("echo 123456789012345678901234567890"); // argv[2] | 786 argv.push_back("echo 123456789012345678901234567890"); // argv[2] |
| 778 | 787 |
| 779 // Run |GetAppOutputRestricted()| 300 (> default per-user processes on Mac OS | 788 // Run |GetAppOutputRestricted()| 300 (> default per-user processes on Mac OS |
| 780 // 10.5) times with an output buffer big enough to capture all output. | 789 // 10.5) times with an output buffer big enough to capture all output. |
| 781 for (int i = 0; i < 300; i++) { | 790 for (int i = 0; i < 300; i++) { |
| 782 std::string output; | 791 std::string output; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 // Check that process was really killed. | 912 // Check that process was really killed. |
| 904 EXPECT_TRUE(IsProcessDead(child_process)); | 913 EXPECT_TRUE(IsProcessDead(child_process)); |
| 905 base::CloseProcessHandle(child_process); | 914 base::CloseProcessHandle(child_process); |
| 906 } | 915 } |
| 907 | 916 |
| 908 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { | 917 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { |
| 909 return 0; | 918 return 0; |
| 910 } | 919 } |
| 911 | 920 |
| 912 #endif // defined(OS_POSIX) | 921 #endif // defined(OS_POSIX) |
| OLD | NEW |