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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "minidump/test/minidump_writable_test_util.h" | 15 #include "minidump/test/minidump_writable_test_util.h" |
16 | 16 |
17 #include <string> | 17 #include <string> |
18 | 18 |
| 19 #include "base/basictypes.h" |
19 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
20 #include "gtest/gtest.h" | 21 #include "gtest/gtest.h" |
21 | 22 |
22 namespace crashpad { | 23 namespace crashpad { |
23 namespace test { | 24 namespace test { |
24 | 25 |
25 const void* MinidumpWritableAtRVAInternal(const std::string& file_contents, | 26 const void* MinidumpWritableAtRVAInternal(const std::string& file_contents, |
26 RVA rva) { | 27 RVA rva) { |
27 if (rva >= file_contents.size()) { | 28 if (rva >= file_contents.size()) { |
28 EXPECT_LT(rva, file_contents.size()); | 29 EXPECT_LT(rva, file_contents.size()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 const std::string& file_contents, | 69 const std::string& file_contents, |
69 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 70 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
70 const IMAGE_DEBUG_MISC* misc = | 71 const IMAGE_DEBUG_MISC* misc = |
71 TMinidumpWritableAtLocationDescriptor<IMAGE_DEBUG_MISC>(file_contents, | 72 TMinidumpWritableAtLocationDescriptor<IMAGE_DEBUG_MISC>(file_contents, |
72 location); | 73 location); |
73 if (!misc) { | 74 if (!misc) { |
74 return nullptr; | 75 return nullptr; |
75 } | 76 } |
76 | 77 |
77 if (misc->DataType != IMAGE_DEBUG_MISC_EXENAME) { | 78 if (misc->DataType != IMAGE_DEBUG_MISC_EXENAME) { |
78 EXPECT_EQ(static_cast<uint32_t>(IMAGE_DEBUG_MISC_EXENAME), misc->DataType); | 79 EXPECT_EQ(implicit_cast<uint32_t>(IMAGE_DEBUG_MISC_EXENAME), |
| 80 misc->DataType); |
79 return nullptr; | 81 return nullptr; |
80 } | 82 } |
81 | 83 |
82 if (misc->Length != location.DataSize) { | 84 if (misc->Length != location.DataSize) { |
83 EXPECT_EQ(location.DataSize, misc->Length); | 85 EXPECT_EQ(location.DataSize, misc->Length); |
84 return nullptr; | 86 return nullptr; |
85 } | 87 } |
86 | 88 |
87 if (misc->Unicode == 0) { | 89 if (misc->Unicode == 0) { |
88 size_t string_length = misc->Length - offsetof(IMAGE_DEBUG_MISC, Data) - 1; | 90 size_t string_length = misc->Length - offsetof(IMAGE_DEBUG_MISC, Data) - 1; |
(...skipping 27 matching lines...) Expand all Loading... |
116 const std::string& file_contents, | 118 const std::string& file_contents, |
117 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 119 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
118 const MINIDUMP_HEADER* header = | 120 const MINIDUMP_HEADER* header = |
119 TMinidumpWritableAtLocationDescriptor<MINIDUMP_HEADER>(file_contents, | 121 TMinidumpWritableAtLocationDescriptor<MINIDUMP_HEADER>(file_contents, |
120 location); | 122 location); |
121 if (!header) { | 123 if (!header) { |
122 return nullptr; | 124 return nullptr; |
123 } | 125 } |
124 | 126 |
125 if (header->Signature != MINIDUMP_SIGNATURE) { | 127 if (header->Signature != MINIDUMP_SIGNATURE) { |
126 EXPECT_EQ(static_cast<uint32_t>(MINIDUMP_SIGNATURE), header->Signature); | 128 EXPECT_EQ(implicit_cast<uint32_t>(MINIDUMP_SIGNATURE), header->Signature); |
127 return nullptr; | 129 return nullptr; |
128 } | 130 } |
129 if (header->Version != MINIDUMP_VERSION) { | 131 if (header->Version != MINIDUMP_VERSION) { |
130 EXPECT_EQ(static_cast<uint32_t>(MINIDUMP_VERSION), header->Version); | 132 EXPECT_EQ(implicit_cast<uint32_t>(MINIDUMP_VERSION), header->Version); |
131 return nullptr; | 133 return nullptr; |
132 } | 134 } |
133 | 135 |
134 return header; | 136 return header; |
135 } | 137 } |
136 | 138 |
137 namespace { | 139 namespace { |
138 | 140 |
139 struct MinidumpMemoryListTraits { | 141 struct MinidumpMemoryListTraits { |
140 using ListType = MINIDUMP_MEMORY_LIST; | 142 using ListType = MINIDUMP_MEMORY_LIST; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const MinidumpModuleCodeViewRecordPDB70* | 285 const MinidumpModuleCodeViewRecordPDB70* |
284 MinidumpWritableAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB70>( | 286 MinidumpWritableAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB70>( |
285 const std::string& file_contents, | 287 const std::string& file_contents, |
286 const MINIDUMP_LOCATION_DESCRIPTOR& location) { | 288 const MINIDUMP_LOCATION_DESCRIPTOR& location) { |
287 return MinidumpCVPDBAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB70>( | 289 return MinidumpCVPDBAtLocationDescriptor<MinidumpModuleCodeViewRecordPDB70>( |
288 file_contents, location); | 290 file_contents, location); |
289 } | 291 } |
290 | 292 |
291 } // namespace test | 293 } // namespace test |
292 } // namespace crashpad | 294 } // namespace crashpad |
OLD | NEW |