OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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 17 matching lines...) Expand all Loading... |
28 #include "minidump/test/minidump_writable_test_util.h" | 28 #include "minidump/test/minidump_writable_test_util.h" |
29 #include "snapshot/test/test_cpu_context.h" | 29 #include "snapshot/test/test_cpu_context.h" |
30 #include "snapshot/test/test_exception_snapshot.h" | 30 #include "snapshot/test/test_exception_snapshot.h" |
31 #include "snapshot/test/test_memory_snapshot.h" | 31 #include "snapshot/test/test_memory_snapshot.h" |
32 #include "snapshot/test/test_module_snapshot.h" | 32 #include "snapshot/test/test_module_snapshot.h" |
33 #include "snapshot/test/test_process_snapshot.h" | 33 #include "snapshot/test/test_process_snapshot.h" |
34 #include "snapshot/test/test_system_snapshot.h" | 34 #include "snapshot/test/test_system_snapshot.h" |
35 #include "snapshot/test/test_thread_snapshot.h" | 35 #include "snapshot/test/test_thread_snapshot.h" |
36 #include "test/gtest_death_check.h" | 36 #include "test/gtest_death_check.h" |
37 #include "util/file/string_file.h" | 37 #include "util/file/string_file.h" |
| 38 #include "util/stdlib/move.h" |
38 | 39 |
39 namespace crashpad { | 40 namespace crashpad { |
40 namespace test { | 41 namespace test { |
41 namespace { | 42 namespace { |
42 | 43 |
43 TEST(MinidumpFileWriter, Empty) { | 44 TEST(MinidumpFileWriter, Empty) { |
44 MinidumpFileWriter minidump_file; | 45 MinidumpFileWriter minidump_file; |
45 StringFile string_file; | 46 StringFile string_file; |
46 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); | 47 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); |
47 ASSERT_EQ(sizeof(MINIDUMP_HEADER), string_file.string().size()); | 48 ASSERT_EQ(sizeof(MINIDUMP_HEADER), string_file.string().size()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 TEST(MinidumpFileWriter, OneStream) { | 90 TEST(MinidumpFileWriter, OneStream) { |
90 MinidumpFileWriter minidump_file; | 91 MinidumpFileWriter minidump_file; |
91 const time_t kTimestamp = 0x155d2fb8; | 92 const time_t kTimestamp = 0x155d2fb8; |
92 minidump_file.SetTimestamp(kTimestamp); | 93 minidump_file.SetTimestamp(kTimestamp); |
93 | 94 |
94 const size_t kStreamSize = 5; | 95 const size_t kStreamSize = 5; |
95 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); | 96 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); |
96 const uint8_t kStreamValue = 0x5a; | 97 const uint8_t kStreamValue = 0x5a; |
97 auto stream = | 98 auto stream = |
98 make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue)); | 99 make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue)); |
99 minidump_file.AddStream(stream.Pass()); | 100 minidump_file.AddStream(crashpad::move(stream)); |
100 | 101 |
101 StringFile string_file; | 102 StringFile string_file; |
102 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); | 103 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); |
103 | 104 |
104 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); | 105 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); |
105 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); | 106 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); |
106 const size_t kFileSize = kStreamOffset + kStreamSize; | 107 const size_t kFileSize = kStreamOffset + kStreamSize; |
107 | 108 |
108 ASSERT_EQ(kFileSize, string_file.string().size()); | 109 ASSERT_EQ(kFileSize, string_file.string().size()); |
109 | 110 |
(...skipping 18 matching lines...) Expand all Loading... |
128 TEST(MinidumpFileWriter, ThreeStreams) { | 129 TEST(MinidumpFileWriter, ThreeStreams) { |
129 MinidumpFileWriter minidump_file; | 130 MinidumpFileWriter minidump_file; |
130 const time_t kTimestamp = 0x155d2fb8; | 131 const time_t kTimestamp = 0x155d2fb8; |
131 minidump_file.SetTimestamp(kTimestamp); | 132 minidump_file.SetTimestamp(kTimestamp); |
132 | 133 |
133 const size_t kStream0Size = 5; | 134 const size_t kStream0Size = 5; |
134 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d); | 135 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d); |
135 const uint8_t kStream0Value = 0x5a; | 136 const uint8_t kStream0Value = 0x5a; |
136 auto stream0 = make_scoped_ptr( | 137 auto stream0 = make_scoped_ptr( |
137 new TestStream(kStream0Type, kStream0Size, kStream0Value)); | 138 new TestStream(kStream0Type, kStream0Size, kStream0Value)); |
138 minidump_file.AddStream(stream0.Pass()); | 139 minidump_file.AddStream(crashpad::move(stream0)); |
139 | 140 |
140 // Make the second stream’s type be a smaller quantity than the first stream’s | 141 // Make the second stream’s type be a smaller quantity than the first stream’s |
141 // to test that the streams show up in the order that they were added, not in | 142 // to test that the streams show up in the order that they were added, not in |
142 // numeric order. | 143 // numeric order. |
143 const size_t kStream1Size = 3; | 144 const size_t kStream1Size = 3; |
144 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); | 145 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); |
145 const uint8_t kStream1Value = 0xa5; | 146 const uint8_t kStream1Value = 0xa5; |
146 auto stream1 = make_scoped_ptr( | 147 auto stream1 = make_scoped_ptr( |
147 new TestStream(kStream1Type, kStream1Size, kStream1Value)); | 148 new TestStream(kStream1Type, kStream1Size, kStream1Value)); |
148 minidump_file.AddStream(stream1.Pass()); | 149 minidump_file.AddStream(crashpad::move(stream1)); |
149 | 150 |
150 const size_t kStream2Size = 1; | 151 const size_t kStream2Size = 1; |
151 const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e); | 152 const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e); |
152 const uint8_t kStream2Value = 0x36; | 153 const uint8_t kStream2Value = 0x36; |
153 auto stream2 = make_scoped_ptr( | 154 auto stream2 = make_scoped_ptr( |
154 new TestStream(kStream2Type, kStream2Size, kStream2Value)); | 155 new TestStream(kStream2Type, kStream2Size, kStream2Value)); |
155 minidump_file.AddStream(stream2.Pass()); | 156 minidump_file.AddStream(crashpad::move(stream2)); |
156 | 157 |
157 StringFile string_file; | 158 StringFile string_file; |
158 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); | 159 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); |
159 | 160 |
160 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); | 161 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); |
161 const size_t kStream0Offset = | 162 const size_t kStream0Offset = |
162 kDirectoryOffset + 3 * sizeof(MINIDUMP_DIRECTORY); | 163 kDirectoryOffset + 3 * sizeof(MINIDUMP_DIRECTORY); |
163 const size_t kStream1Padding = 3; | 164 const size_t kStream1Padding = 3; |
164 const size_t kStream1Offset = kStream0Offset + kStream0Size + kStream1Padding; | 165 const size_t kStream1Offset = kStream0Offset + kStream0Size + kStream1Padding; |
165 const size_t kStream2Padding = 1; | 166 const size_t kStream2Padding = 1; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 std::string expected_stream2(kStream2Size, kStream2Value); | 213 std::string expected_stream2(kStream2Size, kStream2Value); |
213 EXPECT_EQ(0, memcmp(stream2_data, expected_stream2.c_str(), kStream2Size)); | 214 EXPECT_EQ(0, memcmp(stream2_data, expected_stream2.c_str(), kStream2Size)); |
214 } | 215 } |
215 | 216 |
216 TEST(MinidumpFileWriter, ZeroLengthStream) { | 217 TEST(MinidumpFileWriter, ZeroLengthStream) { |
217 MinidumpFileWriter minidump_file; | 218 MinidumpFileWriter minidump_file; |
218 | 219 |
219 const size_t kStreamSize = 0; | 220 const size_t kStreamSize = 0; |
220 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); | 221 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); |
221 auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0)); | 222 auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0)); |
222 minidump_file.AddStream(stream.Pass()); | 223 minidump_file.AddStream(crashpad::move(stream)); |
223 | 224 |
224 StringFile string_file; | 225 StringFile string_file; |
225 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); | 226 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); |
226 | 227 |
227 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); | 228 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); |
228 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); | 229 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); |
229 const size_t kFileSize = kStreamOffset + kStreamSize; | 230 const size_t kFileSize = kStreamOffset + kStreamSize; |
230 | 231 |
231 ASSERT_EQ(kFileSize, string_file.string().size()); | 232 ASSERT_EQ(kFileSize, string_file.string().size()); |
232 | 233 |
(...skipping 11 matching lines...) Expand all Loading... |
244 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { | 245 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { |
245 const uint32_t kSnapshotTime = 0x4976043c; | 246 const uint32_t kSnapshotTime = 0x4976043c; |
246 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; | 247 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; |
247 | 248 |
248 TestProcessSnapshot process_snapshot; | 249 TestProcessSnapshot process_snapshot; |
249 process_snapshot.SetSnapshotTime(kSnapshotTimeval); | 250 process_snapshot.SetSnapshotTime(kSnapshotTimeval); |
250 | 251 |
251 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); | 252 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); |
252 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); | 253 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); |
253 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); | 254 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); |
254 process_snapshot.SetSystem(system_snapshot.Pass()); | 255 process_snapshot.SetSystem(crashpad::move(system_snapshot)); |
255 | 256 |
256 auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot()); | 257 auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot()); |
257 const uint64_t kPebAddress = 0x07f90000; | 258 const uint64_t kPebAddress = 0x07f90000; |
258 peb_snapshot->SetAddress(kPebAddress); | 259 peb_snapshot->SetAddress(kPebAddress); |
259 const size_t kPebSize = 0x280; | 260 const size_t kPebSize = 0x280; |
260 peb_snapshot->SetSize(kPebSize); | 261 peb_snapshot->SetSize(kPebSize); |
261 peb_snapshot->SetValue('p'); | 262 peb_snapshot->SetValue('p'); |
262 process_snapshot.AddExtraMemory(peb_snapshot.Pass()); | 263 process_snapshot.AddExtraMemory(crashpad::move(peb_snapshot)); |
263 | 264 |
264 MinidumpFileWriter minidump_file_writer; | 265 MinidumpFileWriter minidump_file_writer; |
265 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); | 266 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); |
266 | 267 |
267 StringFile string_file; | 268 StringFile string_file; |
268 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); | 269 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); |
269 | 270 |
270 const MINIDUMP_DIRECTORY* directory; | 271 const MINIDUMP_DIRECTORY* directory; |
271 const MINIDUMP_HEADER* header = | 272 const MINIDUMP_HEADER* header = |
272 MinidumpHeaderAtStart(string_file.string(), &directory); | 273 MinidumpHeaderAtStart(string_file.string(), &directory); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value. | 309 MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value. |
309 MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion. | 310 MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion. |
310 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; | 311 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; |
311 | 312 |
312 TestProcessSnapshot process_snapshot; | 313 TestProcessSnapshot process_snapshot; |
313 process_snapshot.SetSnapshotTime(kSnapshotTimeval); | 314 process_snapshot.SetSnapshotTime(kSnapshotTimeval); |
314 | 315 |
315 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); | 316 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); |
316 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); | 317 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); |
317 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); | 318 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); |
318 process_snapshot.SetSystem(system_snapshot.Pass()); | 319 process_snapshot.SetSystem(crashpad::move(system_snapshot)); |
319 | 320 |
320 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); | 321 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); |
321 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); | 322 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); |
322 process_snapshot.AddThread(thread_snapshot.Pass()); | 323 process_snapshot.AddThread(crashpad::move(thread_snapshot)); |
323 | 324 |
324 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); | 325 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); |
325 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); | 326 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); |
326 process_snapshot.SetException(exception_snapshot.Pass()); | 327 process_snapshot.SetException(crashpad::move(exception_snapshot)); |
327 | 328 |
328 // The module does not have anything that needs to be represented in a | 329 // The module does not have anything that needs to be represented in a |
329 // MinidumpModuleCrashpadInfo structure, so no such structure is expected to | 330 // MinidumpModuleCrashpadInfo structure, so no such structure is expected to |
330 // be present, which will in turn suppress the addition of a | 331 // be present, which will in turn suppress the addition of a |
331 // MinidumpCrashpadInfo stream. | 332 // MinidumpCrashpadInfo stream. |
332 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); | 333 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); |
333 process_snapshot.AddModule(module_snapshot.Pass()); | 334 process_snapshot.AddModule(crashpad::move(module_snapshot)); |
334 | 335 |
335 MinidumpFileWriter minidump_file_writer; | 336 MinidumpFileWriter minidump_file_writer; |
336 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); | 337 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); |
337 | 338 |
338 StringFile string_file; | 339 StringFile string_file; |
339 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); | 340 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); |
340 | 341 |
341 const MINIDUMP_DIRECTORY* directory; | 342 const MINIDUMP_DIRECTORY* directory; |
342 const MINIDUMP_HEADER* header = | 343 const MINIDUMP_HEADER* header = |
343 MinidumpHeaderAtStart(string_file.string(), &directory); | 344 MinidumpHeaderAtStart(string_file.string(), &directory); |
(...skipping 28 matching lines...) Expand all Loading... |
372 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) { | 373 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) { |
373 const uint32_t kSnapshotTime = 0x15393bd3; | 374 const uint32_t kSnapshotTime = 0x15393bd3; |
374 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; | 375 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; |
375 | 376 |
376 TestProcessSnapshot process_snapshot; | 377 TestProcessSnapshot process_snapshot; |
377 process_snapshot.SetSnapshotTime(kSnapshotTimeval); | 378 process_snapshot.SetSnapshotTime(kSnapshotTimeval); |
378 | 379 |
379 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); | 380 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); |
380 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); | 381 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); |
381 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); | 382 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); |
382 process_snapshot.SetSystem(system_snapshot.Pass()); | 383 process_snapshot.SetSystem(crashpad::move(system_snapshot)); |
383 | 384 |
384 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); | 385 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); |
385 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); | 386 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); |
386 process_snapshot.AddThread(thread_snapshot.Pass()); | 387 process_snapshot.AddThread(crashpad::move(thread_snapshot)); |
387 | 388 |
388 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); | 389 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); |
389 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); | 390 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); |
390 process_snapshot.SetException(exception_snapshot.Pass()); | 391 process_snapshot.SetException(crashpad::move(exception_snapshot)); |
391 | 392 |
392 // The module needs an annotation for the MinidumpCrashpadInfo stream to be | 393 // The module needs an annotation for the MinidumpCrashpadInfo stream to be |
393 // considered useful and be included. | 394 // considered useful and be included. |
394 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); | 395 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); |
395 std::vector<std::string> annotations_list(1, std::string("annotation")); | 396 std::vector<std::string> annotations_list(1, std::string("annotation")); |
396 module_snapshot->SetAnnotationsVector(annotations_list); | 397 module_snapshot->SetAnnotationsVector(annotations_list); |
397 process_snapshot.AddModule(module_snapshot.Pass()); | 398 process_snapshot.AddModule(crashpad::move(module_snapshot)); |
398 | 399 |
399 MinidumpFileWriter minidump_file_writer; | 400 MinidumpFileWriter minidump_file_writer; |
400 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); | 401 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); |
401 | 402 |
402 StringFile string_file; | 403 StringFile string_file; |
403 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); | 404 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); |
404 | 405 |
405 const MINIDUMP_DIRECTORY* directory; | 406 const MINIDUMP_DIRECTORY* directory; |
406 const MINIDUMP_HEADER* header = | 407 const MINIDUMP_HEADER* header = |
407 MinidumpHeaderAtStart(string_file.string(), &directory); | 408 MinidumpHeaderAtStart(string_file.string(), &directory); |
(...skipping 30 matching lines...) Expand all Loading... |
438 } | 439 } |
439 | 440 |
440 TEST(MinidumpFileWriterDeathTest, SameStreamType) { | 441 TEST(MinidumpFileWriterDeathTest, SameStreamType) { |
441 MinidumpFileWriter minidump_file; | 442 MinidumpFileWriter minidump_file; |
442 | 443 |
443 const size_t kStream0Size = 5; | 444 const size_t kStream0Size = 5; |
444 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d); | 445 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d); |
445 const uint8_t kStream0Value = 0x5a; | 446 const uint8_t kStream0Value = 0x5a; |
446 auto stream0 = make_scoped_ptr( | 447 auto stream0 = make_scoped_ptr( |
447 new TestStream(kStream0Type, kStream0Size, kStream0Value)); | 448 new TestStream(kStream0Type, kStream0Size, kStream0Value)); |
448 minidump_file.AddStream(stream0.Pass()); | 449 minidump_file.AddStream(crashpad::move(stream0)); |
449 | 450 |
450 // It is an error to add a second stream of the same type. | 451 // It is an error to add a second stream of the same type. |
451 const size_t kStream1Size = 3; | 452 const size_t kStream1Size = 3; |
452 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); | 453 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); |
453 const uint8_t kStream1Value = 0xa5; | 454 const uint8_t kStream1Value = 0xa5; |
454 auto stream1 = make_scoped_ptr( | 455 auto stream1 = make_scoped_ptr( |
455 new TestStream(kStream1Type, kStream1Size, kStream1Value)); | 456 new TestStream(kStream1Type, kStream1Size, kStream1Value)); |
456 ASSERT_DEATH_CHECK(minidump_file.AddStream(stream1.Pass()), | 457 ASSERT_DEATH_CHECK(minidump_file.AddStream(crashpad::move(stream1)), |
457 "already present"); | 458 "already present"); |
458 } | 459 } |
459 | 460 |
460 } // namespace | 461 } // namespace |
461 } // namespace test | 462 } // namespace test |
462 } // namespace crashpad | 463 } // namespace crashpad |
OLD | NEW |