[tests]: Register Device::SetLoggingCallback()

And print this to the Dawn logger.
Tests will now print any diagnostic logging calls from Dawn.

Change-Id: Idd4bf816303c182809924f9a432570def808e1b6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57381
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-07-15 09:09:38 +00:00 committed by Dawn LUCI CQ
parent 5e3e3a020a
commit 93a75930b1

View File

@ -948,6 +948,25 @@ void DawnTestBase::SetUp() {
glfwMakeContextCurrent(gTestEnv->GetOpenGLESWindow());
}
#endif // defined(DAWN_ENABLE_BACKEND_OPENGLES)
device.SetLoggingCallback(
[](WGPULoggingType type, char const* message, void*) {
switch (type) {
case WGPULoggingType_Verbose:
dawn::DebugLog() << message;
break;
case WGPULoggingType_Warning:
dawn::WarningLog() << message;
break;
case WGPULoggingType_Error:
dawn::ErrorLog() << message;
break;
default:
dawn::InfoLog() << message;
break;
}
},
nullptr);
}
void DawnTestBase::TearDown() {