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

Unified Diff: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory_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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/client/gpu_memory_buffer_impl_shared_memory_unittest.cc
diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory_unittest.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..06262ce8ef5f5fd21da4cbafc825c15090d988c0
--- /dev/null
+++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h"
+#include "content/test/gpu_memory_buffer_impl_test_template.h"
+
+namespace content {
+namespace {
+
+INSTANTIATE_TYPED_TEST_CASE_P(GpuMemoryBufferImplSharedMemory,
+ GpuMemoryBufferImplTest,
+ GpuMemoryBufferImplSharedMemory);
+
+void BufferDestroyed(bool* destroyed, uint32 sync_point) {
+ *destroyed = true;
+}
+
+TEST(GpuMemoryBufferImplSharedMemoryTest, Create) {
+ const gfx::GpuMemoryBufferId kBufferId(1);
+
+ gfx::Size buffer_size(8, 8);
+
+ for (auto format : gfx::GetBufferFormats()) {
+ if (!GpuMemoryBufferImplSharedMemory::IsFormatSupported(format))
+ continue;
+
+ bool destroyed = false;
+ scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer(
+ GpuMemoryBufferImplSharedMemory::Create(
+ kBufferId, buffer_size, format,
+ base::Bind(&BufferDestroyed, base::Unretained(&destroyed))));
+ ASSERT_TRUE(buffer);
+ EXPECT_EQ(buffer->GetFormat(), format);
+
+ // Check if destruction callback is executed when deleting the buffer.
+ buffer.reset();
+ ASSERT_TRUE(destroyed);
+ }
+}
+
+} // namespace
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698