win: Fixes for minidump_file_writer_test

- implicit conversion from time_t -> long
- "exception_info" is a pseudo-keyword on MSVC related to SEH
- disable warning about expected truncation

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/898013002
This commit is contained in:
Scott Graham 2015-02-05 08:43:38 -08:00
parent db99fdb462
commit 8c74948ae5
2 changed files with 12 additions and 5 deletions

View File

@ -241,7 +241,7 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
const uint32_t kSnapshotTime = 0x4976043c;
const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 };
const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
TestProcessSnapshot process_snapshot;
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
@ -287,8 +287,15 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
// In a 32-bit environment, this will give a “timestamp out of range” warning,
// but the test should complete without failure.
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
#pragma warning(push)
#pragma warning(disable: 4309) // Truncation of constant value.
#endif // OS_WIN && ARCH_CPU_X86
const uint32_t kSnapshotTime = 0xfd469ab8;
const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 };
const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
#if defined(OS_WIN) && defined(ARCH_CPU_X86)
#pragma warning(pop)
#endif // OS_WIN && ARCH_CPU_X86
TestProcessSnapshot process_snapshot;
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
@ -352,7 +359,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
const uint32_t kSnapshotTime = 0x15393bd3;
const timeval kSnapshotTimeval = { implicit_cast<time_t>(kSnapshotTime), 0 };
const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
TestProcessSnapshot process_snapshot;
process_snapshot.SetSnapshotTime(kSnapshotTimeval);

View File

@ -50,8 +50,8 @@ class TestExceptionSnapshot final : public ExceptionSnapshot {
void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; }
void SetException(uint32_t exception) { exception_ = exception; }
void SetExceptionInfo(uint32_t exception_info) {
exception_info_ = exception_info;
void SetExceptionInfo(uint32_t exception_information) {
exception_info_ = exception_information;
}
void SetExceptionAddress(uint64_t exception_address) {
exception_address_ = exception_address;