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

Unified Diff: components/exo/display_unittest.cc

Issue 1427743004: exo: Add support for wl_drm version 2 to wayland bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wayland-drm-third-party
Patch Set: fix unit test and nit Created 5 years, 1 month 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 | « components/exo/display.cc ('k') | components/exo/wayland/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display_unittest.cc
diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc
index f79aae650613a394be4ecd6d16914aee1b5cc2af..2e122096284faedb38ebf4c698abe6ea5f2cb6f0 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);
+
+ 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,
+ gfx::BufferFormat::RGBA_8888, 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, gfx::BufferFormat::RGBA_8888,
+ buffer_size.width() * 4);
+ EXPECT_FALSE(buffer2);
+}
+#endif
+
TEST_F(DisplayTest, CreateShellSurface) {
scoped_ptr<Display> display(new Display);
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/wayland/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698