| 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/gpu_memory_buffer_factory.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 namespace { | 10 namespace { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 &supported_configurations_); | 21 &supported_configurations_); |
| 22 } | 22 } |
| 23 void TearDown() override { factory_.reset(); } | 23 void TearDown() override { factory_.reset(); } |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 scoped_ptr<GpuMemoryBufferFactory> factory_; | 26 scoped_ptr<GpuMemoryBufferFactory> factory_; |
| 27 std::vector<GpuMemoryBufferFactory::Configuration> supported_configurations_; | 27 std::vector<GpuMemoryBufferFactory::Configuration> supported_configurations_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 TEST_P(GpuMemoryBufferFactoryTest, CreateAndDestroy) { | 30 TEST_P(GpuMemoryBufferFactoryTest, CreateAndDestroy) { |
| 31 const int kBufferId = 1; | 31 const gfx::GpuMemoryBufferId kBufferId(1); |
| 32 const int kClientId = 1; | 32 const int kClientId = 1; |
| 33 | 33 |
| 34 gfx::Size buffer_size(2, 2); | 34 gfx::Size buffer_size(2, 2); |
| 35 | 35 |
| 36 for (auto configuration : supported_configurations_) { | 36 for (auto configuration : supported_configurations_) { |
| 37 gfx::GpuMemoryBufferHandle handle = factory_->CreateGpuMemoryBuffer( | 37 gfx::GpuMemoryBufferHandle handle = factory_->CreateGpuMemoryBuffer( |
| 38 kBufferId, buffer_size, configuration.format, configuration.usage, | 38 kBufferId, buffer_size, configuration.format, configuration.usage, |
| 39 kClientId, gfx::kNullPluginWindow); | 39 kClientId, gfx::kNullPluginWindow); |
| 40 EXPECT_EQ(handle.type, GetParam()); | 40 EXPECT_EQ(handle.type, GetParam()); |
| 41 factory_->DestroyGpuMemoryBuffer(kBufferId, kClientId); | 41 factory_->DestroyGpuMemoryBuffer(kBufferId, kClientId); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 std::vector<gfx::GpuMemoryBufferType> | 45 std::vector<gfx::GpuMemoryBufferType> |
| 46 GetSupportedGpuMemoryBufferFactoryTypes() { | 46 GetSupportedGpuMemoryBufferFactoryTypes() { |
| 47 std::vector<gfx::GpuMemoryBufferType> supported_types; | 47 std::vector<gfx::GpuMemoryBufferType> supported_types; |
| 48 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types); | 48 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types); |
| 49 return supported_types; | 49 return supported_types; |
| 50 } | 50 } |
| 51 | 51 |
| 52 INSTANTIATE_TEST_CASE_P( | 52 INSTANTIATE_TEST_CASE_P( |
| 53 GpuMemoryBufferFactoryTests, | 53 GpuMemoryBufferFactoryTests, |
| 54 GpuMemoryBufferFactoryTest, | 54 GpuMemoryBufferFactoryTest, |
| 55 ::testing::ValuesIn(GetSupportedGpuMemoryBufferFactoryTypes())); | 55 ::testing::ValuesIn(GetSupportedGpuMemoryBufferFactoryTypes())); |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 } // namespace content | 58 } // namespace content |
| OLD | NEW |