Use new gmock MOCK_FUNCTION macro.
Bug: None Change-Id: If436fbf5c2392051caeadfc4a7482544d565b597 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19720 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
d3bbcc3334
commit
f941205370
|
@ -121,31 +121,25 @@ class MockProcTable : public ProcTableAsClass {
|
|||
|
||||
{% for type in by_category["object"] %}
|
||||
{% for method in type.methods if len(method.arguments) < 10 and not has_callback_arguments(method) %}
|
||||
MOCK_METHOD{{len(method.arguments) + 1}}(
|
||||
{{-as_MethodSuffix(type.name, method.name)}},
|
||||
{{as_cType(method.return_type.name)}}(
|
||||
MOCK_METHOD({{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 -%}
|
||||
));
|
||||
), (override));
|
||||
{% endfor %}
|
||||
|
||||
MOCK_METHOD1({{as_MethodSuffix(type.name, Name("reference"))}}, void({{as_cType(type.name)}} self));
|
||||
MOCK_METHOD1({{as_MethodSuffix(type.name, Name("release"))}}, void({{as_cType(type.name)}} self));
|
||||
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));
|
||||
{% endfor %}
|
||||
|
||||
MOCK_METHOD3(OnDeviceSetUncapturedErrorCallback, void(WGPUDevice device, WGPUErrorCallback callback, void* userdata));
|
||||
MOCK_METHOD3(OnDeviceSetDeviceLostCallback,
|
||||
void(WGPUDevice device, WGPUDeviceLostCallback callback, void* userdata));
|
||||
MOCK_METHOD3(OnDevicePopErrorScopeCallback, bool(WGPUDevice device, WGPUErrorCallback callback, void* userdata));
|
||||
MOCK_METHOD3(OnBufferMapReadAsyncCallback, void(WGPUBuffer buffer, WGPUBufferMapReadCallback callback, void* userdata));
|
||||
MOCK_METHOD3(OnBufferMapWriteAsyncCallback, void(WGPUBuffer buffer, WGPUBufferMapWriteCallback callback, void* userdata));
|
||||
MOCK_METHOD4(OnFenceOnCompletionCallback,
|
||||
void(WGPUFence fence,
|
||||
uint64_t value,
|
||||
WGPUFenceOnCompletionCallback callback,
|
||||
void* userdata));
|
||||
MOCK_METHOD(void, OnDeviceSetUncapturedErrorCallback, (WGPUDevice device, WGPUErrorCallback callback, void* userdata), (override));
|
||||
MOCK_METHOD(void, OnDeviceSetDeviceLostCallback, (WGPUDevice device, WGPUDeviceLostCallback callback, void* userdata), (override));
|
||||
MOCK_METHOD(bool, OnDevicePopErrorScopeCallback, (WGPUDevice device, WGPUErrorCallback callback, void* userdata), (override));
|
||||
MOCK_METHOD(void, OnBufferMapReadAsyncCallback, (WGPUBuffer buffer, WGPUBufferMapReadCallback callback, void* userdata), (override));
|
||||
MOCK_METHOD(void, OnBufferMapWriteAsyncCallback, (WGPUBuffer buffer, WGPUBufferMapWriteCallback callback, void* userdata), (override));
|
||||
MOCK_METHOD(void, OnFenceOnCompletionCallback, (WGPUFence fence, uint64_t value, WGPUFenceOnCompletionCallback callback, void* userdata), (override));
|
||||
};
|
||||
|
||||
#endif // MOCK_WEBGPU_H
|
||||
|
|
|
@ -64,27 +64,30 @@ namespace dawn_wire { namespace client {
|
|||
MockReadHandle* NewReadHandle();
|
||||
MockWriteHandle* NewWriteHandle();
|
||||
|
||||
MOCK_METHOD1(OnCreateReadHandle, ReadHandle*(size_t));
|
||||
MOCK_METHOD1(OnCreateWriteHandle, WriteHandle*(size_t));
|
||||
MOCK_METHOD(ReadHandle*, OnCreateReadHandle, (size_t));
|
||||
MOCK_METHOD(WriteHandle*, OnCreateWriteHandle, (size_t));
|
||||
|
||||
MOCK_METHOD1(OnReadHandleSerializeCreateSize, size_t(const ReadHandle*));
|
||||
MOCK_METHOD2(OnReadHandleSerializeCreate, void(const ReadHandle*, void* serializePointer));
|
||||
MOCK_METHOD5(OnReadHandleDeserializeInitialData,
|
||||
bool(const ReadHandle*,
|
||||
MOCK_METHOD(size_t, OnReadHandleSerializeCreateSize, (const ReadHandle*));
|
||||
MOCK_METHOD(void, OnReadHandleSerializeCreate, (const ReadHandle*, void* serializePointer));
|
||||
MOCK_METHOD(bool,
|
||||
OnReadHandleDeserializeInitialData,
|
||||
(const ReadHandle*,
|
||||
const uint32_t* deserializePointer,
|
||||
size_t deserializeSize,
|
||||
const void** data,
|
||||
size_t* dataLength));
|
||||
MOCK_METHOD1(OnReadHandleDestroy, void(const ReadHandle*));
|
||||
MOCK_METHOD(void, OnReadHandleDestroy, (const ReadHandle*));
|
||||
|
||||
MOCK_METHOD1(OnWriteHandleSerializeCreateSize, size_t(const void* WriteHandle));
|
||||
MOCK_METHOD2(OnWriteHandleSerializeCreate,
|
||||
void(const void* WriteHandle, void* serializePointer));
|
||||
MOCK_METHOD1(OnWriteHandleOpen, std::pair<void*, size_t>(const void* WriteHandle));
|
||||
MOCK_METHOD1(OnWriteHandleSerializeFlushSize, size_t(const void* WriteHandle));
|
||||
MOCK_METHOD2(OnWriteHandleSerializeFlush,
|
||||
void(const void* WriteHandle, void* serializePointer));
|
||||
MOCK_METHOD1(OnWriteHandleDestroy, void(const void* WriteHandle));
|
||||
MOCK_METHOD(size_t, OnWriteHandleSerializeCreateSize, (const void* WriteHandle));
|
||||
MOCK_METHOD(void,
|
||||
OnWriteHandleSerializeCreate,
|
||||
(const void* WriteHandle, void* serializePointer));
|
||||
MOCK_METHOD((std::pair<void*, size_t>), OnWriteHandleOpen, (const void* WriteHandle));
|
||||
MOCK_METHOD(size_t, OnWriteHandleSerializeFlushSize, (const void* WriteHandle));
|
||||
MOCK_METHOD(void,
|
||||
OnWriteHandleSerializeFlush,
|
||||
(const void* WriteHandle, void* serializePointer));
|
||||
MOCK_METHOD(void, OnWriteHandleDestroy, (const void* WriteHandle));
|
||||
};
|
||||
|
||||
}} // namespace dawn_wire::client
|
||||
|
|
|
@ -65,30 +65,35 @@ namespace dawn_wire { namespace server {
|
|||
MockReadHandle* NewReadHandle();
|
||||
MockWriteHandle* NewWriteHandle();
|
||||
|
||||
MOCK_METHOD3(OnDeserializeReadHandle,
|
||||
bool(const uint32_t* deserializePointer,
|
||||
MOCK_METHOD(bool,
|
||||
OnDeserializeReadHandle,
|
||||
(const uint32_t* deserializePointer,
|
||||
size_t deserializeSize,
|
||||
ReadHandle** readHandle));
|
||||
|
||||
MOCK_METHOD3(OnDeserializeWriteHandle,
|
||||
bool(const uint32_t* deserializePointer,
|
||||
MOCK_METHOD(bool,
|
||||
OnDeserializeWriteHandle,
|
||||
(const uint32_t* deserializePointer,
|
||||
size_t deserializeSize,
|
||||
WriteHandle** writeHandle));
|
||||
|
||||
MOCK_METHOD3(OnReadHandleSerializeInitialDataSize,
|
||||
size_t(const ReadHandle* readHandle, const void* data, size_t dataLength));
|
||||
MOCK_METHOD4(OnReadHandleSerializeInitialData,
|
||||
void(const ReadHandle* readHandle,
|
||||
MOCK_METHOD(size_t,
|
||||
OnReadHandleSerializeInitialDataSize,
|
||||
(const ReadHandle* readHandle, const void* data, size_t dataLength));
|
||||
MOCK_METHOD(void,
|
||||
OnReadHandleSerializeInitialData,
|
||||
(const ReadHandle* readHandle,
|
||||
const void* data,
|
||||
size_t dataLength,
|
||||
void* serializePointer));
|
||||
MOCK_METHOD1(OnReadHandleDestroy, void(const ReadHandle* readHandle));
|
||||
MOCK_METHOD(void, OnReadHandleDestroy, (const ReadHandle* readHandle));
|
||||
|
||||
MOCK_METHOD3(OnWriteHandleDeserializeFlush,
|
||||
bool(const WriteHandle* writeHandle,
|
||||
MOCK_METHOD(bool,
|
||||
OnWriteHandleDeserializeFlush,
|
||||
(const WriteHandle* writeHandle,
|
||||
const uint32_t* deserializePointer,
|
||||
size_t deserializeSize));
|
||||
MOCK_METHOD1(OnWriteHandleDestroy, void(const WriteHandle* writeHandle));
|
||||
MOCK_METHOD(void, OnWriteHandleDestroy, (const WriteHandle* writeHandle));
|
||||
};
|
||||
|
||||
}} // namespace dawn_wire::server
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace testing;
|
|||
|
||||
class MockDeviceLostCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (const char* message, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockDeviceLostCallback> mockDeviceLostCallback;
|
||||
|
@ -36,7 +36,7 @@ static void ToMockDeviceLostCallback(const char* message, void* userdata) {
|
|||
|
||||
class MockFenceOnCompletionCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(WGPUFenceCompletionStatus status, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUFenceCompletionStatus status, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockFenceOnCompletionCallback> mockFenceOnCompletionCallback;
|
||||
|
|
|
@ -22,7 +22,7 @@ using namespace testing;
|
|||
|
||||
class MockFenceOnCompletionCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(WGPUFenceCompletionStatus status, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUFenceCompletionStatus status, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockFenceOnCompletionCallback> mockFenceOnCompletionCallback;
|
||||
|
@ -32,7 +32,7 @@ static void ToMockFenceOnCompletionCallback(WGPUFenceCompletionStatus status, vo
|
|||
|
||||
class MockPopErrorScopeCallback {
|
||||
public:
|
||||
MOCK_METHOD3(Call, void(WGPUErrorType type, const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUErrorType type, const char* message, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockPopErrorScopeCallback> mockPopErrorScopeCallback;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace {
|
|||
|
||||
class MockDestructor {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(void*, DestructedClass));
|
||||
MOCK_METHOD(void, Call, (void*, DestructedClass));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockDestructor>> mockDestructor;
|
||||
|
|
|
@ -22,8 +22,9 @@ using namespace testing;
|
|||
|
||||
class MockBufferMapReadCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
MOCK_METHOD(void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status,
|
||||
const uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
|
@ -41,11 +42,10 @@ static void ToMockBufferMapReadCallback(WGPUBufferMapAsyncStatus status,
|
|||
|
||||
class MockBufferMapWriteCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status, uint32_t* ptr, uint64_t dataLength, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockBufferMapWriteCallback> mockBufferMapWriteCallback;
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace testing;
|
|||
|
||||
class MockDevicePopErrorScopeCallback {
|
||||
public:
|
||||
MOCK_METHOD3(Call, void(WGPUErrorType type, const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUErrorType type, const char* message, void* userdata));
|
||||
};
|
||||
|
||||
static std::unique_ptr<MockDevicePopErrorScopeCallback> mockDevicePopErrorScopeCallback;
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace testing;
|
|||
|
||||
class MockFenceOnCompletionCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(WGPUFenceCompletionStatus status, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUFenceCompletionStatus status, void* userdata));
|
||||
};
|
||||
|
||||
struct FenceOnCompletionExpectation {
|
||||
|
|
|
@ -22,8 +22,9 @@ namespace {
|
|||
// Mock classes to add expectations on the wire calling callbacks
|
||||
class MockBufferMapReadCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
MOCK_METHOD(void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status,
|
||||
const uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
|
@ -41,11 +42,10 @@ namespace {
|
|||
|
||||
class MockBufferMapWriteCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status, uint32_t* ptr, uint64_t dataLength, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockBufferMapWriteCallback>> mockBufferMapWriteCallback;
|
||||
|
@ -61,8 +61,9 @@ namespace {
|
|||
|
||||
class MockBufferCreateMappedCallback {
|
||||
public:
|
||||
MOCK_METHOD5(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
MOCK_METHOD(void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status,
|
||||
WGPUBuffer buffer,
|
||||
uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
// Mock classes to add expectations on the wire calling callbacks
|
||||
class MockDeviceErrorCallback {
|
||||
public:
|
||||
MOCK_METHOD3(Call, void(WGPUErrorType type, const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUErrorType type, const char* message, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockDeviceErrorCallback>> mockDeviceErrorCallback;
|
||||
|
@ -32,7 +32,7 @@ namespace {
|
|||
|
||||
class MockDevicePopErrorScopeCallback {
|
||||
public:
|
||||
MOCK_METHOD3(Call, void(WGPUErrorType type, const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUErrorType type, const char* message, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockDevicePopErrorScopeCallback>> mockDevicePopErrorScopeCallback;
|
||||
|
@ -44,7 +44,7 @@ namespace {
|
|||
|
||||
class MockDeviceLostCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(const char* message, void* userdata));
|
||||
MOCK_METHOD(void, Call, (const char* message, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockDeviceLostCallback>> mockDeviceLostCallback;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace {
|
|||
|
||||
class MockFenceOnCompletionCallback {
|
||||
public:
|
||||
MOCK_METHOD2(Call, void(WGPUFenceCompletionStatus status, void* userdata));
|
||||
MOCK_METHOD(void, Call, (WGPUFenceCompletionStatus status, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockFenceOnCompletionCallback>> mockFenceOnCompletionCallback;
|
||||
|
|
|
@ -25,8 +25,9 @@ namespace {
|
|||
// Mock classes to add expectations on the wire calling callbacks
|
||||
class MockBufferMapReadCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
MOCK_METHOD(void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status,
|
||||
const uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
|
@ -44,11 +45,10 @@ namespace {
|
|||
|
||||
class MockBufferMapWriteCallback {
|
||||
public:
|
||||
MOCK_METHOD4(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
void* userdata));
|
||||
MOCK_METHOD(
|
||||
void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status, uint32_t* ptr, uint64_t dataLength, void* userdata));
|
||||
};
|
||||
|
||||
std::unique_ptr<StrictMock<MockBufferMapWriteCallback>> mockBufferMapWriteCallback;
|
||||
|
@ -62,8 +62,9 @@ namespace {
|
|||
|
||||
class MockBufferCreateMappedCallback {
|
||||
public:
|
||||
MOCK_METHOD5(Call,
|
||||
void(WGPUBufferMapAsyncStatus status,
|
||||
MOCK_METHOD(void,
|
||||
Call,
|
||||
(WGPUBufferMapAsyncStatus status,
|
||||
WGPUBuffer buffer,
|
||||
uint32_t* ptr,
|
||||
uint64_t dataLength,
|
||||
|
|
Loading…
Reference in New Issue