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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Check for the NUL terminator. | 166 // Check for the NUL terminator. |
167 size_t bytes_available = | 167 size_t bytes_available = |
168 misc_debug_record->Length - offsetof(IMAGE_DEBUG_MISC, Data); | 168 misc_debug_record->Length - offsetof(IMAGE_DEBUG_MISC, Data); |
169 EXPECT_EQ('\0', misc_debug_record->Data[bytes_available - 1]); | 169 EXPECT_EQ('\0', misc_debug_record->Data[bytes_available - 1]); |
170 std::string observed_data( | 170 std::string observed_data( |
171 reinterpret_cast<const char*>(misc_debug_record->Data)); | 171 reinterpret_cast<const char*>(misc_debug_record->Data)); |
172 | 172 |
173 size_t bytes_used; | 173 size_t bytes_used; |
174 if (misc_debug_record->Unicode) { | 174 if (misc_debug_record->Unicode) { |
175 string16 observed_data_utf16( | 175 base::string16 observed_data_utf16( |
176 reinterpret_cast<const char16*>(misc_debug_record->Data)); | 176 reinterpret_cast<const base::char16*>(misc_debug_record->Data)); |
177 bytes_used = (observed_data_utf16.size() + 1) * sizeof(char16); | 177 bytes_used = (observed_data_utf16.size() + 1) * sizeof(base::char16); |
178 observed_data = base::UTF16ToUTF8(observed_data_utf16); | 178 observed_data = base::UTF16ToUTF8(observed_data_utf16); |
179 } else { | 179 } else { |
180 observed_data = reinterpret_cast<const char*>(misc_debug_record->Data); | 180 observed_data = reinterpret_cast<const char*>(misc_debug_record->Data); |
181 bytes_used = (observed_data.size() + 1) * sizeof(char); | 181 bytes_used = (observed_data.size() + 1) * sizeof(char); |
182 } | 182 } |
183 EXPECT_LE(bytes_used, bytes_available); | 183 EXPECT_LE(bytes_used, bytes_available); |
184 | 184 |
185 // Make sure that any padding bytes after the first NUL are also NUL. | 185 // Make sure that any padding bytes after the first NUL are also NUL. |
186 for (size_t index = bytes_used; index < bytes_available; ++index) { | 186 for (size_t index = bytes_used; index < bytes_available; ++index) { |
187 EXPECT_EQ('\0', misc_debug_record->Data[index]); | 187 EXPECT_EQ('\0', misc_debug_record->Data[index]); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 EXPECT_EQ(expected->VersionInfo.dwFileSubtype, | 240 EXPECT_EQ(expected->VersionInfo.dwFileSubtype, |
241 observed->VersionInfo.dwFileSubtype); | 241 observed->VersionInfo.dwFileSubtype); |
242 EXPECT_EQ(expected->VersionInfo.dwFileDateMS, | 242 EXPECT_EQ(expected->VersionInfo.dwFileDateMS, |
243 observed->VersionInfo.dwFileDateMS); | 243 observed->VersionInfo.dwFileDateMS); |
244 EXPECT_EQ(expected->VersionInfo.dwFileDateLS, | 244 EXPECT_EQ(expected->VersionInfo.dwFileDateLS, |
245 observed->VersionInfo.dwFileDateLS); | 245 observed->VersionInfo.dwFileDateLS); |
246 EXPECT_EQ(0u, observed->Reserved0); | 246 EXPECT_EQ(0u, observed->Reserved0); |
247 EXPECT_EQ(0u, observed->Reserved1); | 247 EXPECT_EQ(0u, observed->Reserved1); |
248 | 248 |
249 EXPECT_NE(0u, observed->ModuleNameRva); | 249 EXPECT_NE(0u, observed->ModuleNameRva); |
250 string16 observed_module_name_utf16 = | 250 base::string16 observed_module_name_utf16 = |
251 MinidumpStringAtRVAAsString(file_contents, observed->ModuleNameRva); | 251 MinidumpStringAtRVAAsString(file_contents, observed->ModuleNameRva); |
252 string16 expected_module_name_utf16 = base::UTF8ToUTF16(expected_module_name); | 252 base::string16 expected_module_name_utf16 = |
| 253 base::UTF8ToUTF16(expected_module_name); |
253 EXPECT_EQ(expected_module_name_utf16, observed_module_name_utf16); | 254 EXPECT_EQ(expected_module_name_utf16, observed_module_name_utf16); |
254 | 255 |
255 ASSERT_NO_FATAL_FAILURE(ExpectCodeViewRecord(&observed->CvRecord, | 256 ASSERT_NO_FATAL_FAILURE(ExpectCodeViewRecord(&observed->CvRecord, |
256 file_contents, | 257 file_contents, |
257 expected_pdb_name, | 258 expected_pdb_name, |
258 expected_pdb_uuid, | 259 expected_pdb_uuid, |
259 expected_pdb_timestamp, | 260 expected_pdb_timestamp, |
260 expected_pdb_age)); | 261 expected_pdb_age)); |
261 | 262 |
262 ASSERT_NO_FATAL_FAILURE(ExpectMiscellaneousDebugRecord(&observed->MiscRecord, | 263 ASSERT_NO_FATAL_FAILURE(ExpectMiscellaneousDebugRecord(&observed->MiscRecord, |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 module_list_writer->AddModule(module_writer.Pass()); | 749 module_list_writer->AddModule(module_writer.Pass()); |
749 minidump_file_writer.AddStream(module_list_writer.Pass()); | 750 minidump_file_writer.AddStream(module_list_writer.Pass()); |
750 | 751 |
751 StringFileWriter file_writer; | 752 StringFileWriter file_writer; |
752 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); | 753 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "name_"); |
753 } | 754 } |
754 | 755 |
755 } // namespace | 756 } // namespace |
756 } // namespace test | 757 } // namespace test |
757 } // namespace crashpad | 758 } // namespace crashpad |
OLD | NEW |