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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 module_type = ModuleSnapshot::kModuleTypeUnknown; | 642 module_type = ModuleSnapshot::kModuleTypeUnknown; |
643 break; | 643 break; |
644 } | 644 } |
645 module_snapshot->SetModuleType(module_type); | 645 module_snapshot->SetModuleType(module_type); |
646 | 646 |
647 module_snapshot->SetUUID(uuid); | 647 module_snapshot->SetUUID(uuid); |
648 } | 648 } |
649 | 649 |
650 TEST(MinidumpModuleWriter, InitializeFromSnapshot) { | 650 TEST(MinidumpModuleWriter, InitializeFromSnapshot) { |
651 MINIDUMP_MODULE expect_modules[3] = {}; | 651 MINIDUMP_MODULE expect_modules[3] = {}; |
652 const char* module_paths[3] = {}; | 652 const char* module_paths[arraysize(expect_modules)] = {}; |
653 const char* module_names[3] = {}; | 653 const char* module_names[arraysize(expect_modules)] = {}; |
654 UUID uuids[3] = {}; | 654 UUID uuids[arraysize(expect_modules)] = {}; |
655 | |
656 static_assert(arraysize(expect_modules) == arraysize(module_paths), | |
657 "array sizes must be equal"); | |
658 static_assert(arraysize(expect_modules) == arraysize(module_names), | |
659 "array sizes must be equal"); | |
660 static_assert(arraysize(expect_modules) == arraysize(uuids), | |
661 "array sizes must be equal"); | |
662 | 655 |
663 expect_modules[0].BaseOfImage = 0x100101000; | 656 expect_modules[0].BaseOfImage = 0x100101000; |
664 expect_modules[0].SizeOfImage = 0xf000; | 657 expect_modules[0].SizeOfImage = 0xf000; |
665 expect_modules[0].TimeDateStamp = 0x01234567; | 658 expect_modules[0].TimeDateStamp = 0x01234567; |
666 expect_modules[0].VersionInfo.dwFileVersionMS = 0x00010002; | 659 expect_modules[0].VersionInfo.dwFileVersionMS = 0x00010002; |
667 expect_modules[0].VersionInfo.dwFileVersionLS = 0x00030004; | 660 expect_modules[0].VersionInfo.dwFileVersionLS = 0x00030004; |
668 expect_modules[0].VersionInfo.dwProductVersionMS = 0x00050006; | 661 expect_modules[0].VersionInfo.dwProductVersionMS = 0x00050006; |
669 expect_modules[0].VersionInfo.dwProductVersionLS = 0x00070008; | 662 expect_modules[0].VersionInfo.dwProductVersionLS = 0x00070008; |
670 expect_modules[0].VersionInfo.dwFileType = VFT_APP; | 663 expect_modules[0].VersionInfo.dwFileType = VFT_APP; |
671 module_paths[0] = "/usr/bin/true"; | 664 module_paths[0] = "/usr/bin/true"; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 module_list_writer->AddModule(module_writer.Pass()); | 748 module_list_writer->AddModule(module_writer.Pass()); |
756 minidump_file_writer.AddStream(module_list_writer.Pass()); | 749 minidump_file_writer.AddStream(module_list_writer.Pass()); |
757 | 750 |
758 StringFileWriter file_writer; | 751 StringFileWriter file_writer; |
759 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); | 752 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); |
760 } | 753 } |
761 | 754 |
762 } // namespace | 755 } // namespace |
763 } // namespace test | 756 } // namespace test |
764 } // namespace crashpad | 757 } // namespace crashpad |
OLD | NEW |