crashpad/minidump/minidump_context_test_util.h
Mark Mentovai e74a272ab5 Add MinidumpContextWriter test.
TEST=minidump_test MinidumpContextWriter.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/628153004
2014-10-07 17:27:11 -04:00

62 lines
2.4 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright 2014 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_TEST_UTIL_H_
#define CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_TEST_UTIL_H_
#include <stdint.h>
#include "minidump/minidump_context.h"
namespace crashpad {
namespace test {
//! \brief Initializes a context structure for testing.
//!
//! \param[out] context The structure to initialize.
//! \param[in] seed The seed value. Initializing two context structures of the
//! same type with identical seed values should produce identical context
//! structures. Initialization with a different seed value should produce
//! a different context structure. If \a seed is `0`, \a context is zeroed
//! out entirely except for the flags field, which will identify the context
//! type. If \a seed is nonzero \a context will be populated entirely with
//! nonzero values.
//!
//! \{
void InitializeMinidumpContextX86(MinidumpContextX86* context, uint32_t seed);
void InitializeMinidumpContextAMD64(MinidumpContextAMD64* context,
uint32_t seed);
//! \}
//! \brief Verifies, via gtest assertions, that a context structure contains
//! expected values.
//!
//! \param[in] expect_seed The seed value used to initialize a context
//! structure. This is the seed value used with
//! InitializeMinidumpContext*().
//! \param[in] observed The context structure to check. All fields of this
//! structure will be compared against the expected context structure, one
//! initialized with \a expect_seed.
//! \{
void ExpectMinidumpContextX86(uint32_t expect_seed,
const MinidumpContextX86* observed);
void ExpectMinidumpContextAMD64(uint32_t expect_seed,
const MinidumpContextAMD64* observed);
//! \}
} // namespace test
} // namespace crashpad
#endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_TEST_UTIL_H_