| OLD | NEW |
| 1 // Copyright 2016 The Crashpad Authors. All rights reserved. | 1 // Copyright 2016 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <windows.h> | 16 #include <windows.h> |
| 17 #include <tlhelp32.h> | 17 #include <tlhelp32.h> |
| 18 | 18 |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "client/crashpad_client.h" | 22 #include "client/crashpad_client.h" |
| 23 #include "gtest/gtest.h" |
| 23 #include "test/test_paths.h" | 24 #include "test/test_paths.h" |
| 24 #include "test/win/child_launcher.h" | 25 #include "test/win/child_launcher.h" |
| 25 #include "util/file/file_io.h" | 26 #include "util/file/file_io.h" |
| 26 #include "util/win/scoped_handle.h" | 27 #include "util/win/scoped_handle.h" |
| 27 #include "util/win/xp_compat.h" | 28 #include "util/win/xp_compat.h" |
| 28 | 29 |
| 29 namespace crashpad { | 30 namespace crashpad { |
| 30 namespace test { | 31 namespace test { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 fprintf(stderr, "Usage: %ls <server_pipe_name> [noexception]\n", argv[0]); | 87 fprintf(stderr, "Usage: %ls <server_pipe_name> [noexception]\n", argv[0]); |
| 87 return EXIT_FAILURE; | 88 return EXIT_FAILURE; |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Launch another process that hangs. | 91 // Launch another process that hangs. |
| 91 base::FilePath test_executable = TestPaths::Executable(); | 92 base::FilePath test_executable = TestPaths::Executable(); |
| 92 std::wstring child_test_executable = | 93 std::wstring child_test_executable = |
| 93 test_executable.DirName().Append(L"hanging_program.exe").value(); | 94 test_executable.DirName().Append(L"hanging_program.exe").value(); |
| 94 ChildLauncher child(child_test_executable, argv[1]); | 95 ChildLauncher child(child_test_executable, argv[1]); |
| 95 child.Start(); | 96 child.Start(); |
| 97 if (testing::Test::HasFatalFailure()) { |
| 98 LOG(ERROR) << "failed to start child"; |
| 99 return EXIT_FAILURE; |
| 100 } |
| 96 | 101 |
| 97 // Wait until it's ready. | 102 // Wait until it's ready. |
| 98 char c; | 103 char c; |
| 99 if (!LoggingReadFileExactly(child.stdout_read_handle(), &c, sizeof(c)) || | 104 if (!LoggingReadFileExactly(child.stdout_read_handle(), &c, sizeof(c)) || |
| 100 c != ' ') { | 105 c != ' ') { |
| 101 LOG(ERROR) << "failed child communication"; | 106 LOG(ERROR) << "failed child communication"; |
| 102 return EXIT_FAILURE; | 107 return EXIT_FAILURE; |
| 103 } | 108 } |
| 104 | 109 |
| 105 DWORD expect_exit_code; | 110 DWORD expect_exit_code; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 126 return EXIT_SUCCESS; | 131 return EXIT_SUCCESS; |
| 127 } | 132 } |
| 128 | 133 |
| 129 } // namespace | 134 } // namespace |
| 130 } // namespace test | 135 } // namespace test |
| 131 } // namespace crashpad | 136 } // namespace crashpad |
| 132 | 137 |
| 133 int wmain(int argc, wchar_t* argv[]) { | 138 int wmain(int argc, wchar_t* argv[]) { |
| 134 return crashpad::test::CrashOtherProgram(argc, argv); | 139 return crashpad::test::CrashOtherProgram(argc, argv); |
| 135 } | 140 } |
| OLD | NEW |