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

Side by Side Diff: minidump/minidump_module_writer_test.cc

Issue 641603006: Add MinidumpMemoryListWriter::AddFromSnapshot(), everything downstream and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Correctly look for the last memory range at EOF Created 6 years, 1 month 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
« no previous file with comments | « minidump/minidump_module_writer.h ('k') | snapshot/mac/memory_snapshot_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « minidump/minidump_module_writer.h ('k') | snapshot/mac/memory_snapshot_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698