Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ash/common/shell_window_ids.h" | 5 #include "ash/common/shell_window_ids.h" |
| 6 #include "components/exo/buffer.h" | 6 #include "components/exo/buffer.h" |
| 7 #include "components/exo/display.h" | 7 #include "components/exo/display.h" |
| 8 #include "components/exo/shared_memory.h" | 8 #include "components/exo/shared_memory.h" |
| 9 #include "components/exo/shell_surface.h" | 9 #include "components/exo/shell_surface.h" |
| 10 #include "components/exo/sub_surface.h" | 10 #include "components/exo/sub_surface.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 base::ScopedFD(native_pixmap_handle.fd.fd), buffer_size, | 72 base::ScopedFD(native_pixmap_handle.fd.fd), buffer_size, |
| 73 gfx::BufferFormat::RGBA_8888, native_pixmap_handle.stride); | 73 gfx::BufferFormat::RGBA_8888, native_pixmap_handle.stride); |
| 74 EXPECT_TRUE(buffer1); | 74 EXPECT_TRUE(buffer1); |
| 75 | 75 |
| 76 // Creating a prime buffer using an invalid fd should fail. | 76 // Creating a prime buffer using an invalid fd should fail. |
| 77 std::unique_ptr<Buffer> buffer2 = display->CreateLinuxDMABufBuffer( | 77 std::unique_ptr<Buffer> buffer2 = display->CreateLinuxDMABufBuffer( |
| 78 base::ScopedFD(), buffer_size, gfx::BufferFormat::RGBA_8888, | 78 base::ScopedFD(), buffer_size, gfx::BufferFormat::RGBA_8888, |
| 79 buffer_size.width() * 4); | 79 buffer_size.width() * 4); |
| 80 EXPECT_FALSE(buffer2); | 80 EXPECT_FALSE(buffer2); |
| 81 } | 81 } |
| 82 | |
| 83 // TODO(dcastagna): Add YV12 unittest once we can allocate the buffer | |
| 84 // via Ozone. crbug.com/618516 | |
|
reveman
2016/06/10 01:57:32
Oh, we should add the other formats like RGB565 to
Daniele Castagna
2016/06/10 02:08:24
Will do in a follow-up CL.
| |
| 85 | |
| 82 #endif | 86 #endif |
| 83 | 87 |
| 84 TEST_F(DisplayTest, CreateShellSurface) { | 88 TEST_F(DisplayTest, CreateShellSurface) { |
| 85 std::unique_ptr<Display> display(new Display); | 89 std::unique_ptr<Display> display(new Display); |
| 86 | 90 |
| 87 // Create two surfaces. | 91 // Create two surfaces. |
| 88 std::unique_ptr<Surface> surface1 = display->CreateSurface(); | 92 std::unique_ptr<Surface> surface1 = display->CreateSurface(); |
| 89 ASSERT_TRUE(surface1); | 93 ASSERT_TRUE(surface1); |
| 90 std::unique_ptr<Surface> surface2 = display->CreateSurface(); | 94 std::unique_ptr<Surface> surface2 = display->CreateSurface(); |
| 91 ASSERT_TRUE(surface2); | 95 ASSERT_TRUE(surface2); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 // Attempting to create a sub surface for parent with grandchild as its parent | 211 // Attempting to create a sub surface for parent with grandchild as its parent |
| 208 // should fail. | 212 // should fail. |
| 209 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get())); | 213 EXPECT_FALSE(display->CreateSubSurface(parent.get(), grandchild.get())); |
| 210 | 214 |
| 211 // Create a sub surface for parent. | 215 // Create a sub surface for parent. |
| 212 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get())); | 216 EXPECT_TRUE(display->CreateSubSurface(parent.get(), toplevel.get())); |
| 213 } | 217 } |
| 214 | 218 |
| 215 } // namespace | 219 } // namespace |
| 216 } // namespace exo | 220 } // namespace exo |
| OLD | NEW |