Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_unittest.cc

Issue 1389133002: content: Use type-parameterized tests for GpuMemoryBuffer implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add blankline Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/common/gpu/gpu_memory_buffer_factory.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace content {
10 namespace {
11
12 class GpuMemoryBufferFactoryTest
13 : public testing::TestWithParam<gfx::GpuMemoryBufferType> {
14 public:
15 GpuMemoryBufferFactoryTest() : factory_(nullptr) {}
16
17 // Overridden from testing::Test:
18 void SetUp() override {
19 factory_ = GpuMemoryBufferFactory::Create(GetParam());
20 factory_->GetSupportedGpuMemoryBufferConfigurations(
21 &supported_configurations_);
22 }
23 void TearDown() override { factory_.reset(); }
24
25 protected:
26 scoped_ptr<GpuMemoryBufferFactory> factory_;
27 std::vector<GpuMemoryBufferFactory::Configuration> supported_configurations_;
28 };
29
30 TEST_P(GpuMemoryBufferFactoryTest, CreateAndDestroy) {
31 const gfx::GpuMemoryBufferId kBufferId(1);
32 const int kClientId = 1;
33
34 gfx::Size buffer_size(2, 2);
35
36 for (auto configuration : supported_configurations_) {
37 gfx::GpuMemoryBufferHandle handle = factory_->CreateGpuMemoryBuffer(
38 kBufferId, buffer_size, configuration.format, configuration.usage,
39 kClientId, gfx::kNullPluginWindow);
40 EXPECT_EQ(handle.type, GetParam());
41 factory_->DestroyGpuMemoryBuffer(kBufferId, kClientId);
42 }
43 }
44
45 std::vector<gfx::GpuMemoryBufferType>
46 GetSupportedGpuMemoryBufferFactoryTypes() {
47 std::vector<gfx::GpuMemoryBufferType> supported_types;
48 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
49 return supported_types;
50 }
51
52 INSTANTIATE_TEST_CASE_P(
53 GpuMemoryBufferFactoryTests,
54 GpuMemoryBufferFactoryTest,
55 ::testing::ValuesIn(GetSupportedGpuMemoryBufferFactoryTypes()));
56
57 } // namespace
58 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_surface_texture_unittest.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698