| 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 16 matching lines...) Expand all Loading... |
| 27 #include "minidump/minidump_context_writer.h" | 27 #include "minidump/minidump_context_writer.h" |
| 28 #include "minidump/minidump_extensions.h" | 28 #include "minidump/minidump_extensions.h" |
| 29 #include "minidump/minidump_file_writer.h" | 29 #include "minidump/minidump_file_writer.h" |
| 30 #include "minidump/minidump_thread_id_map.h" | 30 #include "minidump/minidump_thread_id_map.h" |
| 31 #include "minidump/test/minidump_context_test_util.h" | 31 #include "minidump/test/minidump_context_test_util.h" |
| 32 #include "minidump/test/minidump_file_writer_test_util.h" | 32 #include "minidump/test/minidump_file_writer_test_util.h" |
| 33 #include "minidump/test/minidump_writable_test_util.h" | 33 #include "minidump/test/minidump_writable_test_util.h" |
| 34 #include "snapshot/test/test_cpu_context.h" | 34 #include "snapshot/test/test_cpu_context.h" |
| 35 #include "snapshot/test/test_exception_snapshot.h" | 35 #include "snapshot/test/test_exception_snapshot.h" |
| 36 #include "util/file/string_file.h" | 36 #include "util/file/string_file.h" |
| 37 #include "util/test/gtest_death_check.h" |
| 37 | 38 |
| 38 namespace crashpad { | 39 namespace crashpad { |
| 39 namespace test { | 40 namespace test { |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 // This returns the MINIDUMP_EXCEPTION_STREAM stream in |exception_stream|. | 43 // This returns the MINIDUMP_EXCEPTION_STREAM stream in |exception_stream|. |
| 43 void GetExceptionStream(const std::string& file_contents, | 44 void GetExceptionStream(const std::string& file_contents, |
| 44 const MINIDUMP_EXCEPTION_STREAM** exception_stream) { | 45 const MINIDUMP_EXCEPTION_STREAM** exception_stream) { |
| 45 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); | 46 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); |
| 46 const size_t kExceptionStreamOffset = | 47 const size_t kExceptionStreamOffset = |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 ExpectMinidumpContextX86(kSeed, observed_context, true)); | 256 ExpectMinidumpContextX86(kSeed, observed_context, true)); |
| 256 } | 257 } |
| 257 | 258 |
| 258 TEST(MinidumpExceptionWriterDeathTest, NoContext) { | 259 TEST(MinidumpExceptionWriterDeathTest, NoContext) { |
| 259 MinidumpFileWriter minidump_file_writer; | 260 MinidumpFileWriter minidump_file_writer; |
| 260 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); | 261 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); |
| 261 | 262 |
| 262 minidump_file_writer.AddStream(exception_writer.Pass()); | 263 minidump_file_writer.AddStream(exception_writer.Pass()); |
| 263 | 264 |
| 264 StringFile string_file; | 265 StringFile string_file; |
| 265 ASSERT_DEATH(minidump_file_writer.WriteEverything(&string_file), "context_"); | 266 ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), |
| 267 "context_"); |
| 266 } | 268 } |
| 267 | 269 |
| 268 TEST(MinidumpExceptionWriterDeathTest, TooMuchInformation) { | 270 TEST(MinidumpExceptionWriterDeathTest, TooMuchInformation) { |
| 269 MinidumpExceptionWriter exception_writer; | 271 MinidumpExceptionWriter exception_writer; |
| 270 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1, | 272 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1, |
| 271 0x5a5a5a5a5a5a5a5a); | 273 0x5a5a5a5a5a5a5a5a); |
| 272 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information), | 274 ASSERT_DEATH_CHECK( |
| 273 "kMaxParameters"); | 275 exception_writer.SetExceptionInformation(exception_information), |
| 276 "kMaxParameters"); |
| 274 } | 277 } |
| 275 | 278 |
| 276 } // namespace | 279 } // namespace |
| 277 } // namespace test | 280 } // namespace test |
| 278 } // namespace crashpad | 281 } // namespace crashpad |
| OLD | NEW |