Don't forward device lost errors to the uncaptured error callback

This issue was discovered in http://crrev.com/c/2613517 where a
device lost error on page teardown was bubbling up to the Renderer's
uncaptured error callback.

Bug: chromium:1160459
Change-Id: I64b8c7779f4808d5a4b87c131aaf2e041c512bb9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36960
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng
2021-01-13 17:53:29 +00:00
committed by Commit Bot service account
parent 558599fc9a
commit 8ef94f1684
5 changed files with 52 additions and 10 deletions

View File

@@ -264,6 +264,7 @@ source_set("dawn_end2end_tests_sources") {
sources = [
"DawnTest.h",
"MockCallback.h",
"end2end/BasicTests.cpp",
"end2end/BindGroupTests.cpp",
"end2end/BufferTests.cpp",

View File

@@ -15,6 +15,7 @@
#include "tests/DawnTest.h"
#include <gmock/gmock.h>
#include "tests/MockCallback.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "utils/WGPUHelpers.h"
@@ -516,6 +517,19 @@ TEST_P(DeviceLostTest, LoseForTestingOnce) {
device.LoseForTesting();
}
TEST_P(DeviceLostTest, DeviceLostDoesntCallUncapturedError) {
// Set no callback.
device.SetDeviceLostCallback(nullptr, nullptr);
// Set the uncaptured error callback which should not be called on
// device lost.
MockCallback<WGPUErrorCallback> mockErrorCallback;
device.SetUncapturedErrorCallback(mockErrorCallback.Callback(),
mockErrorCallback.MakeUserdata(nullptr));
EXPECT_CALL(mockErrorCallback, Call(_, _, _)).Times(Exactly(0));
device.LoseForTesting();
}
DAWN_INSTANTIATE_TEST(DeviceLostTest,
D3D12Backend(),
MetalBackend(),