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

Side by Side Diff: minidump/minidump_module_writer_test.cc

Issue 936153002: Add FileReaderInterface. Move StringFileWriter to StringFile and (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Remove unused #include Created 5 years, 10 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,
(...skipping 12 matching lines...) Expand all
23 #include "base/format_macros.h" 23 #include "base/format_macros.h"
24 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
25 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
26 #include "gtest/gtest.h" 26 #include "gtest/gtest.h"
27 #include "minidump/minidump_extensions.h" 27 #include "minidump/minidump_extensions.h"
28 #include "minidump/minidump_file_writer.h" 28 #include "minidump/minidump_file_writer.h"
29 #include "minidump/test/minidump_file_writer_test_util.h" 29 #include "minidump/test/minidump_file_writer_test_util.h"
30 #include "minidump/test/minidump_string_writer_test_util.h" 30 #include "minidump/test/minidump_string_writer_test_util.h"
31 #include "minidump/test/minidump_writable_test_util.h" 31 #include "minidump/test/minidump_writable_test_util.h"
32 #include "snapshot/test/test_module_snapshot.h" 32 #include "snapshot/test/test_module_snapshot.h"
33 #include "util/file/string_file_writer.h" 33 #include "util/file/string_file.h"
34 #include "util/misc/uuid.h" 34 #include "util/misc/uuid.h"
35 #include "util/stdlib/pointer_container.h" 35 #include "util/stdlib/pointer_container.h"
36 36
37 namespace crashpad { 37 namespace crashpad {
38 namespace test { 38 namespace test {
39 namespace { 39 namespace {
40 40
41 void GetModuleListStream(const std::string& file_contents, 41 void GetModuleListStream(const std::string& file_contents,
42 const MINIDUMP_MODULE_LIST** module_list) { 42 const MINIDUMP_MODULE_LIST** module_list) {
43 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); 43 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
(...skipping 17 matching lines...) Expand all
61 file_contents, directory[0].Location); 61 file_contents, directory[0].Location);
62 ASSERT_TRUE(module_list); 62 ASSERT_TRUE(module_list);
63 } 63 }
64 64
65 TEST(MinidumpModuleWriter, EmptyModuleList) { 65 TEST(MinidumpModuleWriter, EmptyModuleList) {
66 MinidumpFileWriter minidump_file_writer; 66 MinidumpFileWriter minidump_file_writer;
67 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); 67 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
68 68
69 minidump_file_writer.AddStream(module_list_writer.Pass()); 69 minidump_file_writer.AddStream(module_list_writer.Pass());
70 70
71 StringFileWriter file_writer; 71 StringFile string_file;
72 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 72 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
73 73
74 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 74 ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
75 sizeof(MINIDUMP_MODULE_LIST), 75 sizeof(MINIDUMP_MODULE_LIST),
76 file_writer.string().size()); 76 string_file.string().size());
77 77
78 const MINIDUMP_MODULE_LIST* module_list = nullptr; 78 const MINIDUMP_MODULE_LIST* module_list = nullptr;
79 ASSERT_NO_FATAL_FAILURE( 79 ASSERT_NO_FATAL_FAILURE(
80 GetModuleListStream(file_writer.string(), &module_list)); 80 GetModuleListStream(string_file.string(), &module_list));
81 81
82 EXPECT_EQ(0u, module_list->NumberOfModules); 82 EXPECT_EQ(0u, module_list->NumberOfModules);
83 } 83 }
84 84
85 // If |expected_pdb_name| is not nullptr, |codeview_record| is used to locate a 85 // If |expected_pdb_name| is not nullptr, |codeview_record| is used to locate a
86 // CodeView record in |file_contents|, and its fields are compared against the 86 // CodeView record in |file_contents|, and its fields are compared against the
87 // the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView 87 // the |expected_pdb_*| values. If |expected_pdb_uuid| is supplied, the CodeView
88 // record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If 88 // record must be a PDB 7.0 link, otherwise, it must be a PDB 2.0 link. If
89 // |expected_pdb_name| is nullptr, |codeview_record| must not point to anything. 89 // |expected_pdb_name| is nullptr, |codeview_record| must not point to anything.
90 void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record, 90 void ExpectCodeViewRecord(const MINIDUMP_LOCATION_DESCRIPTOR* codeview_record,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); 275 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
276 276
277 const char kModuleName[] = "test_executable"; 277 const char kModuleName[] = "test_executable";
278 278
279 auto module_writer = make_scoped_ptr(new MinidumpModuleWriter()); 279 auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
280 module_writer->SetName(kModuleName); 280 module_writer->SetName(kModuleName);
281 281
282 module_list_writer->AddModule(module_writer.Pass()); 282 module_list_writer->AddModule(module_writer.Pass());
283 minidump_file_writer.AddStream(module_list_writer.Pass()); 283 minidump_file_writer.AddStream(module_list_writer.Pass());
284 284
285 StringFileWriter file_writer; 285 StringFile string_file;
286 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 286 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
287 287
288 ASSERT_GT(file_writer.string().size(), 288 ASSERT_GT(string_file.string().size(),
289 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 289 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
290 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 290 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
291 291
292 const MINIDUMP_MODULE_LIST* module_list = nullptr; 292 const MINIDUMP_MODULE_LIST* module_list = nullptr;
293 ASSERT_NO_FATAL_FAILURE( 293 ASSERT_NO_FATAL_FAILURE(
294 GetModuleListStream(file_writer.string(), &module_list)); 294 GetModuleListStream(string_file.string(), &module_list));
295 295
296 EXPECT_EQ(1u, module_list->NumberOfModules); 296 EXPECT_EQ(1u, module_list->NumberOfModules);
297 297
298 MINIDUMP_MODULE expected = {}; 298 MINIDUMP_MODULE expected = {};
299 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 299 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
300 &module_list->Modules[0], 300 &module_list->Modules[0],
301 file_writer.string(), 301 string_file.string(),
302 kModuleName, 302 kModuleName,
303 nullptr, 303 nullptr,
304 nullptr, 304 nullptr,
305 0, 305 0,
306 0, 306 0,
307 nullptr, 307 nullptr,
308 0, 308 0,
309 false)); 309 false));
310 } 310 }
311 311
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 auto misc_debug_writer = 367 auto misc_debug_writer =
368 make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter()); 368 make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
369 misc_debug_writer->SetDataType(kDebugType); 369 misc_debug_writer->SetDataType(kDebugType);
370 misc_debug_writer->SetData(kDebugName, kDebugUTF16); 370 misc_debug_writer->SetData(kDebugName, kDebugUTF16);
371 module_writer->SetMiscDebugRecord(misc_debug_writer.Pass()); 371 module_writer->SetMiscDebugRecord(misc_debug_writer.Pass());
372 372
373 module_list_writer->AddModule(module_writer.Pass()); 373 module_list_writer->AddModule(module_writer.Pass());
374 minidump_file_writer.AddStream(module_list_writer.Pass()); 374 minidump_file_writer.AddStream(module_list_writer.Pass());
375 375
376 StringFileWriter file_writer; 376 StringFile string_file;
377 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 377 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
378 378
379 ASSERT_GT(file_writer.string().size(), 379 ASSERT_GT(string_file.string().size(),
380 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 380 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
381 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 381 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
382 382
383 const MINIDUMP_MODULE_LIST* module_list = nullptr; 383 const MINIDUMP_MODULE_LIST* module_list = nullptr;
384 ASSERT_NO_FATAL_FAILURE( 384 ASSERT_NO_FATAL_FAILURE(
385 GetModuleListStream(file_writer.string(), &module_list)); 385 GetModuleListStream(string_file.string(), &module_list));
386 386
387 EXPECT_EQ(1u, module_list->NumberOfModules); 387 EXPECT_EQ(1u, module_list->NumberOfModules);
388 388
389 MINIDUMP_MODULE expected = {}; 389 MINIDUMP_MODULE expected = {};
390 expected.BaseOfImage = kModuleBase; 390 expected.BaseOfImage = kModuleBase;
391 expected.SizeOfImage = kModuleSize; 391 expected.SizeOfImage = kModuleSize;
392 expected.CheckSum = kChecksum; 392 expected.CheckSum = kChecksum;
393 expected.TimeDateStamp = kTimestamp; 393 expected.TimeDateStamp = kTimestamp;
394 expected.VersionInfo.dwFileVersionMS = kFileVersionMS; 394 expected.VersionInfo.dwFileVersionMS = kFileVersionMS;
395 expected.VersionInfo.dwFileVersionLS = kFileVersionLS; 395 expected.VersionInfo.dwFileVersionLS = kFileVersionLS;
396 expected.VersionInfo.dwProductVersionMS = kProductVersionMS; 396 expected.VersionInfo.dwProductVersionMS = kProductVersionMS;
397 expected.VersionInfo.dwProductVersionLS = kProductVersionLS; 397 expected.VersionInfo.dwProductVersionLS = kProductVersionLS;
398 expected.VersionInfo.dwFileFlagsMask = kFileFlagsMask; 398 expected.VersionInfo.dwFileFlagsMask = kFileFlagsMask;
399 expected.VersionInfo.dwFileFlags = kFileFlags; 399 expected.VersionInfo.dwFileFlags = kFileFlags;
400 expected.VersionInfo.dwFileOS = kFileOS; 400 expected.VersionInfo.dwFileOS = kFileOS;
401 expected.VersionInfo.dwFileType = kFileType; 401 expected.VersionInfo.dwFileType = kFileType;
402 expected.VersionInfo.dwFileSubtype = kFileSubtype; 402 expected.VersionInfo.dwFileSubtype = kFileSubtype;
403 403
404 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 404 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
405 &module_list->Modules[0], 405 &module_list->Modules[0],
406 file_writer.string(), 406 string_file.string(),
407 kModuleName, 407 kModuleName,
408 kPDBName, 408 kPDBName,
409 &pdb_uuid, 409 &pdb_uuid,
410 0, 410 0,
411 kPDBAge, 411 kPDBAge,
412 kDebugName, 412 kDebugName,
413 kDebugType, 413 kDebugType,
414 kDebugUTF16)); 414 kDebugUTF16));
415 } 415 }
416 416
(...skipping 24 matching lines...) Expand all
441 441
442 auto misc_debug_writer = 442 auto misc_debug_writer =
443 make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter()); 443 make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
444 misc_debug_writer->SetDataType(kDebugType); 444 misc_debug_writer->SetDataType(kDebugType);
445 misc_debug_writer->SetData(kDebugName, kDebugUTF16); 445 misc_debug_writer->SetData(kDebugName, kDebugUTF16);
446 module_writer->SetMiscDebugRecord(misc_debug_writer.Pass()); 446 module_writer->SetMiscDebugRecord(misc_debug_writer.Pass());
447 447
448 module_list_writer->AddModule(module_writer.Pass()); 448 module_list_writer->AddModule(module_writer.Pass());
449 minidump_file_writer.AddStream(module_list_writer.Pass()); 449 minidump_file_writer.AddStream(module_list_writer.Pass());
450 450
451 StringFileWriter file_writer; 451 StringFile string_file;
452 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 452 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
453 453
454 ASSERT_GT(file_writer.string().size(), 454 ASSERT_GT(string_file.string().size(),
455 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 455 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
456 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 456 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
457 457
458 const MINIDUMP_MODULE_LIST* module_list = nullptr; 458 const MINIDUMP_MODULE_LIST* module_list = nullptr;
459 ASSERT_NO_FATAL_FAILURE( 459 ASSERT_NO_FATAL_FAILURE(
460 GetModuleListStream(file_writer.string(), &module_list)); 460 GetModuleListStream(string_file.string(), &module_list));
461 461
462 EXPECT_EQ(1u, module_list->NumberOfModules); 462 EXPECT_EQ(1u, module_list->NumberOfModules);
463 463
464 MINIDUMP_MODULE expected = {}; 464 MINIDUMP_MODULE expected = {};
465 465
466 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 466 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
467 &module_list->Modules[0], 467 &module_list->Modules[0],
468 file_writer.string(), 468 string_file.string(),
469 kModuleName, 469 kModuleName,
470 kPDBName, 470 kPDBName,
471 nullptr, 471 nullptr,
472 kPDBTimestamp, 472 kPDBTimestamp,
473 kPDBAge, 473 kPDBAge,
474 kDebugName, 474 kDebugName,
475 kDebugType, 475 kDebugType,
476 kDebugUTF16)); 476 kDebugUTF16));
477 } 477 }
478 478
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 auto codeview_pdb70_writer_2 = 533 auto codeview_pdb70_writer_2 =
534 make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer()); 534 make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
535 codeview_pdb70_writer_2->SetPDBName(kPDBName2); 535 codeview_pdb70_writer_2->SetPDBName(kPDBName2);
536 codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2); 536 codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
537 module_writer_2->SetCodeViewRecord(codeview_pdb70_writer_2.Pass()); 537 module_writer_2->SetCodeViewRecord(codeview_pdb70_writer_2.Pass());
538 538
539 module_list_writer->AddModule(module_writer_2.Pass()); 539 module_list_writer->AddModule(module_writer_2.Pass());
540 540
541 minidump_file_writer.AddStream(module_list_writer.Pass()); 541 minidump_file_writer.AddStream(module_list_writer.Pass());
542 542
543 StringFileWriter file_writer; 543 StringFile string_file;
544 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 544 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
545 545
546 ASSERT_GT(file_writer.string().size(), 546 ASSERT_GT(string_file.string().size(),
547 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) + 547 sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
548 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE)); 548 sizeof(MINIDUMP_MODULE_LIST) + 1 * sizeof(MINIDUMP_MODULE));
549 549
550 const MINIDUMP_MODULE_LIST* module_list = nullptr; 550 const MINIDUMP_MODULE_LIST* module_list = nullptr;
551 ASSERT_NO_FATAL_FAILURE( 551 ASSERT_NO_FATAL_FAILURE(
552 GetModuleListStream(file_writer.string(), &module_list)); 552 GetModuleListStream(string_file.string(), &module_list));
553 553
554 EXPECT_EQ(3u, module_list->NumberOfModules); 554 EXPECT_EQ(3u, module_list->NumberOfModules);
555 555
556 MINIDUMP_MODULE expected = {}; 556 MINIDUMP_MODULE expected = {};
557 557
558 { 558 {
559 SCOPED_TRACE("module 0"); 559 SCOPED_TRACE("module 0");
560 560
561 expected.BaseOfImage = kModuleBase0; 561 expected.BaseOfImage = kModuleBase0;
562 expected.SizeOfImage = kModuleSize0; 562 expected.SizeOfImage = kModuleSize0;
563 563
564 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 564 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
565 &module_list->Modules[0], 565 &module_list->Modules[0],
566 file_writer.string(), 566 string_file.string(),
567 kModuleName0, 567 kModuleName0,
568 kPDBName0, 568 kPDBName0,
569 &pdb_uuid_0, 569 &pdb_uuid_0,
570 0, 570 0,
571 kPDBAge0, 571 kPDBAge0,
572 nullptr, 572 nullptr,
573 0, 573 0,
574 false)); 574 false));
575 } 575 }
576 576
577 { 577 {
578 SCOPED_TRACE("module 1"); 578 SCOPED_TRACE("module 1");
579 579
580 expected.BaseOfImage = kModuleBase1; 580 expected.BaseOfImage = kModuleBase1;
581 expected.SizeOfImage = kModuleSize1; 581 expected.SizeOfImage = kModuleSize1;
582 582
583 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 583 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
584 &module_list->Modules[1], 584 &module_list->Modules[1],
585 file_writer.string(), 585 string_file.string(),
586 kModuleName1, 586 kModuleName1,
587 nullptr, 587 nullptr,
588 nullptr, 588 nullptr,
589 0, 589 0,
590 0, 590 0,
591 nullptr, 591 nullptr,
592 0, 592 0,
593 false)); 593 false));
594 } 594 }
595 595
596 { 596 {
597 SCOPED_TRACE("module 2"); 597 SCOPED_TRACE("module 2");
598 598
599 expected.BaseOfImage = kModuleBase2; 599 expected.BaseOfImage = kModuleBase2;
600 expected.SizeOfImage = kModuleSize2; 600 expected.SizeOfImage = kModuleSize2;
601 601
602 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected, 602 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expected,
603 &module_list->Modules[2], 603 &module_list->Modules[2],
604 file_writer.string(), 604 string_file.string(),
605 kModuleName2, 605 kModuleName2,
606 kPDBName2, 606 kPDBName2,
607 nullptr, 607 nullptr,
608 kPDBTimestamp2, 608 kPDBTimestamp2,
609 kPDBAge2, 609 kPDBAge2,
610 nullptr, 610 nullptr,
611 0, 611 0,
612 false)); 612 false));
613 } 613 }
614 } 614 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 uuids[index]); 713 uuids[index]);
714 module_snapshots.push_back(module_snapshot); 714 module_snapshots.push_back(module_snapshot);
715 } 715 }
716 716
717 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); 717 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
718 module_list_writer->InitializeFromSnapshot(module_snapshots); 718 module_list_writer->InitializeFromSnapshot(module_snapshots);
719 719
720 MinidumpFileWriter minidump_file_writer; 720 MinidumpFileWriter minidump_file_writer;
721 minidump_file_writer.AddStream(module_list_writer.Pass()); 721 minidump_file_writer.AddStream(module_list_writer.Pass());
722 722
723 StringFileWriter file_writer; 723 StringFile string_file;
724 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 724 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
725 725
726 const MINIDUMP_MODULE_LIST* module_list = nullptr; 726 const MINIDUMP_MODULE_LIST* module_list = nullptr;
727 ASSERT_NO_FATAL_FAILURE( 727 ASSERT_NO_FATAL_FAILURE(
728 GetModuleListStream(file_writer.string(), &module_list)); 728 GetModuleListStream(string_file.string(), &module_list));
729 729
730 ASSERT_EQ(3u, module_list->NumberOfModules); 730 ASSERT_EQ(3u, module_list->NumberOfModules);
731 731
732 for (size_t index = 0; index < module_list->NumberOfModules; ++index) { 732 for (size_t index = 0; index < module_list->NumberOfModules; ++index) {
733 SCOPED_TRACE(base::StringPrintf("index %" PRIuS, index)); 733 SCOPED_TRACE(base::StringPrintf("index %" PRIuS, index));
734 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expect_modules[index], 734 ASSERT_NO_FATAL_FAILURE(ExpectModule(&expect_modules[index],
735 &module_list->Modules[index], 735 &module_list->Modules[index],
736 file_writer.string(), 736 string_file.string(),
737 module_paths[index], 737 module_paths[index],
738 module_names[index], 738 module_names[index],
739 &uuids[index], 739 &uuids[index],
740 0, 740 0,
741 0, 741 0,
742 nullptr, 742 nullptr,
743 0, 743 0,
744 false)); 744 false));
745 } 745 }
746 } 746 }
747 747
748 TEST(MinidumpModuleWriterDeathTest, NoModuleName) { 748 TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
749 MinidumpFileWriter minidump_file_writer; 749 MinidumpFileWriter minidump_file_writer;
750 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); 750 auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
751 auto module_writer = make_scoped_ptr(new MinidumpModuleWriter()); 751 auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
752 module_list_writer->AddModule(module_writer.Pass()); 752 module_list_writer->AddModule(module_writer.Pass());
753 minidump_file_writer.AddStream(module_list_writer.Pass()); 753 minidump_file_writer.AddStream(module_list_writer.Pass());
754 754
755 StringFileWriter file_writer; 755 StringFile string_file;
756 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); 756 ASSERT_DEATH(minidump_file_writer.WriteEverything(&string_file), "name_");
757 } 757 }
758 758
759 } // namespace 759 } // namespace
760 } // namespace test 760 } // namespace test
761 } // namespace crashpad 761 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_module_crashpad_info_writer_test.cc ('k') | minidump/minidump_rva_list_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698