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, |
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 "snapshot/crashpad_info_client_options.h" | 15 #include "snapshot/crashpad_info_client_options.h" |
16 | 16 |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/strings/utf_string_conversions.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "client/crashpad_info.h" | 20 #include "client/crashpad_info.h" |
20 #include "gtest/gtest.h" | 21 #include "gtest/gtest.h" |
21 #include "test/errors.h" | 22 #include "test/errors.h" |
22 #include "test/paths.h" | 23 #include "test/paths.h" |
23 | 24 |
24 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
25 #include <dlfcn.h> | 26 #include <dlfcn.h> |
26 #include "snapshot/mac/process_snapshot_mac.h" | 27 #include "snapshot/mac/process_snapshot_mac.h" |
27 #elif defined(OS_WIN) | 28 #elif defined(OS_WIN) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #endif | 161 #endif |
161 base::FilePath module_path = Paths::Executable().DirName().Append( | 162 base::FilePath module_path = Paths::Executable().DirName().Append( |
162 FILE_PATH_LITERAL("crashpad_snapshot_test_module") + kDlExtension); | 163 FILE_PATH_LITERAL("crashpad_snapshot_test_module") + kDlExtension); |
163 #if defined(OS_MACOSX) | 164 #if defined(OS_MACOSX) |
164 ScopedDlHandle dl_handle( | 165 ScopedDlHandle dl_handle( |
165 dlopen(module_path.value().c_str(), RTLD_LAZY | RTLD_LOCAL)); | 166 dlopen(module_path.value().c_str(), RTLD_LAZY | RTLD_LOCAL)); |
166 ASSERT_TRUE(dl_handle.valid()) << "dlopen " << module_path.value() << ": " | 167 ASSERT_TRUE(dl_handle.valid()) << "dlopen " << module_path.value() << ": " |
167 << dlerror(); | 168 << dlerror(); |
168 #elif defined(OS_WIN) | 169 #elif defined(OS_WIN) |
169 ScopedDlHandle dl_handle(LoadLibrary(module_path.value().c_str())); | 170 ScopedDlHandle dl_handle(LoadLibrary(module_path.value().c_str())); |
170 ASSERT_TRUE(dl_handle.valid()) << "LoadLibrary " | 171 ASSERT_TRUE(dl_handle.valid()) |
171 << module_path.value().c_str() << ": " | 172 << "LoadLibrary " << base::UTF16ToUTF8(module_path.value()) << ": " |
172 << ErrorMessage(); | 173 << ErrorMessage(); |
173 #else | 174 #else |
174 #error Port. | 175 #error Port. |
175 #endif // OS_MACOSX | 176 #endif // OS_MACOSX |
176 | 177 |
177 // Get the function pointer from the module. This wraps GetCrashpadInfo(), but | 178 // Get the function pointer from the module. This wraps GetCrashpadInfo(), but |
178 // because it runs in the module, it returns the remote module’s CrashpadInfo | 179 // because it runs in the module, it returns the remote module’s CrashpadInfo |
179 // structure. | 180 // structure. |
180 CrashpadInfo* (*TestModule_GetCrashpadInfo)() = | 181 CrashpadInfo* (*TestModule_GetCrashpadInfo)() = |
181 dl_handle.LookUpSymbol<CrashpadInfo* (*)()>("TestModule_GetCrashpadInfo"); | 182 dl_handle.LookUpSymbol<CrashpadInfo* (*)()>("TestModule_GetCrashpadInfo"); |
182 ASSERT_TRUE(TestModule_GetCrashpadInfo); | 183 ASSERT_TRUE(TestModule_GetCrashpadInfo); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 247 |
247 process_snapshot.GetCrashpadOptions(&options); | 248 process_snapshot.GetCrashpadOptions(&options); |
248 EXPECT_EQ(TriState::kUnset, options.crashpad_handler_behavior); | 249 EXPECT_EQ(TriState::kUnset, options.crashpad_handler_behavior); |
249 EXPECT_EQ(TriState::kEnabled, options.system_crash_reporter_forwarding); | 250 EXPECT_EQ(TriState::kEnabled, options.system_crash_reporter_forwarding); |
250 } | 251 } |
251 } | 252 } |
252 | 253 |
253 } // namespace | 254 } // namespace |
254 } // namespace test | 255 } // namespace test |
255 } // namespace crashpad | 256 } // namespace crashpad |
OLD | NEW |