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

Side by Side Diff: minidump/minidump_misc_info_writer_test.cc

Issue 902803002: win: Fixes for minidump_misc_info_writer_test.cc (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_test-13
Patch Set: fixes 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
« no previous file with comments | « no previous file | snapshot/test/test_process_snapshot.h » ('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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 TEST(MinidumpMiscInfoWriter, Empty) { 160 TEST(MinidumpMiscInfoWriter, Empty) {
161 MinidumpFileWriter minidump_file_writer; 161 MinidumpFileWriter minidump_file_writer;
162 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 162 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
163 163
164 minidump_file_writer.AddStream(misc_info_writer.Pass()); 164 minidump_file_writer.AddStream(misc_info_writer.Pass());
165 165
166 StringFileWriter file_writer; 166 StringFileWriter file_writer;
167 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 167 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
168 168
169 const MINIDUMP_MISC_INFO* observed; 169 const MINIDUMP_MISC_INFO* observed = nullptr;
170 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 170 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
171 171
172 MINIDUMP_MISC_INFO expected = {}; 172 MINIDUMP_MISC_INFO expected = {};
173 173
174 ExpectMiscInfoEqual(&expected, observed); 174 ExpectMiscInfoEqual(&expected, observed);
175 } 175 }
176 176
177 TEST(MinidumpMiscInfoWriter, ProcessId) { 177 TEST(MinidumpMiscInfoWriter, ProcessId) {
178 MinidumpFileWriter minidump_file_writer; 178 MinidumpFileWriter minidump_file_writer;
179 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 179 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
180 180
181 const uint32_t kProcessId = 12345; 181 const uint32_t kProcessId = 12345;
182 182
183 misc_info_writer->SetProcessID(kProcessId); 183 misc_info_writer->SetProcessID(kProcessId);
184 184
185 minidump_file_writer.AddStream(misc_info_writer.Pass()); 185 minidump_file_writer.AddStream(misc_info_writer.Pass());
186 186
187 StringFileWriter file_writer; 187 StringFileWriter file_writer;
188 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 188 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
189 189
190 const MINIDUMP_MISC_INFO* observed; 190 const MINIDUMP_MISC_INFO* observed = nullptr;
191 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 191 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
192 192
193 MINIDUMP_MISC_INFO expected = {}; 193 MINIDUMP_MISC_INFO expected = {};
194 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID; 194 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID;
195 expected.ProcessId = kProcessId; 195 expected.ProcessId = kProcessId;
196 196
197 ExpectMiscInfoEqual(&expected, observed); 197 ExpectMiscInfoEqual(&expected, observed);
198 } 198 }
199 199
200 TEST(MinidumpMiscInfoWriter, ProcessTimes) { 200 TEST(MinidumpMiscInfoWriter, ProcessTimes) {
201 MinidumpFileWriter minidump_file_writer; 201 MinidumpFileWriter minidump_file_writer;
202 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 202 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
203 203
204 const time_t kProcessCreateTime = 0x15252f00; 204 const time_t kProcessCreateTime = 0x15252f00;
205 const uint32_t kProcessUserTime = 10; 205 const uint32_t kProcessUserTime = 10;
206 const uint32_t kProcessKernelTime = 5; 206 const uint32_t kProcessKernelTime = 5;
207 207
208 misc_info_writer->SetProcessTimes( 208 misc_info_writer->SetProcessTimes(
209 kProcessCreateTime, kProcessUserTime, kProcessKernelTime); 209 kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
210 210
211 minidump_file_writer.AddStream(misc_info_writer.Pass()); 211 minidump_file_writer.AddStream(misc_info_writer.Pass());
212 212
213 StringFileWriter file_writer; 213 StringFileWriter file_writer;
214 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 214 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
215 215
216 const MINIDUMP_MISC_INFO* observed; 216 const MINIDUMP_MISC_INFO* observed = nullptr;
217 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 217 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
218 218
219 MINIDUMP_MISC_INFO expected = {}; 219 MINIDUMP_MISC_INFO expected = {};
220 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES; 220 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES;
221 expected.ProcessCreateTime = kProcessCreateTime; 221 expected.ProcessCreateTime = kProcessCreateTime;
222 expected.ProcessUserTime = kProcessUserTime; 222 expected.ProcessUserTime = kProcessUserTime;
223 expected.ProcessKernelTime = kProcessKernelTime; 223 expected.ProcessKernelTime = kProcessKernelTime;
224 224
225 ExpectMiscInfoEqual(&expected, observed); 225 ExpectMiscInfoEqual(&expected, observed);
226 } 226 }
(...skipping 12 matching lines...) Expand all
239 kProcessorCurrentMhz, 239 kProcessorCurrentMhz,
240 kProcessorMhzLimit, 240 kProcessorMhzLimit,
241 kProcessorMaxIdleState, 241 kProcessorMaxIdleState,
242 kProcessorCurrentIdleState); 242 kProcessorCurrentIdleState);
243 243
244 minidump_file_writer.AddStream(misc_info_writer.Pass()); 244 minidump_file_writer.AddStream(misc_info_writer.Pass());
245 245
246 StringFileWriter file_writer; 246 StringFileWriter file_writer;
247 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 247 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
248 248
249 const MINIDUMP_MISC_INFO_2* observed; 249 const MINIDUMP_MISC_INFO_2* observed = nullptr;
250 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 250 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
251 251
252 MINIDUMP_MISC_INFO_2 expected = {}; 252 MINIDUMP_MISC_INFO_2 expected = {};
253 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO; 253 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO;
254 expected.ProcessorMaxMhz = kProcessorMaxMhz; 254 expected.ProcessorMaxMhz = kProcessorMaxMhz;
255 expected.ProcessorCurrentMhz = kProcessorCurrentMhz; 255 expected.ProcessorCurrentMhz = kProcessorCurrentMhz;
256 expected.ProcessorMhzLimit = kProcessorMhzLimit; 256 expected.ProcessorMhzLimit = kProcessorMhzLimit;
257 expected.ProcessorMaxIdleState = kProcessorMaxIdleState; 257 expected.ProcessorMaxIdleState = kProcessorMaxIdleState;
258 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState; 258 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState;
259 259
260 ExpectMiscInfoEqual(&expected, observed); 260 ExpectMiscInfoEqual(&expected, observed);
261 } 261 }
262 262
263 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) { 263 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
264 MinidumpFileWriter minidump_file_writer; 264 MinidumpFileWriter minidump_file_writer;
265 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 265 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
266 266
267 const uint32_t kProcessIntegrityLevel = 0x2000; 267 const uint32_t kProcessIntegrityLevel = 0x2000;
268 268
269 misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel); 269 misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel);
270 270
271 minidump_file_writer.AddStream(misc_info_writer.Pass()); 271 minidump_file_writer.AddStream(misc_info_writer.Pass());
272 272
273 StringFileWriter file_writer; 273 StringFileWriter file_writer;
274 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 274 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
275 275
276 const MINIDUMP_MISC_INFO_3* observed; 276 const MINIDUMP_MISC_INFO_3* observed = nullptr;
277 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 277 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
278 278
279 MINIDUMP_MISC_INFO_3 expected = {}; 279 MINIDUMP_MISC_INFO_3 expected = {};
280 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY; 280 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY;
281 expected.ProcessIntegrityLevel = kProcessIntegrityLevel; 281 expected.ProcessIntegrityLevel = kProcessIntegrityLevel;
282 282
283 ExpectMiscInfoEqual(&expected, observed); 283 ExpectMiscInfoEqual(&expected, observed);
284 } 284 }
285 285
286 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) { 286 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
287 MinidumpFileWriter minidump_file_writer; 287 MinidumpFileWriter minidump_file_writer;
288 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 288 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
289 289
290 const uint32_t kProcessExecuteFlags = 0x13579bdf; 290 const uint32_t kProcessExecuteFlags = 0x13579bdf;
291 291
292 misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags); 292 misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags);
293 293
294 minidump_file_writer.AddStream(misc_info_writer.Pass()); 294 minidump_file_writer.AddStream(misc_info_writer.Pass());
295 295
296 StringFileWriter file_writer; 296 StringFileWriter file_writer;
297 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 297 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
298 298
299 const MINIDUMP_MISC_INFO_3* observed; 299 const MINIDUMP_MISC_INFO_3* observed = nullptr;
300 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 300 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
301 301
302 MINIDUMP_MISC_INFO_3 expected = {}; 302 MINIDUMP_MISC_INFO_3 expected = {};
303 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS; 303 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS;
304 expected.ProcessExecuteFlags = kProcessExecuteFlags; 304 expected.ProcessExecuteFlags = kProcessExecuteFlags;
305 305
306 ExpectMiscInfoEqual(&expected, observed); 306 ExpectMiscInfoEqual(&expected, observed);
307 } 307 }
308 308
309 TEST(MinidumpMiscInfoWriter, ProtectedProcess) { 309 TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
310 MinidumpFileWriter minidump_file_writer; 310 MinidumpFileWriter minidump_file_writer;
311 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 311 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
312 312
313 const uint32_t kProtectedProcess = 1; 313 const uint32_t kProtectedProcess = 1;
314 314
315 misc_info_writer->SetProtectedProcess(kProtectedProcess); 315 misc_info_writer->SetProtectedProcess(kProtectedProcess);
316 316
317 minidump_file_writer.AddStream(misc_info_writer.Pass()); 317 minidump_file_writer.AddStream(misc_info_writer.Pass());
318 318
319 StringFileWriter file_writer; 319 StringFileWriter file_writer;
320 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 320 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
321 321
322 const MINIDUMP_MISC_INFO_3* observed; 322 const MINIDUMP_MISC_INFO_3* observed = nullptr;
323 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 323 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
324 324
325 MINIDUMP_MISC_INFO_3 expected = {}; 325 MINIDUMP_MISC_INFO_3 expected = {};
326 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS; 326 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS;
327 expected.ProtectedProcess = kProtectedProcess; 327 expected.ProtectedProcess = kProtectedProcess;
328 328
329 ExpectMiscInfoEqual(&expected, observed); 329 ExpectMiscInfoEqual(&expected, observed);
330 } 330 }
331 331
332 TEST(MinidumpMiscInfoWriter, TimeZone) { 332 TEST(MinidumpMiscInfoWriter, TimeZone) {
(...skipping 16 matching lines...) Expand all
349 kStandardBias, 349 kStandardBias,
350 kDaylightName, 350 kDaylightName,
351 kDaylightDate, 351 kDaylightDate,
352 kDaylightBias); 352 kDaylightBias);
353 353
354 minidump_file_writer.AddStream(misc_info_writer.Pass()); 354 minidump_file_writer.AddStream(misc_info_writer.Pass());
355 355
356 StringFileWriter file_writer; 356 StringFileWriter file_writer;
357 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 357 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
358 358
359 const MINIDUMP_MISC_INFO_3* observed; 359 const MINIDUMP_MISC_INFO_3* observed = nullptr;
360 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 360 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
361 361
362 MINIDUMP_MISC_INFO_3 expected = {}; 362 MINIDUMP_MISC_INFO_3 expected = {};
363 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 363 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
364 expected.TimeZoneId = kTimeZoneId; 364 expected.TimeZoneId = kTimeZoneId;
365 expected.TimeZone.Bias = kBias; 365 expected.TimeZone.Bias = kBias;
366 base::string16 standard_name_utf16 = base::UTF8ToUTF16(kStandardName); 366 base::string16 standard_name_utf16 = base::UTF8ToUTF16(kStandardName);
367 c16lcpy(expected.TimeZone.StandardName, 367 c16lcpy(expected.TimeZone.StandardName,
368 standard_name_utf16.c_str(), 368 standard_name_utf16.c_str(),
369 arraysize(expected.TimeZone.StandardName)); 369 arraysize(expected.TimeZone.StandardName));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 kStandardBias, 411 kStandardBias,
412 daylight_name, 412 daylight_name,
413 kSystemTimeZero, 413 kSystemTimeZero,
414 kDaylightBias); 414 kDaylightBias);
415 415
416 minidump_file_writer.AddStream(misc_info_writer.Pass()); 416 minidump_file_writer.AddStream(misc_info_writer.Pass());
417 417
418 StringFileWriter file_writer; 418 StringFileWriter file_writer;
419 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 419 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
420 420
421 const MINIDUMP_MISC_INFO_3* observed; 421 const MINIDUMP_MISC_INFO_3* observed = nullptr;
422 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 422 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
423 423
424 MINIDUMP_MISC_INFO_3 expected = {}; 424 MINIDUMP_MISC_INFO_3 expected = {};
425 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 425 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
426 expected.TimeZoneId = kTimeZoneId; 426 expected.TimeZoneId = kTimeZoneId;
427 expected.TimeZone.Bias = kBias; 427 expected.TimeZone.Bias = kBias;
428 base::string16 standard_name_utf16 = base::UTF8ToUTF16(standard_name); 428 base::string16 standard_name_utf16 = base::UTF8ToUTF16(standard_name);
429 c16lcpy(expected.TimeZone.StandardName, 429 c16lcpy(expected.TimeZone.StandardName,
430 standard_name_utf16.c_str(), 430 standard_name_utf16.c_str(),
431 arraysize(expected.TimeZone.StandardName)); 431 arraysize(expected.TimeZone.StandardName));
(...skipping 20 matching lines...) Expand all
452 const char kBuildString[] = "build string"; 452 const char kBuildString[] = "build string";
453 const char kDebugBuildString[] = "debug build string"; 453 const char kDebugBuildString[] = "debug build string";
454 454
455 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); 455 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
456 456
457 minidump_file_writer.AddStream(misc_info_writer.Pass()); 457 minidump_file_writer.AddStream(misc_info_writer.Pass());
458 458
459 StringFileWriter file_writer; 459 StringFileWriter file_writer;
460 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 460 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
461 461
462 const MINIDUMP_MISC_INFO_4* observed; 462 const MINIDUMP_MISC_INFO_4* observed = nullptr;
463 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 463 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
464 464
465 MINIDUMP_MISC_INFO_4 expected = {}; 465 MINIDUMP_MISC_INFO_4 expected = {};
466 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 466 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
467 base::string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString); 467 base::string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString);
468 c16lcpy(expected.BuildString, 468 c16lcpy(expected.BuildString,
469 build_string_utf16.c_str(), 469 build_string_utf16.c_str(),
470 arraysize(expected.BuildString)); 470 arraysize(expected.BuildString));
471 base::string16 debug_build_string_utf16 = 471 base::string16 debug_build_string_utf16 =
472 base::UTF8ToUTF16(kDebugBuildString); 472 base::UTF8ToUTF16(kDebugBuildString);
(...skipping 16 matching lines...) Expand all
489 std::string debug_build_string(arraysize(MINIDUMP_MISC_INFO_N::DbgBldStr), 489 std::string debug_build_string(arraysize(MINIDUMP_MISC_INFO_N::DbgBldStr),
490 'D'); 490 'D');
491 491
492 misc_info_writer->SetBuildString(build_string, debug_build_string); 492 misc_info_writer->SetBuildString(build_string, debug_build_string);
493 493
494 minidump_file_writer.AddStream(misc_info_writer.Pass()); 494 minidump_file_writer.AddStream(misc_info_writer.Pass());
495 495
496 StringFileWriter file_writer; 496 StringFileWriter file_writer;
497 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 497 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
498 498
499 const MINIDUMP_MISC_INFO_4* observed; 499 const MINIDUMP_MISC_INFO_4* observed = nullptr;
500 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 500 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
501 501
502 MINIDUMP_MISC_INFO_4 expected = {}; 502 MINIDUMP_MISC_INFO_4 expected = {};
503 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 503 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
504 base::string16 build_string_utf16 = base::UTF8ToUTF16(build_string); 504 base::string16 build_string_utf16 = base::UTF8ToUTF16(build_string);
505 c16lcpy(expected.BuildString, 505 c16lcpy(expected.BuildString,
506 build_string_utf16.c_str(), 506 build_string_utf16.c_str(),
507 arraysize(expected.BuildString)); 507 arraysize(expected.BuildString));
508 base::string16 debug_build_string_utf16 = 508 base::string16 debug_build_string_utf16 =
509 base::UTF8ToUTF16(debug_build_string); 509 base::UTF8ToUTF16(debug_build_string);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 kDaylightName, 559 kDaylightName,
560 kSystemTimeZero, 560 kSystemTimeZero,
561 kDaylightBias); 561 kDaylightBias);
562 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); 562 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
563 563
564 minidump_file_writer.AddStream(misc_info_writer.Pass()); 564 minidump_file_writer.AddStream(misc_info_writer.Pass());
565 565
566 StringFileWriter file_writer; 566 StringFileWriter file_writer;
567 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 567 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
568 568
569 const MINIDUMP_MISC_INFO_4* observed; 569 const MINIDUMP_MISC_INFO_4* observed = nullptr;
570 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed)); 570 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &observed));
571 571
572 MINIDUMP_MISC_INFO_4 expected = {}; 572 MINIDUMP_MISC_INFO_4 expected = {};
573 expected.Flags1 = 573 expected.Flags1 =
574 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES | 574 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES |
575 MINIDUMP_MISC1_PROCESSOR_POWER_INFO | MINIDUMP_MISC3_PROCESS_INTEGRITY | 575 MINIDUMP_MISC1_PROCESSOR_POWER_INFO | MINIDUMP_MISC3_PROCESS_INTEGRITY |
576 MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS | MINIDUMP_MISC3_PROTECTED_PROCESS | 576 MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS | MINIDUMP_MISC3_PROTECTED_PROCESS |
577 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC4_BUILDSTRING; 577 MINIDUMP_MISC3_TIMEZONE | MINIDUMP_MISC4_BUILDSTRING;
578 expected.ProcessId = kProcessId; 578 expected.ProcessId = kProcessId;
579 expected.ProcessCreateTime = kProcessCreateTime; 579 expected.ProcessCreateTime = kProcessCreateTime;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 700 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
701 misc_info_writer->InitializeFromSnapshot(&process_snapshot); 701 misc_info_writer->InitializeFromSnapshot(&process_snapshot);
702 702
703 MinidumpFileWriter minidump_file_writer; 703 MinidumpFileWriter minidump_file_writer;
704 minidump_file_writer.AddStream(misc_info_writer.Pass()); 704 minidump_file_writer.AddStream(misc_info_writer.Pass());
705 705
706 StringFileWriter file_writer; 706 StringFileWriter file_writer;
707 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer)); 707 ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
708 708
709 const MINIDUMP_MISC_INFO_4* misc_info; 709 const MINIDUMP_MISC_INFO_4* misc_info = nullptr;
710 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &misc_info)); 710 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(file_writer.string(), &misc_info));
711 711
712 ExpectMiscInfoEqual(&expect_misc_info, misc_info); 712 ExpectMiscInfoEqual(&expect_misc_info, misc_info);
713 } 713 }
714 714
715 } // namespace 715 } // namespace
716 } // namespace test 716 } // namespace test
717 } // namespace crashpad 717 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | snapshot/test/test_process_snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698