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

Side by Side Diff: minidump/test/minidump_context_test_util.h

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_thread_writer_test.cc ('k') | minidump/test/minidump_context_test_util.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 #ifndef CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_ 15 #ifndef CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_
16 #define CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_ 16 #define CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_
17 17
18 #include <stdint.h> 18 #include <stdint.h>
19 19
20 #include "minidump/minidump_context.h" 20 #include "minidump/minidump_context.h"
21 21
22 namespace crashpad { 22 namespace crashpad {
23 namespace test { 23 namespace test {
24 24
25 //! \brief Initializes a context structure for testing. 25 //! \brief Initializes a context structure for testing.
26 //! 26 //!
27 //! Initialization is compatible with the initialization used by CPUContext test
28 //! initialization functions such as InitializeCPUContextX86() and
29 //! InitializeCPUContextX86_64() for identical \a seed values.
30 //!
27 //! \param[out] context The structure to initialize. 31 //! \param[out] context The structure to initialize.
28 //! \param[in] seed The seed value. Initializing two context structures of the 32 //! \param[in] seed The seed value. Initializing two context structures of the
29 //! same type with identical seed values should produce identical context 33 //! same type with identical seed values should produce identical context
30 //! structures. Initialization with a different seed value should produce 34 //! structures. Initialization with a different seed value should produce
31 //! a different context structure. If \a seed is `0`, \a context is zeroed 35 //! a different context structure. If \a seed is `0`, \a context is zeroed
32 //! out entirely except for the flags field, which will identify the context 36 //! out entirely except for the flags field, which will identify the context
33 //! type. If \a seed is nonzero \a context will be populated entirely with 37 //! type. If \a seed is nonzero, \a context will be populated entirely with
34 //! nonzero values. 38 //! nonzero values.
35 //! 39 //!
36 //! \{ 40 //! \{
37 void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed); 41 void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed);
38 void InitializeMinidumpContextAMD64(MinidumpContextAMD64* context, 42 void InitializeMinidumpContextAMD64(MinidumpContextAMD64* context,
39 uint32_t seed); 43 uint32_t seed);
40 //! \} 44 //! \}
41 45
42 //! \brief Verifies, via gtest assertions, that a context structure contains 46 //! \brief Verifies, via gtest assertions, that a context structure contains
43 //! expected values. 47 //! expected values.
44 //! 48 //!
45 //! \param[in] expect_seed The seed value used to initialize a context 49 //! \param[in] expect_seed The seed value used to initialize a context
46 //! structure. This is the seed value used with 50 //! structure. This is the seed value used with
47 //! InitializeMinidumpContext*(). 51 //! InitializeMinidumpContext*().
48 //! \param[in] observed The context structure to check. All fields of this 52 //! \param[in] observed The context structure to check. All fields of this
49 //! structure will be compared against the expected context structure, one 53 //! structure will be compared against the expected context structure, one
50 //! initialized with \a expect_seed. 54 //! initialized with \a expect_seed.
55 //! \param[in] snapshot If `true`, compare \a observed to a context structure
56 //! expected to be produced from a CPUContext snapshot. If `false`, compare
57 //! \a observed to a native minidump context structure. CPUContext snapshot
58 //! structures may carry different sets of data than native minidump context
59 //! structures in meaningless ways. When `true`, fields not found in
60 //! CPUContext structures are expected to be `0`. When `false`, all fields
61 //! are compared. This makes it possible to test both that these fields are
62 //! passed through correctly by the native minidump writer and are zeroed
63 //! out when creating a minidump context structure from a CPUContext
64 //! structure.
51 //! \{ 65 //! \{
52 void ExpectMinidumpContextX86(uint32_t expect_seed, 66 void ExpectMinidumpContextX86(
53 const MinidumpContextX86* observed); 67 uint32_t expect_seed, const MinidumpContextX86* observed, bool snapshot);
54 void ExpectMinidumpContextAMD64(uint32_t expect_seed, 68 void ExpectMinidumpContextAMD64(
55 const MinidumpContextAMD64* observed); 69 uint32_t expect_seed, const MinidumpContextAMD64* observed, bool snapshot);
56 //! \} 70 //! \}
57 71
58 } // namespace test 72 } // namespace test
59 } // namespace crashpad 73 } // namespace crashpad
60 74
61 #endif // CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_ 75 #endif // CRASHPAD_MINIDUMP_TEST_MINIDUMP_CONTEXT_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « minidump/minidump_thread_writer_test.cc ('k') | minidump/test/minidump_context_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698