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

Side by Side Diff: minidump/minidump_module_writer_test.cc

Issue 700383007: Use implicit_cast<> instead of static_cast<> whenever possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 reinterpret_cast<const char*>(&codeview_pdb70_record->pdb_name[0]), 112 reinterpret_cast<const char*>(&codeview_pdb70_record->pdb_name[0]),
113 codeview_record->DataSize - 113 codeview_record->DataSize -
114 offsetof(MinidumpModuleCodeViewRecordPDB70, pdb_name)); 114 offsetof(MinidumpModuleCodeViewRecordPDB70, pdb_name));
115 } else { 115 } else {
116 // The CodeView record should be a PDB 2.0 link. 116 // The CodeView record should be a PDB 2.0 link.
117 const MinidumpModuleCodeViewRecordPDB20* codeview_pdb20_record = 117 const MinidumpModuleCodeViewRecordPDB20* codeview_pdb20_record =
118 MinidumpWritableAtLocationDescriptor< 118 MinidumpWritableAtLocationDescriptor<
119 MinidumpModuleCodeViewRecordPDB20>(file_contents, 119 MinidumpModuleCodeViewRecordPDB20>(file_contents,
120 *codeview_record); 120 *codeview_record);
121 ASSERT_TRUE(codeview_pdb20_record); 121 ASSERT_TRUE(codeview_pdb20_record);
122 EXPECT_EQ(static_cast<uint32_t>(expected_pdb_timestamp), 122 EXPECT_EQ(implicit_cast<uint32_t>(expected_pdb_timestamp),
123 codeview_pdb20_record->timestamp); 123 codeview_pdb20_record->timestamp);
124 EXPECT_EQ(expected_pdb_age, codeview_pdb20_record->age); 124 EXPECT_EQ(expected_pdb_age, codeview_pdb20_record->age);
125 125
126 observed_pdb_name.assign( 126 observed_pdb_name.assign(
127 reinterpret_cast<const char*>(&codeview_pdb20_record->pdb_name[0]), 127 reinterpret_cast<const char*>(&codeview_pdb20_record->pdb_name[0]),
128 codeview_record->DataSize - 128 codeview_record->DataSize -
129 offsetof(MinidumpModuleCodeViewRecordPDB20, pdb_name)); 129 offsetof(MinidumpModuleCodeViewRecordPDB20, pdb_name));
130 } 130 }
131 131
132 // Check for, and then remove, the NUL terminator. 132 // Check for, and then remove, the NUL terminator.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 const UUID* expected_pdb_uuid, 212 const UUID* expected_pdb_uuid,
213 time_t expected_pdb_timestamp, 213 time_t expected_pdb_timestamp,
214 uint32_t expected_pdb_age, 214 uint32_t expected_pdb_age,
215 const char* expected_debug_name, 215 const char* expected_debug_name,
216 uint32_t expected_debug_type, 216 uint32_t expected_debug_type,
217 bool expected_debug_utf16) { 217 bool expected_debug_utf16) {
218 EXPECT_EQ(expected->BaseOfImage, observed->BaseOfImage); 218 EXPECT_EQ(expected->BaseOfImage, observed->BaseOfImage);
219 EXPECT_EQ(expected->SizeOfImage, observed->SizeOfImage); 219 EXPECT_EQ(expected->SizeOfImage, observed->SizeOfImage);
220 EXPECT_EQ(expected->CheckSum, observed->CheckSum); 220 EXPECT_EQ(expected->CheckSum, observed->CheckSum);
221 EXPECT_EQ(expected->TimeDateStamp, observed->TimeDateStamp); 221 EXPECT_EQ(expected->TimeDateStamp, observed->TimeDateStamp);
222 EXPECT_EQ(static_cast<uint32_t>(VS_FFI_SIGNATURE), 222 EXPECT_EQ(implicit_cast<uint32_t>(VS_FFI_SIGNATURE),
223 observed->VersionInfo.dwSignature); 223 observed->VersionInfo.dwSignature);
224 EXPECT_EQ(static_cast<uint32_t>(VS_FFI_STRUCVERSION), 224 EXPECT_EQ(implicit_cast<uint32_t>(VS_FFI_STRUCVERSION),
225 observed->VersionInfo.dwStrucVersion); 225 observed->VersionInfo.dwStrucVersion);
226 EXPECT_EQ(expected->VersionInfo.dwFileVersionMS, 226 EXPECT_EQ(expected->VersionInfo.dwFileVersionMS,
227 observed->VersionInfo.dwFileVersionMS); 227 observed->VersionInfo.dwFileVersionMS);
228 EXPECT_EQ(expected->VersionInfo.dwFileVersionLS, 228 EXPECT_EQ(expected->VersionInfo.dwFileVersionLS,
229 observed->VersionInfo.dwFileVersionLS); 229 observed->VersionInfo.dwFileVersionLS);
230 EXPECT_EQ(expected->VersionInfo.dwProductVersionMS, 230 EXPECT_EQ(expected->VersionInfo.dwProductVersionMS,
231 observed->VersionInfo.dwProductVersionMS); 231 observed->VersionInfo.dwProductVersionMS);
232 EXPECT_EQ(expected->VersionInfo.dwProductVersionLS, 232 EXPECT_EQ(expected->VersionInfo.dwProductVersionLS,
233 observed->VersionInfo.dwProductVersionLS); 233 observed->VersionInfo.dwProductVersionLS);
234 EXPECT_EQ(expected->VersionInfo.dwFileFlagsMask, 234 EXPECT_EQ(expected->VersionInfo.dwFileFlagsMask,
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 module_list_writer->AddModule(module_writer.Pass()); 748 module_list_writer->AddModule(module_writer.Pass());
749 minidump_file_writer.AddStream(module_list_writer.Pass()); 749 minidump_file_writer.AddStream(module_list_writer.Pass());
750 750
751 StringFileWriter file_writer; 751 StringFileWriter file_writer;
752 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); 752 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_");
753 } 753 }
754 754
755 } // namespace 755 } // namespace
756 } // namespace test 756 } // namespace test
757 } // namespace crashpad 757 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698