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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | |
293 #endif // OS_WIN && ARCH_CPU_X86 | |
294 const uint32_t kSnapshotTime = 0xfd469ab8; | 290 const uint32_t kSnapshotTime = 0xfd469ab8; |
| 291 MSVC_SUPPRESS_WARNING(4309) // Truncation of constant value. |
295 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; | 292 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 | |
299 | 293 |
300 TestProcessSnapshot process_snapshot; | 294 TestProcessSnapshot process_snapshot; |
301 process_snapshot.SetSnapshotTime(kSnapshotTimeval); | 295 process_snapshot.SetSnapshotTime(kSnapshotTimeval); |
302 | 296 |
303 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); | 297 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); |
304 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); | 298 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); |
305 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); | 299 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); |
306 process_snapshot.SetSystem(system_snapshot.Pass()); | 300 process_snapshot.SetSystem(system_snapshot.Pass()); |
307 | 301 |
308 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); | 302 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); | 434 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); |
441 const uint8_t kStream1Value = 0xa5; | 435 const uint8_t kStream1Value = 0xa5; |
442 auto stream1 = make_scoped_ptr( | 436 auto stream1 = make_scoped_ptr( |
443 new TestStream(kStream1Type, kStream1Size, kStream1Value)); | 437 new TestStream(kStream1Type, kStream1Size, kStream1Value)); |
444 ASSERT_DEATH(minidump_file.AddStream(stream1.Pass()), "already present"); | 438 ASSERT_DEATH(minidump_file.AddStream(stream1.Pass()), "already present"); |
445 } | 439 } |
446 | 440 |
447 } // namespace | 441 } // namespace |
448 } // namespace test | 442 } // namespace test |
449 } // namespace crashpad | 443 } // namespace crashpad |
OLD | NEW |