[dawn][wire] Update generated mock files for new callback info types.
Change-Id: I004dd14fe3c6566a80df211f35e3062c43cb82dd
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/177060
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 87d76ba..72851b8 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -868,6 +868,14 @@
return type_name.CamelCase() + method_name.CamelCase()
+def as_CppMethodSuffix(type_name, method_name):
+ assert not type_name.native and not method_name.native
+ original_method_name_str = method_name.CamelCase()
+ if method_name.chunks[-1] == 'f':
+ return type_name.CamelCase() + original_method_name_str[:-1]
+ return type_name.CamelCase() + original_method_name_str
+
+
def as_frontendType(metadata, typ):
if typ.category == 'object':
return typ.name.CamelCase() + 'Base*'
@@ -914,6 +922,10 @@
return any(arg.type.category == 'function pointer' for arg in method.arguments)
+def has_callback_info(method):
+ return method.return_type.name.get() == 'future' and any(
+ arg.name.get() == 'callback info' for arg in method.arguments)
+
def make_base_render_params(metadata):
c_prefix = metadata.c_prefix
@@ -954,6 +966,7 @@
'as_cppEnum': as_cppEnum,
'as_cMethod': as_cMethod,
'as_MethodSuffix': as_MethodSuffix,
+ 'as_CppMethodSuffix': as_CppMethodSuffix,
'as_cProc': as_cProc,
'as_cType': lambda name: as_cType(c_prefix, name),
'as_cReturnType': lambda typ: as_cReturnType(c_prefix, typ),
@@ -1110,7 +1123,8 @@
if 'mock_api' in targets:
mock_params = [
RENDER_PARAMS_BASE, params_dawn, {
- 'has_callback_arguments': has_callback_arguments
+ 'has_callback_arguments': has_callback_arguments,
+ "has_callback_info": has_callback_info
}
]
renders.append(
diff --git a/generator/templates/mock_api.cpp b/generator/templates/mock_api.cpp
index b66b27e..ec792af 100644
--- a/generator/templates/mock_api.cpp
+++ b/generator/templates/mock_api.cpp
@@ -41,7 +41,7 @@
{%- endfor -%}
) {
auto object = reinterpret_cast<ProcTableAsClass::Object*>(self);
- return object->procs->{{as_MethodSuffix(type.name, method.name)}}(self
+ return object->procs->{{as_CppMethodSuffix(type.name, method.name)}}(self
{%- for arg in method.arguments -%}
, {{as_varName(arg.name)}}
{%- endfor -%}
@@ -74,43 +74,114 @@
{% endfor %}
}
+//* Generate the older Call*Callback if there is no Future call equivalent.
+//* Includes:
+//* - setDeviceLostCallback
+//* - setUncapturedErrorCallback
+//* - setLoggingCallback
+{% set LegacyCallbackFunctions = ['set device lost callback', 'set uncaptured error callback', 'set logging callback'] %}
+
{% for type in by_category["object"] %}
- {% for method in type.methods if has_callback_arguments(method) %}
- {% set Suffix = as_MethodSuffix(type.name, method.name) %}
-
- {{as_cType(method.return_type.name)}} ProcTableAsClass::{{Suffix}}(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_annotated_cType(arg)}}
- {%- endfor -%}
- ) {
- ProcTableAsClass::Object* object = reinterpret_cast<ProcTableAsClass::Object*>({{as_varName(type.name)}});
- {% for callback_arg in method.arguments if callback_arg.type.category == 'function pointer' %}
- object->m{{as_MethodSuffix(type.name, method.name)}}Callback = {{as_varName(callback_arg.name)}};
- {% endfor %}
- object->userdata = userdata;
- return On{{as_MethodSuffix(type.name, method.name)}}(
- {{-as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_varName(arg.name)}}
- {%- endfor -%}
- );
- }
-
- {% for callback_arg in method.arguments if callback_arg.type.category == 'function pointer' %}
- void ProcTableAsClass::Call{{Suffix}}Callback(
+ {% for method in type.methods %}
+ {% set Suffix = as_CppMethodSuffix(type.name, method.name) %}
+ {% if has_callback_arguments(method) %}
+ {{as_cType(method.return_type.name)}} ProcTableAsClass::{{Suffix}}(
{{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in callback_arg.type.arguments -%}
- {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
{%- endfor -%}
) {
ProcTableAsClass::Object* object = reinterpret_cast<ProcTableAsClass::Object*>({{as_varName(type.name)}});
- object->m{{Suffix}}Callback(
- {%- for arg in callback_arg.type.arguments -%}
- {%- if not loop.last -%}{{as_varName(arg.name)}}, {% endif -%}
- {%- endfor -%}
- object->userdata);
+ {% for arg in method.arguments if arg.type.category == 'function pointer' %}
+ object->m{{Suffix + arg.name.CamelCase()}} = {{as_varName(arg.name)}};
+ object->m{{Suffix}}Userdata = userdata;
+ {% endfor %}
+
+ {% if method.name.get() == 'pop error scope' %}
+ //* Currently special casing popErrorScope since it has an old callback type.
+ On{{Suffix}}({{-as_varName(type.name)}}, {.nextInChain = nullptr, .mode = WGPUCallbackMode_AllowProcessEvents, .callback = nullptr, .oldCallback = oldCallback, .userdata = userdata});
+ {% elif method.name.get() not in LegacyCallbackFunctions %}
+ On{{Suffix}}(
+ {{-as_varName(type.name)}}
+ {%- for arg in method.arguments if arg.type.category != 'function pointer' and arg.type.name.get() != 'void *' -%}
+ , {{as_varName(arg.name)}}
+ {%- endfor -%}
+ , {.nextInChain = nullptr, .mode = WGPUCallbackMode_AllowProcessEvents
+ {%- for arg in method.arguments if arg.type.category == 'function pointer' -%}
+ , .{{as_varName(arg.name)}} = {{as_varName(arg.name)}}
+ {%- endfor -%}
+ , .userdata = userdata});
+ {% else %}
+ On{{Suffix}}(
+ {{-as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_varName(arg.name)}}
+ {%- endfor -%}
+ );
+ {% endif %}
}
+ {% elif has_callback_info(method) %}
+ {{as_cType(method.return_type.name)}} ProcTableAsClass::{{Suffix}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
+ {%- endfor -%}
+ ) {
+ ProcTableAsClass::Object* object = reinterpret_cast<ProcTableAsClass::Object*>({{as_varName(type.name)}});
+ {% for arg in method.arguments %}
+ {% if arg.name.get() == 'callback info' %}
+ {% for callback in types[arg.type.name.get()].members if callback.type.category == 'function pointer' %}
+ object->m{{Suffix + callback.name.CamelCase()}} = {{as_varName(arg.name)}}.{{as_varName(callback.name)}};
+ object->m{{Suffix}}Userdata = {{as_varName(arg.name)}}.userdata;
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
+
+ On{{Suffix}}(
+ {{-as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_varName(arg.name)}}
+ {%- endfor -%}
+ );
+ return {mNextFutureID++};
+ }
+ {% endif %}
+ {% endfor %}
+
+ {% for method in type.methods if has_callback_info(method) or method.name.get() in LegacyCallbackFunctions %}
+ {% set Suffix = as_CppMethodSuffix(type.name, method.name) %}
+ {% for arg in method.arguments %}
+ {% if arg.name.get() == 'callback info' %}
+ {% for callback in types[arg.type.name.get()].members if callback.type.category == 'function pointer' %}
+ void ProcTableAsClass::Call{{Suffix + callback.name.CamelCase()}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in callback.type.arguments -%}
+ {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
+ {%- endfor -%}
+ ) {
+ ProcTableAsClass::Object* object = reinterpret_cast<ProcTableAsClass::Object*>({{as_varName(type.name)}});
+ object->m{{Suffix + callback.name.CamelCase()}}(
+ {%- for arg in callback.type.arguments -%}
+ {%- if not loop.last -%}{{as_varName(arg.name)}}, {% endif -%}
+ {%- endfor -%}
+ object->m{{Suffix}}Userdata);
+ }
+ {% endfor %}
+ {% elif arg.type.category == 'function pointer' %}
+ void ProcTableAsClass::Call{{Suffix + arg.name.CamelCase()}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in arg.type.arguments -%}
+ {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
+ {%- endfor -%}
+ ) {
+ ProcTableAsClass::Object* object = reinterpret_cast<ProcTableAsClass::Object*>({{as_varName(type.name)}});
+ object->m{{Suffix + arg.name.CamelCase()}}(
+ {%- for arg in arg.type.arguments -%}
+ {%- if not loop.last -%}{{as_varName(arg.name)}}, {% endif -%}
+ {%- endfor -%}
+ object->m{{Suffix}}Userdata);
+ }
+ {% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
@@ -129,6 +200,6 @@
void MockProcTable::IgnoreAllReleaseCalls() {
{% for type in by_category["object"] %}
- EXPECT_CALL(*this, {{as_MethodSuffix(type.name, Name("release"))}}(_)).Times(AnyNumber());
+ EXPECT_CALL(*this, {{as_CppMethodSuffix(type.name, Name("release"))}}(_)).Times(AnyNumber());
{% endfor %}
}
diff --git a/generator/templates/mock_api.h b/generator/templates/mock_api.h
index 0acfe8c..e30a33c 100644
--- a/generator/templates/mock_api.h
+++ b/generator/templates/mock_api.h
@@ -36,8 +36,11 @@
#include "dawn/{{api}}.h"
#include <gmock/gmock.h>
+#include <atomic>
#include <memory>
+#include "dawn/common/FutureUtils.h"
+
// An abstract base class representing a proc table so that API calls can be mocked. Most API calls
// are directly represented by a delete virtual method but others need minimal state tracking to be
// useful as mocks.
@@ -55,45 +58,66 @@
{{as_cType(type.name)}} GetNew{{type.name.CamelCase()}}();
{% endfor %}
- {% for type in by_category["object"] %}
- {% for method in type.methods if not has_callback_arguments(method) %}
- virtual {{as_cType(method.return_type.name)}} {{as_MethodSuffix(type.name, method.name)}}(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_annotated_cType(arg)}}
- {%- endfor -%}
- ) = 0;
- {% endfor %}
+ //* Generate the older Call*Callback if there is no Future call equivalent.
+ //* Includes:
+ //* - setDeviceLostCallback
+ //* - setUncapturedErrorCallback
+ //* - setLoggingCallback
+ {%- set LegacyCallbackFunctions = ['set device lost callback', 'set uncaptured error callback', 'set logging callback'] %}
+
+ {%- for type in by_category["object"] %}
virtual void {{as_MethodSuffix(type.name, Name("reference"))}}({{as_cType(type.name)}} self) = 0;
virtual void {{as_MethodSuffix(type.name, Name("release"))}}({{as_cType(type.name)}} self) = 0;
+ {% for method in type.methods %}
+ {% set Suffix = as_CppMethodSuffix(type.name, method.name) %}
+ {% if not has_callback_arguments(method) and not has_callback_info(method) %}
+ virtual {{as_cType(method.return_type.name)}} {{Suffix}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
+ {%- endfor -%}
+ ) = 0;
+ {% else %}
+ //* For functions with callbacks, store callback and userdata and call the On* method.
+ {{as_cType(method.return_type.name)}} {{Suffix}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in method.arguments -%}
+ , {{as_annotated_cType(arg)}}
+ {%- endfor -%}
+ );
+ {% endif %}
+ {% endfor %}
- {% for method in type.methods if has_callback_arguments(method) %}
- {% set Suffix = as_MethodSuffix(type.name, method.name) %}
- //* Stores callback and userdata and calls the On* method.
- {{as_cType(method.return_type.name)}} {{Suffix}}(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in method.arguments -%}
- , {{as_annotated_cType(arg)}}
- {%- endfor -%}
- );
+ {%- for method in type.methods if has_callback_info(method) or method.name.get() in LegacyCallbackFunctions %}
+
+ {% set Suffix = as_CppMethodSuffix(type.name, method.name) %}
//* The virtual function to call after saving the callback and userdata in the proc.
//* This function can be mocked.
- virtual {{as_cType(method.return_type.name)}} On{{Suffix}}(
+ virtual void On{{Suffix}}(
{{-as_cType(type.name)}} {{as_varName(type.name)}}
{%- for arg in method.arguments -%}
, {{as_annotated_cType(arg)}}
{%- endfor -%}
) = 0;
-
- //* Calls the stored callback.
- {% for callback_arg in method.arguments if callback_arg.type.category == 'function pointer' %}
- void Call{{as_MethodSuffix(type.name, method.name)}}Callback(
- {{-as_cType(type.name)}} {{as_varName(type.name)}}
- {%- for arg in callback_arg.type.arguments -%}
- {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
- {%- endfor -%}
- );
+ {% for arg in method.arguments %}
+ {% if arg.name.get() == 'callback info' %}
+ {% for callback in types[arg.type.name.get()].members if callback.type.category == 'function pointer' %}
+ void Call{{Suffix + callback.name.CamelCase()}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in callback.type.arguments -%}
+ {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
+ {%- endfor -%}
+ );
+ {% endfor %}
+ {% elif arg.type.category == 'function pointer' %}
+ void Call{{Suffix + arg.name.CamelCase()}}(
+ {{-as_cType(type.name)}} {{as_varName(type.name)}}
+ {%- for arg in arg.type.arguments -%}
+ {%- if not loop.last -%}, {{as_annotated_cType(arg)}}{%- endif -%}
+ {%- endfor -%}
+ );
+ {% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
@@ -101,18 +125,26 @@
struct Object {
ProcTableAsClass* procs = nullptr;
{% for type in by_category["object"] %}
- {% for method in type.methods if has_callback_arguments(method) %}
- {% for callback_arg in method.arguments if callback_arg.type.category == 'function pointer' %}
- {{as_cType(callback_arg.type.name)}} m{{as_MethodSuffix(type.name, method.name)}}Callback = nullptr;
+ {% for method in type.methods if has_callback_info(method) or method.name.get() in LegacyCallbackFunctions %}
+ void* m{{as_CppMethodSuffix(type.name, method.name)}}Userdata = 0;
+ {% for arg in method.arguments %}
+ {% if arg.name.get() == 'callback info' %}
+ {% for callback in types[arg.type.name.get()].members if callback.type.category == 'function pointer' %}
+ {{as_cType(callback.type.name)}} m{{as_CppMethodSuffix(type.name, method.name)}}{{callback.name.CamelCase()}} = nullptr;
+ {% endfor %}
+ {% elif arg.type.category == 'function pointer' %}
+ {{as_cType(arg.type.name)}} m{{as_CppMethodSuffix(type.name, method.name)}}{{arg.name.CamelCase()}} = nullptr;
+ {% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
- void* userdata = 0;
};
private:
// Remembers the values returned by GetNew* so they can be freed.
std::vector<std::unique_ptr<Object>> mObjects;
+ // Increasing futureID for testing purposes.
+ std::atomic<dawn::FutureID> mNextFutureID = 1;
};
class MockProcTable : public ProcTableAsClass {
@@ -122,8 +154,11 @@
void IgnoreAllReleaseCalls();
- {% for type in by_category["object"] %}
- {% for method in type.methods if not has_callback_arguments(method) %}
+ {%- for type in by_category["object"] %}
+
+ MOCK_METHOD(void, {{as_MethodSuffix(type.name, Name("reference"))}}, ({{as_cType(type.name)}} self), (override));
+ MOCK_METHOD(void, {{as_MethodSuffix(type.name, Name("release"))}}, ({{as_cType(type.name)}} self), (override));
+ {% for method in type.methods if not has_callback_arguments(method) and not has_callback_info(method) %}
MOCK_METHOD({{as_cType(method.return_type.name)}},{{" "}}
{{-as_MethodSuffix(type.name, method.name)}}, (
{{-as_cType(type.name)}} {{as_varName(type.name)}}
@@ -133,12 +168,9 @@
), (override));
{% endfor %}
- MOCK_METHOD(void, {{as_MethodSuffix(type.name, Name("reference"))}}, ({{as_cType(type.name)}} self), (override));
- MOCK_METHOD(void, {{as_MethodSuffix(type.name, Name("release"))}}, ({{as_cType(type.name)}} self), (override));
-
- {% for method in type.methods if has_callback_arguments(method) %}
- MOCK_METHOD({{as_cType(method.return_type.name)}},{{" "-}}
- On{{as_MethodSuffix(type.name, method.name)}}, (
+ {% for method in type.methods if has_callback_info(method) or method.name.get() in LegacyCallbackFunctions %}
+ MOCK_METHOD(void,{{" "-}}
+ On{{as_CppMethodSuffix(type.name, method.name)}}, (
{{-as_cType(type.name)}} {{as_varName(type.name)}}
{%- for arg in method.arguments -%}
, {{as_annotated_cType(arg)}}
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index aba2cd4..5864f39 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -1444,7 +1444,7 @@
{
"name": "pop error scope",
"args": [
- {"name": "callback", "type": "error callback"},
+ {"name": "old callback", "type": "error callback"},
{"name": "userdata", "type": "void *"}
]
},
diff --git a/src/dawn/tests/unittests/wire/WireAdapterTests.cpp b/src/dawn/tests/unittests/wire/WireAdapterTests.cpp
index 20ce02c..5588561 100644
--- a/src/dawn/tests/unittests/wire/WireAdapterTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireAdapterTests.cpp
@@ -72,7 +72,7 @@
wgpu::DeviceDescriptor desc = {};
AdapterRequestDevice(adapter, &desc);
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(WithArg<1>(Invoke([&](const WGPUDeviceDescriptor* apiDesc) {
EXPECT_EQ(apiDesc->label, nullptr);
EXPECT_EQ(apiDesc->requiredFeatureCount, 0u);
@@ -95,7 +95,7 @@
TEST_P(WireAdapterTests, RequestDeviceNullDescriptor) {
AdapterRequestDevice(adapter, nullptr);
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(WithArg<1>(Invoke([&](const WGPUDeviceDescriptor* apiDesc) {
EXPECT_EQ(apiDesc->label, nullptr);
EXPECT_EQ(apiDesc->requiredFeatureCount, 0u);
@@ -126,7 +126,7 @@
AdapterRequestDevice(adapter, &desc);
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(WithArg<1>(Invoke([&](const WGPUDeviceDescriptor* apiDesc) {
EXPECT_STREQ(apiDesc->label, desc.label);
@@ -166,7 +166,7 @@
// The backend device should not be known by the wire server.
EXPECT_FALSE(GetWireServer()->IsDeviceKnown(apiDevice));
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
// Set on device creation to forward callbacks to the client.
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, NotNull(), NotNull()))
@@ -270,7 +270,7 @@
// The reply contains features that the device implementation supports, but the
// wire does not.
WGPUDevice apiDevice = api.GetNewDevice();
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
EXPECT_CALL(api, DeviceEnumerateFeatures(apiDevice, nullptr))
.WillOnce(Return(fakeFeatures.size()));
@@ -308,7 +308,7 @@
AdapterRequestDevice(adapter, &desc, this);
// Expect the server to receive the message. Then, mock an error.
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallAdapterRequestDeviceCallback(apiAdapter, WGPURequestDeviceStatus_Error, nullptr,
"Request device failed");
@@ -343,7 +343,7 @@
// Mock a reply from the server.
WGPUDevice apiDevice = api.GetNewDevice();
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
// Set on device creation to forward callbacks to the client.
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, NotNull(), NotNull()))
diff --git a/src/dawn/tests/unittests/wire/WireBufferMappingTests.cpp b/src/dawn/tests/unittests/wire/WireBufferMappingTests.cpp
index d72f166..a6d14b4 100644
--- a/src/dawn/tests/unittests/wire/WireBufferMappingTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireBufferMappingTests.cpp
@@ -134,7 +134,7 @@
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
uint32_t bufferContent = 31337;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success);
}));
@@ -173,7 +173,7 @@
SetupBuffer(mapMode);
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -216,7 +216,7 @@
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
uint32_t bufferContent = 31337;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success);
}));
@@ -256,7 +256,7 @@
SetupBuffer(mapMode);
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -339,7 +339,7 @@
BufferMapAsync(buffer, WGPUMapMode_Read, 0, kBufferSize, nullptr);
uint32_t bufferContent = 31337;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetConstMappedRange(apiBuffer, 0, kBufferSize))
@@ -367,7 +367,7 @@
BufferMapAsync(buffer, WGPUMapMode_Read, 0, kBufferSize, nullptr);
uint32_t bufferContent = 31337;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetConstMappedRange(apiBuffer, 0, kBufferSize))
@@ -384,7 +384,7 @@
// Map failure while the buffer is already mapped
BufferMapAsync(buffer, WGPUMapMode_Read, 0, kBufferSize, nullptr);
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -419,7 +419,7 @@
uint32_t serverBufferContent = 31337;
uint32_t updatedContent = 4242;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetMappedRange(apiBuffer, 0, kBufferSize))
@@ -456,7 +456,7 @@
BufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, nullptr);
uint32_t bufferContent = 31337;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetMappedRange(apiBuffer, 0, kBufferSize))
@@ -472,7 +472,7 @@
// Map failure while the buffer is already mapped
BufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, nullptr);
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -562,7 +562,7 @@
BufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, nullptr);
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetMappedRange(apiBuffer, 0, kBufferSize))
@@ -597,7 +597,7 @@
// Note that the validation logic is entirely on the native side so we inject the validation
// error here and flush the server response to mock the expected behavior.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -666,7 +666,7 @@
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
uint32_t bufferContent = 0;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
ExpectMappedRangeCall(kBufferSize, &bufferContent);
@@ -702,7 +702,7 @@
// Calls for the first successful map.
uint32_t bufferContent = 0;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
ExpectMappedRangeCall(kBufferSize, &bufferContent);
@@ -745,7 +745,7 @@
uint32_t bufferContent = 31337;
// Server-side success case
{
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success);
}));
@@ -783,7 +783,7 @@
// Server-side error case
{
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -822,7 +822,7 @@
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
uint32_t bufferContent = 0;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
ExpectMappedRangeCall(kBufferSize, &bufferContent);
@@ -851,7 +851,7 @@
BufferMapAsync(buffer, mapMode, 0, kBufferSize, nullptr);
uint32_t bufferContent = 0;
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, mapMode, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
ExpectMappedRangeCall(kBufferSize, &bufferContent);
diff --git a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
index b712e6f..ff17f30 100644
--- a/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireCreatePipelineAsyncTests.cpp
@@ -119,7 +119,7 @@
TEST_P(WireCreateComputePipelineAsyncTest, CreateSuccess) {
DeviceCreateComputePipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateComputePipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
@@ -139,7 +139,7 @@
TEST_P(WireCreateComputePipelineAsyncTest, CreateError) {
DeviceCreateComputePipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateComputePipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_ValidationError, nullptr,
@@ -161,7 +161,7 @@
TEST_P(WireCreateRenderPipelineAsyncTest, CreateSuccess) {
DeviceCreateRenderPipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateRenderPipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
@@ -181,7 +181,7 @@
TEST_P(WireCreateRenderPipelineAsyncTest, CreateError) {
DeviceCreateRenderPipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateRenderPipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_ValidationError, nullptr,
@@ -204,7 +204,7 @@
TEST_P(WireCreateRenderPipelineAsyncTest, CreateThenDisconnect) {
DeviceCreateRenderPipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateRenderPipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateRenderPipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
@@ -225,7 +225,7 @@
TEST_P(WireCreateComputePipelineAsyncTest, CreateThenDisconnect) {
DeviceCreateComputePipelineAsync(device, &mDescriptor, this);
- EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _, _))
+ EXPECT_CALL(api, OnDeviceCreateComputePipelineAsync(apiDevice, _, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallDeviceCreateComputePipelineAsyncCallback(
apiDevice, WGPUCreatePipelineAsyncStatus_Success, nullptr, "");
diff --git a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
index 31ad03c..0ee6996 100644
--- a/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireErrorCallbackTests.cpp
@@ -201,7 +201,7 @@
// Overridden version of wgpuDevicePopErrorScope that defers to the API call based on the test
// callback mode.
void DevicePopErrorScope(WGPUDevice d, void* userdata = nullptr) {
- if (this->IsAsync()) {
+ if (IsAsync()) {
wgpuDevicePopErrorScope(d, mMockOldCb.Callback(), mMockOldCb.MakeUserdata(userdata));
} else {
WGPUPopErrorScopeCallbackInfo callbackInfo = {};
@@ -212,6 +212,17 @@
}
}
+ // Overridden version of api.CallDevicePopErrorScopeCallback to defer to the correct callback
+ // depending on the test callback mode. Note that currently, the ServerDevice calls the native
+ // procs using the old-non-future signature. Once that changes, we can probably just inline
+ // api.CallDevicePopErrorScopeCallback calls in place of this function.
+ void CallDevicePopErrorScopeCallback(WGPUDevice d,
+ WGPUPopErrorScopeStatus status,
+ WGPUErrorType type,
+ char const* message) {
+ api.CallDevicePopErrorScopeOldCallback(d, type, message);
+ }
+
void PushErrorScope(WGPUErrorFilter filter) {
EXPECT_CALL(api, DevicePushErrorScope(apiDevice, filter)).Times(1);
wgpuDevicePushErrorScope(device, filter);
@@ -247,9 +258,10 @@
PushErrorScope(filter);
DevicePopErrorScope(device, this);
- EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).WillOnce(InvokeWithoutArgs([&] {
- api.CallDevicePopErrorScopeCallback(apiDevice, type, "Some error message");
- }));
+ EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _)).WillOnce([&] {
+ CallDevicePopErrorScopeCallback(apiDevice, WGPUPopErrorScopeStatus_Success, type,
+ "Some error message");
+ });
FlushClient();
FlushFutures();
@@ -275,7 +287,7 @@
PushErrorScope(WGPUErrorFilter_Validation);
DevicePopErrorScope(device, this);
- EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).Times(1);
+ EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _)).Times(1);
FlushClient();
FlushFutures();
@@ -303,9 +315,9 @@
PushErrorScope(WGPUErrorFilter_Validation);
DevicePopErrorScope(device, this);
- EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).WillOnce(InvokeWithoutArgs([&] {
- api.CallDevicePopErrorScopeCallback(apiDevice, WGPUErrorType_Validation,
- "Some error message");
+ EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _)).WillOnce(InvokeWithoutArgs([&] {
+ CallDevicePopErrorScopeCallback(apiDevice, WGPUPopErrorScopeStatus_Success,
+ WGPUErrorType_Validation, "Some error message");
}));
FlushClient();
@@ -328,9 +340,9 @@
// Empty stack (We are emulating the errors that would be callback-ed from native).
TEST_P(WirePopErrorScopeCallbackTests, EmptyStack) {
DevicePopErrorScope(device, this);
- EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _, _)).WillOnce(InvokeWithoutArgs([&] {
- api.CallDevicePopErrorScopeCallback(apiDevice, WGPUErrorType_Validation,
- "No error scopes to pop");
+ EXPECT_CALL(api, OnDevicePopErrorScope(apiDevice, _)).WillOnce(InvokeWithoutArgs([&] {
+ CallDevicePopErrorScopeCallback(apiDevice, WGPUPopErrorScopeStatus_Success,
+ WGPUErrorType_Validation, "No error scopes to pop");
}));
FlushClient();
diff --git a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
index 9ea7334..bdf6e34 100644
--- a/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireInstanceTests.cpp
@@ -94,7 +94,7 @@
InstanceRequestAdapter(instance, &options, nullptr);
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce(WithArg<1>(Invoke([&](const WGPURequestAdapterOptions* apiOptions) {
EXPECT_EQ(apiOptions->powerPreference,
static_cast<WGPUPowerPreference>(options.powerPreference));
@@ -140,7 +140,7 @@
// Expect the server to receive the message. Then, mock a fake reply.
WGPUAdapter apiAdapter = api.GetNewAdapter();
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
EXPECT_CALL(api, AdapterHasFeature(apiAdapter, _)).WillRepeatedly(Return(false));
@@ -233,7 +233,7 @@
// Expect the server to receive the message. Then, mock a fake reply.
WGPUAdapter apiAdapter = api.GetNewAdapter();
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
for (WGPUFeatureName feature : fakeFeatures) {
EXPECT_CALL(api, AdapterHasFeature(apiAdapter, feature)).WillOnce(Return(true));
@@ -344,7 +344,7 @@
// Expect the server to receive the message. Then, mock a fake reply.
WGPUAdapter apiAdapter = api.GetNewAdapter();
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
EXPECT_CALL(api, AdapterHasFeature(apiAdapter, _)).WillRepeatedly(Return(false));
@@ -400,7 +400,7 @@
InstanceRequestAdapter(instance, &options, nullptr);
// Expect the server to receive the message. Then, mock an error.
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallInstanceRequestAdapterCallback(apiInstance, WGPURequestAdapterStatus_Error,
nullptr, "Some error");
diff --git a/src/dawn/tests/unittests/wire/WireMemoryTransferServiceTests.cpp b/src/dawn/tests/unittests/wire/WireMemoryTransferServiceTests.cpp
index 79ea2b8..d50cc92 100644
--- a/src/dawn/tests/unittests/wire/WireMemoryTransferServiceTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireMemoryTransferServiceTests.cpp
@@ -363,7 +363,7 @@
ExpectServerReadHandleSerializeDataUpdate(serverHandle);
// Mock a successful callback
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(clientMemoryTransferService, OnReadHandleGetData(clientHandle))
@@ -435,7 +435,7 @@
wgpuBufferMapAsync(buffer, WGPUMapMode_Read, 0, kBufferSize, ToMockBufferMapCallback, nullptr);
// Mock a failed callback.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -512,7 +512,7 @@
ExpectServerReadHandleSerializeDataUpdate(serverHandle);
// Mock a successful callback
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(api, BufferGetConstMappedRange(apiBuffer, 0, kBufferSize))
@@ -557,7 +557,7 @@
ExpectServerReadHandleSerializeDataUpdate(serverHandle);
// Mock a successful callback
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Read, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(clientMemoryTransferService, OnReadHandleGetData(clientHandle))
@@ -611,7 +611,7 @@
wgpuBufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, ToMockBufferMapCallback, nullptr);
// Mock a successful callback.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(clientMemoryTransferService, OnWriteHandleGetData(clientHandle))
@@ -690,7 +690,7 @@
wgpuBufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, ToMockBufferMapCallback, nullptr);
// Mock an error callback.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_ValidationError);
}));
@@ -764,7 +764,7 @@
wgpuBufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, ToMockBufferMapCallback, nullptr);
// Mock a successful callback.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(clientMemoryTransferService, OnWriteHandleGetData(clientHandle))
@@ -815,7 +815,7 @@
wgpuBufferMapAsync(buffer, WGPUMapMode_Write, 0, kBufferSize, ToMockBufferMapCallback, nullptr);
// Mock a successful callback.
- EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _, _))
+ EXPECT_CALL(api, OnBufferMapAsync(apiBuffer, WGPUMapMode_Write, 0, kBufferSize, _))
.WillOnce(InvokeWithoutArgs(
[&] { api.CallBufferMapAsyncCallback(apiBuffer, WGPUBufferMapAsyncStatus_Success); }));
EXPECT_CALL(clientMemoryTransferService, OnWriteHandleGetData(clientHandle))
diff --git a/src/dawn/tests/unittests/wire/WireQueueTests.cpp b/src/dawn/tests/unittests/wire/WireQueueTests.cpp
index b79f268..45d375e 100644
--- a/src/dawn/tests/unittests/wire/WireQueueTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireQueueTests.cpp
@@ -54,7 +54,7 @@
// Test that a successful OnSubmittedWorkDone call is forwarded to the client.
TEST_P(WireQueueTests, OnSubmittedWorkDoneSuccess) {
QueueOnSubmittedWorkDone(queue);
- EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _, _)).WillOnce(InvokeWithoutArgs([&] {
+ EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _)).WillOnce(InvokeWithoutArgs([&] {
api.CallQueueOnSubmittedWorkDoneCallback(apiQueue, WGPUQueueWorkDoneStatus_Success);
}));
FlushClient();
@@ -70,7 +70,7 @@
// Test that an error OnSubmittedWorkDone call is forwarded as an error to the client.
TEST_P(WireQueueTests, OnSubmittedWorkDoneError) {
QueueOnSubmittedWorkDone(queue);
- EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _, _)).WillOnce(InvokeWithoutArgs([&] {
+ EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _)).WillOnce(InvokeWithoutArgs([&] {
api.CallQueueOnSubmittedWorkDoneCallback(apiQueue, WGPUQueueWorkDoneStatus_Error);
}));
FlushClient();
@@ -91,7 +91,7 @@
DAWN_SKIP_TEST_IF(IsSpontaneous());
QueueOnSubmittedWorkDone(queue);
- EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _, _)).WillOnce(InvokeWithoutArgs([&] {
+ EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _)).WillOnce(InvokeWithoutArgs([&] {
api.CallQueueOnSubmittedWorkDoneCallback(apiQueue, WGPUQueueWorkDoneStatus_Error);
}));
FlushClient();
@@ -109,7 +109,7 @@
// dropped.
TEST_P(WireQueueTests, OnSubmittedWorkDoneBeforeDisconnectBeforeReply) {
QueueOnSubmittedWorkDone(queue);
- EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _, _)).WillOnce(InvokeWithoutArgs([&] {
+ EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _)).WillOnce(InvokeWithoutArgs([&] {
api.CallQueueOnSubmittedWorkDoneCallback(apiQueue, WGPUQueueWorkDoneStatus_Error);
}));
FlushClient();
@@ -137,7 +137,7 @@
TEST_P(WireQueueTests, OnSubmittedWorkDoneInsideCallbackBeforeDisconnect) {
static constexpr size_t kNumRequests = 10;
QueueOnSubmittedWorkDone(queue);
- EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _, _)).WillOnce(InvokeWithoutArgs([&] {
+ EXPECT_CALL(api, OnQueueOnSubmittedWorkDone(apiQueue, _)).WillOnce(InvokeWithoutArgs([&] {
api.CallQueueOnSubmittedWorkDoneCallback(apiQueue, WGPUQueueWorkDoneStatus_Error);
}));
FlushClient();
diff --git a/src/dawn/tests/unittests/wire/WireShaderModuleTests.cpp b/src/dawn/tests/unittests/wire/WireShaderModuleTests.cpp
index 495a9eb..91cc44b 100644
--- a/src/dawn/tests/unittests/wire/WireShaderModuleTests.cpp
+++ b/src/dawn/tests/unittests/wire/WireShaderModuleTests.cpp
@@ -77,7 +77,7 @@
TEST_P(WireShaderModuleTests, GetCompilationInfo) {
ShaderModuleGetCompilationInfo(shaderModule);
- EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _, _))
+ EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallShaderModuleGetCompilationInfoCallback(
apiShaderModule, WGPUCompilationInfoRequestStatus_Success, &mCompilationInfo);
@@ -112,7 +112,7 @@
TEST_P(WireShaderModuleTests, GetCompilationInfoBeforeDisconnect) {
ShaderModuleGetCompilationInfo(shaderModule);
- EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _, _))
+ EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallShaderModuleGetCompilationInfoCallback(
apiShaderModule, WGPUCompilationInfoRequestStatus_Success, &mCompilationInfo);
@@ -149,7 +149,7 @@
ShaderModuleGetCompilationInfo(shaderModule);
- EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _, _))
+ EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallShaderModuleGetCompilationInfoCallback(
apiShaderModule, WGPUCompilationInfoRequestStatus_Success, &mCompilationInfo);
@@ -178,7 +178,7 @@
ShaderModuleGetCompilationInfo(shaderModule);
- EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _, _))
+ EXPECT_CALL(api, OnShaderModuleGetCompilationInfo(apiShaderModule, _))
.WillOnce(InvokeWithoutArgs([&] {
api.CallShaderModuleGetCompilationInfoCallback(
apiShaderModule, WGPUCompilationInfoRequestStatus_Success, &mCompilationInfo);
diff --git a/src/dawn/tests/unittests/wire/WireTest.cpp b/src/dawn/tests/unittests/wire/WireTest.cpp
index 9ce777b..67ce338 100644
--- a/src/dawn/tests/unittests/wire/WireTest.cpp
+++ b/src/dawn/tests/unittests/wire/WireTest.cpp
@@ -93,7 +93,7 @@
MockCallback<WGPURequestAdapterCallback> adapterCb;
wgpuInstanceRequestAdapter(instance, &adapterOpts, adapterCb.Callback(),
adapterCb.MakeUserdata(this));
- EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnInstanceRequestAdapter(apiInstance, NotNull(), _))
.WillOnce([&]() {
EXPECT_CALL(api, AdapterHasFeature(apiAdapter, _)).WillRepeatedly(Return(false));
@@ -133,7 +133,7 @@
MockCallback<WGPURequestDeviceCallback> deviceCb;
wgpuAdapterRequestDevice(adapter.Get(), &deviceDesc, deviceCb.Callback(),
deviceCb.MakeUserdata(this));
- EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), NotNull(), NotNull()))
+ EXPECT_CALL(api, OnAdapterRequestDevice(apiAdapter, NotNull(), _))
.WillOnce([&]() {
// Set on device creation to forward callbacks to the client.
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, NotNull(), NotNull()))