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

Side by Side Diff: minidump/minidump_misc_info_writer_test.cc

Issue 1513573005: Provide std::move() in compat instead of using crashpad::move() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "minidump/minidump_misc_info_writer.h" 15 #include "minidump/minidump_misc_info_writer.h"
16 16
17 #include <windows.h> 17 #include <windows.h>
18 #include <dbghelp.h> 18 #include <dbghelp.h>
19 #include <string.h> 19 #include <string.h>
20 20
21 #include <string> 21 #include <string>
22 #include <utility>
22 23
23 #include "base/basictypes.h" 24 #include "base/basictypes.h"
24 #include "base/compiler_specific.h" 25 #include "base/compiler_specific.h"
25 #include "base/memory/scoped_ptr.h" 26 #include "base/memory/scoped_ptr.h"
26 #include "base/strings/string16.h" 27 #include "base/strings/string16.h"
27 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
28 #include "gtest/gtest.h" 29 #include "gtest/gtest.h"
29 #include "minidump/minidump_file_writer.h" 30 #include "minidump/minidump_file_writer.h"
30 #include "minidump/test/minidump_file_writer_test_util.h" 31 #include "minidump/test/minidump_file_writer_test_util.h"
31 #include "minidump/test/minidump_writable_test_util.h" 32 #include "minidump/test/minidump_writable_test_util.h"
32 #include "snapshot/test/test_process_snapshot.h" 33 #include "snapshot/test/test_process_snapshot.h"
33 #include "snapshot/test/test_system_snapshot.h" 34 #include "snapshot/test/test_system_snapshot.h"
34 #include "util/file/string_file.h" 35 #include "util/file/string_file.h"
35 #include "util/stdlib/move.h"
36 #include "util/stdlib/strlcpy.h" 36 #include "util/stdlib/strlcpy.h"
37 37
38 namespace crashpad { 38 namespace crashpad {
39 namespace test { 39 namespace test {
40 namespace { 40 namespace {
41 41
42 template <typename T> 42 template <typename T>
43 void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) { 43 void GetMiscInfoStream(const std::string& file_contents, const T** misc_info) {
44 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); 44 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
45 const size_t kMiscInfoStreamOffset = 45 const size_t kMiscInfoStreamOffset =
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ExpectNULPaddedString16Equal(expected->DbgBldStr, 162 ExpectNULPaddedString16Equal(expected->DbgBldStr,
163 observed->DbgBldStr, 163 observed->DbgBldStr,
164 arraysize(expected->DbgBldStr)); 164 arraysize(expected->DbgBldStr));
165 } 165 }
166 } 166 }
167 167
168 TEST(MinidumpMiscInfoWriter, Empty) { 168 TEST(MinidumpMiscInfoWriter, Empty) {
169 MinidumpFileWriter minidump_file_writer; 169 MinidumpFileWriter minidump_file_writer;
170 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 170 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
171 171
172 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 172 minidump_file_writer.AddStream(std::move(misc_info_writer));
173 173
174 StringFile string_file; 174 StringFile string_file;
175 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 175 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
176 176
177 const MINIDUMP_MISC_INFO* observed = nullptr; 177 const MINIDUMP_MISC_INFO* observed = nullptr;
178 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 178 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
179 179
180 MINIDUMP_MISC_INFO expected = {}; 180 MINIDUMP_MISC_INFO expected = {};
181 181
182 ExpectMiscInfoEqual(&expected, observed); 182 ExpectMiscInfoEqual(&expected, observed);
183 } 183 }
184 184
185 TEST(MinidumpMiscInfoWriter, ProcessId) { 185 TEST(MinidumpMiscInfoWriter, ProcessId) {
186 MinidumpFileWriter minidump_file_writer; 186 MinidumpFileWriter minidump_file_writer;
187 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 187 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
188 188
189 const uint32_t kProcessId = 12345; 189 const uint32_t kProcessId = 12345;
190 190
191 misc_info_writer->SetProcessID(kProcessId); 191 misc_info_writer->SetProcessID(kProcessId);
192 192
193 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 193 minidump_file_writer.AddStream(std::move(misc_info_writer));
194 194
195 StringFile string_file; 195 StringFile string_file;
196 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 196 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
197 197
198 const MINIDUMP_MISC_INFO* observed = nullptr; 198 const MINIDUMP_MISC_INFO* observed = nullptr;
199 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 199 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
200 200
201 MINIDUMP_MISC_INFO expected = {}; 201 MINIDUMP_MISC_INFO expected = {};
202 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID; 202 expected.Flags1 = MINIDUMP_MISC1_PROCESS_ID;
203 expected.ProcessId = kProcessId; 203 expected.ProcessId = kProcessId;
204 204
205 ExpectMiscInfoEqual(&expected, observed); 205 ExpectMiscInfoEqual(&expected, observed);
206 } 206 }
207 207
208 TEST(MinidumpMiscInfoWriter, ProcessTimes) { 208 TEST(MinidumpMiscInfoWriter, ProcessTimes) {
209 MinidumpFileWriter minidump_file_writer; 209 MinidumpFileWriter minidump_file_writer;
210 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 210 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
211 211
212 const time_t kProcessCreateTime = 0x15252f00; 212 const time_t kProcessCreateTime = 0x15252f00;
213 const uint32_t kProcessUserTime = 10; 213 const uint32_t kProcessUserTime = 10;
214 const uint32_t kProcessKernelTime = 5; 214 const uint32_t kProcessKernelTime = 5;
215 215
216 misc_info_writer->SetProcessTimes( 216 misc_info_writer->SetProcessTimes(
217 kProcessCreateTime, kProcessUserTime, kProcessKernelTime); 217 kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
218 218
219 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 219 minidump_file_writer.AddStream(std::move(misc_info_writer));
220 220
221 StringFile string_file; 221 StringFile string_file;
222 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 222 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
223 223
224 const MINIDUMP_MISC_INFO* observed = nullptr; 224 const MINIDUMP_MISC_INFO* observed = nullptr;
225 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 225 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
226 226
227 MINIDUMP_MISC_INFO expected = {}; 227 MINIDUMP_MISC_INFO expected = {};
228 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES; 228 expected.Flags1 = MINIDUMP_MISC1_PROCESS_TIMES;
229 expected.ProcessCreateTime = kProcessCreateTime; 229 expected.ProcessCreateTime = kProcessCreateTime;
(...skipping 12 matching lines...) Expand all
242 const uint32_t kProcessorMhzLimit = 3300; 242 const uint32_t kProcessorMhzLimit = 3300;
243 const uint32_t kProcessorMaxIdleState = 5; 243 const uint32_t kProcessorMaxIdleState = 5;
244 const uint32_t kProcessorCurrentIdleState = 1; 244 const uint32_t kProcessorCurrentIdleState = 1;
245 245
246 misc_info_writer->SetProcessorPowerInfo(kProcessorMaxMhz, 246 misc_info_writer->SetProcessorPowerInfo(kProcessorMaxMhz,
247 kProcessorCurrentMhz, 247 kProcessorCurrentMhz,
248 kProcessorMhzLimit, 248 kProcessorMhzLimit,
249 kProcessorMaxIdleState, 249 kProcessorMaxIdleState,
250 kProcessorCurrentIdleState); 250 kProcessorCurrentIdleState);
251 251
252 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 252 minidump_file_writer.AddStream(std::move(misc_info_writer));
253 253
254 StringFile string_file; 254 StringFile string_file;
255 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 255 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
256 256
257 const MINIDUMP_MISC_INFO_2* observed = nullptr; 257 const MINIDUMP_MISC_INFO_2* observed = nullptr;
258 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 258 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
259 259
260 MINIDUMP_MISC_INFO_2 expected = {}; 260 MINIDUMP_MISC_INFO_2 expected = {};
261 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO; 261 expected.Flags1 = MINIDUMP_MISC1_PROCESSOR_POWER_INFO;
262 expected.ProcessorMaxMhz = kProcessorMaxMhz; 262 expected.ProcessorMaxMhz = kProcessorMaxMhz;
263 expected.ProcessorCurrentMhz = kProcessorCurrentMhz; 263 expected.ProcessorCurrentMhz = kProcessorCurrentMhz;
264 expected.ProcessorMhzLimit = kProcessorMhzLimit; 264 expected.ProcessorMhzLimit = kProcessorMhzLimit;
265 expected.ProcessorMaxIdleState = kProcessorMaxIdleState; 265 expected.ProcessorMaxIdleState = kProcessorMaxIdleState;
266 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState; 266 expected.ProcessorCurrentIdleState = kProcessorCurrentIdleState;
267 267
268 ExpectMiscInfoEqual(&expected, observed); 268 ExpectMiscInfoEqual(&expected, observed);
269 } 269 }
270 270
271 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) { 271 TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
272 MinidumpFileWriter minidump_file_writer; 272 MinidumpFileWriter minidump_file_writer;
273 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 273 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
274 274
275 const uint32_t kProcessIntegrityLevel = 0x2000; 275 const uint32_t kProcessIntegrityLevel = 0x2000;
276 276
277 misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel); 277 misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel);
278 278
279 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 279 minidump_file_writer.AddStream(std::move(misc_info_writer));
280 280
281 StringFile string_file; 281 StringFile string_file;
282 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 282 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
283 283
284 const MINIDUMP_MISC_INFO_3* observed = nullptr; 284 const MINIDUMP_MISC_INFO_3* observed = nullptr;
285 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 285 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
286 286
287 MINIDUMP_MISC_INFO_3 expected = {}; 287 MINIDUMP_MISC_INFO_3 expected = {};
288 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY; 288 expected.Flags1 = MINIDUMP_MISC3_PROCESS_INTEGRITY;
289 expected.ProcessIntegrityLevel = kProcessIntegrityLevel; 289 expected.ProcessIntegrityLevel = kProcessIntegrityLevel;
290 290
291 ExpectMiscInfoEqual(&expected, observed); 291 ExpectMiscInfoEqual(&expected, observed);
292 } 292 }
293 293
294 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) { 294 TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
295 MinidumpFileWriter minidump_file_writer; 295 MinidumpFileWriter minidump_file_writer;
296 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 296 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
297 297
298 const uint32_t kProcessExecuteFlags = 0x13579bdf; 298 const uint32_t kProcessExecuteFlags = 0x13579bdf;
299 299
300 misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags); 300 misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags);
301 301
302 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 302 minidump_file_writer.AddStream(std::move(misc_info_writer));
303 303
304 StringFile string_file; 304 StringFile string_file;
305 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 305 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
306 306
307 const MINIDUMP_MISC_INFO_3* observed = nullptr; 307 const MINIDUMP_MISC_INFO_3* observed = nullptr;
308 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 308 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
309 309
310 MINIDUMP_MISC_INFO_3 expected = {}; 310 MINIDUMP_MISC_INFO_3 expected = {};
311 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS; 311 expected.Flags1 = MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS;
312 expected.ProcessExecuteFlags = kProcessExecuteFlags; 312 expected.ProcessExecuteFlags = kProcessExecuteFlags;
313 313
314 ExpectMiscInfoEqual(&expected, observed); 314 ExpectMiscInfoEqual(&expected, observed);
315 } 315 }
316 316
317 TEST(MinidumpMiscInfoWriter, ProtectedProcess) { 317 TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
318 MinidumpFileWriter minidump_file_writer; 318 MinidumpFileWriter minidump_file_writer;
319 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 319 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
320 320
321 const uint32_t kProtectedProcess = 1; 321 const uint32_t kProtectedProcess = 1;
322 322
323 misc_info_writer->SetProtectedProcess(kProtectedProcess); 323 misc_info_writer->SetProtectedProcess(kProtectedProcess);
324 324
325 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 325 minidump_file_writer.AddStream(std::move(misc_info_writer));
326 326
327 StringFile string_file; 327 StringFile string_file;
328 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 328 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
329 329
330 const MINIDUMP_MISC_INFO_3* observed = nullptr; 330 const MINIDUMP_MISC_INFO_3* observed = nullptr;
331 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 331 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
332 332
333 MINIDUMP_MISC_INFO_3 expected = {}; 333 MINIDUMP_MISC_INFO_3 expected = {};
334 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS; 334 expected.Flags1 = MINIDUMP_MISC3_PROTECTED_PROCESS;
335 expected.ProtectedProcess = kProtectedProcess; 335 expected.ProtectedProcess = kProtectedProcess;
(...skipping 16 matching lines...) Expand all
352 352
353 misc_info_writer->SetTimeZone(kTimeZoneId, 353 misc_info_writer->SetTimeZone(kTimeZoneId,
354 kBias, 354 kBias,
355 kStandardName, 355 kStandardName,
356 kStandardDate, 356 kStandardDate,
357 kStandardBias, 357 kStandardBias,
358 kDaylightName, 358 kDaylightName,
359 kDaylightDate, 359 kDaylightDate,
360 kDaylightBias); 360 kDaylightBias);
361 361
362 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 362 minidump_file_writer.AddStream(std::move(misc_info_writer));
363 363
364 StringFile string_file; 364 StringFile string_file;
365 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 365 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
366 366
367 const MINIDUMP_MISC_INFO_3* observed = nullptr; 367 const MINIDUMP_MISC_INFO_3* observed = nullptr;
368 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 368 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
369 369
370 MINIDUMP_MISC_INFO_3 expected = {}; 370 MINIDUMP_MISC_INFO_3 expected = {};
371 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 371 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
372 expected.TimeZoneId = kTimeZoneId; 372 expected.TimeZoneId = kTimeZoneId;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 misc_info_writer->SetTimeZone(kTimeZoneId, 414 misc_info_writer->SetTimeZone(kTimeZoneId,
415 kBias, 415 kBias,
416 standard_name, 416 standard_name,
417 kSystemTimeZero, 417 kSystemTimeZero,
418 kStandardBias, 418 kStandardBias,
419 daylight_name, 419 daylight_name,
420 kSystemTimeZero, 420 kSystemTimeZero,
421 kDaylightBias); 421 kDaylightBias);
422 422
423 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 423 minidump_file_writer.AddStream(std::move(misc_info_writer));
424 424
425 StringFile string_file; 425 StringFile string_file;
426 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 426 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
427 427
428 const MINIDUMP_MISC_INFO_3* observed = nullptr; 428 const MINIDUMP_MISC_INFO_3* observed = nullptr;
429 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 429 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
430 430
431 MINIDUMP_MISC_INFO_3 expected = {}; 431 MINIDUMP_MISC_INFO_3 expected = {};
432 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE; 432 expected.Flags1 = MINIDUMP_MISC3_TIMEZONE;
433 expected.TimeZoneId = kTimeZoneId; 433 expected.TimeZoneId = kTimeZoneId;
(...skipping 20 matching lines...) Expand all
454 454
455 TEST(MinidumpMiscInfoWriter, BuildStrings) { 455 TEST(MinidumpMiscInfoWriter, BuildStrings) {
456 MinidumpFileWriter minidump_file_writer; 456 MinidumpFileWriter minidump_file_writer;
457 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 457 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
458 458
459 const char kBuildString[] = "build string"; 459 const char kBuildString[] = "build string";
460 const char kDebugBuildString[] = "debug build string"; 460 const char kDebugBuildString[] = "debug build string";
461 461
462 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); 462 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
463 463
464 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 464 minidump_file_writer.AddStream(std::move(misc_info_writer));
465 465
466 StringFile string_file; 466 StringFile string_file;
467 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 467 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
468 468
469 const MINIDUMP_MISC_INFO_4* observed = nullptr; 469 const MINIDUMP_MISC_INFO_4* observed = nullptr;
470 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 470 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
471 471
472 MINIDUMP_MISC_INFO_4 expected = {}; 472 MINIDUMP_MISC_INFO_4 expected = {};
473 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 473 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
474 base::string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString); 474 base::string16 build_string_utf16 = base::UTF8ToUTF16(kBuildString);
(...skipping 16 matching lines...) Expand all
491 MinidumpFileWriter minidump_file_writer; 491 MinidumpFileWriter minidump_file_writer;
492 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 492 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
493 493
494 MINIDUMP_MISC_INFO_4 tmp; 494 MINIDUMP_MISC_INFO_4 tmp;
495 ALLOW_UNUSED_LOCAL(tmp); 495 ALLOW_UNUSED_LOCAL(tmp);
496 std::string build_string(arraysize(tmp.BuildString) + 1, 'B'); 496 std::string build_string(arraysize(tmp.BuildString) + 1, 'B');
497 std::string debug_build_string(arraysize(tmp.DbgBldStr), 'D'); 497 std::string debug_build_string(arraysize(tmp.DbgBldStr), 'D');
498 498
499 misc_info_writer->SetBuildString(build_string, debug_build_string); 499 misc_info_writer->SetBuildString(build_string, debug_build_string);
500 500
501 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 501 minidump_file_writer.AddStream(std::move(misc_info_writer));
502 502
503 StringFile string_file; 503 StringFile string_file;
504 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 504 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
505 505
506 const MINIDUMP_MISC_INFO_4* observed = nullptr; 506 const MINIDUMP_MISC_INFO_4* observed = nullptr;
507 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 507 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
508 508
509 MINIDUMP_MISC_INFO_4 expected = {}; 509 MINIDUMP_MISC_INFO_4 expected = {};
510 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING; 510 expected.Flags1 = MINIDUMP_MISC4_BUILDSTRING;
511 base::string16 build_string_utf16 = base::UTF8ToUTF16(build_string); 511 base::string16 build_string_utf16 = base::UTF8ToUTF16(build_string);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 misc_info_writer->SetTimeZone(kTimeZoneId, 561 misc_info_writer->SetTimeZone(kTimeZoneId,
562 kBias, 562 kBias,
563 kStandardName, 563 kStandardName,
564 kSystemTimeZero, 564 kSystemTimeZero,
565 kStandardBias, 565 kStandardBias,
566 kDaylightName, 566 kDaylightName,
567 kSystemTimeZero, 567 kSystemTimeZero,
568 kDaylightBias); 568 kDaylightBias);
569 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); 569 misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
570 570
571 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 571 minidump_file_writer.AddStream(std::move(misc_info_writer));
572 572
573 StringFile string_file; 573 StringFile string_file;
574 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 574 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
575 575
576 const MINIDUMP_MISC_INFO_4* observed = nullptr; 576 const MINIDUMP_MISC_INFO_4* observed = nullptr;
577 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed)); 577 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &observed));
578 578
579 MINIDUMP_MISC_INFO_4 expected = {}; 579 MINIDUMP_MISC_INFO_4 expected = {};
580 expected.Flags1 = 580 expected.Flags1 =
581 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES | 581 MINIDUMP_MISC1_PROCESS_ID | MINIDUMP_MISC1_PROCESS_TIMES |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 expect_misc_info.ProcessorMaxMhz * kHzPerMHz); 695 expect_misc_info.ProcessorMaxMhz * kHzPerMHz);
696 system_snapshot->SetTimeZone(SystemSnapshot::kObservingStandardTime, 696 system_snapshot->SetTimeZone(SystemSnapshot::kObservingStandardTime,
697 expect_misc_info.TimeZone.Bias * -60, 697 expect_misc_info.TimeZone.Bias * -60,
698 (expect_misc_info.TimeZone.Bias + 698 (expect_misc_info.TimeZone.Bias +
699 expect_misc_info.TimeZone.DaylightBias) * -60, 699 expect_misc_info.TimeZone.DaylightBias) * -60,
700 kStandardTimeName, 700 kStandardTimeName,
701 kDaylightTimeName); 701 kDaylightTimeName);
702 system_snapshot->SetOSVersionFull(kOSVersionFull); 702 system_snapshot->SetOSVersionFull(kOSVersionFull);
703 system_snapshot->SetMachineDescription(kMachineDescription); 703 system_snapshot->SetMachineDescription(kMachineDescription);
704 704
705 process_snapshot.SetSystem(crashpad::move(system_snapshot)); 705 process_snapshot.SetSystem(std::move(system_snapshot));
706 706
707 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); 707 auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
708 misc_info_writer->InitializeFromSnapshot(&process_snapshot); 708 misc_info_writer->InitializeFromSnapshot(&process_snapshot);
709 709
710 MinidumpFileWriter minidump_file_writer; 710 MinidumpFileWriter minidump_file_writer;
711 minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); 711 minidump_file_writer.AddStream(std::move(misc_info_writer));
712 712
713 StringFile string_file; 713 StringFile string_file;
714 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 714 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
715 715
716 const MINIDUMP_MISC_INFO_4* misc_info = nullptr; 716 const MINIDUMP_MISC_INFO_4* misc_info = nullptr;
717 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &misc_info)); 717 ASSERT_NO_FATAL_FAILURE(GetMiscInfoStream(string_file.string(), &misc_info));
718 718
719 ExpectMiscInfoEqual(&expect_misc_info, misc_info); 719 ExpectMiscInfoEqual(&expect_misc_info, misc_info);
720 } 720 }
721 721
722 } // namespace 722 } // namespace
723 } // namespace test 723 } // namespace test
724 } // namespace crashpad 724 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_memory_writer_test.cc ('k') | minidump/minidump_module_crashpad_info_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698