| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 private: | 49 private: |
| 50 uint64_t base_address_; | 50 uint64_t base_address_; |
| 51 off_t expected_offset_; | 51 off_t expected_offset_; |
| 52 size_t size_; | 52 size_t size_; |
| 53 uint8_t value_; | 53 uint8_t value_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(TestMinidumpMemoryWriter); | 55 DISALLOW_COPY_AND_ASSIGN(TestMinidumpMemoryWriter); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 //! \brief Verifies, via gtest assertions, that a MINIDUMP_MEMORY_DESCRIPTOR | 58 //! \brief Verifies, via gtest assertions, that a MINIDUMP_MEMORY_DESCRIPTOR |
| 59 //! structure contains expected values, and that the memory region it points | 59 //! structure contains expected values. |
| 60 //! to contains expected values assuming it was written by a | |
| 61 //! TestMinidumpMemoryWriter object. | |
| 62 //! | 60 //! |
| 63 //! In \a expected and \a observed, | 61 //! In \a expected and \a observed, |
| 64 //! MINIDUMP_MEMORY_DESCRIPTOR::StartOfMemoryRange and | 62 //! MINIDUMP_MEMORY_DESCRIPTOR::StartOfMemoryRange and |
| 65 //! MINIDUMP_LOCATION_DESCRIPTOR::DataSize are compared and must match. If | 63 //! MINIDUMP_LOCATION_DESCRIPTOR::DataSize are compared and must match. If |
| 66 //! MINIDUMP_LOCATION_DESCRIPTOR::Rva is nonzero in \a expected, the same field | 64 //! MINIDUMP_LOCATION_DESCRIPTOR::Rva is nonzero in \a expected, the same field |
| 67 //! in \a observed must match it, subject to a 16-byte alignment augmentation. | 65 //! in \a observed must match it, subject to a 16-byte alignment augmentation. |
| 68 //! | 66 //! |
| 69 //! \param[in] expected A MINIDUMP_MEMORY_DESCRIPTOR structure containing | 67 //! \param[in] expected A MINIDUMP_MEMORY_DESCRIPTOR structure containing |
| 70 //! expected values. | 68 //! expected values. |
| 71 //! \param[in] observed A MINIDUMP_MEMORY_DESCRIPTOR structure containing | 69 //! \param[in] observed A MINIDUMP_MEMORY_DESCRIPTOR structure containing |
| 72 //! observed values. | 70 //! observed values. |
| 71 void ExpectMinidumpMemoryDescriptor(const MINIDUMP_MEMORY_DESCRIPTOR* expected, |
| 72 const MINIDUMP_MEMORY_DESCRIPTOR* observed); |
| 73 |
| 74 //! \brief Verifies, via gtest assertions, that a MINIDUMP_MEMORY_DESCRIPTOR |
| 75 //! structure contains expected values, and that the memory region it points |
| 76 //! to contains expected values assuming it was written by a |
| 77 //! TestMinidumpMemoryWriter object. |
| 78 //! |
| 79 //! \a expected and \a observed are compared by |
| 80 //! ExpectMinidumpMemoryDescriptor(). |
| 81 //! |
| 82 //! \param[in] expected A MINIDUMP_MEMORY_DESCRIPTOR structure containing |
| 83 //! expected values. |
| 84 //! \param[in] observed A MINIDUMP_MEMORY_DESCRIPTOR structure containing |
| 85 //! observed values. |
| 73 //! \param[in] file_contents The contents of the minidump file in which \a | 86 //! \param[in] file_contents The contents of the minidump file in which \a |
| 74 //! observed was found. The memory region referenced by \a observed will be | 87 //! observed was found. The memory region referenced by \a observed will be |
| 75 //! read from this string. | 88 //! read from this string. |
| 76 //! \param[in] value The \a value used to create a TestMinidumpMemoryWriter. | 89 //! \param[in] value The \a value used to create a TestMinidumpMemoryWriter. |
| 77 //! Each byte of memory in the region referenced by \a observed must be this | 90 //! Each byte of memory in the region referenced by \a observed must be this |
| 78 //! value. | 91 //! value. |
| 79 //! \param[in] at_eof If `true`, the region referenced by \a observed must | 92 //! \param[in] at_eof If `true`, the region referenced by \a observed must |
| 80 //! appear at the end of \a file_contents, without any data following it. | 93 //! appear at the end of \a file_contents, without any data following it. |
| 81 void ExpectMinidumpMemoryDescriptorAndContents( | 94 void ExpectMinidumpMemoryDescriptorAndContents( |
| 82 const MINIDUMP_MEMORY_DESCRIPTOR* expected, | 95 const MINIDUMP_MEMORY_DESCRIPTOR* expected, |
| 83 const MINIDUMP_MEMORY_DESCRIPTOR* observed, | 96 const MINIDUMP_MEMORY_DESCRIPTOR* observed, |
| 84 const std::string& file_contents, | 97 const std::string& file_contents, |
| 85 uint8_t value, | 98 uint8_t value, |
| 86 bool at_eof); | 99 bool at_eof); |
| 87 | 100 |
| 88 } // namespace test | 101 } // namespace test |
| 89 } // namespace crashpad | 102 } // namespace crashpad |
| 90 | 103 |
| 91 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MEMORY_WRITER_TEST_UTIL_H_ | 104 #endif // CRASHPAD_MINIDUMP_MINIDUMP_MEMORY_WRITER_TEST_UTIL_H_ |
| OLD | NEW |