OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_MODULE_SNAPSHOT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_MODULE_SNAPSHOT_H_ |
| 17 |
| 18 #include <stdint.h> |
| 19 #include <sys/types.h> |
| 20 |
| 21 #include <map> |
| 22 #include <string> |
| 23 #include <vector> |
| 24 |
| 25 #include "base/basictypes.h" |
| 26 #include "snapshot/module_snapshot.h" |
| 27 |
| 28 namespace crashpad { |
| 29 namespace test { |
| 30 |
| 31 //! \brief A test ModuleSnapshot that can carries arbitrary data for testing |
| 32 //! purposes. |
| 33 class TestModuleSnapshot final : public ModuleSnapshot { |
| 34 public: |
| 35 TestModuleSnapshot(); |
| 36 ~TestModuleSnapshot(); |
| 37 |
| 38 void SetName(const std::string& name) { name_ = name; } |
| 39 void SetAddressAndSize(uint64_t address, uint64_t size) { |
| 40 address_ = address; |
| 41 size_ = size; |
| 42 } |
| 43 void SetTimestamp(time_t timestamp) { timestamp_ = timestamp; } |
| 44 void SetFileVersion(uint16_t file_version_0, |
| 45 uint16_t file_version_1, |
| 46 uint16_t file_version_2, |
| 47 uint16_t file_version_3) { |
| 48 file_version_[0] = file_version_0; |
| 49 file_version_[1] = file_version_1; |
| 50 file_version_[2] = file_version_2; |
| 51 file_version_[3] = file_version_3; |
| 52 } |
| 53 void SetSourceVersion(uint16_t source_version_0, |
| 54 uint16_t source_version_1, |
| 55 uint16_t source_version_2, |
| 56 uint16_t source_version_3) { |
| 57 source_version_[0] = source_version_0; |
| 58 source_version_[1] = source_version_1; |
| 59 source_version_[2] = source_version_2; |
| 60 source_version_[3] = source_version_3; |
| 61 } |
| 62 void SetModuleType(ModuleType module_type) { module_type_ = module_type; } |
| 63 void SetUUID(const crashpad::UUID& uuid) { uuid_ = uuid; } |
| 64 void SetAnnotationsVector( |
| 65 const std::vector<std::string>& annotations_vector) { |
| 66 annotations_vector_ = annotations_vector; |
| 67 } |
| 68 void SetAnnotationsSimpleMap( |
| 69 const std::map<std::string, std::string>& annotations_simple_map) { |
| 70 annotations_simple_map_ = annotations_simple_map; |
| 71 } |
| 72 |
| 73 // ModuleSnapshot: |
| 74 |
| 75 std::string Name() const override; |
| 76 uint64_t Address() const override; |
| 77 uint64_t Size() const override; |
| 78 time_t Timestamp() const override; |
| 79 void FileVersion(uint16_t* version_0, |
| 80 uint16_t* version_1, |
| 81 uint16_t* version_2, |
| 82 uint16_t* version_3) const override; |
| 83 void SourceVersion(uint16_t* version_0, |
| 84 uint16_t* version_1, |
| 85 uint16_t* version_2, |
| 86 uint16_t* version_3) const override; |
| 87 ModuleType GetModuleType() const override; |
| 88 void UUID(crashpad::UUID* uuid) const override; |
| 89 std::vector<std::string> AnnotationsVector() const override; |
| 90 std::map<std::string, std::string> AnnotationsSimpleMap() const override; |
| 91 |
| 92 private: |
| 93 std::string name_; |
| 94 uint64_t address_; |
| 95 uint64_t size_; |
| 96 time_t timestamp_; |
| 97 uint16_t file_version_[4]; |
| 98 uint16_t source_version_[4]; |
| 99 ModuleType module_type_; |
| 100 crashpad::UUID uuid_; |
| 101 std::vector<std::string> annotations_vector_; |
| 102 std::map<std::string, std::string> annotations_simple_map_; |
| 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(TestModuleSnapshot); |
| 105 }; |
| 106 |
| 107 } // namespace test |
| 108 } // namespace crashpad |
| 109 |
| 110 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_MODULE_SNAPSHOT_H_ |
OLD | NEW |