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 CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 8 #ifndef CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
9 #define CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 9 #define CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 }; | 21 }; |
22 | 22 |
23 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); | 23 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryTest); |
24 | 24 |
25 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { | 25 TYPED_TEST_P(GpuMemoryBufferFactoryTest, CreateGpuMemoryBuffer) { |
26 const gfx::GpuMemoryBufferId kBufferId(1); | 26 const gfx::GpuMemoryBufferId kBufferId(1); |
27 const int kClientId = 1; | 27 const int kClientId = 1; |
28 | 28 |
29 gfx::Size buffer_size(2, 2); | 29 gfx::Size buffer_size(2, 2); |
30 | 30 |
31 for (auto format : gfx::GetBufferFormats()) { | 31 for (auto format : gfx::GetBufferFormatsForTesting()) { |
32 gfx::BufferUsage usages[] = {gfx::BufferUsage::MAP, | 32 gfx::BufferUsage usages[] = {gfx::BufferUsage::MAP, |
33 gfx::BufferUsage::PERSISTENT_MAP, | 33 gfx::BufferUsage::PERSISTENT_MAP, |
34 gfx::BufferUsage::SCANOUT}; | 34 gfx::BufferUsage::SCANOUT}; |
35 for (auto usage : usages) { | 35 for (auto usage : usages) { |
36 if (!TypeParam::IsGpuMemoryBufferConfigurationSupported(format, usage)) | 36 if (!TypeParam::IsGpuMemoryBufferConfigurationSupported(format, usage)) |
37 continue; | 37 continue; |
38 | 38 |
39 gfx::GpuMemoryBufferHandle handle = | 39 gfx::GpuMemoryBufferHandle handle = |
40 TestFixture::factory_.CreateGpuMemoryBuffer(kBufferId, buffer_size, | 40 TestFixture::factory_.CreateGpuMemoryBuffer(kBufferId, buffer_size, |
41 format, usage, kClientId, | 41 format, usage, kClientId, |
(...skipping 13 matching lines...) Expand all Loading... |
55 : public GpuMemoryBufferFactoryTest<GpuMemoryBufferFactoryType> {}; | 55 : public GpuMemoryBufferFactoryTest<GpuMemoryBufferFactoryType> {}; |
56 | 56 |
57 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest); | 57 TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest); |
58 | 58 |
59 TYPED_TEST_P(GpuMemoryBufferFactoryImportTest, | 59 TYPED_TEST_P(GpuMemoryBufferFactoryImportTest, |
60 CreateGpuMemoryBufferFromHandle) { | 60 CreateGpuMemoryBufferFromHandle) { |
61 const int kClientId = 1; | 61 const int kClientId = 1; |
62 | 62 |
63 gfx::Size buffer_size(2, 2); | 63 gfx::Size buffer_size(2, 2); |
64 | 64 |
65 for (auto format : gfx::GetBufferFormats()) { | 65 for (auto format : gfx::GetBufferFormatsForTesting()) { |
66 if (!TypeParam::IsGpuMemoryBufferConfigurationSupported( | 66 if (!TypeParam::IsGpuMemoryBufferConfigurationSupported( |
67 format, gfx::BufferUsage::SCANOUT)) { | 67 format, gfx::BufferUsage::SCANOUT)) { |
68 continue; | 68 continue; |
69 } | 69 } |
70 | 70 |
71 const gfx::GpuMemoryBufferId kBufferId1(1); | 71 const gfx::GpuMemoryBufferId kBufferId1(1); |
72 gfx::GpuMemoryBufferHandle handle1 = | 72 gfx::GpuMemoryBufferHandle handle1 = |
73 TestFixture::factory_.CreateGpuMemoryBuffer( | 73 TestFixture::factory_.CreateGpuMemoryBuffer( |
74 kBufferId1, buffer_size, format, gfx::BufferUsage::SCANOUT, | 74 kBufferId1, buffer_size, format, gfx::BufferUsage::SCANOUT, |
75 kClientId, gfx::kNullPluginWindow); | 75 kClientId, gfx::kNullPluginWindow); |
(...skipping 12 matching lines...) Expand all Loading... |
88 } | 88 } |
89 | 89 |
90 // The GpuMemoryBufferFactoryImportTest test case verifies that the | 90 // The GpuMemoryBufferFactoryImportTest test case verifies that the |
91 // GpuMemoryBufferFactory implementation handles import of buffers correctly. | 91 // GpuMemoryBufferFactory implementation handles import of buffers correctly. |
92 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest, | 92 REGISTER_TYPED_TEST_CASE_P(GpuMemoryBufferFactoryImportTest, |
93 CreateGpuMemoryBufferFromHandle); | 93 CreateGpuMemoryBufferFromHandle); |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
96 | 96 |
97 #endif // CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ | 97 #endif // CONTENT_TEST_GPU_MEMORY_BUFFER_FACTORY_TEST_TEMPLATE_H_ |
OLD | NEW |