| 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" |
| 11 #include "ui/ozone/public/ozone_platform.h" | 11 #include "ui/ozone/public/ozone_platform.h" |
| 12 #include "ui/ozone/public/surface_factory_ozone.h" | 12 #include "ui/ozone/public/surface_factory_ozone.h" |
| 13 | 13 |
| 14 namespace gl { | 14 namespace gl { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class GLImageOzoneNativePixmapTestDelegate { | 17 class GLImageOzoneNativePixmapTestDelegate { |
| 18 public: | 18 public: |
| 19 scoped_refptr<gl::GLImage> CreateSolidColorImage( | 19 scoped_refptr<gl::GLImage> CreateSolidColorImage( |
| 20 const gfx::Size& size, | 20 const gfx::Size& size, |
| 21 const uint8_t color[4]) const { | 21 const uint8_t color[4]) const { |
| 22 ui::SurfaceFactoryOzone* surface_factory = | 22 ui::SurfaceFactoryOzone* surface_factory = |
| 23 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); | 23 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); |
| 24 scoped_refptr<ui::NativePixmap> pixmap = | 24 scoped_refptr<ui::NativePixmap> pixmap = |
| 25 surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, | 25 surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, |
| 26 gfx::BufferFormat::RGBA_8888, | 26 gfx::BufferFormat::RGBA_8888, |
| 27 gfx::BufferUsage::SCANOUT); | 27 gfx::BufferUsage::SCANOUT); |
| 28 EXPECT_TRUE(pixmap != nullptr); | 28 EXPECT_TRUE(pixmap); |
| 29 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( | 29 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( |
| 30 new gfx::GLImageOzoneNativePixmap(size, GL_RGBA)); | 30 new gfx::GLImageOzoneNativePixmap(size, GL_RGBA)); |
| 31 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); | 31 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); |
| 32 return image; | 32 return image; |
| 33 } | 33 } |
| 34 | 34 |
| 35 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } | 35 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmap, | 38 INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmap, |
| 39 GLImageTest, | 39 GLImageTest, |
| 40 GLImageOzoneNativePixmapTestDelegate); | 40 GLImageOzoneNativePixmapTestDelegate); |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 } // namespace gl | 43 } // namespace gl |
| OLD | NEW |