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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 size, gl::GLImageMemory::GetInternalFormatForTesting(format))); | 33 size, gl::GLImageMemory::GetInternalFormatForTesting(format))); |
34 rv = image->Initialize( | 34 rv = image->Initialize( |
35 base::SharedMemory::DuplicateHandle(shared_memory.handle()), | 35 base::SharedMemory::DuplicateHandle(shared_memory.handle()), |
36 gfx::GenericSharedMemoryId(0), format, 0, | 36 gfx::GenericSharedMemoryId(0), format, 0, |
37 gfx::RowSizeForBufferFormat(size.width(), format, 0)); | 37 gfx::RowSizeForBufferFormat(size.width(), format, 0)); |
38 EXPECT_TRUE(rv); | 38 EXPECT_TRUE(rv); |
39 return image; | 39 return image; |
40 } | 40 } |
41 | 41 |
42 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } | 42 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } |
| 43 |
| 44 gfx::BufferFormat GetBufferFormat() const { return format; } |
| 45 |
| 46 bool IsSupported() { return true; } |
43 }; | 47 }; |
44 | 48 |
45 using GLImageTestTypes = testing::Types< | 49 using GLImageTestTypes = testing::Types< |
46 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>, | 50 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>, |
47 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>, | 51 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>, |
48 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>, | 52 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>, |
49 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>; | 53 GLImageSharedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>; |
50 | 54 |
51 INSTANTIATE_TYPED_TEST_CASE_P(GLImageSharedMemory, | 55 INSTANTIATE_TYPED_TEST_CASE_P(GLImageSharedMemory, |
52 GLImageTest, | 56 GLImageTest, |
(...skipping 30 matching lines...) Expand all Loading... |
83 new gl::GLImageSharedMemory(size, GL_RGBA)); | 87 new gl::GLImageSharedMemory(size, GL_RGBA)); |
84 rv = image->Initialize( | 88 rv = image->Initialize( |
85 base::SharedMemory::DuplicateHandle(shared_memory.handle()), | 89 base::SharedMemory::DuplicateHandle(shared_memory.handle()), |
86 gfx::GenericSharedMemoryId(0), gfx::BufferFormat::RGBA_8888, | 90 gfx::GenericSharedMemoryId(0), gfx::BufferFormat::RGBA_8888, |
87 buffer_offset, stride); | 91 buffer_offset, stride); |
88 EXPECT_TRUE(rv); | 92 EXPECT_TRUE(rv); |
89 return image; | 93 return image; |
90 } | 94 } |
91 | 95 |
92 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } | 96 unsigned GetTextureTarget() const { return GL_TEXTURE_2D; } |
| 97 |
| 98 gfx::BufferFormat GetBufferFormat() const { |
| 99 return gfx::BufferFormat::RGBA_8888; |
| 100 } |
| 101 |
| 102 bool IsSupported() { return true; } |
93 }; | 103 }; |
94 | 104 |
95 INSTANTIATE_TYPED_TEST_CASE_P(GLImageSharedMemoryPool, | 105 INSTANTIATE_TYPED_TEST_CASE_P(GLImageSharedMemoryPool, |
96 GLImageCopyTest, | 106 GLImageCopyTest, |
97 GLImageSharedMemoryPoolTestDelegate); | 107 GLImageSharedMemoryPoolTestDelegate); |
98 | 108 |
99 } // namespace | 109 } // namespace |
100 } // namespace gl | 110 } // namespace gl |
OLD | NEW |