| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 | 670 |
| 671 std::vector<std::string> argv; | 671 std::vector<std::string> argv; |
| 672 argv.push_back("/bin/echo"); | 672 argv.push_back("/bin/echo"); |
| 673 argv.push_back("-n"); | 673 argv.push_back("-n"); |
| 674 argv.push_back("foobar42"); | 674 argv.push_back("foobar42"); |
| 675 EXPECT_TRUE(base::GetAppOutput(CommandLine(argv), &output)); | 675 EXPECT_TRUE(base::GetAppOutput(CommandLine(argv), &output)); |
| 676 EXPECT_STREQ("foobar42", output.c_str()); | 676 EXPECT_STREQ("foobar42", output.c_str()); |
| 677 #endif // defined(OS_ANDROID) | 677 #endif // defined(OS_ANDROID) |
| 678 } | 678 } |
| 679 | 679 |
| 680 // Flakes on Android, crbug.com/375840 |
| 681 #if defined(OS_ANDROID) |
| 682 #define MAYBE_GetAppOutputRestricted DISABLED_GetAppOutputRestricted |
| 683 #else |
| 684 #define MAYBE_GetAppOutputRestricted GetAppOutputRestricted |
| 685 #endif |
| 680 TEST_F(ProcessUtilTest, GetAppOutputRestricted) { | 686 TEST_F(ProcessUtilTest, GetAppOutputRestricted) { |
| 681 // Unfortunately, since we can't rely on the path, we need to know where | 687 // Unfortunately, since we can't rely on the path, we need to know where |
| 682 // everything is. So let's use /bin/sh, which is on every POSIX system, and | 688 // everything is. So let's use /bin/sh, which is on every POSIX system, and |
| 683 // its built-ins. | 689 // its built-ins. |
| 684 std::vector<std::string> argv; | 690 std::vector<std::string> argv; |
| 685 argv.push_back(std::string(kShellPath)); // argv[0] | 691 argv.push_back(std::string(kShellPath)); // argv[0] |
| 686 argv.push_back("-c"); // argv[1] | 692 argv.push_back("-c"); // argv[1] |
| 687 | 693 |
| 688 // On success, should set |output|. We use |/bin/sh -c 'exit 0'| instead of | 694 // On success, should set |output|. We use |/bin/sh -c 'exit 0'| instead of |
| 689 // |true| since the location of the latter may be |/bin| or |/usr/bin| (and we | 695 // |true| since the location of the latter may be |/bin| or |/usr/bin| (and we |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // Check that process was really killed. | 846 // Check that process was really killed. |
| 841 EXPECT_TRUE(IsProcessDead(child_process)); | 847 EXPECT_TRUE(IsProcessDead(child_process)); |
| 842 base::CloseProcessHandle(child_process); | 848 base::CloseProcessHandle(child_process); |
| 843 } | 849 } |
| 844 | 850 |
| 845 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { | 851 MULTIPROCESS_TEST_MAIN(process_util_test_die_immediately) { |
| 846 return 0; | 852 return 0; |
| 847 } | 853 } |
| 848 | 854 |
| 849 #endif // defined(OS_POSIX) | 855 #endif // defined(OS_POSIX) |
| OLD | NEW |