proxygen
testing::internal::FunctionMockerBase< F > Class Template Reference

#include <gmock-generated-function-mockers.h>

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

Public Types

typedef Function< F >::Result Result
 
typedef Function< F >::ArgumentTuple ArgumentTuple
 
typedef Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
 
typedef Function< F >::Result Result
 
typedef Function< F >::ArgumentTuple ArgumentTuple
 
typedef Function< F >::ArgumentMatcherTuple ArgumentMatcherTuple
 
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)
 
 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)
 
 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)
 
 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)
 
 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
 
typedef ActionResultHolder< ResultResultHolder
 
typedef ActionResultHolder< ResultResultHolder
 
- Protected Types inherited from testing::internal::UntypedFunctionMockerBase
typedef std::vector< const void * > UntypedOnCallSpecs
 
typedef std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations
 
typedef std::vector< const void * > UntypedOnCallSpecs
 
typedef std::vector< internal::linked_ptr< ExpectationBase > > UntypedExpectations
 
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 ()
 
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 ()
 
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)
 
Expectation GetHandleOf (ExpectationBase *exp)
 
Expectation GetHandleOf (ExpectationBase *exp)
 

Private Member Functions

void DescribeDefaultActionTo (const ArgumentTuple &args,::std::ostream *os) const
 
virtual void UntypedDescribeUninterestingCall (const void *untyped_args,::std::ostream *os) const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual const ExpectationBaseUntypedFindMatchingExpectation (const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual void UntypedPrintArgs (const void *untyped_args,::std::ostream *os) const
 
TypedExpectation< F > * FindMatchingExpectationLocked (const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FormatUnexpectedCallMessageLocked (const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void PrintTriedExpectationsLocked (const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (FunctionMockerBase)
 
void DescribeDefaultActionTo (const ArgumentTuple &args,::std::ostream *os) const
 
virtual void UntypedDescribeUninterestingCall (const void *untyped_args,::std::ostream *os) const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual const ExpectationBaseUntypedFindMatchingExpectation (const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual void UntypedPrintArgs (const void *untyped_args,::std::ostream *os) const
 
TypedExpectation< F > * FindMatchingExpectationLocked (const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FormatUnexpectedCallMessageLocked (const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void PrintTriedExpectationsLocked (const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (FunctionMockerBase)
 
void DescribeDefaultActionTo (const ArgumentTuple &args,::std::ostream *os) const
 
virtual void UntypedDescribeUninterestingCall (const void *untyped_args,::std::ostream *os) const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual const ExpectationBaseUntypedFindMatchingExpectation (const void *untyped_args, const void **untyped_action, bool *is_excessive,::std::ostream *what,::std::ostream *why) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
 
virtual void UntypedPrintArgs (const void *untyped_args,::std::ostream *os) const
 
TypedExpectation< F > * FindMatchingExpectationLocked (const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void FormatUnexpectedCallMessageLocked (const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
void PrintTriedExpectationsLocked (const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
 
 GTEST_DISALLOW_COPY_AND_ASSIGN_ (FunctionMockerBase)
 

Private Attributes

MockSpec< F > current_spec_
 

Friends

template<typename Function >
class MockSpec
 
template<typename Func >
class TypedExpectation
 
template<typename Function >
class MockSpec
 
template<typename Func >
class TypedExpectation
 
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 54 of file gmock-generated-function-mockers.h.

Member Typedef Documentation

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

1468  {
1469  MutexLock l(&g_gmock_mutex);
1471  Mock::UnregisterLocked(this);
1473  }
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool VerifyAndClearExpectationsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
template<typename F>
testing::internal::FunctionMockerBase< F >::FunctionMockerBase ( )
inline

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

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

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

1468  {
1469  MutexLock l(&g_gmock_mutex);
1471  Mock::UnregisterLocked(this);
1473  }
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool VerifyAndClearExpectationsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
template<typename F>
testing::internal::FunctionMockerBase< F >::FunctionMockerBase ( )
inline

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

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

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

1468  {
1469  MutexLock l(&g_gmock_mutex);
1471  Mock::UnregisterLocked(this);
1473  }
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
virtual void ClearDefaultActionsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
bool VerifyAndClearExpectationsLocked() GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)

Member Function Documentation

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  {
1607  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1608  TypedExpectation<F>* const expectation =
1609  new TypedExpectation<F>(this, file, line, source_text, m);
1610  const linked_ptr<ExpectationBase> untyped_expectation(expectation);
1611  untyped_expectations_.push_back(untyped_expectation);
1612 
1613  // Adds this expectation into the implicit sequence if there is one.
1614  Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
1615  if (implicit_sequence != NULL) {
1616  implicit_sequence->AddExpectation(Expectation(untyped_expectation));
1617  }
1618 
1619  return *expectation;
1620  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
static map< string, int > m
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  {
1607  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1608  TypedExpectation<F>* const expectation =
1609  new TypedExpectation<F>(this, file, line, source_text, m);
1610  const linked_ptr<ExpectationBase> untyped_expectation(expectation);
1611  untyped_expectations_.push_back(untyped_expectation);
1612 
1613  // Adds this expectation into the implicit sequence if there is one.
1614  Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
1615  if (implicit_sequence != NULL) {
1616  implicit_sequence->AddExpectation(Expectation(untyped_expectation));
1617  }
1618 
1619  return *expectation;
1620  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
static map< string, int > m
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  {
1607  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1608  TypedExpectation<F>* const expectation =
1609  new TypedExpectation<F>(this, file, line, source_text, m);
1610  const linked_ptr<ExpectationBase> untyped_expectation(expectation);
1611  untyped_expectations_.push_back(untyped_expectation);
1612 
1613  // Adds this expectation into the implicit sequence if there is one.
1614  Sequence* const implicit_sequence = g_gmock_implicit_sequence.get();
1615  if (implicit_sequence != NULL) {
1616  implicit_sequence->AddExpectation(Expectation(untyped_expectation));
1617  }
1618 
1619  return *expectation;
1620  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
GTEST_API_ ThreadLocal< Sequence * > g_gmock_implicit_sequence
static map< string, int > m
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.

1593  {
1594  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1595  OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
1596  untyped_on_call_specs_.push_back(on_call_spec);
1597  return *on_call_spec;
1598  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
static map< string, int > m
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.

1593  {
1594  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1595  OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
1596  untyped_on_call_specs_.push_back(on_call_spec);
1597  return *on_call_spec;
1598  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
static map< string, int > m
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.

1593  {
1594  Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line);
1595  OnCallSpec<F>* const on_call_spec = new OnCallSpec<F>(file, line, m);
1596  untyped_on_call_specs_.push_back(on_call_spec);
1597  return *on_call_spec;
1598  }
const void * MockObject() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
static map< string, int > m
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.
1558  UntypedOnCallSpecs specs_to_delete;
1559  untyped_on_call_specs_.swap(specs_to_delete);
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  }
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.
1558  UntypedOnCallSpecs specs_to_delete;
1559  untyped_on_call_specs_.swap(specs_to_delete);
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  }
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.
1558  UntypedOnCallSpecs specs_to_delete;
1559  untyped_on_call_specs_.swap(specs_to_delete);
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  }
template<typename F>
MockSpec<F>& testing::internal::FunctionMockerBase< F >::current_spec ( )
inlineprotected

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

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

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

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

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

template<typename F>
void testing::internal::FunctionMockerBase< F >::DescribeDefaultActionTo ( const ArgumentTuple args,
::std::ostream *  os 
) const
inlineprivate

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

1635  {
1636  const OnCallSpec<F>* const spec = FindOnCallSpec(args);
1637 
1638  if (spec == NULL) {
1640  "returning directly.\n" :
1641  "returning default value.\n");
1642  } else {
1643  *os << "taking default action specified at:\n"
1644  << FormatFileLocation(spec->file(), spec->line()) << "\n";
1645  }
1646  }
::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:880
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static const char *const value
Definition: Conv.cpp:50
template<typename F>
void testing::internal::FunctionMockerBase< F >::DescribeDefaultActionTo ( const ArgumentTuple args,
::std::ostream *  os 
) const
inlineprivate

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

1635  {
1636  const OnCallSpec<F>* const spec = FindOnCallSpec(args);
1637 
1638  if (spec == NULL) {
1640  "returning directly.\n" :
1641  "returning default value.\n");
1642  } else {
1643  *os << "taking default action specified at:\n"
1644  << FormatFileLocation(spec->file(), spec->line()) << "\n";
1645  }
1646  }
::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:880
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static const char *const value
Definition: Conv.cpp:50
template<typename F>
void testing::internal::FunctionMockerBase< F >::DescribeDefaultActionTo ( const ArgumentTuple args,
::std::ostream *  os 
) const
inlineprivate

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

1635  {
1636  const OnCallSpec<F>* const spec = FindOnCallSpec(args);
1637 
1638  if (spec == NULL) {
1640  "returning directly.\n" :
1641  "returning default value.\n");
1642  } else {
1643  *os << "taking default action specified at:\n"
1644  << FormatFileLocation(spec->file(), spec->line()) << "\n";
1645  }
1646  }
::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:880
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static const char *const value
Definition: Conv.cpp:50
template<typename F>
TypedExpectation<F>* testing::internal::FunctionMockerBase< F >::FindMatchingExpectationLocked ( const ArgumentTuple args) const
inlineprivate

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

1716  {
1717  g_gmock_mutex.AssertHeld();
1718  for (typename UntypedExpectations::const_reverse_iterator it =
1719  untyped_expectations_.rbegin();
1720  it != untyped_expectations_.rend(); ++it) {
1721  TypedExpectation<F>* const exp =
1722  static_cast<TypedExpectation<F>*>(it->get());
1723  if (exp->ShouldHandleArguments(args)) {
1724  return exp;
1725  }
1726  }
1727  return NULL;
1728  }
template<typename F>
TypedExpectation<F>* testing::internal::FunctionMockerBase< F >::FindMatchingExpectationLocked ( const ArgumentTuple args) const
inlineprivate

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

1716  {
1717  g_gmock_mutex.AssertHeld();
1718  for (typename UntypedExpectations::const_reverse_iterator it =
1719  untyped_expectations_.rbegin();
1720  it != untyped_expectations_.rend(); ++it) {
1721  TypedExpectation<F>* const exp =
1722  static_cast<TypedExpectation<F>*>(it->get());
1723  if (exp->ShouldHandleArguments(args)) {
1724  return exp;
1725  }
1726  }
1727  return NULL;
1728  }
template<typename F>
TypedExpectation<F>* testing::internal::FunctionMockerBase< F >::FindMatchingExpectationLocked ( const ArgumentTuple args) const
inlineprivate

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

1716  {
1717  g_gmock_mutex.AssertHeld();
1718  for (typename UntypedExpectations::const_reverse_iterator it =
1719  untyped_expectations_.rbegin();
1720  it != untyped_expectations_.rend(); ++it) {
1721  TypedExpectation<F>* const exp =
1722  static_cast<TypedExpectation<F>*>(it->get());
1723  if (exp->ShouldHandleArguments(args)) {
1724  return exp;
1725  }
1726  }
1727  return NULL;
1728  }
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  }
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  }
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  }
template<typename F>
void testing::internal::FunctionMockerBase< F >::FormatUnexpectedCallMessageLocked ( const ArgumentTuple args,
::std::ostream *  os,
::std::ostream *  why 
) const
inlineprivate

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

1735  {
1736  g_gmock_mutex.AssertHeld();
1737  *os << "\nUnexpected mock function call - ";
1738  DescribeDefaultActionTo(args, os);
1739  PrintTriedExpectationsLocked(args, why);
1740  }
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
void PrintTriedExpectationsLocked(const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
template<typename F>
void testing::internal::FunctionMockerBase< F >::FormatUnexpectedCallMessageLocked ( const ArgumentTuple args,
::std::ostream *  os,
::std::ostream *  why 
) const
inlineprivate

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

1735  {
1736  g_gmock_mutex.AssertHeld();
1737  *os << "\nUnexpected mock function call - ";
1738  DescribeDefaultActionTo(args, os);
1739  PrintTriedExpectationsLocked(args, why);
1740  }
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
void PrintTriedExpectationsLocked(const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
template<typename F>
void testing::internal::FunctionMockerBase< F >::FormatUnexpectedCallMessageLocked ( const ArgumentTuple args,
::std::ostream *  os,
::std::ostream *  why 
) const
inlineprivate

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

1735  {
1736  g_gmock_mutex.AssertHeld();
1737  *os << "\nUnexpected mock function call - ";
1738  DescribeDefaultActionTo(args, os);
1739  PrintTriedExpectationsLocked(args, why);
1740  }
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
void PrintTriedExpectationsLocked(const ArgumentTuple &args,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
template<typename F>
testing::internal::FunctionMockerBase< F >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( FunctionMockerBase< F >  )
private
template<typename F>
testing::internal::FunctionMockerBase< F >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( FunctionMockerBase< F >  )
private
template<typename F>
testing::internal::FunctionMockerBase< F >::GTEST_DISALLOW_COPY_AND_ASSIGN_ ( FunctionMockerBase< F >  )
private
template<typename F>
Result testing::internal::FunctionMockerBase< F >::InvokeWith ( const ArgumentTuple args)
inlineprotected

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

1583  {
1584  scoped_ptr<ResultHolder> holder(
1585  DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
1586  return holder->Unwrap();
1587  }
UntypedActionResultHolderBase * UntypedInvokeWith(const void *untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
template<typename F>
Result testing::internal::FunctionMockerBase< F >::InvokeWith ( const ArgumentTuple args)
inlineprotected

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

1583  {
1584  scoped_ptr<ResultHolder> holder(
1585  DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
1586  return holder->Unwrap();
1587  }
UntypedActionResultHolderBase * UntypedInvokeWith(const void *untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
template<typename F>
Result testing::internal::FunctionMockerBase< F >::InvokeWith ( const ArgumentTuple args)
inlineprotected

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

1583  {
1584  scoped_ptr<ResultHolder> holder(
1585  DownCast_<ResultHolder*>(this->UntypedInvokeWith(&args)));
1586  return holder->Unwrap();
1587  }
UntypedActionResultHolderBase * UntypedInvokeWith(const void *untyped_args) GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
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
1510  throw std::runtime_error(message);
1511  }
1512 #else
1513  Assert(DefaultValue<Result>::Exists(), "", -1, message);
1514 #endif
1515  return DefaultValue<Result>::Get();
1516  }
Definition: test.c:42
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static bool Exists()
void Assert(bool condition, const char *file, int line)
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
1510  throw std::runtime_error(message);
1511  }
1512 #else
1513  Assert(DefaultValue<Result>::Exists(), "", -1, message);
1514 #endif
1515  return DefaultValue<Result>::Get();
1516  }
Definition: test.c:42
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static bool Exists()
void Assert(bool condition, const char *file, int line)
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.

Referenced by testing::internal::ActionResultHolder< T >::PerformDefaultAction(), and testing::internal::ActionResultHolder< void >::PerformDefaultAction().

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
1510  throw std::runtime_error(message);
1511  }
1512 #else
1513  Assert(DefaultValue<Result>::Exists(), "", -1, message);
1514 #endif
1515  return DefaultValue<Result>::Get();
1516  }
Definition: test.c:42
const OnCallSpec< F > * FindOnCallSpec(const ArgumentTuple &args) const
static bool Exists()
void Assert(bool condition, const char *file, int line)
template<typename F>
void testing::internal::FunctionMockerBase< F >::PrintTriedExpectationsLocked ( const ArgumentTuple args,
::std::ostream *  why 
) const
inlineprivate

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

1747  {
1748  g_gmock_mutex.AssertHeld();
1749  const int count = static_cast<int>(untyped_expectations_.size());
1750  *why << "Google Mock tried the following " << count << " "
1751  << (count == 1 ? "expectation, but it didn't match" :
1752  "expectations, but none matched")
1753  << ":\n";
1754  for (int i = 0; i < count; i++) {
1755  TypedExpectation<F>* const expectation =
1756  static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
1757  *why << "\n";
1758  expectation->DescribeLocationTo(why);
1759  if (count > 1) {
1760  *why << "tried expectation #" << i << ": ";
1761  }
1762  *why << expectation->source_text() << "...\n";
1763  expectation->ExplainMatchResultTo(args, why);
1764  expectation->DescribeCallCountTo(why);
1765  }
1766  }
int * count
template<typename F>
void testing::internal::FunctionMockerBase< F >::PrintTriedExpectationsLocked ( const ArgumentTuple args,
::std::ostream *  why 
) const
inlineprivate

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

1747  {
1748  g_gmock_mutex.AssertHeld();
1749  const int count = static_cast<int>(untyped_expectations_.size());
1750  *why << "Google Mock tried the following " << count << " "
1751  << (count == 1 ? "expectation, but it didn't match" :
1752  "expectations, but none matched")
1753  << ":\n";
1754  for (int i = 0; i < count; i++) {
1755  TypedExpectation<F>* const expectation =
1756  static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
1757  *why << "\n";
1758  expectation->DescribeLocationTo(why);
1759  if (count > 1) {
1760  *why << "tried expectation #" << i << ": ";
1761  }
1762  *why << expectation->source_text() << "...\n";
1763  expectation->ExplainMatchResultTo(args, why);
1764  expectation->DescribeCallCountTo(why);
1765  }
1766  }
int * count
template<typename F>
void testing::internal::FunctionMockerBase< F >::PrintTriedExpectationsLocked ( const ArgumentTuple args,
::std::ostream *  why 
) const
inlineprivate

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

1747  {
1748  g_gmock_mutex.AssertHeld();
1749  const int count = static_cast<int>(untyped_expectations_.size());
1750  *why << "Google Mock tried the following " << count << " "
1751  << (count == 1 ? "expectation, but it didn't match" :
1752  "expectations, but none matched")
1753  << ":\n";
1754  for (int i = 0; i < count; i++) {
1755  TypedExpectation<F>* const expectation =
1756  static_cast<TypedExpectation<F>*>(untyped_expectations_[i].get());
1757  *why << "\n";
1758  expectation->DescribeLocationTo(why);
1759  if (count > 1) {
1760  *why << "tried expectation #" << i << ": ";
1761  }
1762  *why << expectation->source_text() << "...\n";
1763  expectation->ExplainMatchResultTo(args, why);
1764  expectation->DescribeCallCountTo(why);
1765  }
1766  }
int * count
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedDescribeUninterestingCall ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1654  {
1655  const ArgumentTuple& args =
1656  *static_cast<const ArgumentTuple*>(untyped_args);
1657  *os << "Uninteresting mock function call - ";
1658  DescribeDefaultActionTo(args, os);
1659  *os << " Function call: " << Name();
1660  UniversalPrint(args, os);
1661  }
Function< F >::ArgumentTuple ArgumentTuple
const char * Name() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
void UniversalPrint(const T &value,::std::ostream *os)
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedDescribeUninterestingCall ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1654  {
1655  const ArgumentTuple& args =
1656  *static_cast<const ArgumentTuple*>(untyped_args);
1657  *os << "Uninteresting mock function call - ";
1658  DescribeDefaultActionTo(args, os);
1659  *os << " Function call: " << Name();
1660  UniversalPrint(args, os);
1661  }
Function< F >::ArgumentTuple ArgumentTuple
const char * Name() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
void UniversalPrint(const T &value,::std::ostream *os)
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedDescribeUninterestingCall ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1654  {
1655  const ArgumentTuple& args =
1656  *static_cast<const ArgumentTuple*>(untyped_args);
1657  *os << "Uninteresting mock function call - ";
1658  DescribeDefaultActionTo(args, os);
1659  *os << " Function call: " << Name();
1660  UniversalPrint(args, os);
1661  }
Function< F >::ArgumentTuple ArgumentTuple
const char * Name() const GTEST_LOCK_EXCLUDED_(g_gmock_mutex)
void UniversalPrint(const T &value,::std::ostream *os)
void DescribeDefaultActionTo(const ArgumentTuple &args,::std::ostream *os) const
template<typename F>
virtual const ExpectationBase* testing::internal::FunctionMockerBase< F >::UntypedFindMatchingExpectation ( const void *  untyped_args,
const void **  untyped_action,
bool *  is_excessive,
::std::ostream *  what,
::std::ostream *  why 
)
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1683  {
1684  const ArgumentTuple& args =
1685  *static_cast<const ArgumentTuple*>(untyped_args);
1686  MutexLock l(&g_gmock_mutex);
1687  TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
1688  if (exp == NULL) { // A match wasn't found.
1689  this->FormatUnexpectedCallMessageLocked(args, what, why);
1690  return NULL;
1691  }
1692 
1693  // This line must be done before calling GetActionForArguments(),
1694  // which will increment the call count for *exp and thus affect
1695  // its saturation status.
1696  *is_excessive = exp->IsSaturated();
1697  const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
1698  if (action != NULL && action->IsDoDefault())
1699  action = NULL; // Normalize "do default" to NULL.
1700  *untyped_action = action;
1701  return exp;
1702  }
TypedExpectation< F > * FindMatchingExpectationLocked(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Function< F >::ArgumentTuple ArgumentTuple
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
void FormatUnexpectedCallMessageLocked(const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
action
Definition: upload.py:393
template<typename F>
virtual const ExpectationBase* testing::internal::FunctionMockerBase< F >::UntypedFindMatchingExpectation ( const void *  untyped_args,
const void **  untyped_action,
bool *  is_excessive,
::std::ostream *  what,
::std::ostream *  why 
)
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1683  {
1684  const ArgumentTuple& args =
1685  *static_cast<const ArgumentTuple*>(untyped_args);
1686  MutexLock l(&g_gmock_mutex);
1687  TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
1688  if (exp == NULL) { // A match wasn't found.
1689  this->FormatUnexpectedCallMessageLocked(args, what, why);
1690  return NULL;
1691  }
1692 
1693  // This line must be done before calling GetActionForArguments(),
1694  // which will increment the call count for *exp and thus affect
1695  // its saturation status.
1696  *is_excessive = exp->IsSaturated();
1697  const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
1698  if (action != NULL && action->IsDoDefault())
1699  action = NULL; // Normalize "do default" to NULL.
1700  *untyped_action = action;
1701  return exp;
1702  }
TypedExpectation< F > * FindMatchingExpectationLocked(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Function< F >::ArgumentTuple ArgumentTuple
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
void FormatUnexpectedCallMessageLocked(const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
action
Definition: upload.py:393
template<typename F>
virtual const ExpectationBase* testing::internal::FunctionMockerBase< F >::UntypedFindMatchingExpectation ( const void *  untyped_args,
const void **  untyped_action,
bool *  is_excessive,
::std::ostream *  what,
::std::ostream *  why 
)
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1683  {
1684  const ArgumentTuple& args =
1685  *static_cast<const ArgumentTuple*>(untyped_args);
1686  MutexLock l(&g_gmock_mutex);
1687  TypedExpectation<F>* exp = this->FindMatchingExpectationLocked(args);
1688  if (exp == NULL) { // A match wasn't found.
1689  this->FormatUnexpectedCallMessageLocked(args, what, why);
1690  return NULL;
1691  }
1692 
1693  // This line must be done before calling GetActionForArguments(),
1694  // which will increment the call count for *exp and thus affect
1695  // its saturation status.
1696  *is_excessive = exp->IsSaturated();
1697  const Action<F>* action = exp->GetActionForArguments(this, args, what, why);
1698  if (action != NULL && action->IsDoDefault())
1699  action = NULL; // Normalize "do default" to NULL.
1700  *untyped_action = action;
1701  return exp;
1702  }
TypedExpectation< F > * FindMatchingExpectationLocked(const ArgumentTuple &args) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
Function< F >::ArgumentTuple ArgumentTuple
GTestMutexLock MutexLock
Definition: gtest-port.h:2159
void FormatUnexpectedCallMessageLocked(const ArgumentTuple &args,::std::ostream *os,::std::ostream *why) const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex)
action
Definition: upload.py:393
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);
1542  return ResultHolder::PerformAction(action, args);
1543  }
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Function< F >::ArgumentTuple ArgumentTuple
action
Definition: upload.py:393
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);
1542  return ResultHolder::PerformAction(action, args);
1543  }
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Function< F >::ArgumentTuple ArgumentTuple
action
Definition: upload.py:393
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);
1542  return ResultHolder::PerformAction(action, args);
1543  }
static ActionResultHolder * PerformAction(const Action< F > &action, const typename Function< F >::ArgumentTuple &args)
Function< F >::ArgumentTuple ArgumentTuple
action
Definition: upload.py:393
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);
1528  return ResultHolder::PerformDefaultAction(this, args, call_description);
1529  }
Function< F >::ArgumentTuple ArgumentTuple
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
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);
1528  return ResultHolder::PerformDefaultAction(this, args, call_description);
1529  }
Function< F >::ArgumentTuple ArgumentTuple
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
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);
1528  return ResultHolder::PerformDefaultAction(this, args, call_description);
1529  }
Function< F >::ArgumentTuple ArgumentTuple
static ActionResultHolder * PerformDefaultAction(const FunctionMockerBase< F > *func_mocker, const typename Function< F >::ArgumentTuple &args, const string &call_description)
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedPrintArgs ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1706  {
1707  const ArgumentTuple& args =
1708  *static_cast<const ArgumentTuple*>(untyped_args);
1709  UniversalPrint(args, os);
1710  }
Function< F >::ArgumentTuple ArgumentTuple
void UniversalPrint(const T &value,::std::ostream *os)
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedPrintArgs ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1706  {
1707  const ArgumentTuple& args =
1708  *static_cast<const ArgumentTuple*>(untyped_args);
1709  UniversalPrint(args, os);
1710  }
Function< F >::ArgumentTuple ArgumentTuple
void UniversalPrint(const T &value,::std::ostream *os)
template<typename F>
virtual void testing::internal::FunctionMockerBase< F >::UntypedPrintArgs ( const void *  untyped_args,
::std::ostream *  os 
) const
inlineprivatevirtual

Implements testing::internal::UntypedFunctionMockerBase.

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

1706  {
1707  const ArgumentTuple& args =
1708  *static_cast<const ArgumentTuple*>(untyped_args);
1709  UniversalPrint(args, os);
1710  }
Function< F >::ArgumentTuple ArgumentTuple
void UniversalPrint(const T &value,::std::ostream *os)

Friends And Related Function Documentation

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

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

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

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

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

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

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

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

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

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

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

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

Member Data Documentation

template<typename F>
MockSpec< F > testing::internal::FunctionMockerBase< F >::current_spec_
private

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


The documentation for this class was generated from the following files: