| 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/common/gpu_memory_buffer_support.h" |
| 20 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 12 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "ui/gfx/buffer_format_util.h" | 14 #include "ui/gfx/buffer_format_util.h" |
| 23 | 15 |
| 24 namespace gpu { | 16 namespace gpu { |
| 25 | 17 |
| 26 template <typename GpuMemoryBufferFactoryType> | 18 template <typename GpuMemoryBufferFactoryType> |
| 27 class GpuMemoryBufferFactoryTest : public testing::Test { | 19 class GpuMemoryBufferFactoryTest : public testing::Test { |
| 28 protected: | 20 protected: |
| 29 GpuMemoryBufferFactoryType factory_; | 21 GpuMemoryBufferFactoryType factory_; |
| 30 }; | 22 }; |
| 31 | 23 |
| 32 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); | 24 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); |
| 33 | 25 |
| 34 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { | 26 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { |
| 35 #if defined(OS_ANDROID) | |
| 36 SurfaceTextureManager::SetInstance( | |
| 37 InProcessSurfaceTextureManager::GetInstance()); | |
| 38 #endif | |
| 39 | |
| 40 const gfx::GpuMemoryBufferId kBufferId(1); | 27 const gfx::GpuMemoryBufferId kBufferId(1); |
| 41 const int kClientId = 1; | 28 const int kClientId = 1; |
| 42 | 29 |
| 43 gfx::Size buffer_size(2, 2); | 30 gfx::Size buffer_size(2, 2); |
| 44 | 31 |
| 45 for (auto format : gfx::GetBufferFormatsForTesting()) { | 32 for (auto format : gfx::GetBufferFormatsForTesting()) { |
| 46 gfx::BufferUsage usages[] = { | 33 gfx::BufferUsage usages[] = { |
| 47 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, | 34 gfx::BufferUsage::GPU_READ, gfx::BufferUsage::SCANOUT, |
| 48 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, | 35 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, |
| 49 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; | 36 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT}; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 } | 48 } |
| 62 } | 49 } |
| 63 | 50 |
| 64 // The GpuMemoryBufferFactoryTest test case verifies behavior that is expected | 51 // The GpuMemoryBufferFactoryTest test case verifies behavior that is expected |
| 65 // from a GpuMemoryBuffer factory in order to be conformant. | 52 // from a GpuMemoryBuffer factory in order to be conformant. |
| 66 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer); | 53 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer); |
| 67 | 54 |
| 68 } // namespace gpu | 55 } // namespace gpu |
| 69 | 56 |
| 70 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 57 #endif // GPU_IPC_SERVICE_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
| OLD | NEW |