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

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

Issue 1055403010: content: Add GpuMemoryBuffer MemoryDumpProvider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move register out of ifdef Created 5 years, 8 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
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3a4789f2e18218f3d042b36e801b0ddd428d2abd..94046f1cf15cbc09d4e95e51149342423fdb161b 100644
--- a/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_unittest.cc
@@ -110,16 +110,27 @@ TEST_P(GpuMemoryBufferImplTest, Map) {
buffer->GetStride(strides.get());
// Copy and compare mapped buffers.
- for (size_t i = 0; i < num_planes; ++i) {
- size_t width_in_bytes = 0u;
- EXPECT_TRUE(GpuMemoryBufferImpl::StrideInBytes(
- buffer_size.width(), configuration.format, i, &width_in_bytes));
- EXPECT_GT(width_in_bytes, 0u);
-
- scoped_ptr<char[]> data(new char[width_in_bytes]);
- memset(data.get(), 0x2a + 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);
+ for (size_t plane = 0; plane < num_planes; ++plane) {
+ size_t row_size_in_bytes = 0;
+ EXPECT_TRUE(GpuMemoryBufferImpl::RowSizeInBytes(
+ buffer_size.width(), configuration.format, plane,
+ &row_size_in_bytes));
+ EXPECT_GT(row_size_in_bytes, 0u);
+
+ scoped_ptr<char[]> data(new char[row_size_in_bytes]);
+ memset(data.get(), 0x2a + plane, row_size_in_bytes);
+
+ size_t height =
+ buffer_size.height() /
+ GpuMemoryBufferImpl::SubsamplingFactor(configuration.format, plane);
+ for (size_t y = 0; y < height; ++y) {
+ memcpy(static_cast<char*>(mapped_buffers[plane]) + y * strides[plane],
+ data.get(), row_size_in_bytes);
+ EXPECT_EQ(memcmp(static_cast<char*>(mapped_buffers[plane]) +
+ y * strides[plane],
+ data.get(), row_size_in_bytes),
+ 0);
+ }
}
buffer->Unmap();
« no previous file with comments | « content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698