1e35fdd936d133bf8a48de140a3c666897588a05shiqian// Copyright 2007, Google Inc.
2e35fdd936d133bf8a48de140a3c666897588a05shiqian// All rights reserved.
3e35fdd936d133bf8a48de140a3c666897588a05shiqian//
4e35fdd936d133bf8a48de140a3c666897588a05shiqian// Redistribution and use in source and binary forms, with or without
5e35fdd936d133bf8a48de140a3c666897588a05shiqian// modification, are permitted provided that the following conditions are
6e35fdd936d133bf8a48de140a3c666897588a05shiqian// met:
7e35fdd936d133bf8a48de140a3c666897588a05shiqian//
8e35fdd936d133bf8a48de140a3c666897588a05shiqian//     * Redistributions of source code must retain the above copyright
9e35fdd936d133bf8a48de140a3c666897588a05shiqian// notice, this list of conditions and the following disclaimer.
10e35fdd936d133bf8a48de140a3c666897588a05shiqian//     * Redistributions in binary form must reproduce the above
11e35fdd936d133bf8a48de140a3c666897588a05shiqian// copyright notice, this list of conditions and the following disclaimer
12e35fdd936d133bf8a48de140a3c666897588a05shiqian// in the documentation and/or other materials provided with the
13e35fdd936d133bf8a48de140a3c666897588a05shiqian// distribution.
14e35fdd936d133bf8a48de140a3c666897588a05shiqian//     * Neither the name of Google Inc. nor the names of its
15e35fdd936d133bf8a48de140a3c666897588a05shiqian// contributors may be used to endorse or promote products derived from
16e35fdd936d133bf8a48de140a3c666897588a05shiqian// this software without specific prior written permission.
17e35fdd936d133bf8a48de140a3c666897588a05shiqian//
18e35fdd936d133bf8a48de140a3c666897588a05shiqian// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19e35fdd936d133bf8a48de140a3c666897588a05shiqian// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20e35fdd936d133bf8a48de140a3c666897588a05shiqian// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21e35fdd936d133bf8a48de140a3c666897588a05shiqian// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22e35fdd936d133bf8a48de140a3c666897588a05shiqian// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23e35fdd936d133bf8a48de140a3c666897588a05shiqian// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24e35fdd936d133bf8a48de140a3c666897588a05shiqian// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25e35fdd936d133bf8a48de140a3c666897588a05shiqian// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26e35fdd936d133bf8a48de140a3c666897588a05shiqian// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27e35fdd936d133bf8a48de140a3c666897588a05shiqian// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28e35fdd936d133bf8a48de140a3c666897588a05shiqian// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29e35fdd936d133bf8a48de140a3c666897588a05shiqian//
30e35fdd936d133bf8a48de140a3c666897588a05shiqian// Author: wan@google.com (Zhanyong Wan)
31e35fdd936d133bf8a48de140a3c666897588a05shiqian
32e35fdd936d133bf8a48de140a3c666897588a05shiqian// Google Mock - a framework for writing C++ mock classes.
33e35fdd936d133bf8a48de140a3c666897588a05shiqian//
34e35fdd936d133bf8a48de140a3c666897588a05shiqian// This is the main header file a user should include.
35e35fdd936d133bf8a48de140a3c666897588a05shiqian
36e35fdd936d133bf8a48de140a3c666897588a05shiqian#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
37e35fdd936d133bf8a48de140a3c666897588a05shiqian#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
38e35fdd936d133bf8a48de140a3c666897588a05shiqian
39e35fdd936d133bf8a48de140a3c666897588a05shiqian// This file implements the following syntax:
40e35fdd936d133bf8a48de140a3c666897588a05shiqian//
41e35fdd936d133bf8a48de140a3c666897588a05shiqian//   ON_CALL(mock_object.Method(...))
42bf55085d456e3ee55eb234c98c435e54d0a2d5aazhanyong.wan//     .With(...) ?
43e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .WillByDefault(...);
44e35fdd936d133bf8a48de140a3c666897588a05shiqian//
45bf55085d456e3ee55eb234c98c435e54d0a2d5aazhanyong.wan// where With() is optional and WillByDefault() must appear exactly
46bf55085d456e3ee55eb234c98c435e54d0a2d5aazhanyong.wan// once.
47e35fdd936d133bf8a48de140a3c666897588a05shiqian//
48e35fdd936d133bf8a48de140a3c666897588a05shiqian//   EXPECT_CALL(mock_object.Method(...))
49bf55085d456e3ee55eb234c98c435e54d0a2d5aazhanyong.wan//     .With(...) ?
50e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .Times(...) ?
51e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .InSequence(...) *
52e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .WillOnce(...) *
53e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .WillRepeatedly(...) ?
54e35fdd936d133bf8a48de140a3c666897588a05shiqian//     .RetiresOnSaturation() ? ;
55e35fdd936d133bf8a48de140a3c666897588a05shiqian//
56e35fdd936d133bf8a48de140a3c666897588a05shiqian// where all clauses are optional and WillOnce() can be repeated.
57e35fdd936d133bf8a48de140a3c666897588a05shiqian
5853e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-actions.h"
5953e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-cardinalities.h"
6053e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-generated-actions.h"
6153e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-generated-function-mockers.h"
6253e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-generated-nice-strict.h"
63320814aca02dfb6b5f116bc5de1785a478cc6d42zhanyong.wan#include "gmock/gmock-generated-matchers.h"
6453e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/gmock-matchers.h"
65320814aca02dfb6b5f116bc5de1785a478cc6d42zhanyong.wan#include "gmock/gmock-more-actions.h"
66320814aca02dfb6b5f116bc5de1785a478cc6d42zhanyong.wan#include "gmock/gmock-more-matchers.h"
6753e08c44dd34857ba57581d7c5774d6c96a8d0e1zhanyong.wan#include "gmock/internal/gmock-internal-utils.h"
68e35fdd936d133bf8a48de140a3c666897588a05shiqian
69e35fdd936d133bf8a48de140a3c666897588a05shiqiannamespace testing {
70e35fdd936d133bf8a48de140a3c666897588a05shiqian
71e35fdd936d133bf8a48de140a3c666897588a05shiqian// Declares Google Mock flags that we want a user to use programmatically.
72df35a763b9d98d7040a00fc1e5cffe91a80ba9e0zhanyong.wanGMOCK_DECLARE_bool_(catch_leaked_mocks);
73e0d051ea64dd5f32d5b6af9831747d1acb2a9c40zhanyong.wanGMOCK_DECLARE_string_(verbose);
74e35fdd936d133bf8a48de140a3c666897588a05shiqian
75e35fdd936d133bf8a48de140a3c666897588a05shiqian// Initializes Google Mock.  This must be called before running the
76e35fdd936d133bf8a48de140a3c666897588a05shiqian// tests.  In particular, it parses the command line for the flags
77e35fdd936d133bf8a48de140a3c666897588a05shiqian// that Google Mock recognizes.  Whenever a Google Mock flag is seen,
78e35fdd936d133bf8a48de140a3c666897588a05shiqian// it is removed from argv, and *argc is decremented.
79e35fdd936d133bf8a48de140a3c666897588a05shiqian//
80e35fdd936d133bf8a48de140a3c666897588a05shiqian// No value is returned.  Instead, the Google Mock flag variables are
81e35fdd936d133bf8a48de140a3c666897588a05shiqian// updated.
82e35fdd936d133bf8a48de140a3c666897588a05shiqian//
83e35fdd936d133bf8a48de140a3c666897588a05shiqian// Since Google Test is needed for Google Mock to work, this function
84e35fdd936d133bf8a48de140a3c666897588a05shiqian// also initializes Google Test and parses its flags, if that hasn't
85e35fdd936d133bf8a48de140a3c666897588a05shiqian// been done.
86587c1b37c2f0b6d430fb13ce09326db0135b557cvladlosevGTEST_API_ void InitGoogleMock(int* argc, char** argv);
87e35fdd936d133bf8a48de140a3c666897588a05shiqian
88e35fdd936d133bf8a48de140a3c666897588a05shiqian// This overloaded version can be used in Windows programs compiled in
89e35fdd936d133bf8a48de140a3c666897588a05shiqian// UNICODE mode.
90587c1b37c2f0b6d430fb13ce09326db0135b557cvladlosevGTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
91e35fdd936d133bf8a48de140a3c666897588a05shiqian
92e35fdd936d133bf8a48de140a3c666897588a05shiqian}  // namespace testing
93e35fdd936d133bf8a48de140a3c666897588a05shiqian
94e35fdd936d133bf8a48de140a3c666897588a05shiqian#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_H_
95