Adds a synchronization test.
This commit is contained in:
parent
33605ba454
commit
54af9ba50a
|
@ -2358,9 +2358,23 @@ TEST(VerifyAndClearTest, DoesNotAffectOtherMockObjects) {
|
||||||
// action or as a default action without causing a dead lock. It
|
// action or as a default action without causing a dead lock. It
|
||||||
// verifies that the action is not performed inside the critical
|
// verifies that the action is not performed inside the critical
|
||||||
// section.
|
// section.
|
||||||
|
TEST(SynchronizationTest, CanCallMockMethodInAction) {
|
||||||
|
MockA a;
|
||||||
|
MockC c;
|
||||||
|
ON_CALL(a, DoA(_))
|
||||||
|
.WillByDefault(IgnoreResult(InvokeWithoutArgs(&c,
|
||||||
|
&MockC::NonVoidMethod)));
|
||||||
|
EXPECT_CALL(a, DoA(1));
|
||||||
|
EXPECT_CALL(a, DoA(1))
|
||||||
|
.WillOnce(Invoke(&a, &MockA::DoA))
|
||||||
|
.RetiresOnSaturation();
|
||||||
|
EXPECT_CALL(c, NonVoidMethod());
|
||||||
|
|
||||||
void Helper(MockC* c) {
|
a.DoA(1);
|
||||||
c->NonVoidMethod();
|
// This will match the second EXPECT_CALL() and trigger another a.DoA(1),
|
||||||
|
// which will in turn match the first EXPECT_CALL() and trigger a call to
|
||||||
|
// c.NonVoidMethod() that was specified by the ON_CALL() since the first
|
||||||
|
// EXPECT_CALL() did not specify an action.
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user