| Index: ui/gl/gl_image_ref_counted_memory_unittest.cc
|
| diff --git a/ui/gl/gl_image_ref_counted_memory_unittest.cc b/ui/gl/gl_image_ref_counted_memory_unittest.cc
|
| index 5d5bdd3adb4952a9cd224cb3e42039c69107461f..57b663985111b1690686c9a0ad9c6025df2f548d 100644
|
| --- a/ui/gl/gl_image_ref_counted_memory_unittest.cc
|
| +++ b/ui/gl/gl_image_ref_counted_memory_unittest.cc
|
| @@ -9,16 +9,17 @@
|
| #include "base/memory/ref_counted_memory.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/gl/gl_image_ref_counted_memory.h"
|
| +#include "ui/gl/gl_utils.h"
|
| #include "ui/gl/test/gl_image_test_template.h"
|
|
|
| namespace gl {
|
| namespace {
|
|
|
| -template <gfx::BufferFormat format>
|
| class GLImageRefCountedMemoryTestDelegate {
|
| public:
|
| scoped_refptr<gl::GLImage> CreateSolidColorImage(
|
| const gfx::Size& size,
|
| + gfx::BufferFormat format,
|
| const uint8_t color[4]) const {
|
| DCHECK_EQ(NumberOfPlanesForBufferFormat(format), 1u);
|
| std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format));
|
| @@ -27,27 +28,35 @@ class GLImageRefCountedMemoryTestDelegate {
|
| size.width(), size.height(),
|
| static_cast<int>(RowSizeForBufferFormat(size.width(), format, 0)), 0,
|
| format, color, &bytes->data().front());
|
| - scoped_refptr<GLImageRefCountedMemory> image(new GLImageRefCountedMemory(
|
| - size, gl::GLImageMemory::GetInternalFormatForTesting(format)));
|
| + scoped_refptr<GLImageRefCountedMemory> image(
|
| + new GLImageRefCountedMemory(size, gl::GetTextureFormatFrom(format)));
|
| bool rv = image->Initialize(bytes.get(), format);
|
| EXPECT_TRUE(rv);
|
| return image;
|
| }
|
| -};
|
|
|
| -using GLImageTestTypes = testing::Types<
|
| - GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>,
|
| - GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>,
|
| - GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>,
|
| - GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>;
|
| + static bool IsSupported(gfx::BufferFormat format) {
|
| + switch (format) {
|
| + case gfx::BufferFormat::RGBX_8888:
|
| + case gfx::BufferFormat::RGBA_8888:
|
| + case gfx::BufferFormat::BGRX_8888:
|
| + case gfx::BufferFormat::BGRA_8888:
|
| + return true;
|
| + default:
|
| + return false;
|
| + }
|
| + NOTREACHED();
|
| + return false;
|
| + }
|
| +};
|
|
|
| INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
|
| GLImageTest,
|
| - GLImageTestTypes);
|
| + GLImageRefCountedMemoryTestDelegate);
|
|
|
| INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
|
| GLImageCopyTest,
|
| - GLImageTestTypes);
|
| + GLImageRefCountedMemoryTestDelegate);
|
|
|
| } // namespace
|
| } // namespace gl
|
|
|