mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
Add wire tests and mocks for the MemoryTransferService
This CL tests integration of the MemoryTransferService with buffer mapping. It tests the basic success and error cases for buffer mapping, and it tests mocked failures of each fallible MemoryTransferService method that an embedder could implement. Change-Id: Iece660fb49664cc6a09a0b0b8dbe59e2882a6017 Bug: dawn:156 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8841 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
6a5418a760
commit
72724b8d25
@@ -27,6 +27,14 @@ WireTest::WireTest() {
|
||||
WireTest::~WireTest() {
|
||||
}
|
||||
|
||||
client::MemoryTransferService* WireTest::GetClientMemoryTransferService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
server::MemoryTransferService* WireTest::GetServerMemoryTransferService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void WireTest::SetUp() {
|
||||
DawnProcTable mockProcs;
|
||||
DawnDevice mockDevice;
|
||||
@@ -43,12 +51,14 @@ void WireTest::SetUp() {
|
||||
serverDesc.device = mockDevice;
|
||||
serverDesc.procs = &mockProcs;
|
||||
serverDesc.serializer = mS2cBuf.get();
|
||||
serverDesc.memoryTransferService = GetServerMemoryTransferService();
|
||||
|
||||
mWireServer.reset(new WireServer(serverDesc));
|
||||
mC2sBuf->SetHandler(mWireServer.get());
|
||||
|
||||
WireClientDescriptor clientDesc = {};
|
||||
clientDesc.serializer = mC2sBuf.get();
|
||||
clientDesc.memoryTransferService = GetClientMemoryTransferService();
|
||||
|
||||
mWireClient.reset(new WireClient(clientDesc));
|
||||
mS2cBuf->SetHandler(mWireClient.get());
|
||||
@@ -69,17 +79,18 @@ void WireTest::TearDown() {
|
||||
// cannot be null.
|
||||
api.IgnoreAllReleaseCalls();
|
||||
mWireClient = nullptr;
|
||||
mWireServer = nullptr;
|
||||
}
|
||||
|
||||
void WireTest::FlushClient() {
|
||||
ASSERT_TRUE(mC2sBuf->Flush());
|
||||
void WireTest::FlushClient(bool success) {
|
||||
ASSERT_EQ(mC2sBuf->Flush(), success);
|
||||
|
||||
Mock::VerifyAndClearExpectations(&api);
|
||||
SetupIgnoredCallExpectations();
|
||||
}
|
||||
|
||||
void WireTest::FlushServer() {
|
||||
ASSERT_TRUE(mS2cBuf->Flush());
|
||||
void WireTest::FlushServer(bool success) {
|
||||
ASSERT_EQ(mS2cBuf->Flush(), success);
|
||||
}
|
||||
|
||||
dawn_wire::WireServer* WireTest::GetWireServer() {
|
||||
|
||||
Reference in New Issue
Block a user