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

Unified Diff: ui/gl/gl_image_ozone_native_pixmap_unittest.cc

Issue 1907433002: gl: Add ozone native pixmap bind test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_ozone_native_pixmap_unittest.cc
diff --git a/ui/gl/gl_image_ozone_native_pixmap_unittest.cc b/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
index 223ba6980265d186830c794424e9700dbfece1f5..0f60a181d00e5227bbf5e28c17e3e2d85197734c 100644
--- a/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
+++ b/ui/gl/gl_image_ozone_native_pixmap_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
reveman 2016/04/21 02:31:31 nit: I don't think we update the year in chromium
Daniele Castagna 2016/04/22 07:45:39 Done.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,12 +8,15 @@
#include "ui/gfx/buffer_types.h"
#include "ui/gl/gl_image_ozone_native_pixmap.h"
#include "ui/gl/test/gl_image_test_template.h"
+#include "ui/ozone/public/client_native_pixmap.h"
+#include "ui/ozone/public/client_native_pixmap_factory.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
namespace gl {
namespace {
+template <gfx::BufferUsage usage>
class GLImageOzoneNativePixmapTestDelegate {
public:
scoped_refptr<gl::GLImage> CreateSolidColorImage(
@@ -24,8 +27,20 @@ class GLImageOzoneNativePixmapTestDelegate {
scoped_refptr<ui::NativePixmap> pixmap =
surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size,
gfx::BufferFormat::RGBA_8888,
- gfx::BufferUsage::SCANOUT);
+ usage);
EXPECT_TRUE(pixmap != nullptr);
+ if (usage == gfx::BufferUsage::GPU_READ_CPU_READ_WRITE) {
+ auto client_pixmap_factory = ui::ClientNativePixmapFactory::Create();
reveman 2016/04/21 02:31:31 Would it make more sense to have the factory be a
Daniele Castagna 2016/04/22 07:45:39 Moved.
+ auto client_pixmap = client_pixmap_factory->ImportFromHandle(
+ pixmap->ExportHandle(), size, usage);
+ void* data = client_pixmap->Map();
+ EXPECT_TRUE(data);
+ GLImageTestSupport::SetBufferDataToColor(
+ size.width(), size.height(), pixmap->GetDmaBufPitch(), 0,
+ pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data));
+ client_pixmap->Unmap();
+ }
+
scoped_refptr<gfx::GLImageOzoneNativePixmap> image(
new gfx::GLImageOzoneNativePixmap(size, GL_RGBA));
EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat()));
@@ -35,9 +50,15 @@ class GLImageOzoneNativePixmapTestDelegate {
unsigned GetTextureTarget() const { return GL_TEXTURE_2D; }
};
+INSTANTIATE_TYPED_TEST_CASE_P(
+ GLImageOzoneNativePixmap,
+ GLImageTest,
+ GLImageOzoneNativePixmapTestDelegate<gfx::BufferUsage::SCANOUT>);
+
INSTANTIATE_TYPED_TEST_CASE_P(GLImageOzoneNativePixmap,
- GLImageTest,
- GLImageOzoneNativePixmapTestDelegate);
+ GLImageBindTest,
+ GLImageOzoneNativePixmapTestDelegate<
+ gfx::BufferUsage::GPU_READ_CPU_READ_WRITE>);
} // namespace
} // namespace gl
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698