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

Unified Diff: ui/gl/gl_image_ref_counted_memory_unittest.cc

Issue 1484473003: gl, ozone: enable GLImageBindTest unittests Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix for win and mac, but cros need crrev.com/1208603002 Created 4 years, 11 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: ui/gl/gl_image_ref_counted_memory_unittest.cc
diff --git a/ui/gl/gl_image_ref_counted_memory_unittest.cc b/ui/gl/gl_image_ref_counted_memory_unittest.cc
index 5d5bdd3adb4952a9cd224cb3e42039c69107461f..57b663985111b1690686c9a0ad9c6025df2f548d 100644
--- a/ui/gl/gl_image_ref_counted_memory_unittest.cc
+++ b/ui/gl/gl_image_ref_counted_memory_unittest.cc
@@ -9,16 +9,17 @@
#include "base/memory/ref_counted_memory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_image_ref_counted_memory.h"
+#include "ui/gl/gl_utils.h"
#include "ui/gl/test/gl_image_test_template.h"
namespace gl {
namespace {
-template <gfx::BufferFormat format>
class GLImageRefCountedMemoryTestDelegate {
public:
scoped_refptr<gl::GLImage> CreateSolidColorImage(
const gfx::Size& size,
+ gfx::BufferFormat format,
const uint8_t color[4]) const {
DCHECK_EQ(NumberOfPlanesForBufferFormat(format), 1u);
std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format));
@@ -27,27 +28,35 @@ class GLImageRefCountedMemoryTestDelegate {
size.width(), size.height(),
static_cast<int>(RowSizeForBufferFormat(size.width(), format, 0)), 0,
format, color, &bytes->data().front());
- scoped_refptr<GLImageRefCountedMemory> image(new GLImageRefCountedMemory(
- size, gl::GLImageMemory::GetInternalFormatForTesting(format)));
+ scoped_refptr<GLImageRefCountedMemory> image(
+ new GLImageRefCountedMemory(size, gl::GetTextureFormatFrom(format)));
bool rv = image->Initialize(bytes.get(), format);
EXPECT_TRUE(rv);
return image;
}
-};
-using GLImageTestTypes = testing::Types<
- GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBX_8888>,
- GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::RGBA_8888>,
- GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRX_8888>,
- GLImageRefCountedMemoryTestDelegate<gfx::BufferFormat::BGRA_8888>>;
+ static bool IsSupported(gfx::BufferFormat format) {
+ switch (format) {
+ case gfx::BufferFormat::RGBX_8888:
+ case gfx::BufferFormat::RGBA_8888:
+ case gfx::BufferFormat::BGRX_8888:
+ case gfx::BufferFormat::BGRA_8888:
+ return true;
+ default:
+ return false;
+ }
+ NOTREACHED();
+ return false;
+ }
+};
INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
GLImageTest,
- GLImageTestTypes);
+ GLImageRefCountedMemoryTestDelegate);
INSTANTIATE_TYPED_TEST_CASE_P(GLImageRefCountedMemory,
GLImageCopyTest,
- GLImageTestTypes);
+ GLImageRefCountedMemoryTestDelegate);
} // namespace
} // namespace gl

Powered by Google App Engine
This is Rietveld 408576698