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

Side by Side Diff: content/child/child_thread_impl_browsertest.cc

Issue 1269503007: Unify graphics buffer format & usage enums for GpuMemoryBuffer & SurfaceFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add header to BUILD.gn Created 5 years, 4 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
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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/discardable_memory.h" 7 #include "base/memory/discardable_memory.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/child/child_discardable_shared_memory_manager.h" 10 #include "content/child/child_discardable_shared_memory_manager.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 EXPECT_LT(base::TimeTicks::Now(), end); 124 EXPECT_LT(base::TimeTicks::Now(), end);
125 } 125 }
126 126
127 enum NativeBufferFlag { kDisableNativeBuffers, kEnableNativeBuffers }; 127 enum NativeBufferFlag { kDisableNativeBuffers, kEnableNativeBuffers };
128 128
129 class ChildThreadImplGpuMemoryBufferBrowserTest 129 class ChildThreadImplGpuMemoryBufferBrowserTest
130 : public ChildThreadImplBrowserTest, 130 : public ChildThreadImplBrowserTest,
131 public testing::WithParamInterface< 131 public testing::WithParamInterface<
132 ::testing::tuple<NativeBufferFlag, gfx::GpuMemoryBuffer::Format>> { 132 ::testing::tuple<NativeBufferFlag, gfx::BufferFormat>> {
133 public: 133 public:
134 // Overridden from BrowserTestBase: 134 // Overridden from BrowserTestBase:
135 void SetUpCommandLine(base::CommandLine* command_line) override { 135 void SetUpCommandLine(base::CommandLine* command_line) override {
136 ChildThreadImplBrowserTest::SetUpCommandLine(command_line); 136 ChildThreadImplBrowserTest::SetUpCommandLine(command_line);
137 NativeBufferFlag native_buffer_flag = ::testing::get<0>(GetParam()); 137 NativeBufferFlag native_buffer_flag = ::testing::get<0>(GetParam());
138 switch (native_buffer_flag) { 138 switch (native_buffer_flag) {
139 case kEnableNativeBuffers: 139 case kEnableNativeBuffers:
140 command_line->AppendSwitch(switches::kEnableNativeGpuMemoryBuffers); 140 command_line->AppendSwitch(switches::kEnableNativeGpuMemoryBuffers);
141 break; 141 break;
142 case kDisableNativeBuffers: 142 case kDisableNativeBuffers:
143 break; 143 break;
144 } 144 }
145 } 145 }
146 }; 146 };
147 147
148 IN_PROC_BROWSER_TEST_P(ChildThreadImplGpuMemoryBufferBrowserTest, 148 IN_PROC_BROWSER_TEST_P(ChildThreadImplGpuMemoryBufferBrowserTest,
149 DISABLED_Map) { 149 DISABLED_Map) {
150 gfx::GpuMemoryBuffer::Format format = ::testing::get<1>(GetParam()); 150 gfx::BufferFormat format = ::testing::get<1>(GetParam());
151 gfx::Size buffer_size(4, 4); 151 gfx::Size buffer_size(4, 4);
152 152
153 scoped_ptr<gfx::GpuMemoryBuffer> buffer = 153 scoped_ptr<gfx::GpuMemoryBuffer> buffer =
154 child_gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer( 154 child_gpu_memory_buffer_manager()->AllocateGpuMemoryBuffer(
155 buffer_size, format, gfx::GpuMemoryBuffer::MAP); 155 buffer_size, format, gfx::BufferUsage::MAP);
156 ASSERT_TRUE(buffer); 156 ASSERT_TRUE(buffer);
157 EXPECT_EQ(format, buffer->GetFormat()); 157 EXPECT_EQ(format, buffer->GetFormat());
158 158
159 size_t num_planes = 159 size_t num_planes =
160 GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(format); 160 GpuMemoryBufferImpl::NumberOfPlanesForGpuMemoryBufferFormat(format);
161 161
162 // Map buffer planes. 162 // Map buffer planes.
163 scoped_ptr<void* []> planes(new void* [num_planes]); 163 scoped_ptr<void* []> planes(new void* [num_planes]);
164 bool rv = buffer->Map(planes.get()); 164 bool rv = buffer->Map(planes.get());
165 ASSERT_TRUE(rv); 165 ASSERT_TRUE(rv);
(...skipping 26 matching lines...) Expand all
192 buffer->Unmap(); 192 buffer->Unmap();
193 EXPECT_FALSE(buffer->IsMapped()); 193 EXPECT_FALSE(buffer->IsMapped());
194 } 194 }
195 195
196 INSTANTIATE_TEST_CASE_P( 196 INSTANTIATE_TEST_CASE_P(
197 ChildThreadImplGpuMemoryBufferBrowserTests, 197 ChildThreadImplGpuMemoryBufferBrowserTests,
198 ChildThreadImplGpuMemoryBufferBrowserTest, 198 ChildThreadImplGpuMemoryBufferBrowserTest,
199 ::testing::Combine(::testing::Values(kDisableNativeBuffers, 199 ::testing::Combine(::testing::Values(kDisableNativeBuffers,
200 kEnableNativeBuffers), 200 kEnableNativeBuffers),
201 // These formats are guaranteed to work on all platforms. 201 // These formats are guaranteed to work on all platforms.
202 ::testing::Values(gfx::GpuMemoryBuffer::R_8, 202 ::testing::Values(gfx::BufferFormat::R_8,
203 gfx::GpuMemoryBuffer::RGBA_4444, 203 gfx::BufferFormat::RGBA_4444,
204 gfx::GpuMemoryBuffer::RGBA_8888, 204 gfx::BufferFormat::RGBA_8888,
205 gfx::GpuMemoryBuffer::BGRA_8888, 205 gfx::BufferFormat::BGRA_8888,
206 gfx::GpuMemoryBuffer::YUV_420))); 206 gfx::BufferFormat::YUV_420)));
207 207
208 } // namespace 208 } // namespace
209 } // namespace content 209 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_gpu_memory_buffer_manager.cc ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698