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

Unified Diff: content/test/gpu_memory_buffer_factory_test_template.h

Issue 1382043003: content: Add CreateGpuMemoryBufferFromHandle to GpuMemoryBufferFactory interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iosurface fix Created 5 years, 2 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/gpu_memory_buffer_factory_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/test/gpu_memory_buffer_factory_test_template.h
diff --git a/content/test/gpu_memory_buffer_factory_test_template.h b/content/test/gpu_memory_buffer_factory_test_template.h
index e42401283ce3309c8ab8129cefc7e028e845771b..4d1ce4c14e60cf63aeef6d37e69c297ed2d3bb1f 100644
--- a/content/test/gpu_memory_buffer_factory_test_template.h
+++ b/content/test/gpu_memory_buffer_factory_test_template.h
@@ -50,6 +50,48 @@ TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) {
// from a GpuMemoryBuffer factory in order to be conformant.
REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer);
+template <typename GpuMemoryBufferFactoryType>
+class GpuMemoryBufferFactoryImportTest
+ : public GpuMemoryBufferFactoryTest<GpuMemoryBufferFactoryType> {};
+
+TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest);
+
+TYPED_TEST_P(GpuMemoryBufferFactoryImportTest,
+ CreateGpuMemoryBufferFromHandle) {
+ const int kClientId = 1;
+
+ gfx::Size buffer_size(2, 2);
+
+ for (auto format : gfx::GetBufferFormats()) {
+ if (!TypeParam::IsGpuMemoryBufferConfigurationSupported(
+ format, gfx::BufferUsage::SCANOUT)) {
+ continue;
+ }
+
+ const gfx::GpuMemoryBufferId kBufferId1(1);
+ gfx::GpuMemoryBufferHandle handle1 =
+ TestFixture::factory_.CreateGpuMemoryBuffer(
+ kBufferId1, buffer_size, format, gfx::BufferUsage::SCANOUT,
+ kClientId, gfx::kNullPluginWindow);
+ EXPECT_NE(handle1.type, gfx::EMPTY_BUFFER);
+
+ // Create new buffer from |handle1|.
+ const gfx::GpuMemoryBufferId kBufferId2(2);
+ gfx::GpuMemoryBufferHandle handle2 =
+ TestFixture::factory_.CreateGpuMemoryBufferFromHandle(
+ handle1, kBufferId2, buffer_size, format, kClientId);
+ EXPECT_NE(handle2.type, gfx::EMPTY_BUFFER);
+
+ TestFixture::factory_.DestroyGpuMemoryBuffer(kBufferId1, kClientId);
+ TestFixture::factory_.DestroyGpuMemoryBuffer(kBufferId2, kClientId);
+ }
+}
+
+// The GpuMemoryBufferFactoryImportTest test case verifies that the
+// GpuMemoryBufferFactory implementation handles import of buffers correctly.
+REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest,
+ CreateGpuMemoryBufferFromHandle);
+
} // namespace content
#endif // CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_surface_texture.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698