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

Side by Side Diff: components/exo/display_unittest.cc

Issue 1745943003: exo: Add support for linux_dmabuf interface to wayland bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wayland-protocols-linux-dmabuf
Patch Set: Prime -> LinuxDMABuf Created 4 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 unified diff | Download patch
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/wayland/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/exo/buffer.h" 5 #include "components/exo/buffer.h"
6 #include "components/exo/display.h" 6 #include "components/exo/display.h"
7 #include "components/exo/shared_memory.h" 7 #include "components/exo/shared_memory.h"
8 #include "components/exo/shell_surface.h" 8 #include "components/exo/shell_surface.h"
9 #include "components/exo/sub_surface.h" 9 #include "components/exo/sub_surface.h"
10 #include "components/exo/surface.h" 10 #include "components/exo/surface.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 scoped_ptr<SharedMemory> shm1 = display->CreateSharedMemory(handle, shm_size); 46 scoped_ptr<SharedMemory> shm1 = display->CreateSharedMemory(handle, shm_size);
47 EXPECT_TRUE(shm1); 47 EXPECT_TRUE(shm1);
48 48
49 // Creating a shared memory instance from a invalid handle should fail. 49 // Creating a shared memory instance from a invalid handle should fail.
50 scoped_ptr<SharedMemory> shm2 = 50 scoped_ptr<SharedMemory> shm2 =
51 display->CreateSharedMemory(base::SharedMemoryHandle(), shm_size); 51 display->CreateSharedMemory(base::SharedMemoryHandle(), shm_size);
52 EXPECT_FALSE(shm2); 52 EXPECT_FALSE(shm2);
53 } 53 }
54 54
55 #if defined(USE_OZONE) 55 #if defined(USE_OZONE)
56 TEST_F(DisplayTest, CreatePrimeBuffer) { 56 TEST_F(DisplayTest, CreateLinuxDMABufBuffer) {
57 const gfx::Size buffer_size(256, 256); 57 const gfx::Size buffer_size(256, 256);
58 58
59 scoped_ptr<Display> display(new Display); 59 scoped_ptr<Display> display(new Display);
60 60
61 // Creating a prime buffer from a native pixmap handle should succeed. 61 // Creating a prime buffer from a native pixmap handle should succeed.
62 scoped_refptr<ui::NativePixmap> pixmap = 62 scoped_refptr<ui::NativePixmap> pixmap =
63 ui::OzonePlatform::GetInstance() 63 ui::OzonePlatform::GetInstance()
64 ->GetSurfaceFactoryOzone() 64 ->GetSurfaceFactoryOzone()
65 ->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size, 65 ->CreateNativePixmap(gfx::kNullAcceleratedWidget, buffer_size,
66 gfx::BufferFormat::RGBA_8888, 66 gfx::BufferFormat::RGBA_8888,
67 gfx::BufferUsage::GPU_READ); 67 gfx::BufferUsage::GPU_READ);
68 gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle(); 68 gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle();
69 scoped_ptr<Buffer> buffer1 = display->CreatePrimeBuffer( 69 scoped_ptr<Buffer> buffer1 = display->CreatePrimeBuffer(
70 base::ScopedFD(native_pixmap_handle.fd.fd), buffer_size, 70 base::ScopedFD(native_pixmap_handle.fd.fd), buffer_size,
71 gfx::BufferFormat::RGBA_8888, native_pixmap_handle.stride); 71 gfx::BufferFormat::RGBA_8888, native_pixmap_handle.stride);
72 EXPECT_TRUE(buffer1); 72 EXPECT_TRUE(buffer1);
73 73
74 // Creating a prime buffer using an invalid fd should fail. 74 // Creating a prime buffer using an invalid fd should fail.
75 scoped_ptr<Buffer> buffer2 = display->CreatePrimeBuffer( 75 scoped_ptr<Buffer> buffer2 = display->CreateLinuxDMABufBuffer(
76 base::ScopedFD(), buffer_size, gfx::BufferFormat::RGBA_8888, 76 base::ScopedFD(), buffer_size, gfx::BufferFormat::RGBA_8888,
77 buffer_size.width() * 4); 77 buffer_size.width() * 4);
78 EXPECT_FALSE(buffer2); 78 EXPECT_FALSE(buffer2);
79 } 79 }
80 #endif 80 #endif
81 81
82 TEST_F(DisplayTest, CreateShellSurface) { 82 TEST_F(DisplayTest, CreateShellSurface) {
83 scoped_ptr<Display> display(new Display); 83 scoped_ptr<Display> display(new Display);
84 84
85 // Create two surfaces. 85 // Create two surfaces.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Attempting to create a sub surface for parent with grandchild as its parent 159 // Attempting to create a sub surface for parent with grandchild as its parent
160 // should fail. 160 // should fail.
161 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get())); 161 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get()));
162 162
163 // Create a sub surface for parent. 163 // Create a sub surface for parent.
164 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get())); 164 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get()));
165 } 165 }
166 166
167 } // namespace 167 } // namespace
168 } // namespace exo 168 } // namespace exo
OLDNEW
« 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