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

Side by Side Diff: minidump/minidump_exception_writer_test.cc

Issue 686353004: Add MinidumpContextWriter::CreateFromSnapshot(), everything downstream, and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 1 month 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_context_writer_test.cc ('k') | minidump/minidump_thread_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,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {}; 113 MINIDUMP_EXCEPTION_STREAM expected_exception_stream = {};
114 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86); 114 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86);
115 115
116 const MinidumpContextX86* observed_context; 116 const MinidumpContextX86* observed_context;
117 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream, 117 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream,
118 observed_exception_stream, 118 observed_exception_stream,
119 file_writer.string(), 119 file_writer.string(),
120 &observed_context)); 120 &observed_context));
121 121
122 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context)); 122 ASSERT_NO_FATAL_FAILURE(
123 ExpectMinidumpContextX86(kSeed, observed_context, false));
123 } 124 }
124 125
125 TEST(MinidumpExceptionWriter, Standard) { 126 TEST(MinidumpExceptionWriter, Standard) {
126 MinidumpFileWriter minidump_file_writer; 127 MinidumpFileWriter minidump_file_writer;
127 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); 128 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
128 129
129 const uint32_t kSeed = 200; 130 const uint32_t kSeed = 200;
130 const uint32_t kThreadID = 1; 131 const uint32_t kThreadID = 1;
131 const uint32_t kExceptionCode = 2; 132 const uint32_t kExceptionCode = 2;
132 const uint32_t kExceptionFlags = 3; 133 const uint32_t kExceptionFlags = 3;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 exception_information[index]; 183 exception_information[index];
183 } 184 }
184 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86); 185 expected_exception_stream.ThreadContext.DataSize = sizeof(MinidumpContextX86);
185 186
186 const MinidumpContextX86* observed_context; 187 const MinidumpContextX86* observed_context;
187 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream, 188 ASSERT_NO_FATAL_FAILURE(ExpectExceptionStream(&expected_exception_stream,
188 observed_exception_stream, 189 observed_exception_stream,
189 file_writer.string(), 190 file_writer.string(),
190 &observed_context)); 191 &observed_context));
191 192
192 ASSERT_NO_FATAL_FAILURE(ExpectMinidumpContextX86(kSeed, observed_context)); 193 ASSERT_NO_FATAL_FAILURE(
194 ExpectMinidumpContextX86(kSeed, observed_context, false));
193 } 195 }
194 196
195 TEST(MinidumpExceptionWriterDeathTest, NoContext) { 197 TEST(MinidumpExceptionWriterDeathTest, NoContext) {
196 MinidumpFileWriter minidump_file_writer; 198 MinidumpFileWriter minidump_file_writer;
197 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); 199 auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
198 200
199 minidump_file_writer.AddStream(exception_writer.Pass()); 201 minidump_file_writer.AddStream(exception_writer.Pass());
200 202
201 StringFileWriter file_writer; 203 StringFileWriter file_writer;
202 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "context_"); 204 ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "context_");
203 } 205 }
204 206
205 TEST(MinidumpExceptionWriterDeathTest, TooMuchInformation) { 207 TEST(MinidumpExceptionWriterDeathTest, TooMuchInformation) {
206 MinidumpExceptionWriter exception_writer; 208 MinidumpExceptionWriter exception_writer;
207 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1, 209 std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS + 1,
208 0x5a5a5a5a5a5a5a5a); 210 0x5a5a5a5a5a5a5a5a);
209 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information), 211 ASSERT_DEATH(exception_writer.SetExceptionInformation(exception_information),
210 "kMaxParameters"); 212 "kMaxParameters");
211 } 213 }
212 214
213 } // namespace 215 } // namespace
214 } // namespace test 216 } // namespace test
215 } // namespace crashpad 217 } // namespace crashpad
OLDNEW
« no previous file with comments | « minidump/minidump_context_writer_test.cc ('k') | minidump/minidump_thread_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698