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

Side by Side Diff: minidump/minidump_misc_info_writer_test.cc

Issue 640383002: In tests, use ASSERT_NO_FATAL_FAILURE() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « minidump/minidump_memory_writer_test.cc ('k') | minidump/minidump_module_writer_test.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 27 matching lines...) Expand all
38 const size_t kMiscInfoStreamOffset = 38 const size_t kMiscInfoStreamOffset =
39 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); 39 kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
40 const size_t kMiscInfoStreamSize = sizeof(T); 40 const size_t kMiscInfoStreamSize = sizeof(T);
41 const size_t kFileSize = kMiscInfoStreamOffset + kMiscInfoStreamSize; 41 const size_t kFileSize = kMiscInfoStreamOffset + kMiscInfoStreamSize;
42 42
43 ASSERT_EQ(kFileSize, file_contents.size()); 43 ASSERT_EQ(kFileSize, file_contents.size());
44 44
45 const MINIDUMP_HEADER* header = 45 const MINIDUMP_HEADER* header =
46 reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]); 46 reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]);
47 47
48 VerifyMinidumpHeader(header, 1, 0); 48 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
49 if (testing::Test::HasFatalFailure()) {
50 return;
51 }
52 49
53 const MINIDUMP_DIRECTORY* directory = 50 const MINIDUMP_DIRECTORY* directory =
54 reinterpret_cast<const MINIDUMP_DIRECTORY*>( 51 reinterpret_cast<const MINIDUMP_DIRECTORY*>(
55 &file_contents[kDirectoryOffset]); 52 &file_contents[kDirectoryOffset]);
56 53
57 ASSERT_EQ(kMinidumpStreamTypeMiscInfo, directory->StreamType); 54 ASSERT_EQ(kMinidumpStreamTypeMiscInfo, directory->StreamType);
58 ASSERT_EQ(kMiscInfoStreamSize, directory->Location.DataSize); 55 ASSERT_EQ(kMiscInfoStreamSize, directory->Location.DataSize);
59 ASSERT_EQ(kMiscInfoStreamOffset, directory->Location.Rva); 56 ASSERT_EQ(kMiscInfoStreamOffset, directory->Location.Rva);
60 57
61 *misc_info = 58 *misc_info =
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 TEST(MinidumpMiscInfoWriter, Empty) { 160 TEST(MinidumpMiscInfoWriter, Empty) {
164 MinidumpFileWriter minidump_file_writer; 161 MinidumpFileWriter minidump_file_writer;
165 MinidumpMiscInfoWriter misc_info_writer; 162 MinidumpMiscInfoWriter misc_info_writer;
166 163
167 minidump_file_writer.AddStream(&misc_info_writer); 164 minidump_file_writer.AddStream(&misc_info_writer);
168 165
169 StringFileWriter file_writer; 166 StringFileWriter file_writer;
170 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 167 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
171 168
172 const MINIDUMP_MISC_INFO* observed; 169 const MINIDUMP_MISC_INFO* observed;
173 GetMiscInfoStream(file_writer.string(), &observed); 170 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
174 if (Test::HasFatalFailure()) {
175 return;
176 }
177 171
178 MINIDUMP_MISC_INFO expected = {}; 172 MINIDUMP_MISC_INFO expected = {};
179 173
180 ExpectMiscInfoEqual(&expected, observed); 174 ExpectMiscInfoEqual(&expected, observed);
181 } 175 }
182 176
183 TEST(MinidumpMiscInfoWriter, ProcessId) { 177 TEST(MinidumpMiscInfoWriter, ProcessId) {
184 MinidumpFileWriter minidump_file_writer; 178 MinidumpFileWriter minidump_file_writer;
185 MinidumpMiscInfoWriter misc_info_writer; 179 MinidumpMiscInfoWriter misc_info_writer;
186 180
187 const uint32_t kProcessId = 12345; 181 const uint32_t kProcessId = 12345;
188 182
189 misc_info_writer.SetProcessId(kProcessId); 183 misc_info_writer.SetProcessId(kProcessId);
190 184
191 minidump_file_writer.AddStream(&misc_info_writer); 185 minidump_file_writer.AddStream(&misc_info_writer);
192 186
193 StringFileWriter file_writer; 187 StringFileWriter file_writer;
194 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 188 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
195 189
196 const MINIDUMP_MISC_INFO* observed; 190 const MINIDUMP_MISC_INFO* observed;
197 GetMiscInfoStream(file_writer.string(), &observed); 191 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
198 if (Test::HasFatalFailure()) {
199 return;
200 }
201 192
202 MINIDUMP_MISC_INFO expected = {}; 193 MINIDUMP_MISC_INFO expected = {};
203 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID; 194 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID;
204 expected.ProcessId = kProcessId; 195 expected.ProcessId = kProcessId;
205 196
206 ExpectMiscInfoEqual(&expected, observed); 197 ExpectMiscInfoEqual(&expected, observed);
207 } 198 }
208 199
209 TEST(MinidumpMiscInfoWriter, ProcessTimes) { 200 TEST(MinidumpMiscInfoWriter, ProcessTimes) {
210 MinidumpFileWriter minidump_file_writer; 201 MinidumpFileWriter minidump_file_writer;
211 MinidumpMiscInfoWriter misc_info_writer; 202 MinidumpMiscInfoWriter misc_info_writer;
212 203
213 const time_t kProcessCreateTime = 0x15252f00; 204 const time_t kProcessCreateTime = 0x15252f00;
214 const uint32_t kProcessUserTime = 10; 205 const uint32_t kProcessUserTime = 10;
215 const uint32_t kProcessKernelTime = 5; 206 const uint32_t kProcessKernelTime = 5;
216 207
217 misc_info_writer.SetProcessTimes( 208 misc_info_writer.SetProcessTimes(
218 kProcessCreateTime, kProcessUserTime, kProcessKernelTime); 209 kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
219 210
220 minidump_file_writer.AddStream(&misc_info_writer); 211 minidump_file_writer.AddStream(&misc_info_writer);
221 212
222 StringFileWriter file_writer; 213 StringFileWriter file_writer;
223 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 214 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
224 215
225 const MINIDUMP_MISC_INFO* observed; 216 const MINIDUMP_MISC_INFO* observed;
226 GetMiscInfoStream(file_writer.string(), &observed); 217 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
227 if (Test::HasFatalFailure()) {
228 return;
229 }
230 218
231 MINIDUMP_MISC_INFO expected = {}; 219 MINIDUMP_MISC_INFO expected = {};
232 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES; 220 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES;
233 expected.ProcessCreateTime = kProcessCreateTime; 221 expected.ProcessCreateTime = kProcessCreateTime;
234 expected.ProcessUserTime = kProcessUserTime; 222 expected.ProcessUserTime = kProcessUserTime;
235 expected.ProcessKernelTime = kProcessKernelTime; 223 expected.ProcessKernelTime = kProcessKernelTime;
236 224
237 ExpectMiscInfoEqual(&expected, observed); 225 ExpectMiscInfoEqual(&expected, observed);
238 } 226 }
239 227
(...skipping 12 matching lines...) Expand all
252 kProcessorMhzLimit, 240 kProcessorMhzLimit,
253 kProcessorMaxIdleState, 241 kProcessorMaxIdleState,
254 kProcessorCurrentIdleState); 242 kProcessorCurrentIdleState);
255 243
256 minidump_file_writer.AddStream(&misc_info_writer); 244 minidump_file_writer.AddStream(&misc_info_writer);
257 245
258 StringFileWriter file_writer; 246 StringFileWriter file_writer;
259 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 247 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
260 248
261 const MINIDUMP_MISC_INFO_2* observed; 249 const MINIDUMP_MISC_INFO_2* observed;
262 GetMiscInfoStream(file_writer.string(), &observed); 250 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
263 if (Test::HasFatalFailure()) {
264 return;
265 }
266 251
267 MINIDUMP_MISC_INFO_2 expected = {}; 252 MINIDUMP_MISC_INFO_2 expected = {};
268 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO; 253 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO;
269 expected.ProcessorMaxMhz = kProcessorMaxMhz; 254 expected.ProcessorMaxMhz = kProcessorMaxMhz;
270 expected.ProcessorCurrentMhz = kProcessorCurrentMhz; 255 expected.ProcessorCurrentMhz = kProcessorCurrentMhz;
271 expected.ProcessorMhzLimit = kProcessorMhzLimit; 256 expected.ProcessorMhzLimit = kProcessorMhzLimit;
272 expected.ProcessorMaxIdleState = kProcessorMaxIdleState; 257 expected.ProcessorMaxIdleState = kProcessorMaxIdleState;
273 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState; 258 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState;
274 259
275 ExpectMiscInfoEqual(&expected, observed); 260 ExpectMiscInfoEqual(&expected, observed);
276 } 261 }
277 262
278 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) { 263 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
279 MinidumpFileWriter minidump_file_writer; 264 MinidumpFileWriter minidump_file_writer;
280 MinidumpMiscInfoWriter misc_info_writer; 265 MinidumpMiscInfoWriter misc_info_writer;
281 266
282 const uint32_t kProcessIntegrityLevel = 0x2000; 267 const uint32_t kProcessIntegrityLevel = 0x2000;
283 268
284 misc_info_writer.SetProcessIntegrityLevel(kProcessIntegrityLevel); 269 misc_info_writer.SetProcessIntegrityLevel(kProcessIntegrityLevel);
285 270
286 minidump_file_writer.AddStream(&misc_info_writer); 271 minidump_file_writer.AddStream(&misc_info_writer);
287 272
288 StringFileWriter file_writer; 273 StringFileWriter file_writer;
289 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 274 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
290 275
291 const MINIDUMP_MISC_INFO_3* observed; 276 const MINIDUMP_MISC_INFO_3* observed;
292 GetMiscInfoStream(file_writer.string(), &observed); 277 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
293 if (Test::HasFatalFailure()) {
294 return;
295 }
296 278
297 MINIDUMP_MISC_INFO_3 expected = {}; 279 MINIDUMP_MISC_INFO_3 expected = {};
298 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY; 280 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY;
299 expected.ProcessIntegrityLevel = kProcessIntegrityLevel; 281 expected.ProcessIntegrityLevel = kProcessIntegrityLevel;
300 282
301 ExpectMiscInfoEqual(&expected, observed); 283 ExpectMiscInfoEqual(&expected, observed);
302 } 284 }
303 285
304 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) { 286 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
305 MinidumpFileWriter minidump_file_writer; 287 MinidumpFileWriter minidump_file_writer;
306 MinidumpMiscInfoWriter misc_info_writer; 288 MinidumpMiscInfoWriter misc_info_writer;
307 289
308 const uint32_t kProcessExecuteFlags = 0x13579bdf; 290 const uint32_t kProcessExecuteFlags = 0x13579bdf;
309 291
310 misc_info_writer.SetProcessExecuteFlags(kProcessExecuteFlags); 292 misc_info_writer.SetProcessExecuteFlags(kProcessExecuteFlags);
311 293
312 minidump_file_writer.AddStream(&misc_info_writer); 294 minidump_file_writer.AddStream(&misc_info_writer);
313 295
314 StringFileWriter file_writer; 296 StringFileWriter file_writer;
315 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 297 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
316 298
317 const MINIDUMP_MISC_INFO_3* observed; 299 const MINIDUMP_MISC_INFO_3* observed;
318 GetMiscInfoStream(file_writer.string(), &observed); 300 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
319 if (Test::HasFatalFailure()) {
320 return;
321 }
322 301
323 MINIDUMP_MISC_INFO_3 expected = {}; 302 MINIDUMP_MISC_INFO_3 expected = {};
324 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS; 303 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS;
325 expected.ProcessExecuteFlags = kProcessExecuteFlags; 304 expected.ProcessExecuteFlags = kProcessExecuteFlags;
326 305
327 ExpectMiscInfoEqual(&expected, observed); 306 ExpectMiscInfoEqual(&expected, observed);
328 } 307 }
329 308
330 TEST(MinidumpMiscInfoWriter, ProtectedProcess) { 309 TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
331 MinidumpFileWriter minidump_file_writer; 310 MinidumpFileWriter minidump_file_writer;
332 MinidumpMiscInfoWriter misc_info_writer; 311 MinidumpMiscInfoWriter misc_info_writer;
333 312
334 const uint32_t kProtectedProcess = 1; 313 const uint32_t kProtectedProcess = 1;
335 314
336 misc_info_writer.SetProtectedProcess(kProtectedProcess); 315 misc_info_writer.SetProtectedProcess(kProtectedProcess);
337 316
338 minidump_file_writer.AddStream(&misc_info_writer); 317 minidump_file_writer.AddStream(&misc_info_writer);
339 318
340 StringFileWriter file_writer; 319 StringFileWriter file_writer;
341 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 320 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
342 321
343 const MINIDUMP_MISC_INFO_3* observed; 322 const MINIDUMP_MISC_INFO_3* observed;
344 GetMiscInfoStream(file_writer.string(), &observed); 323 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
345 if (Test::HasFatalFailure()) {
346 return;
347 }
348 324
349 MINIDUMP_MISC_INFO_3 expected = {}; 325 MINIDUMP_MISC_INFO_3 expected = {};
350 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS; 326 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS;
351 expected.ProtectedProcess = kProtectedProcess; 327 expected.ProtectedProcess = kProtectedProcess;
352 328
353 ExpectMiscInfoEqual(&expected, observed); 329 ExpectMiscInfoEqual(&expected, observed);
354 } 330 }
355 331
356 TEST(MinidumpMiscInfoWriter, TimeZone) { 332 TEST(MinidumpMiscInfoWriter, TimeZone) {
357 MinidumpFileWriter minidump_file_writer; 333 MinidumpFileWriter minidump_file_writer;
(...skipping 16 matching lines...) Expand all
374 kDaylightName, 350 kDaylightName,
375 kDaylightDate, 351 kDaylightDate,
376 kDaylightBias); 352 kDaylightBias);
377 353
378 minidump_file_writer.AddStream(&misc_info_writer); 354 minidump_file_writer.AddStream(&misc_info_writer);
379 355
380 StringFileWriter file_writer; 356 StringFileWriter file_writer;
381 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 357 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
382 358
383 const MINIDUMP_MISC_INFO_3* observed; 359 const MINIDUMP_MISC_INFO_3* observed;
384 GetMiscInfoStream(file_writer.string(), &observed); 360 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
385 if (Test::HasFatalFailure()) {
386 return;
387 }
388 361
389 MINIDUMP_MISC_INFO_3 expected = {}; 362 MINIDUMP_MISC_INFO_3 expected = {};
390 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 363 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
391 expected.TimeZoneId = kTimeZoneId; 364 expected.TimeZoneId = kTimeZoneId;
392 expected.TimeZone.Bias = kBias; 365 expected.TimeZone.Bias = kBias;
393 string16 standard_name_utf16 = base::UTF8ToUTF16(kStandardName); 366 string16 standard_name_utf16 = base::UTF8ToUTF16(kStandardName);
394 c16lcpy(expected.TimeZone.StandardName, 367 c16lcpy(expected.TimeZone.StandardName,
395 standard_name_utf16.c_str(), 368 standard_name_utf16.c_str(),
396 arraysize(expected.TimeZone.StandardName)); 369 arraysize(expected.TimeZone.StandardName));
397 memcpy(&expected.TimeZone.StandardDate, 370 memcpy(&expected.TimeZone.StandardDate,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 daylight_name, 412 daylight_name,
440 kSystemTimeZero, 413 kSystemTimeZero,
441 kDaylightBias); 414 kDaylightBias);
442 415
443 minidump_file_writer.AddStream(&misc_info_writer); 416 minidump_file_writer.AddStream(&misc_info_writer);
444 417
445 StringFileWriter file_writer; 418 StringFileWriter file_writer;
446 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 419 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
447 420
448 const MINIDUMP_MISC_INFO_3* observed; 421 const MINIDUMP_MISC_INFO_3* observed;
449 GetMiscInfoStream(file_writer.string(), &observed); 422 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
450 if (Test::HasFatalFailure()) {
451 return;
452 }
453 423
454 MINIDUMP_MISC_INFO_3 expected = {}; 424 MINIDUMP_MISC_INFO_3 expected = {};
455 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 425 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
456 expected.TimeZoneId = kTimeZoneId; 426 expected.TimeZoneId = kTimeZoneId;
457 expected.TimeZone.Bias = kBias; 427 expected.TimeZone.Bias = kBias;
458 string16 standard_name_utf16 = base::UTF8ToUTF16(standard_name); 428 string16 standard_name_utf16 = base::UTF8ToUTF16(standard_name);
459 c16lcpy(expected.TimeZone.StandardName, 429 c16lcpy(expected.TimeZone.StandardName,
460 standard_name_utf16.c_str(), 430 standard_name_utf16.c_str(),
461 arraysize(expected.TimeZone.StandardName)); 431 arraysize(expected.TimeZone.StandardName));
462 memcpy(&expected.TimeZone.StandardDate, 432 memcpy(&expected.TimeZone.StandardDate,
(...skipping 20 matching lines...) Expand all
483 const char kDebugBuildString[] = "debug build string"; 453 const char kDebugBuildString[] = "debug build string";
484 454
485 misc_info_writer.SetBuildString(kBuildString, kDebugBuildString); 455 misc_info_writer.SetBuildString(kBuildString, kDebugBuildString);
486 456
487 minidump_file_writer.AddStream(&misc_info_writer); 457 minidump_file_writer.AddStream(&misc_info_writer);
488 458
489 StringFileWriter file_writer; 459 StringFileWriter file_writer;
490 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 460 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
491 461
492 const MINIDUMP_MISC_INFO_4* observed; 462 const MINIDUMP_MISC_INFO_4* observed;
493 GetMiscInfoStream(file_writer.string(), &observed); 463 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
494 if (Test::HasFatalFailure()) {
495 return;
496 }
497 464
498 MINIDUMP_MISC_INFO_4 expected = {}; 465 MINIDUMP_MISC_INFO_4 expected = {};
499 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 466 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
500 string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString); 467 string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString);
501 c16lcpy(expected.BuildString, 468 c16lcpy(expected.BuildString,
502 build_string_utf16.c_str(), 469 build_string_utf16.c_str(),
503 arraysize(expected.BuildString)); 470 arraysize(expected.BuildString));
504 string16 debug_build_string_utf16 = base::UTF8ToUTF16(kDebugBuildString); 471 string16 debug_build_string_utf16 = base::UTF8ToUTF16(kDebugBuildString);
505 c16lcpy(expected.DbgBldStr, 472 c16lcpy(expected.DbgBldStr,
506 debug_build_string_utf16.c_str(), 473 debug_build_string_utf16.c_str(),
(...skipping 15 matching lines...) Expand all
522 'D'); 489 'D');
523 490
524 misc_info_writer.SetBuildString(build_string, debug_build_string); 491 misc_info_writer.SetBuildString(build_string, debug_build_string);
525 492
526 minidump_file_writer.AddStream(&misc_info_writer); 493 minidump_file_writer.AddStream(&misc_info_writer);
527 494
528 StringFileWriter file_writer; 495 StringFileWriter file_writer;
529 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 496 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
530 497
531 const MINIDUMP_MISC_INFO_4* observed; 498 const MINIDUMP_MISC_INFO_4* observed;
532 GetMiscInfoStream(file_writer.string(), &observed); 499 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
533 if (Test::HasFatalFailure()) {
534 return;
535 }
536 500
537 MINIDUMP_MISC_INFO_4 expected = {}; 501 MINIDUMP_MISC_INFO_4 expected = {};
538 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 502 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
539 string16 build_string_utf16 = base::UTF8ToUTF16(build_string); 503 string16 build_string_utf16 = base::UTF8ToUTF16(build_string);
540 c16lcpy(expected.BuildString, 504 c16lcpy(expected.BuildString,
541 build_string_utf16.c_str(), 505 build_string_utf16.c_str(),
542 arraysize(expected.BuildString)); 506 arraysize(expected.BuildString));
543 string16 debug_build_string_utf16 = base::UTF8ToUTF16(debug_build_string); 507 string16 debug_build_string_utf16 = base::UTF8ToUTF16(debug_build_string);
544 c16lcpy(expected.DbgBldStr, 508 c16lcpy(expected.DbgBldStr,
545 debug_build_string_utf16.c_str(), 509 debug_build_string_utf16.c_str(),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 kSystemTimeZero, 558 kSystemTimeZero,
595 kDaylightBias); 559 kDaylightBias);
596 misc_info_writer.SetBuildString(kBuildString, kDebugBuildString); 560 misc_info_writer.SetBuildString(kBuildString, kDebugBuildString);
597 561
598 minidump_file_writer.AddStream(&misc_info_writer); 562 minidump_file_writer.AddStream(&misc_info_writer);
599 563
600 StringFileWriter file_writer; 564 StringFileWriter file_writer;
601 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 565 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
602 566
603 const MINIDUMP_MISC_INFO_4* observed; 567 const MINIDUMP_MISC_INFO_4* observed;
604 GetMiscInfoStream(file_writer.string(), &observed); 568 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
605 if (Test::HasFatalFailure()) {
606 return;
607 }
608 569
609 MINIDUMP_MISC_INFO_4 expected = {}; 570 MINIDUMP_MISC_INFO_4 expected = {};
610 expected.Flags1 = 571 expected.Flags1 =
611 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES | 572 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES |
612 MINIDUMP_MISC1_PROCESSOR_POWER_INFO | MINIDUMP_MISC3_PROCESS_INTEGRITY | 573 MINIDUMP_MISC1_PROCESSOR_POWER_INFO | MINIDUMP_MISC3_PROCESS_INTEGRITY |
613 MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS | MINIDUMP_MISC3_PROTECTED_PROCESS | 574 MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS | MINIDUMP_MISC3_PROTECTED_PROCESS |
614 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC4_BUILDSTRING; 575 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC4_BUILDSTRING;
615 expected.ProcessId = kProcessId; 576 expected.ProcessId = kProcessId;
616 expected.ProcessCreateTime = kProcessCreateTime; 577 expected.ProcessCreateTime = kProcessCreateTime;
617 expected.ProcessUserTime = kProcessUserTime; 578 expected.ProcessUserTime = kProcessUserTime;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 c16lcpy(expected.DbgBldStr, 611 c16lcpy(expected.DbgBldStr,
651 debug_build_string_utf16.c_str(), 612 debug_build_string_utf16.c_str(),
652 arraysize(expected.DbgBldStr)); 613 arraysize(expected.DbgBldStr));
653 614
654 ExpectMiscInfoEqual(&expected, observed); 615 ExpectMiscInfoEqual(&expected, observed);
655 } 616 }
656 617
657 } // namespace 618 } // namespace
658 } // namespace test 619 } // namespace test
659 } // namespace crashpad 620 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_memory_writer_test.cc ('k') | minidump/minidump_module_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698