Chromium Code Reviews| Index: components/exo/display_unittest.cc |
| diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc |
| index f79aae650613a394be4ecd6d16914aee1b5cc2af..ca71e6b27d1528e2640047e3673cc0592a0df9d0 100644 |
| --- a/components/exo/display_unittest.cc |
| +++ b/components/exo/display_unittest.cc |
| @@ -11,6 +11,12 @@ |
| #include "components/exo/test/exo_test_base.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#if defined(USE_OZONE) |
| +#include "ui/ozone/public/native_pixmap.h" |
| +#include "ui/ozone/public/ozone_platform.h" |
| +#include "ui/ozone/public/surface_factory_ozone.h" |
| +#endif |
| + |
| namespace exo { |
| namespace { |
| @@ -46,6 +52,33 @@ TEST_F(DisplayTest, CreateSharedMemory) { |
| EXPECT_FALSE(shm2); |
| } |
| +#if defined(USE_OZONE) |
| +TEST_F(DisplayTest, CreatePrimeBuffer) { |
| + const gfx::Size buffer_size(256, 256); |
| + const uint32_t drm_format = 0x34324241; // DRM_FORMAT_ABGR8888 |
| + |
| + scoped_ptr<Display> display(new Display); |
| + |
| + // Creating a prime buffer from a native pixmap handle should succeed. |
| + scoped_refptr<ui::NativePixmap> pixmap = |
| + ui::OzonePlatform::GetInstance() |
| + ->GetSurfaceFactoryOzone() |
| + ->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size, |
| + gfx::BufferFormat::RGBA_8888, |
| + gfx::BufferUsage::GPU_READ); |
| + gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle(); |
| + scoped_ptr<Buffer> buffer1 = display->CreatePrimeBuffer( |
| + base::ScopedFD(native_pixmap_handle.fd.fd), buffer_size, drm_format, |
|
piman
2015/11/20 19:40:34
drm_format? Doesn't CreatePrimeBuffer take a gfx::
reveman
2015/11/20 20:53:52
Done. Forgot to update this when changing this fro
|
| + native_pixmap_handle.stride); |
| + EXPECT_TRUE(buffer1); |
| + |
| + // Creating a prime buffer using an invalid fd should fail. |
| + scoped_ptr<Buffer> buffer2 = display->CreatePrimeBuffer( |
| + base::ScopedFD(), buffer_size, drm_format, buffer_size.width() * 4); |
| + EXPECT_FALSE(buffer2); |
| +} |
| +#endif |
| + |
| TEST_F(DisplayTest, CreateShellSurface) { |
| scoped_ptr<Display> display(new Display); |