Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 | 21 |
| 22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
| 23 #include "base/compiler_specific.h" | 23 #include "base/compiler_specific.h" |
| 24 #include "gtest/gtest.h" | 24 #include "gtest/gtest.h" |
| 25 #include "minidump/minidump_stream_writer.h" | 25 #include "minidump/minidump_stream_writer.h" |
| 26 #include "minidump/minidump_writable.h" | 26 #include "minidump/minidump_writable.h" |
| 27 #include "minidump/test/minidump_file_writer_test_util.h" | 27 #include "minidump/test/minidump_file_writer_test_util.h" |
| 28 #include "minidump/test/minidump_writable_test_util.h" | 28 #include "minidump/test/minidump_writable_test_util.h" |
| 29 #include "snapshot/test/test_cpu_context.h" | 29 #include "snapshot/test/test_cpu_context.h" |
| 30 #include "snapshot/test/test_exception_snapshot.h" | 30 #include "snapshot/test/test_exception_snapshot.h" |
| 31 #include "snapshot/test/test_memory_snapshot.h" | |
| 31 #include "snapshot/test/test_module_snapshot.h" | 32 #include "snapshot/test/test_module_snapshot.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 "snapshot/test/test_thread_snapshot.h" | 35 #include "snapshot/test/test_thread_snapshot.h" |
| 35 #include "test/gtest_death_check.h" | 36 #include "test/gtest_death_check.h" |
| 36 #include "util/file/string_file.h" | 37 #include "util/file/string_file.h" |
| 37 | 38 |
| 38 namespace crashpad { | 39 namespace crashpad { |
| 39 namespace test { | 40 namespace test { |
| 40 namespace { | 41 namespace { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; | 246 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; |
| 246 | 247 |
| 247 TestProcessSnapshot process_snapshot; | 248 TestProcessSnapshot process_snapshot; |
| 248 process_snapshot.SetSnapshotTime(kSnapshotTimeval); | 249 process_snapshot.SetSnapshotTime(kSnapshotTimeval); |
| 249 | 250 |
| 250 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); | 251 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); |
| 251 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); | 252 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); |
| 252 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); | 253 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); |
| 253 process_snapshot.SetSystem(system_snapshot.Pass()); | 254 process_snapshot.SetSystem(system_snapshot.Pass()); |
| 254 | 255 |
| 256 auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot()); | |
| 257 peb_snapshot->SetAddress(0x07f90000); | |
| 258 peb_snapshot->SetSize(0x280); | |
| 259 peb_snapshot->SetValue('p'); | |
| 260 process_snapshot.SetPeb(peb_snapshot.Pass()); | |
|
Mark Mentovai
2015/09/23 21:40:50
You never test that this had any effect on the out
scottmg
2015/09/24 20:00:10
Oops, done.
| |
| 261 | |
| 255 MinidumpFileWriter minidump_file_writer; | 262 MinidumpFileWriter minidump_file_writer; |
| 256 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); | 263 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); |
| 257 | 264 |
| 258 StringFile string_file; | 265 StringFile string_file; |
| 259 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); | 266 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); |
| 260 | 267 |
| 261 const MINIDUMP_DIRECTORY* directory; | 268 const MINIDUMP_DIRECTORY* directory; |
| 262 const MINIDUMP_HEADER* header = | 269 const MINIDUMP_HEADER* header = |
| 263 MinidumpHeaderAtStart(string_file.string(), &directory); | 270 MinidumpHeaderAtStart(string_file.string(), &directory); |
| 264 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 5, kSnapshotTime)); | 271 ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 5, kSnapshotTime)); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 const uint8_t kStream1Value = 0xa5; | 444 const uint8_t kStream1Value = 0xa5; |
| 438 auto stream1 = make_scoped_ptr( | 445 auto stream1 = make_scoped_ptr( |
| 439 new TestStream(kStream1Type, kStream1Size, kStream1Value)); | 446 new TestStream(kStream1Type, kStream1Size, kStream1Value)); |
| 440 ASSERT_DEATH_CHECK(minidump_file.AddStream(stream1.Pass()), | 447 ASSERT_DEATH_CHECK(minidump_file.AddStream(stream1.Pass()), |
| 441 "already present"); | 448 "already present"); |
| 442 } | 449 } |
| 443 | 450 |
| 444 } // namespace | 451 } // namespace |
| 445 } // namespace test | 452 } // namespace test |
| 446 } // namespace crashpad | 453 } // namespace crashpad |
| OLD | NEW |