OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 8 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 TEST_P(GpuMemoryBufferImplTest, Map) { | 80 TEST_P(GpuMemoryBufferImplTest, Map) { |
81 const int kBufferId = 1; | 81 const int kBufferId = 1; |
82 | 82 |
83 gfx::Size buffer_size(1, 1); | 83 gfx::Size buffer_size(1, 1); |
84 | 84 |
85 for (auto configuration : supported_configurations_) { | 85 for (auto configuration : supported_configurations_) { |
86 if (configuration.usage != gfx::GpuMemoryBuffer::MAP) | 86 if (configuration.usage != gfx::GpuMemoryBuffer::MAP) |
87 continue; | 87 continue; |
88 | 88 |
89 size_t width_in_bytes = | 89 size_t width_in_bytes = 0; |
90 GpuMemoryBufferImpl::BytesPerPixel(configuration.format) * | 90 EXPECT_TRUE(GpuMemoryBufferImpl::StrideInBytes( |
91 buffer_size.width(); | 91 buffer_size.width(), configuration.format, &width_in_bytes)); |
92 EXPECT_GT(width_in_bytes, 0u); | 92 EXPECT_GT(width_in_bytes, 0u); |
93 scoped_ptr<char[]> data(new char[width_in_bytes]); | 93 scoped_ptr<char[]> data(new char[width_in_bytes]); |
94 memset(data.get(), 0x2a, width_in_bytes); | 94 memset(data.get(), 0x2a, width_in_bytes); |
95 | 95 |
96 scoped_ptr<GpuMemoryBufferImpl> buffer( | 96 scoped_ptr<GpuMemoryBufferImpl> buffer( |
97 GpuMemoryBufferImpl::CreateFromHandle( | 97 GpuMemoryBufferImpl::CreateFromHandle( |
98 CreateGpuMemoryBuffer(kBufferId, | 98 CreateGpuMemoryBuffer(kBufferId, |
99 buffer_size, | 99 buffer_size, |
100 configuration.format, | 100 configuration.format, |
101 configuration.usage), | 101 configuration.usage), |
(...skipping 23 matching lines...) Expand all Loading... |
125 return supported_types; | 125 return supported_types; |
126 } | 126 } |
127 | 127 |
128 INSTANTIATE_TEST_CASE_P( | 128 INSTANTIATE_TEST_CASE_P( |
129 GpuMemoryBufferImplTests, | 129 GpuMemoryBufferImplTests, |
130 GpuMemoryBufferImplTest, | 130 GpuMemoryBufferImplTest, |
131 ::testing::ValuesIn(GetSupportedGpuMemoryBufferTypes())); | 131 ::testing::ValuesIn(GetSupportedGpuMemoryBufferTypes())); |
132 | 132 |
133 } // namespace | 133 } // namespace |
134 } // namespace content | 134 } // namespace content |
OLD | NEW |