Remove annoying warnings in dawn_unittests

There are a lot of annoying warnings about uninteresting mock
function calls when running dawn_unittests because object release
function calls are not included into the gtest EXPECT_CALL.

BUG=dawn:93

Change-Id: I49f772bc1b9da9eaa86a51ca3a754886e8f0bcdc
Reviewed-on: https://dawn-review.googlesource.com/c/3960
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yunchao He 2019-01-16 23:56:16 +00:00 committed by Commit Bot service account
parent acd8b7d937
commit 63b59cfdf3
1 changed files with 32 additions and 7 deletions

View File

@ -213,6 +213,7 @@ TEST_F(WireTests, CallForwarded) {
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
.WillOnce(Return(apiCmdBufBuilder)); .WillOnce(Return(apiCmdBufBuilder));
EXPECT_CALL(api, CommandBufferBuilderRelease(apiCmdBufBuilder));
FlushClient(); FlushClient();
} }
@ -229,6 +230,8 @@ TEST_F(WireTests, CreateThenCall) {
EXPECT_CALL(api, CommandBufferBuilderGetResult(apiCmdBufBuilder)) EXPECT_CALL(api, CommandBufferBuilderGetResult(apiCmdBufBuilder))
.WillOnce(Return(apiCmdBuf)); .WillOnce(Return(apiCmdBuf));
EXPECT_CALL(api, CommandBufferBuilderRelease(apiCmdBufBuilder));
EXPECT_CALL(api, CommandBufferRelease(apiCmdBuf));
FlushClient(); FlushClient();
} }
@ -242,6 +245,7 @@ TEST_F(WireTests, RefCountKeptInClient) {
dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder(); dawnCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice)) EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
.WillOnce(Return(apiCmdBufBuilder)); .WillOnce(Return(apiCmdBufBuilder));
EXPECT_CALL(api, CommandBufferBuilderRelease(apiCmdBufBuilder));
FlushClient(); FlushClient();
} }
@ -278,6 +282,8 @@ TEST_F(WireTests, ValueArgument) {
EXPECT_CALL(api, ComputePassEncoderDispatch(apiPass, 1, 2, 3)) EXPECT_CALL(api, ComputePassEncoderDispatch(apiPass, 1, 2, 3))
.Times(1); .Times(1);
EXPECT_CALL(api, CommandBufferBuilderRelease(apiBuilder));
EXPECT_CALL(api, ComputePassEncoderRelease(apiPass));
FlushClient(); FlushClient();
} }
@ -312,6 +318,8 @@ TEST_F(WireTests, ValueArrayArgument) {
.WillOnce(Return(apiPass)); .WillOnce(Return(apiPass));
EXPECT_CALL(api, ComputePassEncoderSetPushConstants(apiPass, DAWN_SHADER_STAGE_BIT_VERTEX, 0, 4, ResultOf(CheckPushConstantValues, Eq(true)))); EXPECT_CALL(api, ComputePassEncoderSetPushConstants(apiPass, DAWN_SHADER_STAGE_BIT_VERTEX, 0, 4, ResultOf(CheckPushConstantValues, Eq(true))));
EXPECT_CALL(api, CommandBufferBuilderRelease(apiBuilder));
EXPECT_CALL(api, ComputePassEncoderRelease(apiPass));
FlushClient(); FlushClient();
} }
@ -418,6 +426,10 @@ TEST_F(WireTests, CStringArgument) {
return desc->vertexStage->entryPoint == std::string("main"); return desc->vertexStage->entryPoint == std::string("main");
}))) })))
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
EXPECT_CALL(api, ShaderModuleRelease(apiVsModule));
EXPECT_CALL(api, InputStateBuilderRelease(apiInputStateBuilder));
EXPECT_CALL(api, InputStateRelease(apiInputState));
EXPECT_CALL(api, PipelineLayoutRelease(apiLayout));
FlushClient(); FlushClient();
} }
@ -446,6 +458,9 @@ TEST_F(WireTests, ObjectAsValueArgument) {
EXPECT_CALL(api, CommandBufferBuilderBeginRenderPass(apiCmdBufBuilder, apiRenderPass)) EXPECT_CALL(api, CommandBufferBuilderBeginRenderPass(apiCmdBufBuilder, apiRenderPass))
.Times(1); .Times(1);
EXPECT_CALL(api, CommandBufferBuilderRelease(apiCmdBufBuilder));
EXPECT_CALL(api, RenderPassDescriptorBuilderRelease(apiRenderPassBuilder));
EXPECT_CALL(api, RenderPassDescriptorRelease(apiRenderPass));
FlushClient(); FlushClient();
} }
@ -469,6 +484,8 @@ TEST_F(WireTests, ObjectsAsPointerArgument) {
apiCmdBufs[i] = api.GetNewCommandBuffer(); apiCmdBufs[i] = api.GetNewCommandBuffer();
EXPECT_CALL(api, CommandBufferBuilderGetResult(apiCmdBufBuilder)) EXPECT_CALL(api, CommandBufferBuilderGetResult(apiCmdBufBuilder))
.WillOnce(Return(apiCmdBufs[i])); .WillOnce(Return(apiCmdBufs[i]));
EXPECT_CALL(api, CommandBufferBuilderRelease(apiCmdBufBuilder));
EXPECT_CALL(api, CommandBufferRelease(apiCmdBufs[i]));
} }
// Create queue // Create queue
@ -484,6 +501,7 @@ TEST_F(WireTests, ObjectsAsPointerArgument) {
return cmdBufs[0] == apiCmdBufs[0] && cmdBufs[1] == apiCmdBufs[1]; return cmdBufs[0] == apiCmdBufs[0] && cmdBufs[1] == apiCmdBufs[1];
}))); })));
EXPECT_CALL(api, QueueRelease(apiQueue));
FlushClient(); FlushClient();
} }
@ -544,6 +562,7 @@ TEST_F(WireTests, StructureOfObjectArrayArgument) {
}))) })))
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
EXPECT_CALL(api, BindGroupLayoutRelease(apiBgl));
FlushClient(); FlushClient();
} }
@ -580,6 +599,7 @@ TEST_F(WireTests, StructureOfStructureArrayArgument) {
}))) })))
.WillOnce(Return(apiBgl)); .WillOnce(Return(apiBgl));
EXPECT_CALL(api, BindGroupLayoutRelease(apiBgl));
FlushClient(); FlushClient();
} }
@ -618,6 +638,7 @@ TEST_F(WireTests, OptionalObjectValue) {
}))) })))
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
EXPECT_CALL(api, BindGroupLayoutRelease(apiBindGroupLayout));
FlushClient(); FlushClient();
} }
@ -710,6 +731,8 @@ TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) {
return apiBuffer; return apiBuffer;
})); }));
EXPECT_CALL(api, BufferBuilderRelease(apiBufferBuilder));
EXPECT_CALL(api, BufferRelease(apiBuffer));
FlushClient(); FlushClient();
EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_SUCCESS, _ , 1 ,2)); EXPECT_CALL(*mockBuilderErrorCallback, Call(DAWN_BUILDER_ERROR_STATUS_SUCCESS, _ , 1 ,2));
@ -772,6 +795,8 @@ TEST_F(WireTests, SuccessCallbackNotForwardedToDevice) {
return apiBuffer; return apiBuffer;
})); }));
EXPECT_CALL(api, BufferBuilderRelease(apiBufferBuilder));
EXPECT_CALL(api, BufferRelease(apiBuffer));
FlushClient(); FlushClient();
FlushServer(); FlushServer();
} }
@ -794,6 +819,7 @@ TEST_F(WireTests, ErrorCallbackForwardedToDevice) {
return nullptr; return nullptr;
})); }));
EXPECT_CALL(api, BufferBuilderRelease(apiBufferBuilder));
FlushClient(); FlushClient();
EXPECT_CALL(*mockDeviceErrorCallback, Call(_, userdata)).Times(1); EXPECT_CALL(*mockDeviceErrorCallback, Call(_, userdata)).Times(1);
@ -855,6 +881,8 @@ TEST_F(WireSetCallbackTests, BuilderErrorCallback) {
return apiBuffer; return apiBuffer;
})); }));
EXPECT_CALL(api, BufferBuilderRelease(apiBufferBuilder));
EXPECT_CALL(api, BufferRelease(apiBuffer));
FlushClient(); FlushClient();
// The error callback gets called on the client side // The error callback gets called on the client side
@ -882,6 +910,7 @@ class WireBufferMappingTests : public WireTestsBase {
EXPECT_CALL(api, DeviceCreateBuffer(apiDevice, _)) EXPECT_CALL(api, DeviceCreateBuffer(apiDevice, _))
.WillOnce(Return(apiBuffer)) .WillOnce(Return(apiBuffer))
.RetiresOnSaturation(); .RetiresOnSaturation();
EXPECT_CALL(api, BufferRelease(apiBuffer));
FlushClient(); FlushClient();
} }
{ {
@ -1083,9 +1112,6 @@ TEST_F(WireBufferMappingTests, DestroyInsideMapReadCallback) {
FlushServer(); FlushServer();
EXPECT_CALL(api, BufferRelease(apiBuffer))
.Times(1);
FlushClient(); FlushClient();
} }
@ -1279,9 +1305,6 @@ TEST_F(WireBufferMappingTests, DestroyInsideMapWriteCallback) {
FlushServer(); FlushServer();
EXPECT_CALL(api, BufferRelease(apiBuffer))
.Times(1);
FlushClient(); FlushClient();
} }
@ -1302,12 +1325,14 @@ class WireFenceTests : public WireTestsBase {
fence = dawnDeviceCreateFence(device, &descriptor); fence = dawnDeviceCreateFence(device, &descriptor);
EXPECT_CALL(api, DeviceCreateFence(apiDevice, _)).WillOnce(Return(apiFence)); EXPECT_CALL(api, DeviceCreateFence(apiDevice, _)).WillOnce(Return(apiFence));
EXPECT_CALL(api, FenceRelease(apiFence));
FlushClient(); FlushClient();
} }
{ {
queue = dawnDeviceCreateQueue(device); queue = dawnDeviceCreateQueue(device);
apiQueue = api.GetNewQueue(); apiQueue = api.GetNewQueue();
EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue)); EXPECT_CALL(api, DeviceCreateQueue(apiDevice)).WillOnce(Return(apiQueue));
EXPECT_CALL(api, QueueRelease(apiQueue));
FlushClient(); FlushClient();
} }
} }