Electroneum
Loading...
Searching...
No Matches
testing::internal::FunctionMockerBase< F > Class Template Reference

#include <gmock-spec-builders.h>

Inheritance diagram for testing::internal::FunctionMockerBase< F >:
Collaboration diagram for testing::internal::FunctionMockerBase< F >:

Public Types

typedef Function< F >::Result Result
typedef Function< F >::ArgumentTuple ArgumentTuple
typedef Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple

Public Member Functions

 FunctionMockerBase ()
virtual ~FunctionMockerBase () GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
const OnCallSpec< F > * FindOnCallSpec (const ArgumentTuple &args) const
Result PerformDefaultAction (const ArgumentTuple &args, const string &call_description) const
virtual UntypedActionResultHolderBaseUntypedPerformDefaultAction (const void *untyped_args, const string &call_description) const
virtual UntypedActionResultHolderBaseUntypedPerformAction (const void *untyped_action, const void *untyped_args) const
virtual void ClearDefaultActionsLocked () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Public Member Functions inherited from testing::internal::UntypedFunctionMockerBase
 UntypedFunctionMockerBase ()
virtual ~UntypedFunctionMockerBase ()
bool VerifyAndClearExpectationsLocked () GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
void RegisterOwner (const void *mock_obj) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
void SetOwnerAndName (const void *mock_obj, const char *name) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
const void * MockObject () const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
const char * Name () const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
UntypedActionResultHolderBaseUntypedInvokeWith (const void *untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)

Protected Types

typedef ActionResultHolder< ResultResultHolder
Protected Types inherited from testing::internal::UntypedFunctionMockerBase
typedef std::vector< const void * > UntypedOnCallSpecs
typedef std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations

Protected Member Functions

Result InvokeWith (const ArgumentTuple &args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
OnCallSpec< F > & AddNewOnCallSpec (const char *file, int line, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
TypedExpectation< F > & AddNewExpectation (const char *file, int line, const string &source_text, const ArgumentMatcherTuple &m) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
MockSpec< F > & current_spec ()
Protected Member Functions inherited from testing::internal::UntypedFunctionMockerBase
Expectation GetHandleOf (ExpectationBase *exp)

Friends

template<typename Function>
class MockSpec
template<typename Func>
class TypedExpectation

Additional Inherited Members

Protected Attributes inherited from testing::internal::UntypedFunctionMockerBase
const void * mock_obj_
const char * name_
UntypedOnCallSpecs untyped_on_call_specs_
UntypedExpectations untyped_expectations_

Detailed Description

template<typename F>
class testing::internal::FunctionMockerBase< F >

Definition at line 1456 of file gmock-spec-builders.h.

Member Typedef Documentation

◆ ArgumentMatcherTuple

template<typename F>
typedef Function<F>::ArgumentMatcherTuple testing::internal::FunctionMockerBase< F >::ArgumentMatcherTuple

Definition at line 1460 of file gmock-spec-builders.h.

◆ ArgumentTuple

template<typename F>
typedef Function<F>::ArgumentTuple testing::internal::FunctionMockerBase< F >::ArgumentTuple

Definition at line 1459 of file gmock-spec-builders.h.

◆ Result

template<typename F>
typedef Function<F>::Result testing::internal::FunctionMockerBase< F >::Result

Definition at line 1458 of file gmock-spec-builders.h.

◆ ResultHolder

template<typename F>
typedef ActionResultHolder<Result> testing::internal::FunctionMockerBase< F >::ResultHolder
protected

Definition at line 1577 of file gmock-spec-builders.h.

Constructor & Destructor Documentation

◆ FunctionMockerBase()

template<typename F>
testing::internal::FunctionMockerBase< F >::FunctionMockerBase ( )
inline

Definition at line 1462 of file gmock-spec-builders.h.

1462: current_spec_(this) {}

◆ ~FunctionMockerBase()

template<typename F>
virtual testing::internal::FunctionMockerBase< F >::~FunctionMockerBase ( )
inlinevirtual

Definition at line 1467 of file gmock-spec-builders.h.

1468 {
1473 }
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool VerifyAndClearExpectationsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Here is the call graph for this function:

Member Function Documentation

◆ AddNewExpectation()

template<typename F>
TypedExpectation< F > & testing::internal::FunctionMockerBase< F >::AddNewExpectation ( const char * file,
int line,
const string & source_text,
const ArgumentMatcherTuple & m )
inlineprotected

Definition at line 1601 of file gmock-spec-builders.h.

1606 {
1612
1613 // Adds this expectation into the implicit sequence if there is one.
1615 if (implicit_sequence != NULL) {
1617 }
1618
1619 return *expectation;
1620 }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Here is the call graph for this function:

◆ AddNewOnCallSpec()

template<typename F>
OnCallSpec< F > & testing::internal::FunctionMockerBase< F >::AddNewOnCallSpec ( const char * file,
int line,
const ArgumentMatcherTuple & m )
inlineprotected

Definition at line 1590 of file gmock-spec-builders.h.

Here is the call graph for this function:

◆ ClearDefaultActionsLocked()

template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::ClearDefaultActionsLocked ( )
inlinevirtual

Implements testing::internal::UntypedFunctionMockerBase.

Definition at line 1547 of file gmock-spec-builders.h.

1548 {
1549 g_gmock_mutex.AssertHeld();
1550
1551 // Deleting our default actions may trigger other mock objects to be
1552 // deleted, for example if an action contains a reference counted smart
1553 // pointer to that mock object, and that is the last reference. So if we
1554 // delete our actions within the context of the global mutex we may deadlock
1555 // when this method is called again. Instead, make a copy of the set of
1556 // actions to delete, clear our set within the mutex, and then delete the
1557 // actions outside of the mutex.
1560
1561 g_gmock_mutex.Unlock();
1562 for (UntypedOnCallSpecs::const_iterator it =
1563 specs_to_delete.begin();
1564 it != specs_to_delete.end(); ++it) {
1565 delete static_cast<const OnCallSpec<F>*>(*it);
1566 }
1567
1568 // Lock the mutex again, since the caller expects it to be locked when we
1569 // return.
1570 g_gmock_mutex.Lock();
1571 }
Here is the caller graph for this function:

◆ current_spec()

template<typename F>
MockSpec< F > & testing::internal::FunctionMockerBase< F >::current_spec ( )
inlineprotected

Definition at line 1624 of file gmock-spec-builders.h.

1624{ return current_spec_; }
Here is the call graph for this function:

◆ FindOnCallSpec()

template<typename F>
const OnCallSpec< F > * testing::internal::FunctionMockerBase< F >::FindOnCallSpec ( const ArgumentTuple & args) const
inline

Definition at line 1478 of file gmock-spec-builders.h.

1479 {
1480 for (UntypedOnCallSpecs::const_reverse_iterator it
1481 = untyped_on_call_specs_.rbegin();
1482 it != untyped_on_call_specs_.rend(); ++it) {
1483 const OnCallSpec<F>* spec = static_cast<const OnCallSpec<F>*>(*it);
1484 if (spec->Matches(args))
1485 return spec;
1486 }
1487
1488 return NULL;
1489 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InvokeWith()

template<typename F>
Result testing::internal::FunctionMockerBase< F >::InvokeWith ( const ArgumentTuple & args)
inlineprotected

Definition at line 1582 of file gmock-spec-builders.h.

1583 {
1586 return holder->Unwrap();
1587 }
UntypedActionResultHolderBase * UntypedInvokeWith(const void *untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
Here is the call graph for this function:

◆ PerformDefaultAction()

template<typename F>
Result testing::internal::FunctionMockerBase< F >::PerformDefaultAction ( const ArgumentTuple & args,
const string & call_description ) const
inline

Definition at line 1498 of file gmock-spec-builders.h.

1499 {
1500 const OnCallSpec<F>* const spec =
1501 this->FindOnCallSpec(args);
1502 if (spec != NULL) {
1503 return spec->GetAction().Perform(args);
1504 }
1505 const string message = call_description +
1506 "\n The mock function has no default action "
1507 "set, and its return type has no default value set.";
1508#if GTEST_HAS_EXCEPTIONS
1511 }
1512#else
1514#endif
1516 }
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
void Assert(bool condition, const char *file, int line)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UntypedPerformAction()

template<typename F>
virtual UntypedActionResultHolderBase * testing::internal::FunctionMockerBase< F >::UntypedPerformAction ( const void * untyped_action,
const void * untyped_args ) const
inlinevirtual

Implements testing::internal::UntypedFunctionMockerBase.

Definition at line 1535 of file gmock-spec-builders.h.

1536 {
1537 // Make a copy of the action before performing it, in case the
1538 // action deletes the mock object (and thus deletes itself).
1539 const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
1540 const ArgumentTuple& args =
1541 *static_cast<const ArgumentTuple*>(untyped_args);
1543 }
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Function< F >::ArgumentTuple ArgumentTuple
Here is the call graph for this function:

◆ UntypedPerformDefaultAction()

template<typename F>
virtual UntypedActionResultHolderBase * testing::internal::FunctionMockerBase< F >::UntypedPerformDefaultAction ( const void * untyped_args,
const string & call_description ) const
inlinevirtual

Implements testing::internal::UntypedFunctionMockerBase.

Definition at line 1523 of file gmock-spec-builders.h.

1525 {
1526 const ArgumentTuple& args =
1527 *static_cast<const ArgumentTuple*>(untyped_args);
1529 }
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
Here is the call graph for this function:

◆ MockSpec

template<typename F>
template<typename Function>
friend class MockSpec
friend

Definition at line 1575 of file gmock-spec-builders.h.

◆ TypedExpectation

template<typename F>
template<typename Func>
friend class TypedExpectation
friend

Definition at line 1627 of file gmock-spec-builders.h.


The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-spec-builders.h