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 // This file defines tests that implementations of GpuMemoryBufferFactory should | 5 // This file defines tests that implementations of GpuMemoryBufferFactory should |
6 // pass in order to be conformant. | 6 // pass in order to be conformant. |
7 | 7 |
8 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 8 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
9 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 9 #define GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
10 | 10 |
| 11 #if defined(OS_ANDROID) |
| 12 // TODO(markdittmer): Service code shouldn't depend on client code. |
| 13 // See crbug.com/608800. |
| 14 #include "gpu/ipc/client/android/in_process_surface_texture_manager.h" |
| 15 |
| 16 #include "gpu/ipc/common/android/surface_texture_manager.h" |
| 17 #endif |
| 18 |
| 19 #include "gpu/ipc/common/gpu_memory_buffer_support.h" |
11 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 20 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
12 #include "gpu/ipc/common/gpu_memory_buffer_support.h" | |
13 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/gfx/buffer_format_util.h" | 22 #include "ui/gfx/buffer_format_util.h" |
15 | 23 |
16 namespace gpu { | 24 namespace gpu { |
17 | 25 |
18 template <typename GpuMemoryBufferFactoryType> | 26 template <typename GpuMemoryBufferFactoryType> |
19 class GpuMemoryBufferFactoryTest : public testing::Test { | 27 class GpuMemoryBufferFactoryTest : public testing::Test { |
20 protected: | 28 protected: |
21 GpuMemoryBufferFactoryType factory_; | 29 GpuMemoryBufferFactoryType factory_; |
22 }; | 30 }; |
23 | 31 |
24 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); | 32 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); |
25 | 33 |
26 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { | 34 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { |
| 35 #if defined(OS_ANDROID) |
| 36 SurfaceTextureManager::SetInstance( |
| 37 InProcessSurfaceTextureManager::GetInstance()); |
| 38 #endif |
| 39 |
27 const gfx::GpuMemoryBufferId kBufferId(1); | 40 const gfx::GpuMemoryBufferId kBufferId(1); |
28 const int kClientId = 1; | 41 const int kClientId = 1; |
29 | 42 |
30 gfx::Size buffer_size(2, 2); | 43 gfx::Size buffer_size(2, 2); |
31 | 44 |
32 for (auto format : gfx::GetBufferFormatsForTesting()) { | 45 for (auto format : gfx::GetBufferFormatsForTesting()) { |
33 gfx::BufferUsage usages[] = { | 46 gfx::BufferUsage usages[] = { |
34 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, | 47 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, |
35 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, | 48 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, |
36 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; | 49 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 103 } |
91 | 104 |
92 // The GpuMemoryBufferFactoryImportTest test case verifies that the | 105 // The GpuMemoryBufferFactoryImportTest test case verifies that the |
93 // GpuMemoryBufferFactory implementation handles import of buffers correctly. | 106 // GpuMemoryBufferFactory implementation handles import of buffers correctly. |
94 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest, | 107 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest, |
95 CreateGpuMemoryBufferFromHandle); | 108 CreateGpuMemoryBufferFromHandle); |
96 | 109 |
97 } // namespace gpu | 110 } // namespace gpu |
98 | 111 |
99 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 112 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
OLD | NEW |