mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
Make Wire tests more strict w.r.t. expectations
This changes Wire tests to produces errors on "uninteresting calls" and flushes mock expectations on client/server flushes so that we control 100% of the order of calls. BUG=941543 Change-Id: I6eabc79dde2abb564e54df90c5c0e615fd4496c6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6040 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
1ba2cb8589
commit
d754fb2034
@@ -34,10 +34,7 @@ void WireTest::SetUp() {
|
||||
|
||||
// This SetCallback call cannot be ignored because it is done as soon as we start the server
|
||||
EXPECT_CALL(api, OnDeviceSetErrorCallback(_, _, _)).Times(Exactly(1));
|
||||
if (mIgnoreSetCallbackCalls) {
|
||||
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
|
||||
}
|
||||
EXPECT_CALL(api, DeviceTick(_)).Times(AnyNumber());
|
||||
SetupIgnoredCallExpectations();
|
||||
|
||||
mS2cBuf = std::make_unique<utils::TerribleCommandBuffer>();
|
||||
mC2sBuf = std::make_unique<utils::TerribleCommandBuffer>(mWireServer.get());
|
||||
@@ -62,13 +59,24 @@ void WireTest::TearDown() {
|
||||
// be reset before any mocks are deleted.
|
||||
// Incomplete client callbacks will be called on deletion, so the mocks
|
||||
// cannot be null.
|
||||
api.IgnoreAllReleaseCalls();
|
||||
mWireClient = nullptr;
|
||||
}
|
||||
|
||||
void WireTest::FlushClient() {
|
||||
ASSERT_TRUE(mC2sBuf->Flush());
|
||||
|
||||
Mock::VerifyAndClearExpectations(&api);
|
||||
SetupIgnoredCallExpectations();
|
||||
}
|
||||
|
||||
void WireTest::FlushServer() {
|
||||
ASSERT_TRUE(mS2cBuf->Flush());
|
||||
}
|
||||
|
||||
void WireTest::SetupIgnoredCallExpectations() {
|
||||
if (mIgnoreSetCallbackCalls) {
|
||||
EXPECT_CALL(api, OnBuilderSetErrorCallback(_, _, _, _)).Times(AnyNumber());
|
||||
}
|
||||
EXPECT_CALL(api, DeviceTick(_)).Times(AnyNumber());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user