Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: minidump/minidump_file_writer_test.cc

Issue 1513573005: Provide std::move() in compat instead of using crashpad::move() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « minidump/minidump_file_writer.cc ('k') | minidump/minidump_handle_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/minidump_file_writer.h" 15 #include "minidump/minidump_file_writer.h"
16 16
17 #include <windows.h> 17 #include <windows.h>
18 #include <dbghelp.h> 18 #include <dbghelp.h>
19 19
20 #include <string> 20 #include <string>
21 #include <utility>
21 22
22 #include "base/basictypes.h" 23 #include "base/basictypes.h"
23 #include "base/compiler_specific.h" 24 #include "base/compiler_specific.h"
24 #include "gtest/gtest.h" 25 #include "gtest/gtest.h"
25 #include "minidump/minidump_stream_writer.h" 26 #include "minidump/minidump_stream_writer.h"
26 #include "minidump/minidump_writable.h" 27 #include "minidump/minidump_writable.h"
27 #include "minidump/test/minidump_file_writer_test_util.h" 28 #include "minidump/test/minidump_file_writer_test_util.h"
28 #include "minidump/test/minidump_writable_test_util.h" 29 #include "minidump/test/minidump_writable_test_util.h"
29 #include "snapshot/test/test_cpu_context.h" 30 #include "snapshot/test/test_cpu_context.h"
30 #include "snapshot/test/test_exception_snapshot.h" 31 #include "snapshot/test/test_exception_snapshot.h"
31 #include "snapshot/test/test_memory_snapshot.h" 32 #include "snapshot/test/test_memory_snapshot.h"
32 #include "snapshot/test/test_module_snapshot.h" 33 #include "snapshot/test/test_module_snapshot.h"
33 #include "snapshot/test/test_process_snapshot.h" 34 #include "snapshot/test/test_process_snapshot.h"
34 #include "snapshot/test/test_system_snapshot.h" 35 #include "snapshot/test/test_system_snapshot.h"
35 #include "snapshot/test/test_thread_snapshot.h" 36 #include "snapshot/test/test_thread_snapshot.h"
36 #include "test/gtest_death_check.h" 37 #include "test/gtest_death_check.h"
37 #include "util/file/string_file.h" 38 #include "util/file/string_file.h"
38 #include "util/stdlib/move.h"
39 39
40 namespace crashpad { 40 namespace crashpad {
41 namespace test { 41 namespace test {
42 namespace { 42 namespace {
43 43
44 TEST(MinidumpFileWriter, Empty) { 44 TEST(MinidumpFileWriter, Empty) {
45 MinidumpFileWriter minidump_file; 45 MinidumpFileWriter minidump_file;
46 StringFile string_file; 46 StringFile string_file;
47 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); 47 ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
48 ASSERT_EQ(sizeof(MINIDUMP_HEADER), string_file.string().size()); 48 ASSERT_EQ(sizeof(MINIDUMP_HEADER), string_file.string().size());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 TEST(MinidumpFileWriter, OneStream) { 90 TEST(MinidumpFileWriter, OneStream) {
91 MinidumpFileWriter minidump_file; 91 MinidumpFileWriter minidump_file;
92 const time_t kTimestamp = 0x155d2fb8; 92 const time_t kTimestamp = 0x155d2fb8;
93 minidump_file.SetTimestamp(kTimestamp); 93 minidump_file.SetTimestamp(kTimestamp);
94 94
95 const size_t kStreamSize = 5; 95 const size_t kStreamSize = 5;
96 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); 96 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
97 const uint8_t kStreamValue = 0x5a; 97 const uint8_t kStreamValue = 0x5a;
98 auto stream = 98 auto stream =
99 make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue)); 99 make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue));
100 minidump_file.AddStream(crashpad::move(stream)); 100 minidump_file.AddStream(std::move(stream));
101 101
102 StringFile string_file; 102 StringFile string_file;
103 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); 103 ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
104 104
105 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); 105 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
106 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); 106 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
107 const size_t kFileSize = kStreamOffset + kStreamSize; 107 const size_t kFileSize = kStreamOffset + kStreamSize;
108 108
109 ASSERT_EQ(kFileSize, string_file.string().size()); 109 ASSERT_EQ(kFileSize, string_file.string().size());
110 110
(...skipping 18 matching lines...) Expand all
129 TEST(MinidumpFileWriter, ThreeStreams) { 129 TEST(MinidumpFileWriter, ThreeStreams) {
130 MinidumpFileWriter minidump_file; 130 MinidumpFileWriter minidump_file;
131 const time_t kTimestamp = 0x155d2fb8; 131 const time_t kTimestamp = 0x155d2fb8;
132 minidump_file.SetTimestamp(kTimestamp); 132 minidump_file.SetTimestamp(kTimestamp);
133 133
134 const size_t kStream0Size = 5; 134 const size_t kStream0Size = 5;
135 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d); 135 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d);
136 const uint8_t kStream0Value = 0x5a; 136 const uint8_t kStream0Value = 0x5a;
137 auto stream0 = make_scoped_ptr( 137 auto stream0 = make_scoped_ptr(
138 new TestStream(kStream0Type, kStream0Size, kStream0Value)); 138 new TestStream(kStream0Type, kStream0Size, kStream0Value));
139 minidump_file.AddStream(crashpad::move(stream0)); 139 minidump_file.AddStream(std::move(stream0));
140 140
141 // Make the second stream’s type be a smaller quantity than the first stream’s 141 // Make the second stream’s type be a smaller quantity than the first stream’s
142 // to test that the streams show up in the order that they were added, not in 142 // to test that the streams show up in the order that they were added, not in
143 // numeric order. 143 // numeric order.
144 const size_t kStream1Size = 3; 144 const size_t kStream1Size = 3;
145 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); 145 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
146 const uint8_t kStream1Value = 0xa5; 146 const uint8_t kStream1Value = 0xa5;
147 auto stream1 = make_scoped_ptr( 147 auto stream1 = make_scoped_ptr(
148 new TestStream(kStream1Type, kStream1Size, kStream1Value)); 148 new TestStream(kStream1Type, kStream1Size, kStream1Value));
149 minidump_file.AddStream(crashpad::move(stream1)); 149 minidump_file.AddStream(std::move(stream1));
150 150
151 const size_t kStream2Size = 1; 151 const size_t kStream2Size = 1;
152 const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e); 152 const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e);
153 const uint8_t kStream2Value = 0x36; 153 const uint8_t kStream2Value = 0x36;
154 auto stream2 = make_scoped_ptr( 154 auto stream2 = make_scoped_ptr(
155 new TestStream(kStream2Type, kStream2Size, kStream2Value)); 155 new TestStream(kStream2Type, kStream2Size, kStream2Value));
156 minidump_file.AddStream(crashpad::move(stream2)); 156 minidump_file.AddStream(std::move(stream2));
157 157
158 StringFile string_file; 158 StringFile string_file;
159 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); 159 ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
160 160
161 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); 161 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
162 const size_t kStream0Offset = 162 const size_t kStream0Offset =
163 kDirectoryOffset + 3 * sizeof(MINIDUMP_DIRECTORY); 163 kDirectoryOffset + 3 * sizeof(MINIDUMP_DIRECTORY);
164 const size_t kStream1Padding = 3; 164 const size_t kStream1Padding = 3;
165 const size_t kStream1Offset = kStream0Offset + kStream0Size + kStream1Padding; 165 const size_t kStream1Offset = kStream0Offset + kStream0Size + kStream1Padding;
166 const size_t kStream2Padding = 1; 166 const size_t kStream2Padding = 1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 std::string expected_stream2(kStream2Size, kStream2Value); 213 std::string expected_stream2(kStream2Size, kStream2Value);
214 EXPECT_EQ(0, memcmp(stream2_data, expected_stream2.c_str(), kStream2Size)); 214 EXPECT_EQ(0, memcmp(stream2_data, expected_stream2.c_str(), kStream2Size));
215 } 215 }
216 216
217 TEST(MinidumpFileWriter, ZeroLengthStream) { 217 TEST(MinidumpFileWriter, ZeroLengthStream) {
218 MinidumpFileWriter minidump_file; 218 MinidumpFileWriter minidump_file;
219 219
220 const size_t kStreamSize = 0; 220 const size_t kStreamSize = 0;
221 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d); 221 const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
222 auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0)); 222 auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0));
223 minidump_file.AddStream(crashpad::move(stream)); 223 minidump_file.AddStream(std::move(stream));
224 224
225 StringFile string_file; 225 StringFile string_file;
226 ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); 226 ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
227 227
228 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER); 228 const size_t kDirectoryOffset = sizeof(MINIDUMP_HEADER);
229 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY); 229 const size_t kStreamOffset = kDirectoryOffset + sizeof(MINIDUMP_DIRECTORY);
230 const size_t kFileSize = kStreamOffset + kStreamSize; 230 const size_t kFileSize = kStreamOffset + kStreamSize;
231 231
232 ASSERT_EQ(kFileSize, string_file.string().size()); 232 ASSERT_EQ(kFileSize, string_file.string().size());
233 233
(...skipping 11 matching lines...) Expand all
245 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { 245 TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
246 const uint32_t kSnapshotTime = 0x4976043c; 246 const uint32_t kSnapshotTime = 0x4976043c;
247 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; 247 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
248 248
249 TestProcessSnapshot process_snapshot; 249 TestProcessSnapshot process_snapshot;
250 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 250 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
251 251
252 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 252 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
253 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 253 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
254 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 254 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
255 process_snapshot.SetSystem(crashpad::move(system_snapshot)); 255 process_snapshot.SetSystem(std::move(system_snapshot));
256 256
257 auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot()); 257 auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
258 const uint64_t kPebAddress = 0x07f90000; 258 const uint64_t kPebAddress = 0x07f90000;
259 peb_snapshot->SetAddress(kPebAddress); 259 peb_snapshot->SetAddress(kPebAddress);
260 const size_t kPebSize = 0x280; 260 const size_t kPebSize = 0x280;
261 peb_snapshot->SetSize(kPebSize); 261 peb_snapshot->SetSize(kPebSize);
262 peb_snapshot->SetValue('p'); 262 peb_snapshot->SetValue('p');
263 process_snapshot.AddExtraMemory(crashpad::move(peb_snapshot)); 263 process_snapshot.AddExtraMemory(std::move(peb_snapshot));
264 264
265 MinidumpFileWriter minidump_file_writer; 265 MinidumpFileWriter minidump_file_writer;
266 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); 266 minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
267 267
268 StringFile string_file; 268 StringFile string_file;
269 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 269 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
270 270
271 const MINIDUMP_DIRECTORY* directory; 271 const MINIDUMP_DIRECTORY* directory;
272 const MINIDUMP_HEADER* header = 272 const MINIDUMP_HEADER* header =
273 MinidumpHeaderAtStart(string_file.string(), &directory); 273 MinidumpHeaderAtStart(string_file.string(), &directory);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value. 309 MSVC_SUPPRESS_WARNING(4309); // Truncation of constant value.
310 MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion. 310 MSVC_SUPPRESS_WARNING(4838); // Narrowing conversion.
311 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; 311 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
312 312
313 TestProcessSnapshot process_snapshot; 313 TestProcessSnapshot process_snapshot;
314 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 314 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
315 315
316 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 316 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
317 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 317 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
318 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 318 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
319 process_snapshot.SetSystem(crashpad::move(system_snapshot)); 319 process_snapshot.SetSystem(std::move(system_snapshot));
320 320
321 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); 321 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
322 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); 322 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
323 process_snapshot.AddThread(crashpad::move(thread_snapshot)); 323 process_snapshot.AddThread(std::move(thread_snapshot));
324 324
325 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); 325 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
326 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); 326 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
327 process_snapshot.SetException(crashpad::move(exception_snapshot)); 327 process_snapshot.SetException(std::move(exception_snapshot));
328 328
329 // The module does not have anything that needs to be represented in a 329 // The module does not have anything that needs to be represented in a
330 // MinidumpModuleCrashpadInfo structure, so no such structure is expected to 330 // MinidumpModuleCrashpadInfo structure, so no such structure is expected to
331 // be present, which will in turn suppress the addition of a 331 // be present, which will in turn suppress the addition of a
332 // MinidumpCrashpadInfo stream. 332 // MinidumpCrashpadInfo stream.
333 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); 333 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
334 process_snapshot.AddModule(crashpad::move(module_snapshot)); 334 process_snapshot.AddModule(std::move(module_snapshot));
335 335
336 MinidumpFileWriter minidump_file_writer; 336 MinidumpFileWriter minidump_file_writer;
337 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); 337 minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
338 338
339 StringFile string_file; 339 StringFile string_file;
340 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 340 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
341 341
342 const MINIDUMP_DIRECTORY* directory; 342 const MINIDUMP_DIRECTORY* directory;
343 const MINIDUMP_HEADER* header = 343 const MINIDUMP_HEADER* header =
344 MinidumpHeaderAtStart(string_file.string(), &directory); 344 MinidumpHeaderAtStart(string_file.string(), &directory);
(...skipping 28 matching lines...) Expand all
373 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) { 373 TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
374 const uint32_t kSnapshotTime = 0x15393bd3; 374 const uint32_t kSnapshotTime = 0x15393bd3;
375 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 }; 375 const timeval kSnapshotTimeval = { static_cast<time_t>(kSnapshotTime), 0 };
376 376
377 TestProcessSnapshot process_snapshot; 377 TestProcessSnapshot process_snapshot;
378 process_snapshot.SetSnapshotTime(kSnapshotTimeval); 378 process_snapshot.SetSnapshotTime(kSnapshotTimeval);
379 379
380 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); 380 auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
381 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); 381 system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
382 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); 382 system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
383 process_snapshot.SetSystem(crashpad::move(system_snapshot)); 383 process_snapshot.SetSystem(std::move(system_snapshot));
384 384
385 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); 385 auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
386 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); 386 InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
387 process_snapshot.AddThread(crashpad::move(thread_snapshot)); 387 process_snapshot.AddThread(std::move(thread_snapshot));
388 388
389 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); 389 auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
390 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); 390 InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
391 process_snapshot.SetException(crashpad::move(exception_snapshot)); 391 process_snapshot.SetException(std::move(exception_snapshot));
392 392
393 // The module needs an annotation for the MinidumpCrashpadInfo stream to be 393 // The module needs an annotation for the MinidumpCrashpadInfo stream to be
394 // considered useful and be included. 394 // considered useful and be included.
395 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); 395 auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
396 std::vector<std::string> annotations_list(1, std::string("annotation")); 396 std::vector<std::string> annotations_list(1, std::string("annotation"));
397 module_snapshot->SetAnnotationsVector(annotations_list); 397 module_snapshot->SetAnnotationsVector(annotations_list);
398 process_snapshot.AddModule(crashpad::move(module_snapshot)); 398 process_snapshot.AddModule(std::move(module_snapshot));
399 399
400 MinidumpFileWriter minidump_file_writer; 400 MinidumpFileWriter minidump_file_writer;
401 minidump_file_writer.InitializeFromSnapshot(&process_snapshot); 401 minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
402 402
403 StringFile string_file; 403 StringFile string_file;
404 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); 404 ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
405 405
406 const MINIDUMP_DIRECTORY* directory; 406 const MINIDUMP_DIRECTORY* directory;
407 const MINIDUMP_HEADER* header = 407 const MINIDUMP_HEADER* header =
408 MinidumpHeaderAtStart(string_file.string(), &directory); 408 MinidumpHeaderAtStart(string_file.string(), &directory);
(...skipping 30 matching lines...) Expand all
439 } 439 }
440 440
441 TEST(MinidumpFileWriterDeathTest, SameStreamType) { 441 TEST(MinidumpFileWriterDeathTest, SameStreamType) {
442 MinidumpFileWriter minidump_file; 442 MinidumpFileWriter minidump_file;
443 443
444 const size_t kStream0Size = 5; 444 const size_t kStream0Size = 5;
445 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d); 445 const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d);
446 const uint8_t kStream0Value = 0x5a; 446 const uint8_t kStream0Value = 0x5a;
447 auto stream0 = make_scoped_ptr( 447 auto stream0 = make_scoped_ptr(
448 new TestStream(kStream0Type, kStream0Size, kStream0Value)); 448 new TestStream(kStream0Type, kStream0Size, kStream0Value));
449 minidump_file.AddStream(crashpad::move(stream0)); 449 minidump_file.AddStream(std::move(stream0));
450 450
451 // It is an error to add a second stream of the same type. 451 // It is an error to add a second stream of the same type.
452 const size_t kStream1Size = 3; 452 const size_t kStream1Size = 3;
453 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d); 453 const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
454 const uint8_t kStream1Value = 0xa5; 454 const uint8_t kStream1Value = 0xa5;
455 auto stream1 = make_scoped_ptr( 455 auto stream1 = make_scoped_ptr(
456 new TestStream(kStream1Type, kStream1Size, kStream1Value)); 456 new TestStream(kStream1Type, kStream1Size, kStream1Value));
457 ASSERT_DEATH_CHECK(minidump_file.AddStream(crashpad::move(stream1)), 457 ASSERT_DEATH_CHECK(minidump_file.AddStream(std::move(stream1)),
458 "already present"); 458 "already present");
459 } 459 }
460 460
461 } // namespace 461 } // namespace
462 } // namespace test 462 } // namespace test
463 } // namespace crashpad 463 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_file_writer.cc ('k') | minidump/minidump_handle_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698