Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc

Issue 1024113003: Add multi-planar functions to GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment and typo fix. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc b/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
index 419dfeed92fa7c1ca0fa73a40b4a92dd7cc9df53..3c6b645aeb8845a1875669eecfbb456a6468ed2c 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
@@ -106,13 +106,26 @@ TEST_P(GpuMemoryBufferImplTest, Map) {
ASSERT_TRUE(buffer);
EXPECT_FALSE(buffer->IsMapped());
- void* memory = buffer->Map();
- ASSERT_TRUE(memory);
+ size_t num_buffers = buffer->GetNumberOfPlanes();
+
+ // Map buffer into user space.
+ void* mapped_buffers[num_buffers];
+ bool map_completed = buffer->Map(mapped_buffers);
+ ASSERT_TRUE(map_completed);
EXPECT_TRUE(buffer->IsMapped());
- uint32 stride = buffer->GetStride();
- EXPECT_GE(stride, width_in_bytes);
- memcpy(memory, data.get(), width_in_bytes);
- EXPECT_EQ(memcmp(memory, data.get(), width_in_bytes), 0);
+
+ // Get strides.
+ uint32 strides[num_buffers];
+ bool getStride_completed = buffer->GetStride(strides);
+ DCHECK(getStride_completed);
+
+ // Copy and compare mapped buffers.
+ for (size_t i = 0; i < num_buffers; ++i) {
+ EXPECT_GE(strides[i], width_in_bytes);
+ memcpy(mapped_buffers[i], data.get(), width_in_bytes);
+ EXPECT_EQ(memcmp(mapped_buffers[i], data.get(), width_in_bytes), 0);
+ }
+
buffer->Unmap();
EXPECT_FALSE(buffer->IsMapped());
}

Powered by Google App Engine
This is Rietveld 408576698