Fix GetMappedRange unittests on the wire

The tests should wait till the MapAsync operation is complete
before calling GetMappedRange.

Bug: dawn:651
Change-Id: Iec001efaa3c3b76704dc4d926e91d1b1c58901bb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/40303
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2021-02-04 16:10:52 +00:00 committed by Commit Bot service account
parent 6d315daa5d
commit ef369b9ffc
1 changed files with 8 additions and 3 deletions

View File

@ -808,13 +808,11 @@ TEST_F(BufferValidationTest, GetMappedRange_OnErrorBuffer) {
// Test validation of the GetMappedRange parameters
TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
// TODO(crbug.com/dawn/651): Fix failures on the wire.
DAWN_SKIP_TEST_IF(UsesWire());
// Valid case: full range is ok
{
wgpu::Buffer buffer = CreateMapWriteBuffer(8);
buffer.MapAsync(wgpu::MapMode::Write, 0, 8, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_NE(buffer.GetMappedRange(0, 8), nullptr);
}
@ -822,6 +820,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(8);
buffer.MapAsync(wgpu::MapMode::Write, 0, 0, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_NE(buffer.GetMappedRange(0, 8), nullptr);
}
@ -829,6 +828,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(8);
buffer.MapAsync(wgpu::MapMode::Write, 0, 8, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_NE(buffer.GetMappedRange(8, 0), nullptr);
}
@ -836,6 +836,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(16);
buffer.MapAsync(wgpu::MapMode::Write, 0, 16, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_NE(buffer.GetMappedRange(8, 4), nullptr);
}
@ -843,6 +844,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(8);
buffer.MapAsync(wgpu::MapMode::Write, 0, 8, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_EQ(buffer.GetMappedRange(9, 0), nullptr);
EXPECT_EQ(buffer.GetMappedRange(16, 0), nullptr);
}
@ -851,6 +853,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(12);
buffer.MapAsync(wgpu::MapMode::Write, 0, 12, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_EQ(buffer.GetMappedRange(8, 5), nullptr);
EXPECT_EQ(buffer.GetMappedRange(8, 8), nullptr);
}
@ -859,6 +862,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(12);
buffer.MapAsync(wgpu::MapMode::Write, 0, 12, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_EQ(buffer.GetMappedRange(8, std::numeric_limits<size_t>::max()), nullptr);
}
@ -866,6 +870,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
{
wgpu::Buffer buffer = CreateMapWriteBuffer(12);
buffer.MapAsync(wgpu::MapMode::Write, 8, 4, nullptr, nullptr);
WaitForAllOperations(device);
EXPECT_EQ(buffer.GetMappedRange(7, 4), nullptr);
EXPECT_EQ(buffer.GetMappedRange(0, 4), nullptr);
}