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

Side by Side Diff: minidump/minidump_file_writer_test.cc

Issue 898013002: win: Fixes for minidump_file_writer_test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@minidump_test-6
Patch Set: 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
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0)); 234 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
235 ASSERT_TRUE(directory); 235 ASSERT_TRUE(directory);
236 236
237 EXPECT_EQ(kStreamType, directory[0].StreamType); 237 EXPECT_EQ(kStreamType, directory[0].StreamType);
238 EXPECT_EQ(kStreamSize, directory[0].Location.DataSize); 238 EXPECT_EQ(kStreamSize, directory[0].Location.DataSize);
239 EXPECT_EQ(kStreamOffset, directory[0].Location.Rva); 239 EXPECT_EQ(kStreamOffset, directory[0].Location.Rva);
240 } 240 }
241 241
242 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { 242 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
243 const uint32_t kSnapshotTime = 0x4976043c; 243 const uint32_t kSnapshotTime = 0x4976043c;
244 const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 }; 244 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
245 245
246 TestProcessSnapshot process_snapshot; 246 TestProcessSnapshot process_snapshot;
247 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 247 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
248 248
249 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 249 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
250 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 250 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
251 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 251 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
252 process_snapshot.SetSystem(system_snapshot.Pass()); 252 process_snapshot.SetSystem(system_snapshot.Pass());
253 253
254 MinidumpFileWriter minidump_file_writer; 254 MinidumpFileWriter minidump_file_writer;
(...skipping 25 matching lines...) Expand all
280 file_writer.string(), directory[3].Location)); 280 file_writer.string(), directory[3].Location));
281 281
282 EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[4].StreamType); 282 EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[4].StreamType);
283 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>( 283 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
284 file_writer.string(), directory[4].Location)); 284 file_writer.string(), directory[4].Location));
285 } 285 }
286 286
287 TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) { 287 TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
288 // In a 32-bit environment, this will give a “timestamp out of range” warning, 288 // In a 32-bit environment, this will give a “timestamp out of range” warning,
289 // but the test should complete without failure. 289 // but the test should complete without failure.
290 #if defined(OS_WIN) && defined(ARCH_CPU_X86)
291 #pragma warning(push)
292 #pragma warning(disable: 4309) // Truncation of constant value.
Mark Mentovai 2015/02/05 14:24:32 If this comes up in many more places, perhaps we s
293 #endif // OS_WIN && ARCH_CPU_X86
290 const uint32_t kSnapshotTime = 0xfd469ab8; 294 const uint32_t kSnapshotTime = 0xfd469ab8;
291 const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 }; 295 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
296 #if defined(OS_WIN) && defined(ARCH_CPU_X86)
297 #pragma warning(pop)
298 #endif // OS_WIN && ARCH_CPU_X86
292 299
293 TestProcessSnapshot process_snapshot; 300 TestProcessSnapshot process_snapshot;
294 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 301 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
295 302
296 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 303 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
297 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 304 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
298 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 305 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
299 process_snapshot.SetSystem(system_snapshot.Pass()); 306 process_snapshot.SetSystem(system_snapshot.Pass());
300 307
301 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); 308 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>( 352 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MODULE_LIST>(
346 file_writer.string(), directory[4].Location)); 353 file_writer.string(), directory[4].Location));
347 354
348 EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[5].StreamType); 355 EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[5].StreamType);
349 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>( 356 EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
350 file_writer.string(), directory[5].Location)); 357 file_writer.string(), directory[5].Location));
351 } 358 }
352 359
353 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) { 360 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
354 const uint32_t kSnapshotTime = 0x15393bd3; 361 const uint32_t kSnapshotTime = 0x15393bd3;
355 const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 }; 362 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
356 363
357 TestProcessSnapshot process_snapshot; 364 TestProcessSnapshot process_snapshot;
358 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 365 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
359 366
360 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 367 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
361 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 368 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
362 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 369 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
363 process_snapshot.SetSystem(system_snapshot.Pass()); 370 process_snapshot.SetSystem(system_snapshot.Pass());
364 371
365 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); 372 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); 440 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
434 const uint8_t kStream1Value = 0xa5; 441 const uint8_t kStream1Value = 0xa5;
435 auto stream1 = make_scoped_ptr( 442 auto stream1 = make_scoped_ptr(
436 new TestStream(kStream1Type, kStream1Size, kStream1Value)); 443 new TestStream(kStream1Type, kStream1Size, kStream1Value));
437 ASSERT_DEATH(minidump_file.AddStream(stream1.Pass()), "already present"); 444 ASSERT_DEATH(minidump_file.AddStream(stream1.Pass()), "already present");
438 } 445 }
439 446
440 } // namespace 447 } // namespace
441 } // namespace test 448 } // namespace test
442 } // namespace crashpad 449 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | snapshot/test/test_exception_snapshot.h » ('j') | snapshot/test/test_exception_snapshot.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698