| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/gfx/buffer_types.h" | 8 #include "ui/gfx/buffer_types.h" |
| 9 #include "ui/gl/gl_image_ozone_native_pixmap.h" | 9 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
| 10 #include "ui/gl/test/gl_image_test_template.h" | 10 #include "ui/gl/test/gl_image_test_template.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 auto client_pixmap = client_pixmap_factory_->ImportFromHandle( | 36 auto client_pixmap = client_pixmap_factory_->ImportFromHandle( |
| 37 pixmap->ExportHandle(), size, usage); | 37 pixmap->ExportHandle(), size, usage); |
| 38 void* data = client_pixmap->Map(); | 38 void* data = client_pixmap->Map(); |
| 39 EXPECT_TRUE(data); | 39 EXPECT_TRUE(data); |
| 40 GLImageTestSupport::SetBufferDataToColor( | 40 GLImageTestSupport::SetBufferDataToColor( |
| 41 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0, | 41 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0, |
| 42 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data)); | 42 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data)); |
| 43 client_pixmap->Unmap(); | 43 client_pixmap->Unmap(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( | 46 scoped_refptr<gl::GLImageOzoneNativePixmap> image( |
| 47 new gfx::GLImageOzoneNativePixmap(size, GL_RGBA)); | 47 new gl::GLImageOzoneNativePixmap(size, GL_RGBA)); |
| 48 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); | 48 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); |
| 49 return image; | 49 return image; |
| 50 } | 50 } |
| 51 | 51 |
| 52 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } | 52 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 std::unique_ptr<ui::ClientNativePixmapFactory> client_pixmap_factory_; | 55 std::unique_ptr<ui::ClientNativePixmapFactory> client_pixmap_factory_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 INSTANTIATE_TYPED_TEST_CASE_P( | 58 INSTANTIATE_TYPED_TEST_CASE_P( |
| 59 GLImageOzoneNativePixmap, | 59 GLImageOzoneNativePixmap, |
| 60 GLImageTest, | 60 GLImageTest, |
| 61 GLImageOzoneNativePixmapTestDelegate<gfx::BufferUsage::SCANOUT>); | 61 GLImageOzoneNativePixmapTestDelegate<gfx::BufferUsage::SCANOUT>); |
| 62 | 62 |
| 63 // This test is disabled since the trybots are running with Ozone X11 | 63 // This test is disabled since the trybots are running with Ozone X11 |
| 64 // implementation that doesn't support creating ClientNativePixmap. | 64 // implementation that doesn't support creating ClientNativePixmap. |
| 65 // TODO(dcastagna): Implement ClientNativePixmapFactory on Ozone X11. | 65 // TODO(dcastagna): Implement ClientNativePixmapFactory on Ozone X11. |
| 66 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap, | 66 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap, |
| 67 GLImageBindTest, | 67 GLImageBindTest, |
| 68 GLImageOzoneNativePixmapTestDelegate< | 68 GLImageOzoneNativePixmapTestDelegate< |
| 69 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE>); | 69 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE>); |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 } // namespace gl | 72 } // namespace gl |
| OLD | NEW |