aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorvladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2010-05-04 16:05:11 +0000
committervladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386>2010-05-04 16:05:11 +0000
commit54af9ba50a8ce03a4463faf45a61b47bdf79fefd (patch)
tree1a74619f02f940f50fb6c895a36c51c8416ad0b5 /test
parent33605ba45417979cff7254c1196dfee65a7275b3 (diff)
downloadgoogletest-54af9ba50a8ce03a4463faf45a61b47bdf79fefd.tar.gz
googletest-54af9ba50a8ce03a4463faf45a61b47bdf79fefd.tar.bz2
googletest-54af9ba50a8ce03a4463faf45a61b47bdf79fefd.zip
Adds a synchronization test.
Diffstat (limited to 'test')
-rw-r--r--test/gmock-spec-builders_test.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/gmock-spec-builders_test.cc b/test/gmock-spec-builders_test.cc
index e5fc2ec9..e22d8cf7 100644
--- a/test/gmock-spec-builders_test.cc
+++ b/test/gmock-spec-builders_test.cc
@@ -2358,9 +2358,23 @@ TEST(VerifyAndClearTest, DoesNotAffectOtherMockObjects) {
// action or as a default action without causing a dead lock. It
// verifies that the action is not performed inside the critical
// 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) {
- c->NonVoidMethod();
+ a.DoA(1);
+ // 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