OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 DISALLOW_COPY_AND_ASSIGN(CrashingDelegate); | 119 DISALLOW_COPY_AND_ASSIGN(CrashingDelegate); |
120 }; | 120 }; |
121 | 121 |
122 void TestCrashingChild(const base::string16& directory_modification) { | 122 void TestCrashingChild(const base::string16& directory_modification) { |
123 // Set up the registration server on a background thread. | 123 // Set up the registration server on a background thread. |
124 ScopedKernelHANDLE server_ready(CreateEvent(nullptr, false, false, nullptr)); | 124 ScopedKernelHANDLE server_ready(CreateEvent(nullptr, false, false, nullptr)); |
125 ScopedKernelHANDLE completed(CreateEvent(nullptr, false, false, nullptr)); | 125 ScopedKernelHANDLE completed(CreateEvent(nullptr, false, false, nullptr)); |
126 CrashingDelegate delegate(server_ready.get(), completed.get()); | 126 CrashingDelegate delegate(server_ready.get(), completed.get()); |
127 | 127 |
128 ExceptionHandlerServer exception_handler_server(true); | 128 ExceptionHandlerServer exception_handler_server(true); |
129 std::wstring pipe_name = exception_handler_server.CreatePipe(); | 129 std::wstring pipe_name(L"\\\\.\\pipe\\test_name"); |
| 130 exception_handler_server.SetPipeName(pipe_name); |
130 RunServerThread server_thread(&exception_handler_server, &delegate); | 131 RunServerThread server_thread(&exception_handler_server, &delegate); |
131 server_thread.Start(); | 132 server_thread.Start(); |
132 ScopedStopServerAndJoinThread scoped_stop_server_and_join_thread( | 133 ScopedStopServerAndJoinThread scoped_stop_server_and_join_thread( |
133 &exception_handler_server, &server_thread); | 134 &exception_handler_server, &server_thread); |
134 | 135 |
135 WaitForSingleObject(server_ready.get(), INFINITE); | 136 WaitForSingleObject(server_ready.get(), INFINITE); |
136 | 137 |
137 // Spawn a child process, passing it the pipe name to connect to. | 138 // Spawn a child process, passing it the pipe name to connect to. |
138 base::FilePath test_executable = Paths::Executable(); | 139 base::FilePath test_executable = Paths::Executable(); |
139 std::wstring child_test_executable = | 140 std::wstring child_test_executable = |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 }; | 221 }; |
221 | 222 |
222 void TestDumpWithoutCrashingChild( | 223 void TestDumpWithoutCrashingChild( |
223 const base::string16& directory_modification) { | 224 const base::string16& directory_modification) { |
224 // Set up the registration server on a background thread. | 225 // Set up the registration server on a background thread. |
225 ScopedKernelHANDLE server_ready(CreateEvent(nullptr, false, false, nullptr)); | 226 ScopedKernelHANDLE server_ready(CreateEvent(nullptr, false, false, nullptr)); |
226 ScopedKernelHANDLE completed(CreateEvent(nullptr, false, false, nullptr)); | 227 ScopedKernelHANDLE completed(CreateEvent(nullptr, false, false, nullptr)); |
227 SimulateDelegate delegate(server_ready.get(), completed.get()); | 228 SimulateDelegate delegate(server_ready.get(), completed.get()); |
228 | 229 |
229 ExceptionHandlerServer exception_handler_server(true); | 230 ExceptionHandlerServer exception_handler_server(true); |
230 std::wstring pipe_name = exception_handler_server.CreatePipe(); | 231 std::wstring pipe_name(L"\\\\.\\pipe\\test_name"); |
| 232 exception_handler_server.SetPipeName(pipe_name); |
231 RunServerThread server_thread(&exception_handler_server, &delegate); | 233 RunServerThread server_thread(&exception_handler_server, &delegate); |
232 server_thread.Start(); | 234 server_thread.Start(); |
233 ScopedStopServerAndJoinThread scoped_stop_server_and_join_thread( | 235 ScopedStopServerAndJoinThread scoped_stop_server_and_join_thread( |
234 &exception_handler_server, &server_thread); | 236 &exception_handler_server, &server_thread); |
235 | 237 |
236 WaitForSingleObject(server_ready.get(), INFINITE); | 238 WaitForSingleObject(server_ready.get(), INFINITE); |
237 | 239 |
238 // Spawn a child process, passing it the pipe name to connect to. | 240 // Spawn a child process, passing it the pipe name to connect to. |
239 base::FilePath test_executable = Paths::Executable(); | 241 base::FilePath test_executable = Paths::Executable(); |
240 std::wstring child_test_executable = | 242 std::wstring child_test_executable = |
(...skipping 26 matching lines...) Expand all Loading... |
267 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug")); | 269 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Debug")); |
268 #else | 270 #else |
269 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release")); | 271 TestDumpWithoutCrashingChild(FILE_PATH_LITERAL("..\\..\\out\\Release")); |
270 #endif | 272 #endif |
271 } | 273 } |
272 #endif // ARCH_CPU_64_BITS | 274 #endif // ARCH_CPU_64_BITS |
273 | 275 |
274 } // namespace | 276 } // namespace |
275 } // namespace test | 277 } // namespace test |
276 } // namespace crashpad | 278 } // namespace crashpad |
OLD | NEW |