Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/crashpad/crashpad/minidump/minidump_module_writer_test.cc

Issue 2773813002: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 (Closed)
Patch Set: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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,
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 "minidump/minidump_module_writer.h" 15 #include "minidump/minidump_module_writer.h"
16 16
17 #include <stddef.h>
17 #include <string.h> 18 #include <string.h>
18 19
19 #include <utility> 20 #include <utility>
20 21
21 #include "base/format_macros.h" 22 #include "base/format_macros.h"
22 #include "base/memory/ptr_util.h" 23 #include "base/memory/ptr_util.h"
23 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
25 #include "gtest/gtest.h" 26 #include "gtest/gtest.h"
26 #include "minidump/minidump_extensions.h" 27 #include "minidump/minidump_extensions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 *module_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>( 62 *module_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
62 file_contents, directory[0].Location); 63 file_contents, directory[0].Location);
63 ASSERT_TRUE(module_list); 64 ASSERT_TRUE(module_list);
64 } 65 }
65 66
66 TEST(MinidumpModuleWriter, EmptyModuleList) { 67 TEST(MinidumpModuleWriter, EmptyModuleList) {
67 MinidumpFileWriter minidump_file_writer; 68 MinidumpFileWriter minidump_file_writer;
68 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter()); 69 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
69 70
70 minidump_file_writer.AddStream(std::move(module_list_writer)); 71 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
71 72
72 StringFile string_file; 73 StringFile string_file;
73 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 74 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
74 75
75 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 76 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
76 sizeof(MINIDUMP_MODULE_LIST), 77 sizeof(MINIDUMP_MODULE_LIST),
77 string_file.string().size()); 78 string_file.string().size());
78 79
79 const MINIDUMP_MODULE_LIST* module_list = nullptr; 80 const MINIDUMP_MODULE_LIST* module_list = nullptr;
80 ASSERT_NO_FATAL_FAILURE( 81 ASSERT_NO_FATAL_FAILURE(
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 TEST(MinidumpModuleWriter, EmptyModule) { 270 TEST(MinidumpModuleWriter, EmptyModule) {
270 MinidumpFileWriter minidump_file_writer; 271 MinidumpFileWriter minidump_file_writer;
271 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter()); 272 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
272 273
273 const char kModuleName[] = "test_executable"; 274 const char kModuleName[] = "test_executable";
274 275
275 auto module_writer = base::WrapUnique(new MinidumpModuleWriter()); 276 auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
276 module_writer->SetName(kModuleName); 277 module_writer->SetName(kModuleName);
277 278
278 module_list_writer->AddModule(std::move(module_writer)); 279 module_list_writer->AddModule(std::move(module_writer));
279 minidump_file_writer.AddStream(std::move(module_list_writer)); 280 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
280 281
281 StringFile string_file; 282 StringFile string_file;
282 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 283 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
283 284
284 ASSERT_GT(string_file.string().size(), 285 ASSERT_GT(string_file.string().size(),
285 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 286 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
286 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 287 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
287 288
288 const MINIDUMP_MODULE_LIST* module_list = nullptr; 289 const MINIDUMP_MODULE_LIST* module_list = nullptr;
289 ASSERT_NO_FATAL_FAILURE( 290 ASSERT_NO_FATAL_FAILURE(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge); 361 codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge);
361 module_writer->SetCodeViewRecord(std::move(codeview_pdb70_writer)); 362 module_writer->SetCodeViewRecord(std::move(codeview_pdb70_writer));
362 363
363 auto misc_debug_writer = 364 auto misc_debug_writer =
364 base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter()); 365 base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter());
365 misc_debug_writer->SetDataType(kDebugType); 366 misc_debug_writer->SetDataType(kDebugType);
366 misc_debug_writer->SetData(kDebugName, kDebugUTF16); 367 misc_debug_writer->SetData(kDebugName, kDebugUTF16);
367 module_writer->SetMiscDebugRecord(std::move(misc_debug_writer)); 368 module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
368 369
369 module_list_writer->AddModule(std::move(module_writer)); 370 module_list_writer->AddModule(std::move(module_writer));
370 minidump_file_writer.AddStream(std::move(module_list_writer)); 371 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
371 372
372 StringFile string_file; 373 StringFile string_file;
373 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 374 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
374 375
375 ASSERT_GT(string_file.string().size(), 376 ASSERT_GT(string_file.string().size(),
376 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 377 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
377 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 378 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
378 379
379 const MINIDUMP_MODULE_LIST* module_list = nullptr; 380 const MINIDUMP_MODULE_LIST* module_list = nullptr;
380 ASSERT_NO_FATAL_FAILURE( 381 ASSERT_NO_FATAL_FAILURE(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge); 436 codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge);
436 module_writer->SetCodeViewRecord(std::move(codeview_pdb20_writer)); 437 module_writer->SetCodeViewRecord(std::move(codeview_pdb20_writer));
437 438
438 auto misc_debug_writer = 439 auto misc_debug_writer =
439 base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter()); 440 base::WrapUnique(new MinidumpModuleMiscDebugRecordWriter());
440 misc_debug_writer->SetDataType(kDebugType); 441 misc_debug_writer->SetDataType(kDebugType);
441 misc_debug_writer->SetData(kDebugName, kDebugUTF16); 442 misc_debug_writer->SetData(kDebugName, kDebugUTF16);
442 module_writer->SetMiscDebugRecord(std::move(misc_debug_writer)); 443 module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
443 444
444 module_list_writer->AddModule(std::move(module_writer)); 445 module_list_writer->AddModule(std::move(module_writer));
445 minidump_file_writer.AddStream(std::move(module_list_writer)); 446 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
446 447
447 StringFile string_file; 448 StringFile string_file;
448 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 449 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
449 450
450 ASSERT_GT(string_file.string().size(), 451 ASSERT_GT(string_file.string().size(),
451 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 452 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
452 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 453 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
453 454
454 const MINIDUMP_MODULE_LIST* module_list = nullptr; 455 const MINIDUMP_MODULE_LIST* module_list = nullptr;
455 ASSERT_NO_FATAL_FAILURE( 456 ASSERT_NO_FATAL_FAILURE(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 module_writer_2->SetImageSize(kModuleSize2); 528 module_writer_2->SetImageSize(kModuleSize2);
528 529
529 auto codeview_pdb70_writer_2 = 530 auto codeview_pdb70_writer_2 =
530 base::WrapUnique(new MinidumpModuleCodeViewRecordPDB20Writer()); 531 base::WrapUnique(new MinidumpModuleCodeViewRecordPDB20Writer());
531 codeview_pdb70_writer_2->SetPDBName(kPDBName2); 532 codeview_pdb70_writer_2->SetPDBName(kPDBName2);
532 codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2); 533 codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
533 module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2)); 534 module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2));
534 535
535 module_list_writer->AddModule(std::move(module_writer_2)); 536 module_list_writer->AddModule(std::move(module_writer_2));
536 537
537 minidump_file_writer.AddStream(std::move(module_list_writer)); 538 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
538 539
539 StringFile string_file; 540 StringFile string_file;
540 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 541 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
541 542
542 ASSERT_GT(string_file.string().size(), 543 ASSERT_GT(string_file.string().size(),
543 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 544 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
544 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 545 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
545 546
546 const MINIDUMP_MODULE_LIST* module_list = nullptr; 547 const MINIDUMP_MODULE_LIST* module_list = nullptr;
547 ASSERT_NO_FATAL_FAILURE( 548 ASSERT_NO_FATAL_FAILURE(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 647 }
647 module_snapshot->SetModuleType(module_type); 648 module_snapshot->SetModuleType(module_type);
648 649
649 module_snapshot->SetUUIDAndAge(uuid, age); 650 module_snapshot->SetUUIDAndAge(uuid, age);
650 module_snapshot->SetDebugFileName(pdb_name); 651 module_snapshot->SetDebugFileName(pdb_name);
651 } 652 }
652 653
653 TEST(MinidumpModuleWriter, InitializeFromSnapshot) { 654 TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
654 MINIDUMP_MODULE expect_modules[3] = {}; 655 MINIDUMP_MODULE expect_modules[3] = {};
655 const char* module_paths[arraysize(expect_modules)] = {}; 656 const char* module_paths[arraysize(expect_modules)] = {};
656 const char* module_names[arraysize(expect_modules)] = {};
657 const char* module_pdbs[arraysize(expect_modules)] = {}; 657 const char* module_pdbs[arraysize(expect_modules)] = {};
658 UUID uuids[arraysize(expect_modules)] = {}; 658 UUID uuids[arraysize(expect_modules)] = {};
659 uint32_t ages[arraysize(expect_modules)] = {}; 659 uint32_t ages[arraysize(expect_modules)] = {};
660 660
661 expect_modules[0].BaseOfImage = 0x100101000; 661 expect_modules[0].BaseOfImage = 0x100101000;
662 expect_modules[0].SizeOfImage = 0xf000; 662 expect_modules[0].SizeOfImage = 0xf000;
663 expect_modules[0].TimeDateStamp = 0x01234567; 663 expect_modules[0].TimeDateStamp = 0x01234567;
664 expect_modules[0].VersionInfo.dwFileVersionMS = 0x00010002; 664 expect_modules[0].VersionInfo.dwFileVersionMS = 0x00010002;
665 expect_modules[0].VersionInfo.dwFileVersionLS = 0x00030004; 665 expect_modules[0].VersionInfo.dwFileVersionLS = 0x00030004;
666 expect_modules[0].VersionInfo.dwProductVersionMS = 0x00050006; 666 expect_modules[0].VersionInfo.dwProductVersionMS = 0x00050006;
667 expect_modules[0].VersionInfo.dwProductVersionLS = 0x00070008; 667 expect_modules[0].VersionInfo.dwProductVersionLS = 0x00070008;
668 expect_modules[0].VersionInfo.dwFileType = VFT_APP; 668 expect_modules[0].VersionInfo.dwFileType = VFT_APP;
669 module_paths[0] = "/usr/bin/true"; 669 module_paths[0] = "/usr/bin/true";
670 module_names[0] = "true";
671 module_pdbs[0] = "true"; 670 module_pdbs[0] = "true";
672 const uint8_t kUUIDBytes0[16] = 671 const uint8_t kUUIDBytes0[16] =
673 {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 672 {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
674 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; 673 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
675 uuids[0].InitializeFromBytes(kUUIDBytes0); 674 uuids[0].InitializeFromBytes(kUUIDBytes0);
676 ages[0] = 10; 675 ages[0] = 10;
677 676
678 expect_modules[1].BaseOfImage = 0x200202000; 677 expect_modules[1].BaseOfImage = 0x200202000;
679 expect_modules[1].SizeOfImage = 0x1e1000; 678 expect_modules[1].SizeOfImage = 0x1e1000;
680 expect_modules[1].TimeDateStamp = 0x89abcdef; 679 expect_modules[1].TimeDateStamp = 0x89abcdef;
681 expect_modules[1].VersionInfo.dwFileVersionMS = 0x0009000a; 680 expect_modules[1].VersionInfo.dwFileVersionMS = 0x0009000a;
682 expect_modules[1].VersionInfo.dwFileVersionLS = 0x000b000c; 681 expect_modules[1].VersionInfo.dwFileVersionLS = 0x000b000c;
683 expect_modules[1].VersionInfo.dwProductVersionMS = 0x000d000e; 682 expect_modules[1].VersionInfo.dwProductVersionMS = 0x000d000e;
684 expect_modules[1].VersionInfo.dwProductVersionLS = 0x000f0000; 683 expect_modules[1].VersionInfo.dwProductVersionLS = 0x000f0000;
685 expect_modules[1].VersionInfo.dwFileType = VFT_DLL; 684 expect_modules[1].VersionInfo.dwFileType = VFT_DLL;
686 module_paths[1] = "/usr/lib/libSystem.B.dylib"; 685 module_paths[1] = "/usr/lib/libSystem.B.dylib";
687 module_names[1] = "libSystem.B.dylib";
688 module_pdbs[1] = "libSystem.B.dylib.pdb"; 686 module_pdbs[1] = "libSystem.B.dylib.pdb";
689 const uint8_t kUUIDBytes1[16] = 687 const uint8_t kUUIDBytes1[16] =
690 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 688 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
691 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}; 689 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
692 uuids[1].InitializeFromBytes(kUUIDBytes1); 690 uuids[1].InitializeFromBytes(kUUIDBytes1);
693 ages[1] = 20; 691 ages[1] = 20;
694 692
695 expect_modules[2].BaseOfImage = 0x300303000; 693 expect_modules[2].BaseOfImage = 0x300303000;
696 expect_modules[2].SizeOfImage = 0x2d000; 694 expect_modules[2].SizeOfImage = 0x2d000;
697 expect_modules[2].TimeDateStamp = 0x76543210; 695 expect_modules[2].TimeDateStamp = 0x76543210;
698 expect_modules[2].VersionInfo.dwFileVersionMS = 0x11112222; 696 expect_modules[2].VersionInfo.dwFileVersionMS = 0x11112222;
699 expect_modules[2].VersionInfo.dwFileVersionLS = 0x33334444; 697 expect_modules[2].VersionInfo.dwFileVersionLS = 0x33334444;
700 expect_modules[2].VersionInfo.dwProductVersionMS = 0x9999aaaa; 698 expect_modules[2].VersionInfo.dwProductVersionMS = 0x9999aaaa;
701 expect_modules[2].VersionInfo.dwProductVersionLS = 0xbbbbcccc; 699 expect_modules[2].VersionInfo.dwProductVersionLS = 0xbbbbcccc;
702 expect_modules[2].VersionInfo.dwFileType = VFT_UNKNOWN; 700 expect_modules[2].VersionInfo.dwFileType = VFT_UNKNOWN;
703 module_paths[2] = "/usr/lib/dyld"; 701 module_paths[2] = "/usr/lib/dyld";
704 module_names[2] = "dyld";
705 module_pdbs[2] = "/usr/lib/dyld.pdb"; 702 module_pdbs[2] = "/usr/lib/dyld.pdb";
706 const uint8_t kUUIDBytes2[16] = 703 const uint8_t kUUIDBytes2[16] =
707 {0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 704 {0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
708 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0}; 705 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0};
709 uuids[2].InitializeFromBytes(kUUIDBytes2); 706 uuids[2].InitializeFromBytes(kUUIDBytes2);
710 ages[2] = 30; 707 ages[2] = 30;
711 708
712 PointerVector<TestModuleSnapshot> module_snapshots_owner; 709 PointerVector<TestModuleSnapshot> module_snapshots_owner;
713 std::vector<const ModuleSnapshot*> module_snapshots; 710 std::vector<const ModuleSnapshot*> module_snapshots;
714 for (size_t index = 0; index < arraysize(expect_modules); ++index) { 711 for (size_t index = 0; index < arraysize(expect_modules); ++index) {
715 TestModuleSnapshot* module_snapshot = new TestModuleSnapshot(); 712 TestModuleSnapshot* module_snapshot = new TestModuleSnapshot();
716 module_snapshots_owner.push_back(module_snapshot); 713 module_snapshots_owner.push_back(module_snapshot);
717 InitializeTestModuleSnapshotFromMinidumpModule(module_snapshot, 714 InitializeTestModuleSnapshotFromMinidumpModule(module_snapshot,
718 expect_modules[index], 715 expect_modules[index],
719 module_paths[index], 716 module_paths[index],
720 module_pdbs[index], 717 module_pdbs[index],
721 uuids[index], 718 uuids[index],
722 ages[index]); 719 ages[index]);
723 module_snapshots.push_back(module_snapshot); 720 module_snapshots.push_back(module_snapshot);
724 } 721 }
725 722
726 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter()); 723 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
727 module_list_writer->InitializeFromSnapshot(module_snapshots); 724 module_list_writer->InitializeFromSnapshot(module_snapshots);
728 725
729 MinidumpFileWriter minidump_file_writer; 726 MinidumpFileWriter minidump_file_writer;
730 minidump_file_writer.AddStream(std::move(module_list_writer)); 727 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
731 728
732 StringFile string_file; 729 StringFile string_file;
733 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 730 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
734 731
735 const MINIDUMP_MODULE_LIST* module_list = nullptr; 732 const MINIDUMP_MODULE_LIST* module_list = nullptr;
736 ASSERT_NO_FATAL_FAILURE( 733 ASSERT_NO_FATAL_FAILURE(
737 GetModuleListStream(string_file.string(), &module_list)); 734 GetModuleListStream(string_file.string(), &module_list));
738 735
739 ASSERT_EQ(3u, module_list->NumberOfModules); 736 ASSERT_EQ(3u, module_list->NumberOfModules);
740 737
(...skipping 11 matching lines...) Expand all
752 0, 749 0,
753 false)); 750 false));
754 } 751 }
755 } 752 }
756 753
757 TEST(MinidumpModuleWriterDeathTest, NoModuleName) { 754 TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
758 MinidumpFileWriter minidump_file_writer; 755 MinidumpFileWriter minidump_file_writer;
759 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter()); 756 auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
760 auto module_writer = base::WrapUnique(new MinidumpModuleWriter()); 757 auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
761 module_list_writer->AddModule(std::move(module_writer)); 758 module_list_writer->AddModule(std::move(module_writer));
762 minidump_file_writer.AddStream(std::move(module_list_writer)); 759 ASSERT_TRUE(minidump_file_writer.AddStream(std::move(module_list_writer)));
763 760
764 StringFile string_file; 761 StringFile string_file;
765 ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), 762 ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
766 "name_"); 763 "name_");
767 } 764 }
768 765
769 } // namespace 766 } // namespace
770 } // namespace test 767 } // namespace test
771 } // namespace crashpad 768 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698